1. 29 3月, 2019 2 次提交
    • J
      s390/qeth: remove locking for RX modeset cache · 5c0aebc6
      Julian Wiedmann 提交于
      The L2 and L3 .ndo_set_rx_mode callbacks maintain an address cache
      to decide which addresses have changed since the last modeset.
      
      When the card is set offline, qeth_l?_stop_card() drains this cache.
      This happens only after 1) the net_device has been detached, and
      2) any pending RX modeset has completed. Consequently we can access the
      cache lock-free.
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5c0aebc6
    • J
      s390/qeth: defer RX modesetting · d0c74825
      Julian Wiedmann 提交于
      .ndo_set_rx_mode gets called in process context, but while holding the
      addr_list spinlock. Which means we currently can't sleep while
      re-programming the HW, and need to poll for IO completion. That's bad,
      in particular since receiving the cmd response can fail silently and
      we're then polling until the timeout hits.
      
      As a first step towards eliminating the IO completion polling, run the
      RX modeset from a work element and only take the addr_list lock while
      updating the RX mode address cache.
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d0c74825
  2. 19 3月, 2019 3 次提交
  3. 01 3月, 2019 7 次提交
    • J
      s390/qeth: drop redundant state checking · 0f7aedbd
      Julian Wiedmann 提交于
      Now that qeth always uses dev_close() to shutdown the interface, we can
      trust the locking and remove some custom state checks.
      qeth_l?_stop_card() is no longer called for a card in UP state, so remove
      the checks there too. This basically makes the UP state obsolete, so rip
      out the whole thing (except for the sysfs-visible string).
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0f7aedbd
    • J
      s390/qeth: don't special-case HW trap during suspend · 62ca98d4
      Julian Wiedmann 提交于
      It makes no difference whether we
      1. manually disarm the HW trap and call the offline code with
         recovery_mode == 1, or
      2. call the offline code with recovery_mode == 0, and let it disarm the
         HW trap for us.
      
      So consolidate the two code paths in the suspend callback.
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      62ca98d4
    • J
      s390/qeth: don't defer close_dev work during recovery · bf42d40b
      Julian Wiedmann 提交于
      The recovery code already runs in a kthread, we don't have to defer the
      offlining further.
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bf42d40b
    • J
      s390/qeth: remove a redundant check for card->dev · 464e86da
      Julian Wiedmann 提交于
      smatch complains that __qeth_l3_set_offline() first accesses card->dev,
      and then later checks whether the pointer is valid.
      Since commit d3d1b205 ("s390/qeth: allocate netdevice early"), the
      pointer is _always_ valid - that patch merely missed to remove this one
      check.
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      464e86da
    • J
      s390/qeth: call dev_close() during recovery · d4560150
      Julian Wiedmann 提交于
      When resetting an interface ("recovery"), qeth currently attempts to
      elide the call to dev_close(). We initially only call .ndo_close to
      quiesce the data path, and then offline & online the ccwgroup device.
      If the reset succeeded, a call to .ndo_open then resumes the data path
      along with some internal setup (dev_addr validation, RX modeset) that
      dev_open() would have usually triggered.
      dev_close() only gets called (via the close_dev worker) if the reset
      action fails.
      
      It's unclear whether this was initially done due to locking concerns, or
      rather to execute the reset transparently. Either way, temporarily
      closing the interface without dev_close() is fragile, and means we're
      susceptible to various races and unexpected behaviour. For instance:
      
      - Bypassing dev_deactivate_many() means that the qdiscs are not set to
      __QDISC_STATE_DEACTIVATED. Consequently any intermittent TX completion
      can wake up the txq, resulting in calls to .ndo_start_xmit while the
      data path is down. We have custom state checking to detect this case
      and drop such packets.
      
      - Because the IFF_UP flag doesn't reflect the interface's actual state
      during a reset, we have custom state checking in .ndo_open and
      .ndo_close to guard against invalid calls.
      
      - Considering that the reset might take a considerable amount of time
      (in particular if an IO fails and we end up waiting for its timeout), we
      _do_ want NETDEV_GOING_DOWN and NETDEV_DOWN events so that components
      like bonding, team, bridge, macvlan, vlan, ... can take appropriate
      action.
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d4560150
    • J
      s390/qeth: enable/disable the HW trap a little earlier · d7ef489f
      Julian Wiedmann 提交于
      When setting a L2 qeth device online, enable the HW trap as soon as the
      control plane is available. This allows us to catch any error that
      occurs during the very first commands.
      
      In the same spirit, the offline code should disable the HW trap as the
      very first step of its processing.
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d7ef489f
    • J
      s390/qeth: remove RECOVER state · d7d543f2
      Julian Wiedmann 提交于
      The offline code uses a specific RECOVER state to indicate that the
      interface should be brought up when a qeth device is set online again.
      
      Rather than having a specific card-state for this, just put it in an
      internal flag bit and set the state to DOWN. When working with the
      card's state transitions, this reduces the complexity quite a bit.
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d7d543f2
  4. 16 2月, 2019 3 次提交
  5. 13 2月, 2019 3 次提交
    • J
      s390/qeth: convert remaining legacy cmd callbacks · 742d4d40
      Julian Wiedmann 提交于
      This calls the existing errno translation helpers from the callbacks,
      adding trivial wrappers where necessary. For cmds that have no
      sophisticated errno translation, default to -EIO.
      
      For IPA cmds with no callback, fall back to a minimal default. This is
      currently being used by qeth_l3_send_setrouting().
      
      Thus having all converted all callbacks, remove the legacy path in
      qeth_send_control_data_cb().
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      742d4d40
    • J
      s390/qeth: allow cmd callbacks to return errnos · 4b7ae122
      Julian Wiedmann 提交于
      Error propagation from cmd callbacks currently works in a way where
      qeth_send_control_data_cb() picks the raw HW code from the response,
      and the cmd's originator later translates this into an errno.
      The callback itself only returns 0 ("done") or 1 ("expect more data").
      
      This is
      1. limiting, as the only means for the callback to report an internal
      error is to invent pseudo HW codes (such as IPA_RC_ENOMEM), that
      the originator then needs to understand. For non-IPA callbacks, we
      even provide a separate field in the IO buffer metadata (iob->rc) so
      the callback can pass back a return value.
      2. fragile, as the originator must take care to not translate any errno
      that is returned by qeth's own IO code paths (eg -ENOMEM). Also, any
      originator that forgets to translate the HW codes potentially passes
      garbage back to its caller. For instance, see
      commit 2aa48671 ("s390/qeth: translate SETVLAN/DELVLAN errors").
      
      Introduce a new model where all HW error translation is done within the
      callback, and the callback returns
      >  0, if it expects more data (as before)
      == 0, on success
      <  0, with an errno
      
      Start off with converting all callbacks to the new model that either
      a) pass back pseudo HW codes, or b) have a dependency on a specific
      HW error code. Also convert c) the one callback that uses iob->rc, and
      d) qeth_setadpparms_change_macaddr_cb() so that it can pass back an
      error back to qeth_l2_request_initial_mac() even when the cmd itself
      was successful.
      
      The old model remains supported: if the callback returns 0, we still
      propagate the response's HW error code back to the originator.
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4b7ae122
    • J
      s390/qeth: reduce data length for ARP cache query · 84dbea46
      Julian Wiedmann 提交于
      qeth_l3_query_arp_cache_info() indicates a data length that's much
      larger than the actual length of its request (ie. the value passed to
      qeth_get_setassparms_cmd()). The confusion presumably comes from the
      fact that the cmd _response_ can be quite large - but that's no concern
      for the initial request IO.
      
      Fixing this up allows us to use the generic qeth_send_ipa_cmd()
      infrastructure.
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      84dbea46
  6. 05 2月, 2019 2 次提交
  7. 26 1月, 2019 4 次提交
  8. 07 12月, 2018 1 次提交
  9. 09 11月, 2018 6 次提交
  10. 04 11月, 2018 5 次提交
    • J
      s390/qeth: sanitize ARP requests · 125d7d30
      Julian Wiedmann 提交于
      The ARP_{ADD,REMOVE}_ENTRY cmd structs contain reserved fields.
      Introduce a common helper that doesn't raw-copy the user-provided data
      into the cmd, but only sets those fields that are strictly needed for
      the command.
      
      This also sets the correct command length for ARP_REMOVE_ENTRY.
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      125d7d30
    • J
      s390/qeth: fix initial operstate · 9fae5c3b
      Julian Wiedmann 提交于
      Setting the carrier 'on' for an unregistered netdevice doesn't update
      its operstate. Fix this by delaying the update until the netdevice has
      been registered.
      
      Fixes: 91cc98f5 ("s390/qeth: remove duplicated carrier state tracking")
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9fae5c3b
    • J
      s390/qeth: unregister netdevice only when registered · 30356d08
      Julian Wiedmann 提交于
      qeth only registers its netdevice when the qeth device is first set
      online. Thus a device that has never been set online will trigger
      a WARN ("network todo 'hsi%d' but state 0") in unregister_netdev() when
      removed.
      
      Fix this by protecting the unregister step, just like we already protect
      against repeated registering of the netdevice.
      
      Fixes: d3d1b205 ("s390/qeth: allocate netdevice early")
      Reported-by: NKarsten Graul <kgraul@linux.ibm.com>
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      30356d08
    • J
      s390/qeth: fix HiperSockets sniffer · bd74a7f9
      Julian Wiedmann 提交于
      Sniffing mode for L3 HiperSockets requires that no IP addresses are
      registered with the HW. The preferred way to achieve this is for
      userspace to delete all the IPs on the interface. But qeth is expected
      to also tolerate a configuration where that is not the case, by skipping
      the IP registration when in sniffer mode.
      Since commit 5f78e29c ("qeth: optimize IP handling in rx_mode callback")
      reworked the IP registration logic in the L3 subdriver, this no longer
      works. When the qeth device is set online, qeth_l3_recover_ip() now
      unconditionally registers all unicast addresses from our internal
      IP table.
      
      While we could fix this particular problem by skipping
      qeth_l3_recover_ip() on a sniffer device, the more future-proof change
      is to skip the IP address registration at the lowest level. This way we
      a) catch any future code path that attempts to register an IP address
         without considering the sniffer scenario, and
      b) continue to build up our internal IP table, so that if sniffer mode
         is switched off later we can operate just like normal.
      
      Fixes: 5f78e29c ("qeth: optimize IP handling in rx_mode callback")
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bd74a7f9
    • J
      s390/qeth: sanitize strings in debug messages · e19e5be8
      Julian Wiedmann 提交于
      As Documentation/s390/s390dbf.txt states quite clearly, using any
      pointer in sprinf-formatted s390dbf debug entries is dangerous.
      The pointers are dereferenced whenever the trace file is read from.
      So if the referenced data has a shorter life-time than the trace file,
      any read operation can result in a use-after-free.
      
      So rip out all hazardous use of indirect data, and replace any usage of
      dev_name() and such by the Bus ID number.
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e19e5be8
  11. 13 10月, 2018 2 次提交
  12. 27 9月, 2018 2 次提交