Skip to content

Commit bda5896

Browse files
gentoo-rootkuba-moo
authored andcommitted
net/mlx5e: Remove jumbo_remove step from TX path
Now that the kernel doesn't insert HBH for BIG TCP IPv6 packets, remove unnecessary steps from the mlx5e and mlx5i TX path, that used to check and remove HBH. Signed-off-by: Alice Mikityanska <alice@isovalent.com> Acked-by: Paolo Abeni <pabeni@redhat.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Link: https://patch.msgid.link/20260205133925.526371-6-alice.kernel@fastmail.im Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 1676ebb commit bda5896

1 file changed

Lines changed: 12 additions & 63 deletions

File tree

  • drivers/net/ethernet/mellanox/mlx5/core

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

Lines changed: 12 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,11 @@ mlx5e_txwqe_build_eseg_csum(struct mlx5e_txqsq *sq, struct sk_buff *skb,
152152
* to inline later in the transmit descriptor
153153
*/
154154
static inline u16
155-
mlx5e_tx_get_gso_ihs(struct mlx5e_txqsq *sq, struct sk_buff *skb, int *hopbyhop)
155+
mlx5e_tx_get_gso_ihs(struct mlx5e_txqsq *sq, struct sk_buff *skb)
156156
{
157157
struct mlx5e_sq_stats *stats = sq->stats;
158158
u16 ihs;
159159

160-
*hopbyhop = 0;
161160
if (skb->encapsulation) {
162161
if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4)
163162
ihs = skb_inner_transport_offset(skb) +
@@ -167,17 +166,12 @@ mlx5e_tx_get_gso_ihs(struct mlx5e_txqsq *sq, struct sk_buff *skb, int *hopbyhop)
167166
stats->tso_inner_packets++;
168167
stats->tso_inner_bytes += skb->len - ihs;
169168
} else {
170-
if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) {
169+
if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4)
171170
ihs = skb_transport_offset(skb) + sizeof(struct udphdr);
172-
} else {
171+
else
173172
ihs = skb_tcp_all_headers(skb);
174-
if (ipv6_has_hopopt_jumbo(skb)) {
175-
*hopbyhop = sizeof(struct hop_jumbo_hdr);
176-
ihs -= sizeof(struct hop_jumbo_hdr);
177-
}
178-
}
179173
stats->tso_packets++;
180-
stats->tso_bytes += skb->len - ihs - *hopbyhop;
174+
stats->tso_bytes += skb->len - ihs;
181175
}
182176

183177
return ihs;
@@ -239,7 +233,6 @@ struct mlx5e_tx_attr {
239233
__be16 mss;
240234
u16 insz;
241235
u8 opcode;
242-
u8 hopbyhop;
243236
};
244237

245238
struct mlx5e_tx_wqe_attr {
@@ -275,16 +268,14 @@ static void mlx5e_sq_xmit_prepare(struct mlx5e_txqsq *sq, struct sk_buff *skb,
275268
struct mlx5e_sq_stats *stats = sq->stats;
276269

277270
if (skb_is_gso(skb)) {
278-
int hopbyhop;
279-
u16 ihs = mlx5e_tx_get_gso_ihs(sq, skb, &hopbyhop);
271+
u16 ihs = mlx5e_tx_get_gso_ihs(sq, skb);
280272

281273
*attr = (struct mlx5e_tx_attr) {
282274
.opcode = MLX5_OPCODE_LSO,
283275
.mss = cpu_to_be16(skb_shinfo(skb)->gso_size),
284276
.ihs = ihs,
285277
.num_bytes = skb->len + (skb_shinfo(skb)->gso_segs - 1) * ihs,
286-
.headlen = skb_headlen(skb) - ihs - hopbyhop,
287-
.hopbyhop = hopbyhop,
278+
.headlen = skb_headlen(skb) - ihs,
288279
};
289280

290281
stats->packets += skb_shinfo(skb)->gso_segs;
@@ -439,7 +430,6 @@ mlx5e_sq_xmit_wqe(struct mlx5e_txqsq *sq, struct sk_buff *skb,
439430
struct mlx5_wqe_data_seg *dseg;
440431
struct mlx5e_tx_wqe_info *wi;
441432
u16 ihs = attr->ihs;
442-
struct ipv6hdr *h6;
443433
struct mlx5e_sq_stats *stats = sq->stats;
444434
int num_dma;
445435

@@ -456,28 +446,7 @@ mlx5e_sq_xmit_wqe(struct mlx5e_txqsq *sq, struct sk_buff *skb,
456446
if (ihs) {
457447
u8 *start = eseg->inline_hdr.start;
458448

459-
if (unlikely(attr->hopbyhop)) {
460-
/* remove the HBH header.
461-
* Layout: [Ethernet header][IPv6 header][HBH][TCP header]
462-
*/
463-
if (skb_vlan_tag_present(skb)) {
464-
mlx5e_insert_vlan(start, skb, ETH_HLEN + sizeof(*h6));
465-
ihs += VLAN_HLEN;
466-
h6 = (struct ipv6hdr *)(start + sizeof(struct vlan_ethhdr));
467-
} else {
468-
unsafe_memcpy(start, skb->data,
469-
ETH_HLEN + sizeof(*h6),
470-
MLX5_UNSAFE_MEMCPY_DISCLAIMER);
471-
h6 = (struct ipv6hdr *)(start + ETH_HLEN);
472-
}
473-
h6->nexthdr = IPPROTO_TCP;
474-
/* Copy the TCP header after the IPv6 one */
475-
memcpy(h6 + 1,
476-
skb->data + ETH_HLEN + sizeof(*h6) +
477-
sizeof(struct hop_jumbo_hdr),
478-
tcp_hdrlen(skb));
479-
/* Leave ipv6 payload_len set to 0, as LSO v2 specs request. */
480-
} else if (skb_vlan_tag_present(skb)) {
449+
if (skb_vlan_tag_present(skb)) {
481450
mlx5e_insert_vlan(start, skb, ihs);
482451
ihs += VLAN_HLEN;
483452
stats->added_vlan_packets++;
@@ -491,7 +460,7 @@ mlx5e_sq_xmit_wqe(struct mlx5e_txqsq *sq, struct sk_buff *skb,
491460
}
492461

493462
dseg += wqe_attr->ds_cnt_ids;
494-
num_dma = mlx5e_txwqe_build_dsegs(sq, skb, skb->data + attr->ihs + attr->hopbyhop,
463+
num_dma = mlx5e_txwqe_build_dsegs(sq, skb, skb->data + attr->ihs,
495464
attr->headlen, dseg);
496465
if (unlikely(num_dma < 0))
497466
goto err_drop;
@@ -1019,34 +988,14 @@ void mlx5i_sq_xmit(struct mlx5e_txqsq *sq, struct sk_buff *skb,
1019988
eseg->mss = attr.mss;
1020989

1021990
if (attr.ihs) {
1022-
if (unlikely(attr.hopbyhop)) {
1023-
struct ipv6hdr *h6;
1024-
1025-
/* remove the HBH header.
1026-
* Layout: [Ethernet header][IPv6 header][HBH][TCP header]
1027-
*/
1028-
unsafe_memcpy(eseg->inline_hdr.start, skb->data,
1029-
ETH_HLEN + sizeof(*h6),
1030-
MLX5_UNSAFE_MEMCPY_DISCLAIMER);
1031-
h6 = (struct ipv6hdr *)((char *)eseg->inline_hdr.start + ETH_HLEN);
1032-
h6->nexthdr = IPPROTO_TCP;
1033-
/* Copy the TCP header after the IPv6 one */
1034-
unsafe_memcpy(h6 + 1,
1035-
skb->data + ETH_HLEN + sizeof(*h6) +
1036-
sizeof(struct hop_jumbo_hdr),
1037-
tcp_hdrlen(skb),
1038-
MLX5_UNSAFE_MEMCPY_DISCLAIMER);
1039-
/* Leave ipv6 payload_len set to 0, as LSO v2 specs request. */
1040-
} else {
1041-
unsafe_memcpy(eseg->inline_hdr.start, skb->data,
1042-
attr.ihs,
1043-
MLX5_UNSAFE_MEMCPY_DISCLAIMER);
1044-
}
991+
unsafe_memcpy(eseg->inline_hdr.start, skb->data,
992+
attr.ihs,
993+
MLX5_UNSAFE_MEMCPY_DISCLAIMER);
1045994
eseg->inline_hdr.sz = cpu_to_be16(attr.ihs);
1046995
dseg += wqe_attr.ds_cnt_inl;
1047996
}
1048997

1049-
num_dma = mlx5e_txwqe_build_dsegs(sq, skb, skb->data + attr.ihs + attr.hopbyhop,
998+
num_dma = mlx5e_txwqe_build_dsegs(sq, skb, skb->data + attr.ihs,
1050999
attr.headlen, dseg);
10511000
if (unlikely(num_dma < 0))
10521001
goto err_drop;

0 commit comments

Comments
 (0)