diff options
author | Tariq Toukan <tariqt@mellanox.com> | 2018-02-07 14:28:35 +0300 |
---|---|---|
committer | Saeed Mahameed <saeedm@mellanox.com> | 2018-03-28 03:17:27 +0300 |
commit | b0cedc844c00991d323c13b82d651d372dcbbb12 (patch) | |
tree | bd54660e6489b37ab4ca3e367bd4c32f24708d79 /drivers/net/ethernet/mellanox/mlx5/core/en_main.c | |
parent | f1e4fc9b4b02ec728b06ad09d6cdf5a9bb7ec372 (diff) | |
download | linux-b0cedc844c00991d323c13b82d651d372dcbbb12.tar.xz |
net/mlx5e: Remove rq_headroom field from params
It can be derived from other params, calculate it
via the dedicated function when needed.
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx5/core/en_main.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 65e6955713e7..4907b7bb08e0 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -92,6 +92,19 @@ u8 mlx5e_mpwqe_get_log_num_strides(struct mlx5_core_dev *mdev, mlx5e_mpwqe_get_log_stride_size(mdev, params); } +static u16 mlx5e_get_rq_headroom(struct mlx5e_params *params) +{ + u16 linear_rq_headroom = params->xdp_prog ? + XDP_PACKET_HEADROOM : MLX5_RX_HEADROOM; + + linear_rq_headroom += NET_IP_ALIGN; + + if (params->rq_wq_type == MLX5_WQ_TYPE_LINKED_LIST) + return linear_rq_headroom; + + return 0; +} + void mlx5e_init_rq_type_params(struct mlx5_core_dev *mdev, struct mlx5e_params *params, u8 rq_type) { @@ -107,12 +120,9 @@ void mlx5e_init_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 -= params->rq_headroom + + params->lro_wqe_sz -= mlx5e_get_rq_headroom(params) + SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); } @@ -441,7 +451,7 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c, goto err_rq_wq_destroy; rq->buff.map_dir = rq->xdp_prog ? DMA_BIDIRECTIONAL : DMA_FROM_DEVICE; - rq->buff.headroom = params->rq_headroom; + rq->buff.headroom = mlx5e_get_rq_headroom(params); switch (rq->wq_type) { case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ: |