Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: gro: use cb instead of skb->network_header

This patch converts references of skb->network_header to napi_gro_cb's
network_offset and inner_network_offset.

Signed-off-by: Richard Gobert <richardbgobert@gmail.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://lore.kernel.org/r/20240509190819.2985-2-richardbgobert@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Richard Gobert and committed by
Jakub Kicinski
186b1ea7 9af9b891

+13 -11
+7 -2
include/net/gro.h
··· 181 181 return ptr; 182 182 } 183 183 184 + static inline int skb_gro_receive_network_offset(const struct sk_buff *skb) 185 + { 186 + return NAPI_GRO_CB(skb)->network_offsets[NAPI_GRO_CB(skb)->encap_mark]; 187 + } 188 + 184 189 static inline void *skb_gro_network_header(const struct sk_buff *skb) 185 190 { 186 191 if (skb_gro_may_pull(skb, skb_gro_offset(skb))) 187 - return skb_gro_header_fast(skb, skb_network_offset(skb)); 192 + return skb_gro_header_fast(skb, skb_gro_receive_network_offset(skb)); 188 193 189 - return skb_network_header(skb); 194 + return skb->data + skb_gro_receive_network_offset(skb); 190 195 } 191 196 192 197 static inline __wsum inet_gro_compute_pseudo(const struct sk_buff *skb,
-4
net/ipv4/af_inet.c
··· 1569 1569 1570 1570 NAPI_GRO_CB(skb)->is_atomic = !!(iph->frag_off & htons(IP_DF)); 1571 1571 NAPI_GRO_CB(skb)->flush |= flush; 1572 - skb_set_network_header(skb, off); 1573 - /* The above will be needed by the transport layer if there is one 1574 - * immediately following this IP hdr. 1575 - */ 1576 1572 NAPI_GRO_CB(skb)->inner_network_offset = off; 1577 1573 1578 1574 /* Note : No need to call skb_gro_postpull_rcsum() here,
+2 -1
net/ipv4/tcp_offload.c
··· 463 463 464 464 INDIRECT_CALLABLE_SCOPE int tcp4_gro_complete(struct sk_buff *skb, int thoff) 465 465 { 466 - const struct iphdr *iph = ip_hdr(skb); 466 + const u16 offset = NAPI_GRO_CB(skb)->network_offsets[skb->encapsulation]; 467 + const struct iphdr *iph = (struct iphdr *)(skb->data + offset); 467 468 struct tcphdr *th = tcp_hdr(skb); 468 469 469 470 if (unlikely(NAPI_GRO_CB(skb)->is_flist)) {
+2 -3
net/ipv6/ip6_offload.c
··· 67 67 off += len; 68 68 } 69 69 70 - skb_gro_pull(skb, off - skb_network_offset(skb)); 70 + skb_gro_pull(skb, off - skb_gro_receive_network_offset(skb)); 71 71 return proto; 72 72 } 73 73 ··· 236 236 if (unlikely(!iph)) 237 237 goto out; 238 238 239 - skb_set_network_header(skb, off); 240 239 NAPI_GRO_CB(skb)->inner_network_offset = off; 241 240 242 241 flush += ntohs(iph->payload_len) != skb->len - hlen; ··· 259 260 NAPI_GRO_CB(skb)->proto = proto; 260 261 261 262 flush--; 262 - nlen = skb_network_header_len(skb); 263 + nlen = skb_gro_offset(skb) - off; 263 264 264 265 list_for_each_entry(p, head, list) { 265 266 const struct ipv6hdr *iph2;
+2 -1
net/ipv6/tcpv6_offload.c
··· 72 72 73 73 INDIRECT_CALLABLE_SCOPE int tcp6_gro_complete(struct sk_buff *skb, int thoff) 74 74 { 75 - const struct ipv6hdr *iph = ipv6_hdr(skb); 75 + const u16 offset = NAPI_GRO_CB(skb)->network_offsets[skb->encapsulation]; 76 + const struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + offset); 76 77 struct tcphdr *th = tcp_hdr(skb); 77 78 78 79 if (unlikely(NAPI_GRO_CB(skb)->is_flist)) {