]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net/mlx5e: Remove jumbo_remove step from TX path
authorAlice Mikityanska <alice@isovalent.com>
Thu, 5 Feb 2026 13:39:18 +0000 (15:39 +0200)
committerJakub Kicinski <kuba@kernel.org>
Sat, 7 Feb 2026 04:50:12 +0000 (20:50 -0800)
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>
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c

index a01ee656a1e7f3db814f9caff7c4d43ba83ca5dd..9f0272649fa1eac2383f55570055e2d5b951609e 100644 (file)
@@ -152,12 +152,11 @@ mlx5e_txwqe_build_eseg_csum(struct mlx5e_txqsq *sq, struct sk_buff *skb,
  * to inline later in the transmit descriptor
  */
 static inline u16
-mlx5e_tx_get_gso_ihs(struct mlx5e_txqsq *sq, struct sk_buff *skb, int *hopbyhop)
+mlx5e_tx_get_gso_ihs(struct mlx5e_txqsq *sq, struct sk_buff *skb)
 {
        struct mlx5e_sq_stats *stats = sq->stats;
        u16 ihs;
 
-       *hopbyhop = 0;
        if (skb->encapsulation) {
                if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4)
                        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)
                stats->tso_inner_packets++;
                stats->tso_inner_bytes += skb->len - ihs;
        } else {
-               if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) {
+               if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4)
                        ihs = skb_transport_offset(skb) + sizeof(struct udphdr);
-               } else {
+               else
                        ihs = skb_tcp_all_headers(skb);
-                       if (ipv6_has_hopopt_jumbo(skb)) {
-                               *hopbyhop = sizeof(struct hop_jumbo_hdr);
-                               ihs -= sizeof(struct hop_jumbo_hdr);
-                       }
-               }
                stats->tso_packets++;
-               stats->tso_bytes += skb->len - ihs - *hopbyhop;
+               stats->tso_bytes += skb->len - ihs;
        }
 
        return ihs;
@@ -239,7 +233,6 @@ struct mlx5e_tx_attr {
        __be16 mss;
        u16 insz;
        u8 opcode;
-       u8 hopbyhop;
 };
 
 struct mlx5e_tx_wqe_attr {
@@ -275,16 +268,14 @@ static void mlx5e_sq_xmit_prepare(struct mlx5e_txqsq *sq, struct sk_buff *skb,
        struct mlx5e_sq_stats *stats = sq->stats;
 
        if (skb_is_gso(skb)) {
-               int hopbyhop;
-               u16 ihs = mlx5e_tx_get_gso_ihs(sq, skb, &hopbyhop);
+               u16 ihs = mlx5e_tx_get_gso_ihs(sq, skb);
 
                *attr = (struct mlx5e_tx_attr) {
                        .opcode    = MLX5_OPCODE_LSO,
                        .mss       = cpu_to_be16(skb_shinfo(skb)->gso_size),
                        .ihs       = ihs,
                        .num_bytes = skb->len + (skb_shinfo(skb)->gso_segs - 1) * ihs,
-                       .headlen   = skb_headlen(skb) - ihs - hopbyhop,
-                       .hopbyhop  = hopbyhop,
+                       .headlen   = skb_headlen(skb) - ihs,
                };
 
                stats->packets += skb_shinfo(skb)->gso_segs;
@@ -439,7 +430,6 @@ mlx5e_sq_xmit_wqe(struct mlx5e_txqsq *sq, struct sk_buff *skb,
        struct mlx5_wqe_data_seg *dseg;
        struct mlx5e_tx_wqe_info *wi;
        u16 ihs = attr->ihs;
-       struct ipv6hdr *h6;
        struct mlx5e_sq_stats *stats = sq->stats;
        int num_dma;
 
@@ -456,28 +446,7 @@ mlx5e_sq_xmit_wqe(struct mlx5e_txqsq *sq, struct sk_buff *skb,
        if (ihs) {
                u8 *start = eseg->inline_hdr.start;
 
-               if (unlikely(attr->hopbyhop)) {
-                       /* remove the HBH header.
-                        * Layout: [Ethernet header][IPv6 header][HBH][TCP header]
-                        */
-                       if (skb_vlan_tag_present(skb)) {
-                               mlx5e_insert_vlan(start, skb, ETH_HLEN + sizeof(*h6));
-                               ihs += VLAN_HLEN;
-                               h6 = (struct ipv6hdr *)(start + sizeof(struct vlan_ethhdr));
-                       } else {
-                               unsafe_memcpy(start, skb->data,
-                                             ETH_HLEN + sizeof(*h6),
-                                             MLX5_UNSAFE_MEMCPY_DISCLAIMER);
-                               h6 = (struct ipv6hdr *)(start + ETH_HLEN);
-                       }
-                       h6->nexthdr = IPPROTO_TCP;
-                       /* Copy the TCP header after the IPv6 one */
-                       memcpy(h6 + 1,
-                              skb->data + ETH_HLEN + sizeof(*h6) +
-                                       sizeof(struct hop_jumbo_hdr),
-                              tcp_hdrlen(skb));
-                       /* Leave ipv6 payload_len set to 0, as LSO v2 specs request. */
-               } else if (skb_vlan_tag_present(skb)) {
+               if (skb_vlan_tag_present(skb)) {
                        mlx5e_insert_vlan(start, skb, ihs);
                        ihs += VLAN_HLEN;
                        stats->added_vlan_packets++;
@@ -491,7 +460,7 @@ mlx5e_sq_xmit_wqe(struct mlx5e_txqsq *sq, struct sk_buff *skb,
        }
 
        dseg += wqe_attr->ds_cnt_ids;
-       num_dma = mlx5e_txwqe_build_dsegs(sq, skb, skb->data + attr->ihs + attr->hopbyhop,
+       num_dma = mlx5e_txwqe_build_dsegs(sq, skb, skb->data + attr->ihs,
                                          attr->headlen, dseg);
        if (unlikely(num_dma < 0))
                goto err_drop;
@@ -1019,34 +988,14 @@ void mlx5i_sq_xmit(struct mlx5e_txqsq *sq, struct sk_buff *skb,
        eseg->mss = attr.mss;
 
        if (attr.ihs) {
-               if (unlikely(attr.hopbyhop)) {
-                       struct ipv6hdr *h6;
-
-                       /* remove the HBH header.
-                        * Layout: [Ethernet header][IPv6 header][HBH][TCP header]
-                        */
-                       unsafe_memcpy(eseg->inline_hdr.start, skb->data,
-                                     ETH_HLEN + sizeof(*h6),
-                                     MLX5_UNSAFE_MEMCPY_DISCLAIMER);
-                       h6 = (struct ipv6hdr *)((char *)eseg->inline_hdr.start + ETH_HLEN);
-                       h6->nexthdr = IPPROTO_TCP;
-                       /* Copy the TCP header after the IPv6 one */
-                       unsafe_memcpy(h6 + 1,
-                                     skb->data + ETH_HLEN + sizeof(*h6) +
-                                                 sizeof(struct hop_jumbo_hdr),
-                                     tcp_hdrlen(skb),
-                                     MLX5_UNSAFE_MEMCPY_DISCLAIMER);
-                       /* Leave ipv6 payload_len set to 0, as LSO v2 specs request. */
-               } else {
-                       unsafe_memcpy(eseg->inline_hdr.start, skb->data,
-                                     attr.ihs,
-                                     MLX5_UNSAFE_MEMCPY_DISCLAIMER);
-               }
+               unsafe_memcpy(eseg->inline_hdr.start, skb->data,
+                             attr.ihs,
+                             MLX5_UNSAFE_MEMCPY_DISCLAIMER);
                eseg->inline_hdr.sz = cpu_to_be16(attr.ihs);
                dseg += wqe_attr.ds_cnt_inl;
        }
 
-       num_dma = mlx5e_txwqe_build_dsegs(sq, skb, skb->data + attr.ihs + attr.hopbyhop,
+       num_dma = mlx5e_txwqe_build_dsegs(sq, skb, skb->data + attr.ihs,
                                          attr.headlen, dseg);
        if (unlikely(num_dma < 0))
                goto err_drop;