Skip to content

Commit 94379a5

Browse files
gentoo-rootkuba-moo
authored andcommitted
net/mlx4: 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 mlx4 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-7-alice.kernel@fastmail.im Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent bda5896 commit 94379a5

1 file changed

Lines changed: 8 additions & 34 deletions

File tree

  • drivers/net/ethernet/mellanox/mlx4

drivers/net/ethernet/mellanox/mlx4/en_tx.c

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -636,28 +636,20 @@ static int get_real_size(const struct sk_buff *skb,
636636
struct net_device *dev,
637637
int *lso_header_size,
638638
bool *inline_ok,
639-
void **pfrag,
640-
int *hopbyhop)
639+
void **pfrag)
641640
{
642641
struct mlx4_en_priv *priv = netdev_priv(dev);
643642
int real_size;
644643

645644
if (shinfo->gso_size) {
646645
*inline_ok = false;
647-
*hopbyhop = 0;
648646
if (skb->encapsulation) {
649647
*lso_header_size = skb_inner_tcp_all_headers(skb);
650648
} else {
651-
/* Detects large IPV6 TCP packets and prepares for removal of
652-
* HBH header that has been pushed by ip6_xmit(),
653-
* mainly so that tcpdump can dissect them.
654-
*/
655-
if (ipv6_has_hopopt_jumbo(skb))
656-
*hopbyhop = sizeof(struct hop_jumbo_hdr);
657649
*lso_header_size = skb_tcp_all_headers(skb);
658650
}
659651
real_size = CTRL_SIZE + shinfo->nr_frags * DS_SIZE +
660-
ALIGN(*lso_header_size - *hopbyhop + 4, DS_SIZE);
652+
ALIGN(*lso_header_size + 4, DS_SIZE);
661653
if (unlikely(*lso_header_size != skb_headlen(skb))) {
662654
/* We add a segment for the skb linear buffer only if
663655
* it contains data */
@@ -884,7 +876,6 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
884876
int desc_size;
885877
int real_size;
886878
u32 index, bf_index;
887-
struct ipv6hdr *h6;
888879
__be32 op_own;
889880
int lso_header_size;
890881
void *fragptr = NULL;
@@ -893,7 +884,6 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
893884
bool stop_queue;
894885
bool inline_ok;
895886
u8 data_offset;
896-
int hopbyhop;
897887
bool bf_ok;
898888

899889
tx_ind = skb_get_queue_mapping(skb);
@@ -903,7 +893,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
903893
goto tx_drop;
904894

905895
real_size = get_real_size(skb, shinfo, dev, &lso_header_size,
906-
&inline_ok, &fragptr, &hopbyhop);
896+
&inline_ok, &fragptr);
907897
if (unlikely(!real_size))
908898
goto tx_drop_count;
909899

@@ -956,7 +946,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
956946
data = &tx_desc->data;
957947
data_offset = offsetof(struct mlx4_en_tx_desc, data);
958948
} else {
959-
int lso_align = ALIGN(lso_header_size - hopbyhop + 4, DS_SIZE);
949+
int lso_align = ALIGN(lso_header_size + 4, DS_SIZE);
960950

961951
data = (void *)&tx_desc->lso + lso_align;
962952
data_offset = offsetof(struct mlx4_en_tx_desc, lso) + lso_align;
@@ -1021,31 +1011,15 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
10211011
((ring->prod & ring->size) ?
10221012
cpu_to_be32(MLX4_EN_BIT_DESC_OWN) : 0);
10231013

1024-
lso_header_size -= hopbyhop;
10251014
/* Fill in the LSO prefix */
10261015
tx_desc->lso.mss_hdr_size = cpu_to_be32(
10271016
shinfo->gso_size << 16 | lso_header_size);
10281017

1018+
/* Copy headers;
1019+
* note that we already verified that it is linear
1020+
*/
1021+
memcpy(tx_desc->lso.header, skb->data, lso_header_size);
10291022

1030-
if (unlikely(hopbyhop)) {
1031-
/* remove the HBH header.
1032-
* Layout: [Ethernet header][IPv6 header][HBH][TCP header]
1033-
*/
1034-
memcpy(tx_desc->lso.header, skb->data, ETH_HLEN + sizeof(*h6));
1035-
h6 = (struct ipv6hdr *)((char *)tx_desc->lso.header + ETH_HLEN);
1036-
h6->nexthdr = IPPROTO_TCP;
1037-
/* Copy the TCP header after the IPv6 one */
1038-
memcpy(h6 + 1,
1039-
skb->data + ETH_HLEN + sizeof(*h6) +
1040-
sizeof(struct hop_jumbo_hdr),
1041-
tcp_hdrlen(skb));
1042-
/* Leave ipv6 payload_len set to 0, as LSO v2 specs request. */
1043-
} else {
1044-
/* Copy headers;
1045-
* note that we already verified that it is linear
1046-
*/
1047-
memcpy(tx_desc->lso.header, skb->data, lso_header_size);
1048-
}
10491023
ring->tso_packets++;
10501024

10511025
i = shinfo->gso_segs;

0 commit comments

Comments
 (0)