Skip to content

Commit a90f559

Browse files
cjubranSaeed Mahameed
authored andcommitted
net/mlx5e: XDP, Exclude headroom and tailroom from memory calculations
In the case of XDP Multi-Buffer with Striding RQ, an extra page is allocated for the linear part of non-linear SKBs. Including headroom and tailroom in the calculation may result in an unnecessary increase in the amount of memory allocated. This could be critical, particularly for large MTUs (e.g. 7975B) and large RQ sizes (e.g. 8192). In this case, the requested page pool size is 64K, but 32K would be sufficient. This causes a failure due to exceeding the page pool size limit of 32K. Exclude headroom and tailroom from SKB size calculations to reduce page pool size. Signed-off-by: Carolina Jubran <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent fb3bfdf commit a90f559

File tree

1 file changed

+8
-1
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/en

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ static u32 mlx5e_rx_get_linear_stride_sz(struct mlx5_core_dev *mdev,
257257
struct mlx5e_xsk_param *xsk,
258258
bool mpwqe)
259259
{
260+
bool no_head_tail_room;
260261
u32 sz;
261262

262263
/* XSK frames are mapped as individual pages, because frames may come in
@@ -265,7 +266,13 @@ static u32 mlx5e_rx_get_linear_stride_sz(struct mlx5_core_dev *mdev,
265266
if (xsk)
266267
return mpwqe ? 1 << mlx5e_mpwrq_page_shift(mdev, xsk) : PAGE_SIZE;
267268

268-
sz = roundup_pow_of_two(mlx5e_rx_get_linear_sz_skb(params, false));
269+
no_head_tail_room = params->xdp_prog && mpwqe && !mlx5e_rx_is_linear_skb(mdev, params, xsk);
270+
271+
/* When no_head_tail_room is set, headroom and tailroom are excluded from skb calculations.
272+
* no_head_tail_room should be set in the case of XDP with Striding RQ
273+
* when SKB is not linear. This is because another page is allocated for the linear part.
274+
*/
275+
sz = roundup_pow_of_two(mlx5e_rx_get_linear_sz_skb(params, no_head_tail_room));
269276

270277
/* XDP in mlx5e doesn't support multiple packets per page.
271278
* Do not assume sz <= PAGE_SIZE if params->xdp_prog is set.

0 commit comments

Comments
 (0)