1. 29 1月, 2021 3 次提交
  2. 08 1月, 2021 2 次提交
    • J
      s390/qeth: fix locking for discipline setup / removal · b41b554c
      Julian Wiedmann 提交于
      Due to insufficient locking, qeth_core_set_online() and
      qeth_dev_layer2_store() can run in parallel, both attempting to load &
      setup the discipline (and stepping on each other toes along the way).
      A similar race can also occur between qeth_core_remove_device() and
      qeth_dev_layer2_store().
      
      Access to .discipline is meant to be protected by the discipline_mutex,
      so add/expand the locking in qeth_core_remove_device() and
      qeth_core_set_online().
      Adjust the locking in qeth_l*_remove_device() accordingly, as it's now
      handled by the callers in a consistent manner.
      
      Based on an initial patch by Ursula Braun.
      
      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>
      b41b554c
    • 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
  3. 07 12月, 2020 5 次提交
  4. 21 11月, 2020 3 次提交
    • J
      s390/qeth: fix tear down of async TX buffers · 7ed10e16
      Julian Wiedmann 提交于
      When qeth_iqd_tx_complete() detects that a TX buffer requires additional
      async completion via QAOB, it might fail to replace the queue entry's
      metadata (and ends up triggering recovery).
      
      Assume now that the device gets torn down, overruling the recovery.
      If the QAOB notification then arrives before the tear down has
      sufficiently progressed, the buffer state is changed to
      QETH_QDIO_BUF_HANDLED_DELAYED by qeth_qdio_handle_aob().
      
      The tear down code calls qeth_drain_output_queue(), where
      qeth_cleanup_handled_pending() will then attempt to replace such a
      buffer _again_. If it succeeds this time, the buffer ends up dangling in
      its replacement's ->next_pending list ... where it will never be freed,
      since there's no further call to qeth_cleanup_handled_pending().
      
      But the second attempt isn't actually needed, we can simply leave the
      buffer on the queue and re-use it after a potential recovery has
      completed. The qeth_clear_output_buffer() in qeth_drain_output_queue()
      will ensure that it's in a clean state again.
      
      Fixes: 72861ae7 ("qeth: recovery through asynchronous delivery")
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      7ed10e16
    • 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
    • J
      s390/qeth: make af_iucv TX notification call more robust · 34c7f50f
      Julian Wiedmann 提交于
      Calling into socket code is ugly already, at least check whether we are
      dealing with the expected sk_family. Only looking at skb->protocol is
      bound to cause troubles (consider eg. af_packet).
      
      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>
      34c7f50f
  5. 19 11月, 2020 4 次提交
    • 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: use QUERY OAT for initial link info · e92d42e7
      Julian Wiedmann 提交于
      Improve the initial link info with data obtained from QUERY OAT.
      Doing so _only_ at initialization time avoids
      1. dealing with multi-part replies, and
      2. sifting through all the data that may get returned at runtime.
      
      This allows us to determine the correct port type for the 1000BT variant
      of recent OSA adapter generations (where the .card_type field in
      QUERY CARD INFO is no longer sufficient).
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      e92d42e7
    • 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
  6. 03 10月, 2020 5 次提交
  7. 24 9月, 2020 3 次提交
  8. 16 9月, 2020 1 次提交
    • 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
  9. 27 8月, 2020 2 次提交
    • 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
    • J
      s390/qeth: use to_delayed_work() · beaadcc6
      Julian Wiedmann 提交于
      Avoid poking around in the delayed_work struct's internals.
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      beaadcc6
  10. 24 8月, 2020 1 次提交
  11. 01 8月, 2020 3 次提交
  12. 15 7月, 2020 8 次提交