1. Feb 05, 2022
  2. Feb 04, 2022
    • David S. Miller's avatar
      Merge branch 'ipa-RX-replenish' · c531adaf
      David S. Miller authored
      
      
      Alex Elder says:
      
      ====================
      net: ipa: improve RX buffer replenishing
      
      This series revises the algorithm used for replenishing receive
      buffers on RX endpoints.  Currently there are two atomic variables
      that track how many receive buffers can be sent to the hardware.
      The new algorithm obviates the need for those, by just assuming we
      always want to provide the hardware with buffers until it can hold
      no more.
      
      The first patch eliminates an atomic variable that's not required.
      The next moves some code into the main replenish function's caller,
      making one of the called function's arguments unnecessary.   The
      next six refactor things a bit more, adding a new helper function
      that allows us to eliminate an additional atomic variable.  And the
      final two implement two more minor improvements.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c531adaf
    • Alex Elder's avatar
      net: ipa: determine replenish doorbell differently · 9654d8c4
      Alex Elder authored
      
      
      Rather than tracking the number of receive buffer transactions that
      have been submitted without a doorbell, just track the total number
      of transactions that have been issued.  Then ring the doorbell when
      that number modulo the replenish batch size is 0.
      
      The effect is roughly the same, but the new count is slightly more
      interesting, and this approach will someday allow the replenish
      batch size to be tuned at runtime.
      
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9654d8c4
    • Alex Elder's avatar
      net: ipa: replenish after delivering payload · 5d6ac24f
      Alex Elder authored
      
      
      Replenishing is now solely driven by whether transactions are
      available for a channel, and it doesn't really matter whether
      we replenish before or after we deliver received packets to the
      network stack.
      
      Replenishing before delivering the payload adds a little latency.
      Eliminate that by requesting a replenish after the payload is
      delivered.
      
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5d6ac24f
    • Alex Elder's avatar
      net: ipa: kill replenish_backlog · 09b337de
      Alex Elder authored
      
      
      We no longer use the replenish_backlog atomic variable to decide
      when we've got work to do providing receive buffers to hardware.
      Basically, we try to keep the hardware as full as possible, all the
      time.  We keep supplying buffers until the hardware has no more
      space for them.
      
      As a result, we can get rid of the replenish_backlog field and the
      atomic operations performed on it.
      
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      09b337de
    • Alex Elder's avatar
      net: ipa: introduce gsi_channel_trans_idle() · 5fc7f9ba
      Alex Elder authored
      
      
      Create a new function that returns true if all transactions for a
      channel are available for use.
      
      Use it in ipa_endpoint_replenish_enable() to see whether to start
      replenishing, and in ipa_endpoint_replenish() to determine whether
      it's necessary after a failure to schedule delayed work to ensure a
      future replenish attempt occurs.
      
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5fc7f9ba
    • Alex Elder's avatar
      net: ipa: don't use replenish_backlog · d0ac30e7
      Alex Elder authored
      
      
      Rather than determining when to stop replenishing using the
      replenish backlog, just stop when we have exhausted all available
      transactions.
      
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d0ac30e7
    • Alex Elder's avatar
      net: ipa: allocate transaction in replenish loop · 6a606b90
      Alex Elder authored
      
      
      When replenishing, have ipa_endpoint_replenish() allocate a
      transaction, and pass that to ipa_endpoint_replenish_one() to fill.
      Then, if that produces no error, commit the transaction within the
      replenish loop as well.  In this way we can distinguish between
      transaction failures and buffer allocation/mapping failures.
      
      Failure to allocate a transaction simply means the hardware already
      has as many receive buffers as it can hold.  In that case we can
      break out of the replenish loop because there's nothing more to do.
      
      If we fail to allocate or map pages for the receive buffer, just
      try again later.
      
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6a606b90
    • Alex Elder's avatar
      net: ipa: decide on doorbell in replenish loop · b9dbabc5
      Alex Elder authored
      
      
      Decide whether the doorbell should be signaled when committing a
      replenish transaction in the main replenish loop, rather than in
      ipa_endpoint_replenish_one().  This is a step to facilitate the
      next patch.
      
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b9dbabc5