1. 19 3月, 2021 2 次提交
  2. 10 3月, 2021 4 次提交
    • J
      s390/qeth: fix notification for pending buffers during teardown · 7eefda7f
      Julian Wiedmann 提交于
      The cited commit reworked the state machine for pending TX buffers.
      In qeth_iqd_tx_complete() it turned PENDING into a transient state, and
      uses NEED_QAOB for buffers that get parked while waiting for their QAOB
      completion.
      
      But it missed to adjust the check in qeth_tx_complete_buf(). So if
      qeth_tx_complete_pending_bufs() is called during teardown to drain
      the parked TX buffers, we no longer raise a notification for af_iucv.
      
      Instead of updating the checked state, just move this code into
      qeth_tx_complete_pending_bufs() itself. This also gets rid of the
      special-case in the common TX completion path.
      
      Fixes: 8908f36d ("s390/qeth: fix af_iucv notification race")
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7eefda7f
    • J
      s390/qeth: schedule TX NAPI on QAOB completion · 3e83d467
      Julian Wiedmann 提交于
      When a QAOB notifies us that a pending TX buffer has been delivered, the
      actual TX completion processing by qeth_tx_complete_pending_bufs()
      is done within the context of a TX NAPI instance. We shouldn't rely on
      this instance being scheduled by some other TX event, but just do it
      ourselves.
      
      qeth_qdio_handle_aob() is called from qeth_poll(), ie. our main NAPI
      instance. To avoid touching the TX queue's NAPI instance
      before/after it is (un-)registered, reorder the code in qeth_open()
      and qeth_stop() accordingly.
      
      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>
      3e83d467
    • 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
    • J
      s390/qeth: fix memory leak after failed TX Buffer allocation · e7a36d27
      Julian Wiedmann 提交于
      When qeth_alloc_qdio_queues() fails to allocate one of the buffers that
      back an Output Queue, the 'out_freeoutqbufs' path will free all
      previously allocated buffers for this queue. But it misses to free the
      half-finished queue struct itself.
      
      Move the buffer allocation into qeth_alloc_output_queue(), and deal with
      such errors internally.
      
      Fixes: 0da9581d ("qeth: exploit asynchronous delivery of storage blocks")
      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>
      e7a36d27
  3. 14 2月, 2021 2 次提交
    • J
      s390/qdio: remove 'merge_pending' mechanism · 2223318c
      Julian Wiedmann 提交于
      For non-QEBSM devices, get_buf_states() merges PENDING and EMPTY buffers
      into a single group of finished buffers. To allow the upper-layer driver
      to differentiate between the two states, qdio_check_pending() looks at
      each buffer's state again and sets the sbal_state flag to
      QDIO_OUTBUF_STATE_FLAG_PENDING accordingly.
      
      So effectively we're spending overhead on _every_ Output Queue
      inspection, just to avoid some additional TX completion calls in case
      a group of buffers has completed with mixed EMPTY / PENDING state.
      Given that PENDING buffers should rarely occur, this is a bad trade-off.
      In particular so as the additional checks in get_buf_states() affect
      _all_ device types (even those that don't use the PENDING state).
      
      Rip it all out, and just report the PENDING completions separately as
      we already do for QEBSM devices.
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Reviewed-by: NBenjamin Block <bblock@linux.ibm.com>
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      2223318c
    • J
      s390/qdio: improve handling of PENDING buffers for QEBSM devices · 7940eaf2
      Julian Wiedmann 提交于
      For QEBSM devices the 'merge_pending' mechanism in get_buf_states()
      doesn't apply, and we can actually get SLSB_P_OUTPUT_PENDING returned.
      
      So for this case propagating the PENDING state to the driver via the
      queue's sbal_state doesn't make sense and creates unnecessary overhead.
      Instead introduce a new QDIO_ERROR_* flag that gets passed to the
      driver, and triggers the same processing as if the buffers were flagged
      as QDIO_OUTBUF_STATE_FLAG_PENDING.
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Reviewed-by: NBenjamin Block <bblock@linux.ibm.com>
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      7940eaf2
  4. 29 1月, 2021 6 次提交
  5. 08 1月, 2021 3 次提交
    • J
      s390/qeth: fix L2 header access in qeth_l3_osa_features_check() · f9c48453
      Julian Wiedmann 提交于
      ip_finish_output_gso() may call .ndo_features_check() even before the
      skb has a L2 header. This conflicts with qeth_get_ip_version()'s attempt
      to inspect the L2 header via vlan_eth_hdr().
      
      Switch to vlan_get_protocol(), as already used further down in the
      common qeth_features_check() path.
      
      Fixes: f13ade19 ("s390/qeth: run non-offload L3 traffic over common xmit path")
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      f9c48453
    • 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
  6. 07 12月, 2020 5 次提交
  7. 02 12月, 2020 6 次提交
  8. 21 11月, 2020 4 次提交
    • 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
    • A
      s390/qeth: Remove pnso workaround · 0d0e2b53
      Alexandra Winter 提交于
      Remove workaround that supported early hardware implementations
      of PNSO OC3. Rely on the 'enarf' feature bit instead.
      
      Fixes: fa115adf ("s390/qeth: Detect PNSO OC3 capability")
      Signed-off-by: NAlexandra Winter <wintera@linux.ibm.com>
      Reviewed-by: NJulian Wiedmann <jwi@linux.ibm.com>
      [jwi: use logical instead of bit-wise AND]
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      0d0e2b53
  9. 19 11月, 2020 8 次提交