• Tariq Toukan's avatar
    net/mlx5e: Use linear SKB in Striding RQ · 619a8f2a
    Tariq Toukan authored
    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: default avatarTariq Toukan <tariqt@mellanox.com>
    Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
    619a8f2a
en_rx.c 35.4 KB