sch_cake: do not use skb_mac_header() in cake_overhead()
authorEric Dumazet <edumazet@google.com>
Tue, 21 Mar 2023 16:45:18 +0000 (16:45 +0000)
committerJakub Kicinski <kuba@kernel.org>
Thu, 23 Mar 2023 05:43:23 +0000 (22:43 -0700)
We want to remove our use of skb_mac_header() in tx paths,
eg remove skb_reset_mac_header() from __dev_queue_xmit().

Idea is that ndo_start_xmit() can get the mac header
simply looking at skb->data.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/sched/sch_cake.c

index 7970217..891e007 100644 (file)
@@ -1360,7 +1360,7 @@ static u32 cake_overhead(struct cake_sched_data *q, const struct sk_buff *skb)
                return cake_calc_overhead(q, len, off);
 
        /* borrowed from qdisc_pkt_len_init() */
-       hdr_len = skb_transport_header(skb) - skb_mac_header(skb);
+       hdr_len = skb_transport_offset(skb);
 
        /* + transport layer */
        if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 |
@@ -1368,14 +1368,14 @@ static u32 cake_overhead(struct cake_sched_data *q, const struct sk_buff *skb)
                const struct tcphdr *th;
                struct tcphdr _tcphdr;
 
-               th = skb_header_pointer(skb, skb_transport_offset(skb),
+               th = skb_header_pointer(skb, hdr_len,
                                        sizeof(_tcphdr), &_tcphdr);
                if (likely(th))
                        hdr_len += __tcp_hdrlen(th);
        } else {
                struct udphdr _udphdr;
 
-               if (skb_header_pointer(skb, skb_transport_offset(skb),
+               if (skb_header_pointer(skb, hdr_len,
                                       sizeof(_udphdr), &_udphdr))
                        hdr_len += sizeof(struct udphdr);
        }