1. 01 5月, 2018 5 次提交
  2. 24 4月, 2018 2 次提交
  3. 17 4月, 2018 5 次提交
    • J
      xdp: transition into using xdp_frame for return API · 03993094
      Jesper Dangaard Brouer 提交于
      Changing API xdp_return_frame() to take struct xdp_frame as argument,
      seems like a natural choice. But there are some subtle performance
      details here that needs extra care, which is a deliberate choice.
      
      When de-referencing xdp_frame on a remote CPU during DMA-TX
      completion, result in the cache-line is change to "Shared"
      state. Later when the page is reused for RX, then this xdp_frame
      cache-line is written, which change the state to "Modified".
      
      This situation already happens (naturally) for, virtio_net, tun and
      cpumap as the xdp_frame pointer is the queued object.  In tun and
      cpumap, the ptr_ring is used for efficiently transferring cache-lines
      (with pointers) between CPUs. Thus, the only option is to
      de-referencing xdp_frame.
      
      It is only the ixgbe driver that had an optimization, in which it can
      avoid doing the de-reference of xdp_frame.  The driver already have
      TX-ring queue, which (in case of remote DMA-TX completion) have to be
      transferred between CPUs anyhow.  In this data area, we stored a
      struct xdp_mem_info and a data pointer, which allowed us to avoid
      de-referencing xdp_frame.
      
      To compensate for this, a prefetchw is used for telling the cache
      coherency protocol about our access pattern.  My benchmarks show that
      this prefetchw is enough to compensate the ixgbe driver.
      
      V7: Adjust for commit d9314c47 ("i40e: add support for XDP_REDIRECT")
      V8: Adjust for commit bd658dda ("net/mlx5e: Separate dma base address
      and offset in dma_sync call")
      Signed-off-by: NJesper Dangaard Brouer <brouer@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      03993094
    • J
      mlx5: use page_pool for xdp_return_frame call · 60bbf7ee
      Jesper Dangaard Brouer 提交于
      This patch shows how it is possible to have both the driver local page
      cache, which uses elevated refcnt for "catching"/avoiding SKB
      put_page returns the page through the page allocator.  And at the
      same time, have pages getting returned to the page_pool from
      ndp_xdp_xmit DMA completion.
      
      The performance improvement for XDP_REDIRECT in this patch is really
      good.  Especially considering that (currently) the xdp_return_frame
      API and page_pool_put_page() does per frame operations of both
      rhashtable ID-lookup and locked return into (page_pool) ptr_ring.
      (It is the plan to remove these per frame operation in a followup
      patchset).
      
      The benchmark performed was RX on mlx5 and XDP_REDIRECT out ixgbe,
      with xdp_redirect_map (using devmap) . And the target/maximum
      capability of ixgbe is 13Mpps (on this HW setup).
      
      Before this patch for mlx5, XDP redirected frames were returned via
      the page allocator.  The single flow performance was 6Mpps, and if I
      started two flows the collective performance drop to 4Mpps, because we
      hit the page allocator lock (further negative scaling occurs).
      
      Two test scenarios need to be covered, for xdp_return_frame API, which
      is DMA-TX completion running on same-CPU or cross-CPU free/return.
      Results were same-CPU=10Mpps, and cross-CPU=12Mpps.  This is very
      close to our 13Mpps max target.
      
      The reason max target isn't reached in cross-CPU test, is likely due
      to RX-ring DMA unmap/map overhead (which doesn't occur in ixgbe to
      ixgbe testing).  It is also planned to remove this unnecessary DMA
      unmap in a later patchset
      
      V2: Adjustments requested by Tariq
       - Changed page_pool_create return codes not return NULL, only
         ERR_PTR, as this simplifies err handling in drivers.
       - Save a branch in mlx5e_page_release
       - Correct page_pool size calc for MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ
      
      V5: Updated patch desc
      
      V8: Adjust for b0cedc84 ("net/mlx5e: Remove rq_headroom field from params")
      V9:
       - Adjust for 121e8927 ("net/mlx5e: Refactor RQ XDP_TX indication")
       - Adjust for 73281b78 ("net/mlx5e: Derive Striding RQ size from MTU")
       - Correct handling if page_pool_create fail for MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ
      
      V10: Req from Tariq
       - Change pool_size calc for MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ
      Signed-off-by: NJesper Dangaard Brouer <brouer@redhat.com>
      Reviewed-by: NTariq Toukan <tariqt@mellanox.com>
      Acked-by: NSaeed Mahameed <saeedm@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      60bbf7ee
    • J
      page_pool: refurbish version of page_pool code · ff7d6b27
      Jesper Dangaard Brouer 提交于
      Need a fast page recycle mechanism for ndo_xdp_xmit API for returning
      pages on DMA-TX completion time, which have good cross CPU
      performance, given DMA-TX completion time can happen on a remote CPU.
      
      Refurbish my page_pool code, that was presented[1] at MM-summit 2016.
      Adapted page_pool code to not depend the page allocator and
      integration into struct page.  The DMA mapping feature is kept,
      even-though it will not be activated/used in this patchset.
      
      [1] http://people.netfilter.org/hawk/presentations/MM-summit2016/generic_page_pool_mm_summit2016.pdf
      
      V2: Adjustments requested by Tariq
       - Changed page_pool_create return codes, don't return NULL, only
         ERR_PTR, as this simplifies err handling in drivers.
      
      V4: many small improvements and cleanups
      - Add DOC comment section, that can be used by kernel-doc
      - Improve fallback mode, to work better with refcnt based recycling
        e.g. remove a WARN as pointed out by Tariq
        e.g. quicker fallback if ptr_ring is empty.
      
      V5: Fixed SPDX license as pointed out by Alexei
      
      V6: Adjustments requested by Eric Dumazet
       - Adjust ____cacheline_aligned_in_smp usage/placement
       - Move rcu_head in struct page_pool
       - Free pages quicker on destroy, minimize resources delayed an RCU period
       - Remove code for forward/backward compat ABI interface
      
      V8: Issues found by kbuild test robot
       - Address sparse should be static warnings
       - Only compile+link when a driver use/select page_pool,
         mlx5 selects CONFIG_PAGE_POOL, although its first used in two patches
      Signed-off-by: NJesper Dangaard Brouer <brouer@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ff7d6b27
    • J
      mlx5: register a memory model when XDP is enabled · 84f5e3fb
      Jesper Dangaard Brouer 提交于
      Now all the users of ndo_xdp_xmit have been converted to use xdp_return_frame.
      This enable a different memory model, thus activating another code path
      in the xdp_return_frame API.
      
      V2: Fixed issues pointed out by Tariq.
      Signed-off-by: NJesper Dangaard Brouer <brouer@redhat.com>
      Reviewed-by: NTariq Toukan <tariqt@mellanox.com>
      Acked-by: NSaeed Mahameed <saeedm@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      84f5e3fb
    • J
      mlx5: basic XDP_REDIRECT forward support · 5168d732
      Jesper Dangaard Brouer 提交于
      This implements basic XDP redirect support in mlx5 driver.
      
      Notice that the ndo_xdp_xmit() is NOT implemented, because that API
      need some changes that this patchset is working towards.
      
      The main purpose of this patch is have different drivers doing
      XDP_REDIRECT to show how different memory models behave in a cross
      driver world.
      
      Update(pre-RFCv2 Tariq): Need to DMA unmap page before xdp_do_redirect,
      as the return API does not exist yet to to keep this mapped.
      
      Update(pre-RFCv3 Saeed): Don't mix XDP_TX and XDP_REDIRECT flushing,
      introduce xdpsq.db.redirect_flush boolian.
      
      V9: Adjust for commit 121e8927 ("net/mlx5e: Refactor RQ XDP_TX indication")
      Signed-off-by: NJesper Dangaard Brouer <brouer@redhat.com>
      Reviewed-by: NTariq Toukan <tariqt@mellanox.com>
      Acked-by: NSaeed Mahameed <saeedm@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5168d732
  4. 06 4月, 2018 2 次提交
  5. 03 4月, 2018 2 次提交
  6. 02 4月, 2018 1 次提交
    • T
      net/mlx5e: Set EQE based as default TX interrupt moderation mode · 48bfc397
      Tal Gilboa 提交于
      The default TX moderation mode was mistakenly set to CQE based. The
      intention was to add a control ability in order to improve some specific
      use-cases. In general, we prefer to use EQE based moderation as it gives
      much better numbers for the common cases.
      
      CQE based causes a degradation in the common case since it resets the
      moderation timer on CQE generation. This causes an issue when TSO is
      well utilized (large TSO sessions). The timer is set to 16us so traffic
      of ~64KB TSO sessions per second would mean timer reset (CQE per TSO
      session -> long time between CQEs). In this case we quickly reach the
      tcp_limit_output_bytes (256KB by default) and cause a halt in TX traffic.
      
      By setting EQE based moderation we make sure timer would expire after
      16us regardless of the packet rate.
      This fixes an up to 40% packet rate and up to 23% bandwidth degradtions.
      
      Fixes: 0088cbbc ("net/mlx5e: Enable CQE based moderation on TX CQ")
      Signed-off-by: NTal Gilboa <talgi@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      48bfc397
  7. 31 3月, 2018 15 次提交
    • T
      net/mlx5e: RX, Recycle buffer of UMR WQEs · ab966d7e
      Tariq Toukan 提交于
      Upon a new UMR post, check if the WQE buffer contains
      a previous UMR WQE. If so, modify the dynamic fields
      instead of a whole WQE overwrite. This saves a memcpy.
      
      In current setting, after 2 WQ cycles (12 UMR posts),
      this will always be the case.
      
      No degradation sensed.
      Signed-off-by: NTariq Toukan <tariqt@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      ab966d7e
    • T
      net/mlx5e: Keep single pre-initialized UMR WQE per RQ · b8a98a4c
      Tariq Toukan 提交于
      All UMR WQEs of an RQ share many common fields. We use
      pre-initialized structures to save calculations in datapath.
      One field (xlt_offset) was the only reason we saved a pre-initialized
      copy per WQE index.
      Here we remove its initialization (move its calculation to datapath),
      and reduce the number of copies to one-per-RQ.
      
      A very small datapath calculation is added, it occurs once per a MPWQE
      (i.e. once every 256KB), but reduces memory consumption and gives
      better cache utilization.
      
      Performance testing:
      Tested packet rate, no degradation sensed.
      Signed-off-by: NTariq Toukan <tariqt@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      b8a98a4c
    • T
      net/mlx5e: Remove page_ref bulking in Striding RQ · 9f9e9cd5
      Tariq Toukan 提交于
      When many packets reside on the same page, the bulking of
      page_ref modifications reduces the total number of atomic
      operations executed.
      
      Besides the necessary 2 operations on page alloc/free, we
      have the following extra ops per page:
      - one on WQE allocation (bump refcnt to maximum possible),
      - zero ops for SKBs,
      - one on WQE free,
      a constant of two operations in total, no matter how many
      packets/SKBs actually populate the page.
      
      Without this bulking, we have:
      - no ops on WQE allocation or free,
      - one op per SKB,
      
      Comparing the two methods when PAGE_SIZE is 4K:
      - As mentioned above, bulking method always executes 2 operations,
        not more, but not less.
      - In the default MTU configuration (1500, stride size is 2K),
        the non-bulking method execute 2 ops as well.
      - For larger MTUs with stride size of 4K, non-bulking method
        executes only a single op.
      - For XDP (stride size of 4K, no SKBs), non-bulking method
        executes no ops at all!
      
      Hence, to optimize the flows with linear SKB and XDP over Striding RQ,
      we here remove the page_ref bulking method.
      
      Performance testing:
      ConnectX-5, Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz.
      
      Single core packet rate (64 bytes).
      
      Early drop in TC: no degradation.
      
      XDP_DROP:
      before: 14,270,188 pps
      after:  20,503,603 pps, 43% improvement.
      Signed-off-by: NTariq Toukan <tariqt@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      9f9e9cd5
    • T
      net/mlx5e: Support XDP over Striding RQ · 22f45398
      Tariq Toukan 提交于
      Add XDP support over Striding RQ.
      Now that linear SKB is supported over Striding RQ,
      we can support XDP by setting stride size to PAGE_SIZE
      and headroom to XDP_PACKET_HEADROOM.
      
      Upon a MPWQE free, do not release pages that are being
      XDP xmit, they will be released upon completions.
      
      Striding RQ is capable of a higher packet-rate than
      conventional RQ.
      A performance gain is expected for all cases that had
      a HW packet-rate bottleneck. This is the case whenever
      using many flows that distribute to many cores.
      
      Performance testing:
      ConnectX-5, 24 rings, default MTU.
      CQE compression ON (to reduce completions BW in PCI).
      
      XDP_DROP packet rate:
      --------------------------------------------------
      | pkt size | XDP rate   | 100GbE linerate | pct% |
      --------------------------------------------------
      |   64byte | 126.2 Mpps |      148.0 Mpps |  85% |
      |  128byte |  80.0 Mpps |       84.8 Mpps |  94% |
      |  256byte |  42.7 Mpps |       42.7 Mpps | 100% |
      |  512byte |  23.4 Mpps |       23.4 Mpps | 100% |
      --------------------------------------------------
      Signed-off-by: NTariq Toukan <tariqt@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      22f45398
    • T
      net/mlx5e: Refactor RQ XDP_TX indication · 121e8927
      Tariq Toukan 提交于
      Make the xdp_xmit indication available for Striding RQ
      by taking it out of the type-specific union.
      This refactor is a preparation for a downstream patch that
      adds XDP support over Striding RQ.
      In addition, use a bitmap instead of a boolean for possible
      future flags.
      Signed-off-by: NTariq Toukan <tariqt@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      121e8927
    • T
      net/mlx5e: Use linear SKB in Striding RQ · 619a8f2a
      Tariq Toukan 提交于
      Current Striding RQ HW feature utilizes the RX buffers so that
      there is no wasted room between the strides. This maximises
      the memory utilization.
      This prevents the use of build_skb() (which requires headroom
      and tailroom), and demands to memcpy the packets headers into
      the skb linear part.
      
      In this patch, whenever a set of conditions holds, we apply
      an RQ configuration that allows combining the use of linear SKB
      on top of a Striding RQ.
      
      To use build_skb() with Striding RQ, the following must hold:
      1. packet does not cross a page boundary.
      2. there is enough headroom and tailroom surrounding the packet.
      
      We can satisfy 1 and 2 by configuring:
      	stride size = MTU + headroom + tailoom.
      
      This is possible only when:
      a. (MTU - headroom - tailoom) does not exceed PAGE_SIZE.
      b. HW LRO is turned off.
      
      Using linear SKB has many advantages:
      - Saves a memcpy of the headers.
      - No page-boundary checks in datapath.
      - No filler CQEs.
      - Significantly smaller CQ.
      - SKB data continuously resides in linear part, and not split to
        small amount (linear part) and large amount (fragment).
        This saves datapath cycles in driver and improves utilization
        of SKB fragments in GRO.
      - The fragments of a resulting GRO SKB follow the IP forwarding
        assumption of equal-size fragments.
      
      Some implementation details:
      HW writes the packets to the beginning of a stride,
      i.e. does not keep headroom. To overcome this we make sure we can
      extend backwards and use the last bytes of stride i-1.
      Extra care is needed for stride 0 as it has no preceding stride.
      We make sure headroom bytes are available by shifting the buffer
      pointer passed to HW by headroom bytes.
      
      This configuration now becomes default, whenever capable.
      Of course, this implies turning LRO off.
      
      Performance testing:
      ConnectX-5, single core, single RX ring, default MTU.
      
      UDP packet rate, early drop in TC layer:
      
      --------------------------------------------
      | pkt size | before    | after     | ratio |
      --------------------------------------------
      | 1500byte | 4.65 Mpps | 5.96 Mpps | 1.28x |
      |  500byte | 5.23 Mpps | 5.97 Mpps | 1.14x |
      |   64byte | 5.94 Mpps | 5.96 Mpps | 1.00x |
      --------------------------------------------
      
      TCP streams: ~20% gain
      Signed-off-by: NTariq Toukan <tariqt@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      619a8f2a
    • T
      net/mlx5e: Use inline MTTs in UMR WQEs · ea3886ca
      Tariq Toukan 提交于
      When modifying the page mapping of a HW memory region
      (via a UMR post), post the new values inlined in WQE,
      instead of using a data pointer.
      
      This is a micro-optimization, inline UMR WQEs of different
      rings scale better in HW.
      
      In addition, this obsoletes a few control flows and helps
      delete ~50 LOC.
      Signed-off-by: NTariq Toukan <tariqt@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      ea3886ca
    • T
      net/mlx5e: Do not busy-wait for UMR completion in Striding RQ · e4d86a4a
      Tariq Toukan 提交于
      Do not busy-wait a pending UMR completion. Under high HW load,
      busy-waiting a delayed completion would fully utilize the CPU core
      and mistakenly indicate a SW bottleneck.
      Signed-off-by: NTariq Toukan <tariqt@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      e4d86a4a
    • T
      net/mlx5e: Code movements in RX UMR WQE post · 18187fb2
      Tariq Toukan 提交于
      Gets the process of a UMR WQE post in one function,
      in preparation for a downstream patch that inlines
      the WQE data.
      No functional change here.
      Signed-off-by: NTariq Toukan <tariqt@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      18187fb2
    • T
      net/mlx5e: Derive Striding RQ size from MTU · 73281b78
      Tariq Toukan 提交于
      In Striding RQ, each WQE serves multiple packets
      (hence called Multi-Packet WQE, MPWQE).
      The size of a MPWQE is constant (currently 256KB).
      
      Upon a ringparam set operation, we calculate the number of
      MPWQEs per RQ. For this, first it is needed to determine the
      number of packets that can reside within a single MPWQE.
      In this patch we use the actual MTU size instead of ETH_DATA_LEN
      for this calculation.
      
      This implies that a change in MTU might require a change
      in Striding RQ ring size.
      
      In addition, this obsoletes some WQEs-to-packets translation
      functions and helps delete ~60 LOC.
      Signed-off-by: NTariq Toukan <tariqt@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      73281b78
    • T
      net/mlx5e: Save MTU in channels params · 472a1e44
      Tariq Toukan 提交于
      Knowing the MTU is required for RQ creation flow.
      By our design, channels creation flow is totally isolated
      from priv/netdev, and can be completed with access to
      channels params and mdev.
      Adding the MTU to the channels params helps preserving that.
      In addition, we save it in RQ to make its access faster in
      datapath checks.
      Signed-off-by: NTariq Toukan <tariqt@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      472a1e44
    • T
      net/mlx5e: IPoIB, Fix spelling mistake · 53378898
      Talat Batheesh 提交于
      Fix spelling mistake in debug message text.
      "dettaching" -> "detaching"
      Signed-off-by: NTalat Batheesh <talatb@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      53378898
    • A
      net/mlx5: Change teardown with force mode failure message to warning · 6c750628
      Alaa Hleihel 提交于
      With ConnectX-4, we expect the force teardown to fail in case that
      DC was enabled, therefore change the message from error to warning.
      Signed-off-by: NAlaa Hleihel <alaa@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      6c750628
    • S
      net/mlx5: Eliminate query xsrq dead code · b2d3907c
      Saeed Mahameed 提交于
      1. This function is not used anywhere in mlx5 driver
      2. It has a memcpy statement that makes no sense and produces build
      warning with gcc8
      
      drivers/net/ethernet/mellanox/mlx5/core/transobj.c: In function 'mlx5_core_query_xsrq':
      drivers/net/ethernet/mellanox/mlx5/core/transobj.c:347:3: error: 'memcpy' source argument is the same as destination [-Werror=restrict]
      
      Fixes: 01949d01 ("net/mlx5_core: Enable XRCs and SRQs when using ISSI > 0")
      Reported-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      b2d3907c
    • S
      net/mlx5e: Use eq ptr from cq · 7b2117bb
      Saeed Mahameed 提交于
      Instead of looking for the EQ of the CQ, remove that redundant code and
      use the eq pointer stored in the cq struct.
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      7b2117bb
  8. 28 3月, 2018 8 次提交