net/mlx5e: Enhance RX SKB headroom logic
authorTariq Toukan <tariqt@mellanox.com>
Tue, 31 Jan 2017 14:48:59 +0000 (16:48 +0200)
committerSaeed Mahameed <saeedm@mellanox.com>
Thu, 22 Jun 2017 11:30:13 +0000 (14:30 +0300)
In the RX memory scheme of non Striding RQ, we use linear SKBs.
Keeping NET_IP_ALIGN in headroom can improve performance on some archs.
In addition, take this headroom into account when calculating the
LRO WQE size.

These are not needed in Striding RQ as they're done implicitly
within the non-linear SKB allocation.

Fixes: 1bfecfca565c ("net/mlx5e: Build RX SKB on demand")
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/en.h
drivers/net/ethernet/mellanox/mlx5/core/en_main.c

index 6af1fbe62082b0562753371dd53da11d9b244864..00ff2a1651e7e50b7434a0930a9afcc29f111567 100644 (file)
@@ -217,6 +217,7 @@ struct mlx5e_cq_moder {
 struct mlx5e_params {
        u8  log_sq_size;
        u8  rq_wq_type;
+       u16 rq_headroom;
        u8  mpwqe_log_stride_sz;
        u8  mpwqe_log_num_strides;
        u8  log_rq_size;
index c991c1e9ea1f5820239418fc938df1b370a97cee..66173e5545ce84a05bc37a3c6935054568d2d75b 100644 (file)
@@ -96,9 +96,12 @@ void mlx5e_set_rq_type_params(struct mlx5_core_dev *mdev,
                params->log_rq_size = is_kdump_kernel() ?
                        MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE :
                        MLX5E_PARAMS_DEFAULT_LOG_RQ_SIZE;
+               params->rq_headroom = params->xdp_prog ?
+                       XDP_PACKET_HEADROOM : MLX5_RX_HEADROOM;
+               params->rq_headroom += NET_IP_ALIGN;
 
                /* Extra room needed for build_skb */
-               params->lro_wqe_sz -= MLX5_RX_HEADROOM +
+               params->lro_wqe_sz -= params->rq_headroom +
                        SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
        }
 
@@ -579,13 +582,8 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c,
                goto err_rq_wq_destroy;
        }
 
-       if (rq->xdp_prog) {
-               rq->buff.map_dir = DMA_BIDIRECTIONAL;
-               rq->rx_headroom = XDP_PACKET_HEADROOM;
-       } else {
-               rq->buff.map_dir = DMA_FROM_DEVICE;
-               rq->rx_headroom = MLX5_RX_HEADROOM;
-       }
+       rq->buff.map_dir = rq->xdp_prog ? DMA_BIDIRECTIONAL : DMA_FROM_DEVICE;
+       rq->rx_headroom = params->rq_headroom;
 
        switch (rq->wq_type) {
        case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ: