1. 25 4月, 2017 2 次提交
  2. 18 4月, 2017 1 次提交
  3. 07 4月, 2017 3 次提交
    • M
      qede: Support XDP adjustment of headers · 059eeb07
      Mintz, Yuval 提交于
      In case an XDP program is attached, reserve XDP_PACKET_HEADROOM
      bytes at the beginning of the packet for the program to play
      with.
      
      Modify the XDP logic in the driver to fill-in the missing bits
      and re-calculate offsets and length after the program has finished
      running to properly reflect the current status of the packet.
      
      We can then go and remove the limitation of not supporting XDP programs
      where xdp_adjust_head is set.
      Signed-off-by: NYuval Mintz <Yuval.Mintz@cavium.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      059eeb07
    • M
      qede: Add support for ingress headroom · 15ed8a47
      Mintz, Yuval 提交于
      Driver currently doesn't support any headroom; The only 'available'
      space it has in the head of the buffer is due to the placement
      offset.
      In order to allow [later] support of XDP adjustment of headroom,
      modify the the ingress flow to properly handle a scenario where
      the packets would have such.
      Signed-off-by: NYuval Mintz <Yuval.Mintz@cavium.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      15ed8a47
    • M
      qede: Correct XDP forward unmapping · 89e1afc4
      Mintz, Yuval 提交于
      Driver is currently using dma_unmap_single() with the address it
      passed to device for the purpose of forwarding, but the XDP
      transmission buffer was originally a page allocated for the rx-queue.
      The mapped address is likely to differ from the original mapped
      address due to the placement offset.
      
      This difference is going to get even bigger once we support headroom.
      
      Cache the original mapped address of the page, and use it for unmapping
      of the buffer when completion arrives for the XDP forwarded packet.
      Signed-off-by: NYuval Mintz <Yuval.Mintz@cavium.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      89e1afc4
  4. 15 3月, 2017 1 次提交
  5. 21 2月, 2017 3 次提交
  6. 16 2月, 2017 1 次提交
  7. 09 1月, 2017 1 次提交
  8. 02 1月, 2017 7 次提交
  9. 09 12月, 2016 1 次提交
  10. 04 12月, 2016 1 次提交
  11. 03 12月, 2016 1 次提交
    • D
      bpf, xdp: drop rcu_read_lock from bpf_prog_run_xdp and move to caller · 366cbf2f
      Daniel Borkmann 提交于
      After 326fe02d ("net/mlx4_en: protect ring->xdp_prog with rcu_read_lock"),
      the rcu_read_lock() in bpf_prog_run_xdp() is superfluous, since callers
      need to hold rcu_read_lock() already to make sure BPF program doesn't
      get released in the background.
      
      Thus, drop it from bpf_prog_run_xdp(), as it can otherwise be misleading.
      Still keeping the bpf_prog_run_xdp() is useful as it allows for grepping
      in XDP supported drivers and to keep the typecheck on the context intact.
      For mlx4, this means we don't have a double rcu_read_lock() anymore. nfp can
      just make use of bpf_prog_run_xdp(), too. For qede, just move rcu_read_lock()
      out of the helper. When the driver gets atomic replace support, this will
      move to call-sites eventually.
      
      mlx5 needs actual fixing as it has the same issue as described already in
      326fe02d ("net/mlx4_en: protect ring->xdp_prog with rcu_read_lock"),
      that is, we're under RCU bh at this time, BPF programs are released via
      call_rcu(), and call_rcu() != call_rcu_bh(), so we need to properly mark
      read side as programs can get xchg()'ed in mlx5e_xdp_set() without queue
      reset.
      
      Fixes: 86994156 ("net/mlx5e: XDP fast RX drop bpf programs support")
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      366cbf2f
  12. 01 12月, 2016 9 次提交
    • M
      qede: Add support for XDP_TX · cb6aeb07
      Mintz, Yuval 提交于
      Add support for forwarding via XDP. Once the eBPF is attached,
      driver would allocate & configure a designated transmission queue
      meant solely for forwarding packets. Said queue would share the
      receive-queue's interrupt line, and would have it's own Tx statistics.
      
      Infrastructure changes required for this [spread-out through the code]:
       - Determine the DMA direction of the receive buffers based on the presence
      of the eBPF program.
       - Turn the sw Tx ring into a union, as regular/XDP queues have different
      needs for releasing resources after completion [regular requires the SKB,
      XDP requires the transmitted page].
      Signed-off-by: NYuval Mintz <Yuval.Mintz@cavium.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cb6aeb07
    • M
      qede: Add basic XDP support · 496e0517
      Mintz, Yuval 提交于
      Add support for the ndo_xdp callback. This patch would support XDP_PASS,
      XDP_DROP and XDP_ABORTED commands.
      
      This also adds a per Rx queue statistic which counts number of packets
      which didn't reach the stack [due to XDP].
      Signed-off-by: NYuval Mintz <Yuval.Mintz@cavium.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      496e0517
    • M
      qede: Better utilize the qede_[rt]x_queue · 9eb22357
      Mintz, Yuval 提交于
      Improve the cacheline usage of both queues by reordering -
      This reduces the cachelines required for egress datapath processing
      from 3 to 2 and those required by ingress datapath processing by 2.
      
      It also changes a couple of datapath related functions that currently
      require either the fastpath or the qede_dev, changing them to be based
      on the tx/rx queue instead.
      Signed-off-by: NYuval Mintz <Yuval.Mintz@cavium.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9eb22357
    • M
      qede: Don't check netdevice for rx-hash · 8a472530
      Mintz, Yuval 提交于
      Receive-hashing is a fixed feature, so there's no need to check
      during the ingress datapath whether it's set or not.
      Signed-off-by: NYuval Mintz <Yuval.Mintz@cavium.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8a472530
    • M
      qed*: Handle-based L2-queues. · 3da7a37a
      Mintz, Yuval 提交于
      The driver needs to maintain several FW/HW-indices for each one of
      its queues. Currently, that mapping is done by the QED where it uses
      an rx/tx array of so-called hw-cids, populating them whenever a new
      queue is opened and clearing them upon destruction of said queues.
      
      This maintenance is far from ideal - there's no real reason why
      QED needs to maintain such a data-structure. It becomes even worse
      when considering the fact that the PF's queues and its child VFs' queues
      are all mapped into the same data-structure.
      As a by-product, the set of parameters an interface needs to supply for
      queue APIs is non-trivial, and some of the variables in the API
      structures have different meaning depending on their exact place
      in the configuration flow.
      
      This patch re-organizes the way L2 queues are configured and maintained.
      In short:
        - Required parameters for queue init are now well-defined.
        - Qed would allocate a queue-cid based on parameters.
          Upon initialization success, it would return a handle to caller.
        - Queue-handle would be maintained by entity requesting queue-init,
          not necessarily qed.
        - All further queue-APIs [update, destroy] would use the opaque
          handle as reference for the queue instead of various indices.
      
      The possible owners of such handles:
        - PF queues [qede] - complete handles based on provided configuration.
        - VF queues [qede] - fw-context-less handles, containing only relative
          information; Only the PF-side would need the absolute indices
          for configuration, so they're omitted here.
        - VF queues [qed, PF-side] - complete handles based on VF initialization.
      Signed-off-by: NYuval Mintz <Yuval.Mintz@cavium.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3da7a37a
    • M
      qede: Revise state locking scheme · 567b3c12
      Mintz, Yuval 提交于
      As qede utilizes an internal-reload sequence as result of various
      configuration changes, the netif state wouldn't always accurately describe
      the status of the configuration.
      To compensate, we're storing an internal state of the device, which should
      only be accessed under the qede_lock.
      
      This patch fixes and improves several state/lock interactions:
        - The internal state should only be checked while locked.
        - While holding lock, it's preferable to check state rather than
          the netdevice's state.
        - The reload sequence is not 'atomic' - unload and subsequent load
          are not in the same critical section.
      
      This also add the 'locked' variant for the reload, which would later be
      used by XDP - useful in the case where the correct sequence is 'lock,
      check state and re-configure if good', instead of allowing the reload
      itself to make the decision regarding the configurability of the device.
      Signed-off-by: NYuval Mintz <Yuval.Mintz@cavium.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      567b3c12
    • M
      qede: Refactor data-path Rx flow · f4fad34c
      Mintz, Yuval 提交于
      Driver's NAPI poll is using a long sequence for processing ingress
      packets, and it's going to get even longer once we do XDP.
      Break down the main loop into a series of sub-functions to allow
      better readability of the function.
      
      While we're at it, correct the accounting of the NAPI budget -
      currently we're counting only packets passed to the stack against
      the budget, even in case those are actually aggregations.
      After refactoring every CQE processed would be counted against the budget.
      Signed-off-by: NYuval Mintz <Yuval.Mintz@cavium.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f4fad34c
    • M
      qede: Remove 'num_tc'. · 80439a17
      Mintz, Yuval 提交于
      Driver currently doesn't support multi-CoS, but it contains logic
      where multiple transmission queues could be theoretically manipulated.
      No point in maintaining the infrastructure at the moment.
      Signed-off-by: NYuval Mintz <Yuval.Mintz@cavium.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      80439a17
    • M
      qede: Optimize aggregation information size · 01e23015
      Mintz, Yuval 提交于
      Driver needs to maintain a structure per-each concurrent possible
      open aggregation, but the structure storing that metadata is far from
      being optimized - biggest waste in it is that there are 2 buffer metadata,
      one for a replacement buffer when the aggregation begins and the other for
      holding the first aggregation's buffer after it begins [as firmware might
      still update it]. Those 2 can safely be united into a single metadata
      structure.
      
      struct qede_agg_info changes the following:
      
      	/* size: 120, cachelines: 2, members: 9 */
      	/* sum members: 114, holes: 1, sum holes: 4 */
      	/* padding: 2 */
      	/* paddings: 2, sum paddings: 8 */
      	/* last cacheline: 56 bytes */
       -->
      	/* size: 48, cachelines: 1, members: 9 */
      	/* paddings: 1, sum paddings: 4 */
      	/* last cacheline: 48 bytes */
      Signed-off-by: NYuval Mintz <Yuval.Mintz@cavium.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      01e23015
  13. 04 11月, 2016 1 次提交
    • M
      qede: Correctly map aggregation replacement pages · 9512925a
      Mintz, Yuval 提交于
      Driver allocates replacement buffers before-hand to make
      sure whenever an aggregation begins there would be a replacement
      for the Rx buffers, as we can't release the buffer until
      aggregation is terminated and driver logic assumes the Rx rings
      are always full.
      
      For every other Rx page that's being allocated [I.e., regular]
      the page is being completely mapped while for the replacement
      buffers only the first portion of the page is being mapped.
      This means that:
        a. Once replacement buffer replenishes the regular Rx ring,
      assuming there's more than a single packet on page we'd post unmapped
      memory toward HW [assuming mapping is actually done in granularity
      smaller than page].
        b. Unmaps are being done for the entire page, which is incorrect.
      
      Fixes: 55482edc ("qede: Add slowpath/fastpath support and enable hardware GRO")
      Signed-off-by: NYuval Mintz <Yuval.Mintz@cavium.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9512925a
  14. 01 11月, 2016 3 次提交
  15. 30 10月, 2016 1 次提交
  16. 23 10月, 2016 2 次提交
  17. 18 10月, 2016 1 次提交
  18. 14 10月, 2016 1 次提交