Skip to content

Commit 4e7401f

Browse files
gentoo-rootSaeed Mahameed
authored andcommitted
net/mlx5e: XDP, Allow growing tail for XDP multi buffer
The cited commits missed passing frag_size to __xdp_rxq_info_reg, which is required by bpf_xdp_adjust_tail to support growing the tail pointer in fragmented packets. Pass the missing parameter when the current RQ mode allows XDP multi buffer. Fixes: ea5d49b ("net/mlx5e: Add XDP multi buffer support to the non-linear legacy RQ") Fixes: 9cb9482 ("net/mlx5e: Use fragments of the same size in non-linear legacy RQ with XDP") Signed-off-by: Maxim Mikityanskiy <[email protected]> Cc: Tariq Toukan <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent d4e0672 commit 4e7401f

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en/params.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,8 @@ static void mlx5e_rx_compute_wqe_bulk_params(struct mlx5e_params *params,
732732
static int mlx5e_build_rq_frags_info(struct mlx5_core_dev *mdev,
733733
struct mlx5e_params *params,
734734
struct mlx5e_xsk_param *xsk,
735-
struct mlx5e_rq_frags_info *info)
735+
struct mlx5e_rq_frags_info *info,
736+
u32 *xdp_frag_size)
736737
{
737738
u32 byte_count = MLX5E_SW2HW_MTU(params, params->sw_mtu);
738739
int frag_size_max = DEFAULT_FRAG_SIZE;
@@ -845,6 +846,8 @@ static int mlx5e_build_rq_frags_info(struct mlx5_core_dev *mdev,
845846

846847
info->log_num_frags = order_base_2(info->num_frags);
847848

849+
*xdp_frag_size = info->num_frags > 1 && params->xdp_prog ? PAGE_SIZE : 0;
850+
848851
return 0;
849852
}
850853

@@ -989,7 +992,8 @@ int mlx5e_build_rq_param(struct mlx5_core_dev *mdev,
989992
}
990993
default: /* MLX5_WQ_TYPE_CYCLIC */
991994
MLX5_SET(wq, wq, log_wq_sz, params->log_rq_mtu_frames);
992-
err = mlx5e_build_rq_frags_info(mdev, params, xsk, &param->frags_info);
995+
err = mlx5e_build_rq_frags_info(mdev, params, xsk, &param->frags_info,
996+
&param->xdp_frag_size);
993997
if (err)
994998
return err;
995999
ndsegs = param->frags_info.num_frags;

drivers/net/ethernet/mellanox/mlx5/core/en/params.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ struct mlx5e_rq_param {
2424
u32 rqc[MLX5_ST_SZ_DW(rqc)];
2525
struct mlx5_wq_param wq;
2626
struct mlx5e_rq_frags_info frags_info;
27+
u32 xdp_frag_size;
2728
};
2829

2930
struct mlx5e_sq_param {

drivers/net/ethernet/mellanox/mlx5/core/en_main.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ static void mlx5e_free_mpwqe_rq_drop_page(struct mlx5e_rq *rq)
641641
}
642642

643643
static int mlx5e_init_rxq_rq(struct mlx5e_channel *c, struct mlx5e_params *params,
644-
struct mlx5e_rq *rq)
644+
u32 xdp_frag_size, struct mlx5e_rq *rq)
645645
{
646646
struct mlx5_core_dev *mdev = c->mdev;
647647
int err;
@@ -665,7 +665,8 @@ static int mlx5e_init_rxq_rq(struct mlx5e_channel *c, struct mlx5e_params *param
665665
if (err)
666666
return err;
667667

668-
return xdp_rxq_info_reg(&rq->xdp_rxq, rq->netdev, rq->ix, c->napi.napi_id);
668+
return __xdp_rxq_info_reg(&rq->xdp_rxq, rq->netdev, rq->ix, c->napi.napi_id,
669+
xdp_frag_size);
669670
}
670671

671672
static int mlx5_rq_shampo_alloc(struct mlx5_core_dev *mdev,
@@ -2240,7 +2241,7 @@ static int mlx5e_open_rxq_rq(struct mlx5e_channel *c, struct mlx5e_params *param
22402241
{
22412242
int err;
22422243

2243-
err = mlx5e_init_rxq_rq(c, params, &c->rq);
2244+
err = mlx5e_init_rxq_rq(c, params, rq_params->xdp_frag_size, &c->rq);
22442245
if (err)
22452246
return err;
22462247

0 commit comments

Comments
 (0)