Skip to content

Commit 26782aa

Browse files
Eric Dumazetkuba-moo
authored andcommitted
net/mlx4: MLX4_TX_BOUNCE_BUFFER_SIZE depends on MAX_SKB_FRAGS
Google production kernel has increased MAX_SKB_FRAGS to 45 for BIG-TCP rollout. Unfortunately mlx4 TX bounce buffer is not big enough whenever an skb has up to 45 page fragments. This can happen often with TCP TX zero copy, as one frag usually holds 4096 bytes of payload (order-0 page). Tested: Kernel built with MAX_SKB_FRAGS=45 ip link set dev eth0 gso_max_size 185000 netperf -t TCP_SENDFILE I made sure that "ethtool -G eth0 tx 64" was properly working, ring->full_size being set to 15. Signed-off-by: Eric Dumazet <[email protected]> Reported-by: Wei Wang <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 35f31ff commit 26782aa

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

drivers/net/ethernet/mellanox/mlx4/mlx4_en.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,18 @@
8989
#define MLX4_EN_FILTER_HASH_SHIFT 4
9090
#define MLX4_EN_FILTER_EXPIRY_QUOTA 60
9191

92-
/* Typical TSO descriptor with 16 gather entries is 352 bytes... */
93-
#define MLX4_TX_BOUNCE_BUFFER_SIZE 512
92+
#define CTRL_SIZE sizeof(struct mlx4_wqe_ctrl_seg)
93+
#define DS_SIZE sizeof(struct mlx4_wqe_data_seg)
94+
95+
/* Maximal size of the bounce buffer:
96+
* 256 bytes for LSO headers.
97+
* CTRL_SIZE for control desc.
98+
* DS_SIZE if skb->head contains some payload.
99+
* MAX_SKB_FRAGS frags.
100+
*/
101+
#define MLX4_TX_BOUNCE_BUFFER_SIZE \
102+
ALIGN(256 + CTRL_SIZE + DS_SIZE + MAX_SKB_FRAGS * DS_SIZE, TXBB_SIZE)
103+
94104
#define MLX4_MAX_DESC_TXBBS (MLX4_TX_BOUNCE_BUFFER_SIZE / TXBB_SIZE)
95105

96106
/*
@@ -217,9 +227,7 @@ struct mlx4_en_tx_info {
217227

218228

219229
#define MLX4_EN_BIT_DESC_OWN 0x80000000
220-
#define CTRL_SIZE sizeof(struct mlx4_wqe_ctrl_seg)
221230
#define MLX4_EN_MEMTYPE_PAD 0x100
222-
#define DS_SIZE sizeof(struct mlx4_wqe_data_seg)
223231

224232

225233
struct mlx4_en_tx_desc {

0 commit comments

Comments
 (0)