1. 12 6月, 2021 7 次提交
  2. 22 3月, 2021 1 次提交
    • J
      s390/qdio: let driver manage the QAOB · 396c1004
      Julian Wiedmann 提交于
      We are spending way too much effort on qdio-internal bookkeeping for
      QAOB management & caching, and it's still not robust. Once qdio's
      TX path has detached the QAOB from a PENDING buffer, we lost all
      track of it until it shows up in a CQ notification again. So if the
      device is torn down before that notification arrives, we leak the QAOB.
      
      Just have the driver take care of it, and simply pass down a QAOB if
      they want a TX with async-completion capability. For a buffer in PENDING
      state that requires the QAOB for final completion, qeth can now also try
      to recycle the buffer's QAOB rather than unconditionally freeing it.
      
      This also eliminates the qdio_outbuf_state array, which was only needed
      to transfer the aob->user1 tag from the driver to the qdio layer.
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Acked-by: NBenjamin Block <bblock@linux.ibm.com>
      Signed-off-by: NHeiko Carstens <hca@linux.ibm.com>
      396c1004
  3. 10 3月, 2021 1 次提交
    • J
      s390/qeth: improve completion of pending TX buffers · c20383ad
      Julian Wiedmann 提交于
      The current design attaches a pending TX buffer to a custom
      single-linked list, which is anchored at the buffer's slot on the
      TX ring. The buffer is then checked for final completion whenever
      this slot is processed during a subsequent TX NAPI poll cycle.
      
      But if there's insufficient traffic on the ring, we might never make
      enough progress to get back to this ring slot and discover the pending
      buffer's final TX completion. In particular if this missing TX
      completion blocks the application from sending further traffic.
      
      So convert the custom single-linked list code to a per-queue list_head,
      and scan this list on every TX NAPI cycle.
      
      Fixes: 0da9581d ("qeth: exploit asynchronous delivery of storage blocks")
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c20383ad
  4. 29 1月, 2021 2 次提交
  5. 08 1月, 2021 1 次提交
    • J
      s390/qeth: fix deadlock during recovery · 0b9902c1
      Julian Wiedmann 提交于
      When qeth_dev_layer2_store() - holding the discipline_mutex - waits
      inside qeth_l*_remove_device() for a qeth_do_reset() thread to complete,
      we can hit a deadlock if qeth_do_reset() concurrently calls
      qeth_set_online() and thus tries to aquire the discipline_mutex.
      
      Move the discipline_mutex locking outside of qeth_set_online() and
      qeth_set_offline(), and turn the discipline into a parameter so that
      callers understand the dependency.
      
      To fix the deadlock, we can now relax the locking:
      As already established, qeth_l*_remove_device() waits for
      qeth_do_reset() to complete. So qeth_do_reset() itself is under no risk
      of having card->discipline ripped out while it's running, and thus
      doesn't need to take the discipline_mutex.
      
      Fixes: 9dc48ccc ("qeth: serialize sysfs-triggered device configurations")
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Reviewed-by: NAlexandra Winter <wintera@linux.ibm.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      0b9902c1
  6. 07 12月, 2020 3 次提交
  7. 21 11月, 2020 1 次提交
    • J
      s390/qeth: fix af_iucv notification race · 8908f36d
      Julian Wiedmann 提交于
      The two expected notification sequences are
      1. TX_NOTIFY_PENDING with a subsequent TX_NOTIFY_DELAYED_*, when
         our TX completion code first observed the pending TX and the QAOB
         then completes at a later time; or
      2. TX_NOTIFY_OK, when qeth_qdio_handle_aob() picked up the QAOB
         completion before our TX completion code even noticed that the TX
         was pending.
      
      But as qeth_iqd_tx_complete() and qeth_qdio_handle_aob() can run
      concurrently, we may end up with a race that results in a sequence of
      TX_NOTIFY_DELAYED_* followed by TX_NOTIFY_PENDING. Which would confuse
      the af_iucv code in its tracking of pending transmits.
      
      Rework the notification code, so that qeth_qdio_handle_aob() defers its
      notification if the TX completion code is still active.
      
      Fixes: b3332930 ("qeth: add support for af_iucv HiperSockets transport")
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      8908f36d
  8. 19 11月, 2020 3 次提交
    • J
      s390/qeth: improve selection of ethtool link modes · 235db527
      Julian Wiedmann 提交于
      The link mode is a combination of port speed and port mode. But we
      currently only consider the speed, and then typically select the
      corresponding TP-based link mode. For 1G and 10G Fibre links this means
      we display the wrong link modes.
      
      Move the SPEED_* switch statements inside the PORT_* cases, and only
      consider valid combinations where we can select the corresponding
      link mode. Add the relevant link modes (1000baseX, 10000baseSR and
      1000baseLR) that were introduced back with
      commit 5711a982 ("net: ethtool: add support for 1000BaseX and missing 10G link modes").
      
      To differentiate between 10000baseSR and 10000baseLR, use the detailed
      media_type information that QUERY OAT provides.
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      235db527
    • J
      s390/qeth: set static link info during initialization · baf7998d
      Julian Wiedmann 提交于
      Hard-code the minimal link info at initialization time, after we
      obtained the link_type. qeth_get_link_ksettings() can still override
      this with more accurate data from QUERY CARD INFO later on.
      
      Don't set arbitrary defaults for unknown OSA link types, they
      certainly won't match any future type.
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      baf7998d
    • J
      s390/qeth: improve QUERY CARD INFO processing · 4139b2b1
      Julian Wiedmann 提交于
      Move all the HW reply data parsing into qeth_query_card_info_cb(), and
      use common ethtool enums for transporting the information back to the
      caller.
      
      Also only look at the .port_speed field when we couldn't determine the
      speed from the .card_type field, and introduce some 'default' cases for
      SPEED_UNKNOWN, PORT_OTHER and DUPLEX_UNKNOWN.
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      4139b2b1
  9. 03 10月, 2020 6 次提交
  10. 24 9月, 2020 5 次提交
  11. 16 9月, 2020 3 次提交
    • A
      s390/qeth: Reset address notification in case of buffer overflow · 817741a8
      Alexandra Winter 提交于
      In case hardware sends more device-to-bridge-address-change notfications
      than the qeth-l2 driver can handle, the hardware will send an overflow
      event and then stop sending any events. It expects software to flush its
      FDB and start over again. Re-enabling address-change-notification will
      report all current addresses.
      
      In order to re-enable address-change-notification this patch defines
      the functions qeth_l2_dev2br_an_set() and qeth_l2_dev2br_an_set_cb
      to enable or disable dev-to-bridge-address-notification.
      
      A following patch will use the learning_sync bridgeport flag to trigger
      enabling or disabling of address-change-notification, so we define
      priv->brport_features to store the current setting. BRIDGE_INFO and
      ADDR_INFO functionality are mutually exclusive, whereas ADDR_INFO and
      qeth_l2_vnicc* can be used together.
      
      Alternative implementations to handle buffer overflow:
      Just re-enabling notification and adding all newly reported addresses
      would cover any lost 'add' events, but not the lost 'delete' events.
      Then these invalid addresses would stay in the bridge FDB as long as the
      device exists.
      Setting the net device down and up, would be an alternative, but is a bit
      drastic. If the net device has many secondary addresses this will create
      many delete/add events at its peers which could de-stabilize the
      network segment.
      Signed-off-by: NAlexandra Winter <wintera@linux.ibm.com>
      Reviewed-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      817741a8
    • A
      s390/qeth: Translate address events into switchdev notifiers · 10a6cfc0
      Alexandra Winter 提交于
      A qeth-l2 HiperSockets card can show switch-ish behaviour in the sense,
      that it can report all MACs that are reachable via this interface. Just
      like a switch device, it can notify the software bridge about changes
      to its fdb. This patch exploits this device-to-bridge-notification and
      extracts the relevant information from the hardware events to generate
      notifications to an attached software bridge.
      
      There are 2 sources for this information:
      1) The reply message of Perform-Network-Subchannel-Operations (PNSO)
      (operation code ADDR_INFO) reports all addresses that are currently
      reachable (implemented in a later patch).
      2) As long as device-to-bridge-notification is enabled, hardware will
      generate address change notification events, whenever the content of
      the hardware fdb changes (this patch).
      
      The bridge_hostnotify feature (PNSO operation code BRIDGE_INFO) uses
      the same address change notification events. We need to distinguish
      between qeth_pnso_mode QETH_PNSO_BRIDGEPORT and QETH_PNSO_ADDR_INFO
      and call a different handler. In both cases deadlocks must be
      prevented, if the workqueue is drained under lock and QETH_PNSO_NONE,
      when notification is disabled.
      
      bridge_hostnotify generates udev events, there is no intend to do the same
      for dev2br. Instead this patch will generate SWITCHDEV_FDB_ADD_TO_BRIDGE
      and SWITCHDEV_FDB_DEL_TO_BRIDGE notifications, that will cause the
      software bridge to add (or delete) entries to its fdb as 'extern_learn
      offload'.
      
      Documentation/networking/switchdev.txt proposes to add
      "depends NET_SWITCHDEV" to driver's Kconfig. This is not done here,
      so even in absence of the NET_SWITCHDEV module, the QETH_L2 module will
      still be built, but then the switchdev notifiers will have no effect.
      
      No VLAN filtering is done on the entries and VLAN information is not
      passed on to the bridge fdb entries. This could be added later.
      For now VLAN interfaces can be defined on the upper bridge interface.
      
      Multicast entries are not passed on to the bridge fdb.
      This could be added later. For now mcast flooding can be used in the
      bridge.
      
      The card reports all MACs that are in its FDB, but we must not pass on
      MACs that are registered for this interface.
      Signed-off-by: NAlexandra Winter <wintera@linux.ibm.com>
      Reviewed-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      10a6cfc0
    • A
      s390/qeth: Detect PNSO OC3 capability · fa115adf
      Alexandra Winter 提交于
      This patch detects whether device-to-bridge-notification, provided
      by the Perform Network Subchannel Operation (PNSO) operation code
      ADDR_INFO (OC3), is supported by this card. A following patch will
      map this to the learning_sync bridgeport flag, so we store it in
      priv->brport_hw_features in bridgeport flag format.
      
      Only IQD cards provide PNSO.
      There is a feature bit to indicate whether the machine provides OC3,
      unfortunately it is not set on old machines.
      So PNSO is called to find out. As this will disable notification
      and is exclusive with bridgeport_notification, this must be done
      during card initialisation before previous settings are restored.
      
      PNSO functionality requires some configuration values that are added to
      the qeth_card.info structure. Some helper functions are defined to fill
      them out when the card is brought online and some other places are
      adapted, that can also benefit from these fields.
      Signed-off-by: NAlexandra Winter <wintera@linux.ibm.com>
      Reviewed-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fa115adf
  12. 27 8月, 2020 2 次提交
    • J
      s390/qeth: strictly order bridge address events · 9d6a569a
      Julian Wiedmann 提交于
      The current code for bridge address events has two shortcomings in its
      control sequence:
      
      1. after disabling address events via PNSO, we don't flush the remaining
         events from the event_wq. So if the feature is re-enabled fast
         enough, stale events could leak over.
      2. PNSO and the events' arrival via the READ ccw device are unordered.
         So even if we flushed the workqueue, it's difficult to say whether
         the READ device might produce more events onto the workqueue
         afterwards.
      
      Fix this by
      1. explicitly fencing off the events when we no longer care, in the
         READ device's event handler. This ensures that once we flush the
         workqueue, it doesn't get additional address events.
      2. Flush the workqueue after disabling the events & fencing them off.
         As the code that triggers the flush will typically hold the sbp_lock,
         we need to rework the worker code to avoid a deadlock here in case
         of a 'notifications-stopped' event. In case of lock contention,
         requeue such an event with a delay. We'll eventually aquire the lock,
         or spot that the feature has been disabled and the event can thus be
         discarded.
      
      This leaves the theoretical race that a stale event could arrive
      _after_ we re-enabled ourselves to receive events again. Such an event
      would be impossible to distinguish from a 'good' event, nothing we can
      do about it.
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Reviewed-by: NAlexandra Winter <wintera@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9d6a569a
    • J
      s390/qeth: make queue lock a proper spinlock · a1668474
      Julian Wiedmann 提交于
      queue->state is a ternary spinlock in disguise, used by
      OSA's TX completion path to lock the Output Queue and flush any pending
      packets on it to the device. If the Queue is already locked by our TX
      code, setting the lock word to QETH_OUT_Q_LOCKED_FLUSH lets the TX
      completion code move on - the TX path will later take care of things
      when it unlocks the Queue.
      
      This sort of DIY locking is a non-starter of course, just let the
      TX completion path block on the spinlock when necessary. If that ends up
      causing additional latency due to lock contention, then converting
      the OSA path to use xmit_more is the right way to go forward.
      
      Also slightly expand the locked section and capture all of
      qeth_do_send_packet(), so that the update for the 'bufs_pack' statistics
      is done race-free.
      
      While reworking the TX completion path's code, remove a barrier() that
      doesn't make any sense.
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a1668474
  13. 01 8月, 2020 1 次提交
    • J
      s390/qeth: integrate RX refill worker with NAPI · 7c94a882
      Julian Wiedmann 提交于
      Running a RX refill outside of NAPI context is inherently racy, even
      though the worker is only started for an entirely idle RX ring.
      >From the moment that the worker has replenished parts of the RX ring,
      the HW can use those RX buffers, raise an IRQ and cause our NAPI code to
      run concurrently to the RX refill worker.
      
      Instead let the worker schedule our NAPI instance, and refill the RX
      ring from there. Keeping accurate count of how many buffers still need
      to be refilled also removes some quirky arithmetic from the low-level
      code.
      
      Fixes: b3332930 ("qeth: add support for af_iucv HiperSockets transport")
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7c94a882
  14. 15 7月, 2020 2 次提交
  15. 07 5月, 2020 2 次提交