1. 04 2月, 2022 3 次提交
  2. 03 2月, 2022 1 次提交
    • A
      net: ipa: define per-endpoint receive buffer size · ed23f026
      Alex Elder 提交于
      Allow RX endpoints to have differing receive buffer sizes.  Define
      the receive buffer size in the configuration data, and use that
      rather than IPA_RX_BUFFER_SIZE when configuring the endpoint.
      
      Add verification in ipa_endpoint_data_valid_one() that the receive
      buffer specified for AP RX endpoints is both big enough to handle at
      least one full packet, and not so big in an aggregating endpoint
      that its size can't be represented when programming the hardware.
      Move aggr_byte_limit_max() up in "ipa_endpoint.c" so it can be used
      earlier in the file without a forward-reference.
      
      Initially we'll just keep the 8KB receive buffer size already in use
      for all AP RX endpoints..
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      ed23f026
  3. 12 1月, 2022 3 次提交
  4. 26 11月, 2021 4 次提交
    • A
      net: ipa: introduce channel flow control · 4c9d631a
      Alex Elder 提交于
      One quirk for certain versions of IPA is that endpoint DELAY mode
      does not work properly.  IPA DELAY mode prevents any packets from
      being delivered to the IPA core for processing on a TX endpoint.
      The AP uses DELAY mode when the modem crashes, to prevent modem TX
      endpoints from generating traffic during crash recovery.  Without
      this, there is a chance the hardware will stall during recovery from
      a modem crash.
      
      To achieve a similar effect, a GSI FLOW_CONTROLLED channel state
      was created.  A STARTED TX channel can be placed in FLOW_CONTROLLED
      state, which prevents the transfer of any more packets.  A channel
      in FLOW_CONTROLLED state can be either returned to STARTED state, or
      can be transitioned to STOPPED state.
      
      Because this operates on GSI channels, two generic commands were
      added to allow the AP to control this state for modem channels
      (similar to the ALLOCATE and HALT channel commands).
      
      Previously the code assumed this quirk only applied to IPA v4.2.
      In fact, channel flow control (rather than endpoint DELAY mode)
      should be used for all versions *starting* with IPA v4.2.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      4c9d631a
    • A
      net: ipa: skip SKB copy if no netdev · 1b65bbcc
      Alex Elder 提交于
      In ipa_endpoint_skb_copy(), a new socket buffer structure is
      allocated so that some data can be copied into it.  However, after
      doing this, if the endpoint has a null netdev pointer, we just drop
      free the socket buffer.
      
      Instead, check endpoint->netdev pointer first, and just return early
      if it's null.  Also return early if the SKB allocation fails, to
      avoid the deeper indentation in the normal path.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      1b65bbcc
    • A
      net: ipa: explicitly disable HOLB drop during setup · 01c36637
      Alex Elder 提交于
      During setup, ipa_endpoint_program() programs each endpoint with
      various configuration parameters.  One of those registers defines
      whether to drop packets when a head-of-line blocking condition is
      detected on an RX endpoint.  We currently assume this is disabled;
      instead, explicitly set it to be disabled.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      01c36637
    • A
      net: ipa: rework how HOL_BLOCK handling is specified · e6aab6b9
      Alex Elder 提交于
      The head-of-line block (HOLB) drop timer is only meaningful when
      dropping packets due to blocking is enabled.  Given that, redefine
      the interface so the timer is specified when enabling HOLB drop, and
      use a different function when disabling.
      
      To enable and disable HOLB drop, these functions will now be used:
        ipa_endpoint_init_hol_block_enable(endpoint, milliseconds)
        ipa_endpoint_init_hol_block_disable(endpoint)
      
      The existing ipa_endpoint_init_hol_block_enable() becomes a helper
      function, renamed ipa_endpoint_init_hol_block_en(), and used with
      ipa_endpoint_init_hol_block_timer() to enable HOLB block on an
      endpoint.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      e6aab6b9
  5. 23 11月, 2021 1 次提交
    • A
      net: ipa: kill ipa_cmd_pipeline_clear() · e4e9bfb7
      Alex Elder 提交于
      Calling ipa_cmd_pipeline_clear() after stopping the channel
      underlying the AP<-modem RX endpoint can lead to a deadlock.
      
      This occurs in the ->runtime_suspend device power operation for the
      IPA driver.  While this callback is in progress, any other requests
      for power will block until the callback returns.
      
      Stopping the AP<-modem RX channel does not prevent the modem from
      sending another packet to this endpoint.  If a packet arrives for an
      RX channel when the channel is stopped, an SUSPEND IPA interrupt
      condition will be pending.  Handling an IPA interrupt requires
      power, so ipa_isr_thread() calls pm_runtime_get_sync() first thing.
      
      The problem occurs because a "pipeline clear" command will not
      complete while such a SUSPEND interrupt condition exists.  So the
      SUSPEND IPA interrupt handler won't proceed until it gets power;
      that won't happen until the ->runtime_suspend callback (and its
      "pipeline clear" command) completes; and that can't happen while
      the SUSPEND interrupt condition exists.
      
      It turns out that in this case there is no need to use the "pipeline
      clear" command.  There are scenarios in which clearing the pipeline
      is required while suspending, but those are not (yet) supported
      upstream.  So a simple fix, avoiding the potential deadlock, is to
      stop calling ipa_cmd_pipeline_clear() in ipa_endpoint_suspend().
      This removes the only user of ipa_cmd_pipeline_clear(), so get rid
      of that function.  It can be restored again whenever it's needed.
      
      This is basically a manual revert along with an explanation for
      commit 6cb63ea6 ("net: ipa: introduce ipa_cmd_tag_process()").
      
      Fixes: 6cb63ea6 ("net: ipa: introduce ipa_cmd_tag_process()")
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e4e9bfb7
  6. 15 11月, 2021 2 次提交
  7. 22 8月, 2021 2 次提交
    • A
      net: ipa: rename "ipa_clock.c" · 2775cbc5
      Alex Elder 提交于
      Finally, rename "ipa_clock.c" to be "ipa_power.c" and "ipa_clock.h"
      to be "ipa_power.h".
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2775cbc5
    • A
      net: ipa: rename ipa_clock_* symbols · 7aa0e8b8
      Alex Elder 提交于
      Rename a number of functions to clarify that there is no longer a
      notion of an "IPA clock," but rather that the functions are more
      generally related to IPA power management.
      
        ipa_clock_enable() -> ipa_power_enable()
        ipa_clock_disable() -> ipa_power_disable()
        ipa_clock_rate() -> ipa_core_clock_rate()
        ipa_clock_init() -> ipa_power_init()
        ipa_clock_exit() -> ipa_power_exit()
      
      Rename the ipa_clock structure to be ipa_power.  Rename all
      variables and fields using that structure type "power" rather
      than "clock".
      
      Rename the ipa_clock_data structure to be ipa_power_data, and more
      broadly, just substitute "power" for "clock" in places that
      previously represented things related to the "IPA clock".
      
      Update comments throughout.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7aa0e8b8
  8. 04 8月, 2021 1 次提交
  9. 27 7月, 2021 1 次提交
  10. 22 6月, 2021 1 次提交
  11. 12 6月, 2021 1 次提交
  12. 04 6月, 2021 2 次提交
    • A
      Revert "net: ipa: disable checksum offload for IPA v4.5+" · d15ec193
      Alex Elder 提交于
      This reverts commit c88c34fc.
      
      The RMNet driver now supports inline checksum offload.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d15ec193
    • A
      net: ipa: add support for inline checksum offload · 5567d4d9
      Alex Elder 提交于
      Starting with IPA v4.5, IP payload checksum offload is implemented
      differently.
      
      Prior to v4.5, the IPA hardware appends an rmnet_map_dl_csum_trailer
      structure to each packet if checksum offload is enabled in the
      download direction (modem->AP).  In the upload direction (AP->modem)
      a rmnet_map_ul_csum_header structure is prepended before each sent
      packet.
      
      Starting with IPA v4.5, checksum offload is implemented using a
      single new rmnet_map_v5_csum_header structure which sits between
      the QMAP header and the packet data.  The same header structure
      is used in both directions.
      
      The new header contains a header type (CSUM_OFFLOAD); a checksum
      flag; and a flag indicating whether any other headers follow this
      one.  The checksum flag indicates whether the hardware should
      compute (and insert) the checksum on a sent packet.  On a received
      packet the checksum flag indicates whether the hardware confirms the
      checksum value in the payload is correct.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5567d4d9
  13. 12 4月, 2021 1 次提交
    • A
      net: ipa: disable checksum offload for IPA v4.5+ · c88c34fc
      Alex Elder 提交于
      Checksum offload for IPA v4.5+ is implemented differently, using
      "inline" offload (which uses a common header format for both upload
      and download offload).
      
      The IPA hardware must be programmed to enable MAP checksum offload,
      but the RMNet driver is responsible for interpreting checksum
      metadata supplied with messages.
      
      Currently, the RMNet driver does not support inline checksum offload.
      This support is imminent, but until it is available, do not allow
      newer versions of IPA to specify checksum offload for endpoints.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c88c34fc
  14. 10 4月, 2021 1 次提交
    • A
      net: ipa: three small fixes · 602a1c76
      Alex Elder 提交于
      Some time ago changes were made to stop referring to clearing the
      hardware pipeline as a "tag process."  Fix a comment to use the
      newer terminology.
      
      Get rid of a pointless double-negation of the Boolean toward_ipa
      flag in ipa_endpoint_config().
      
      make ipa_endpoint_exit_one() private; it's only referenced inside
      "ipa_endpoint.c".
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      602a1c76
  15. 31 3月, 2021 1 次提交
  16. 25 3月, 2021 2 次提交
  17. 21 3月, 2021 2 次提交
    • A
      net: ipa: sequencer type is for TX endpoints only · 1690d8a7
      Alex Elder 提交于
      We only program the sequencer type for TX endpoints.  So move the
      definition of the sequencer type fields into the TX-specific portion
      of the endpoint configuration data.  There's no need to maintain
      this in the IPA structure; we can extract it from the configuration
      data it points to in the one spot it's needed.
      
      We previously specified the sequencer type for RX endpoints with
      INVALID values.  These are no longer needed, so get rid of them.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1690d8a7
    • A
      net: ipa: split sequencer type in two · 8ee5df65
      Alex Elder 提交于
      An IPA endpoint has a sequencer that must be configured based on how
      the endpoint is to be used.  Currently the IPA code programs the
      sequencer type by splitting a value into four 4-bit nibbles.  Doing
      that doesn't really add much value, and regardless, a better way of
      splitting the sequencer type is into two halves--the lower byte
      describing how normal packet processing is handled, and the next
      byte describing information about processing replicas.
      
      So split the sequencer type into two sub-parts:  the sequencer type
      and the replication sequencer type.  Define the values supported for
      the "main" sequencer type, and define the values supported for the
      replication part separately.
      
      In addition, the sequencer type names are quite verbose, encoding
      what the type includes, but also what it *excludes*.  Rename the
      sequencer types in a way that mainly describes the number of passes
      that a packet takes through the IPA processing pipeline, and how
      many of those passes end by supplying the processed packet to the
      microprocessor.
      
      The result expands the supported types beyond what is required for
      now, but simplifies the way these are defined.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8ee5df65
  18. 07 2月, 2021 2 次提交
  19. 03 2月, 2021 2 次提交
  20. 29 1月, 2021 4 次提交
    • A
      net: ipa: signal when tag transfer completes · 51c48ce2
      Alex Elder 提交于
      There are times, such as when the modem crashes, when we issue
      commands to clear the IPA hardware pipeline.  These commands include
      a data transfer command that delivers a small packet directly to the
      default (AP<-LAN RX) endpoint.
      
      The places that do this wait for the transactions that contain these
      commands to complete, but the pipeline can't be assumed clear until
      the sent packet has been *received*.
      
      The small transfer will be delivered with a status structure, and
      that status will indicate its tag is valid.  This is the only place
      we send a tagged packet, so we use the tag to determine when the
      pipeline clear packet has arrived.
      
      Add a completion to the IPA structure to to be used to signal
      the receipt of a pipeline clear packet.  Create a new function
      ipa_cmd_pipeline_clear_wait() that will wait for that completion.
      
      Reinitialize the completion whenever pipeline clear commands are
      added to a transaction.  Extend ipa_endpoint_status_tag() to check
      whether a packet whose status contains a valid tag was sent from the
      AP->command TX endpoint, and if so, signal the new IPA completion.
      
      Have all callers of ipa_cmd_pipeline_clear_add() wait for the
      pipeline clear indication after the transaction that clears the
      pipeline has completed.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Acked-by: NWillem de Bruijn <willemb@google.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      51c48ce2
    • A
      net: ipa: drop packet if status has valid tag · f6aba7b5
      Alex Elder 提交于
      Introduce ipa_endpoint_status_tag(), which returns true if received
      status indicates its tag field is valid.  The endpoint parameter is
      not yet used.
      
      Call this from ipa_status_drop_packet(), and drop the packet if the
      status indicates the tag was valid.  Pass the endpoint pointer to
      ipa_status_drop_packet(), and rename it ipa_endpoint_status_drop().
      The endpoint will be used in the next patch.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Acked-by: NWillem de Bruijn <willemb@google.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      f6aba7b5
    • A
      net: ipa: minor update to handling of packet with status · 162fbc6f
      Alex Elder 提交于
      Rearrange some comments and assignments made when handling a packet
      that is received with status, aiming to improve understandability.
      
      Use DIV_ROUND_CLOSEST() to get a better per-packet true size estimate.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Acked-by: NWillem de Bruijn <willemb@google.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      162fbc6f
    • A
      net: ipa: rename "tag status" symbols · aa56e3e5
      Alex Elder 提交于
      There is a set of functions and symbols related to performing
      "tag_process" immediate commands to clear the IPA pipeline.  The
      name is related to one of the commands issued when doing this, but
      it doesn't really convey the overall purpose of taking this action.
      
      The purpose is to take some steps to "clear out" the hardware
      pipeline, and to wait until that process completes, to ensure the
      IPA hardware is in a well-defined state.
      
      Rename these symbols to use "pipeline_clear" in their names instead.
      Add some comments to explain a bit more about what's going on.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Acked-by: NWillem de Bruijn <willemb@google.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      aa56e3e5
  21. 15 1月, 2021 1 次提交
  22. 02 12月, 2020 2 次提交
    • A
      net: ipa: use Qtime for IPA v4.5 head-of-line time limit · 63e5afc8
      Alex Elder 提交于
      Extend ipa_reg_init_hol_block_timer_val() so it properly calculates
      the head-of-line block timeout to use for IPA v4.5.
      
      Introduce hol_block_timer_qtime_val() to compute the value to use
      for IPA v4.5, where Qtime is used as the basis of the timer.  Call
      that function from hol_block_timer_val() for IPA v4.5.
      
      Both of these are private functions, so shorten their names a bit so
      they don't take up so much space on the line.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      63e5afc8
    • A
      net: ipa: use Qtime for IPA v4.5 aggregation time limit · 19547041
      Alex Elder 提交于
      Change aggr_time_limit_encoded() to properly calculate the
      aggregation time limit to use for IPA v4.5.
      
      Older IPA versions program the AGGR_GRANULARITY field of the
      of the COUNTER_CFG register to set the granularity of the
      aggregation timer, which we configure to be 500 microseconds.
      
      Instead, IPA v4.5 selects between two possible granularity values
      derived from the 19.2 MHz Qtime clock.  These granularities are
      100 microseconds or 1 millisecond per tick.  We use the smaller
      granularity if possible, unless the desired period is too large
      to be specified that way.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      19547041