Skip to content

Commit 186b1ea

Browse files
Richard Gobertkuba-moo
authored andcommitted
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 <[email protected]> Reviewed-by: Willem de Bruijn <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 9af9b89 commit 186b1ea

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed

include/net/gro.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,17 @@ static inline void *skb_gro_header(struct sk_buff *skb, unsigned int hlen,
181181
return ptr;
182182
}
183183

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+
184189
static inline void *skb_gro_network_header(const struct sk_buff *skb)
185190
{
186191
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));
188193

189-
return skb_network_header(skb);
194+
return skb->data + skb_gro_receive_network_offset(skb);
190195
}
191196

192197
static inline __wsum inet_gro_compute_pseudo(const struct sk_buff *skb,

net/ipv4/af_inet.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1569,10 +1569,6 @@ struct sk_buff *inet_gro_receive(struct list_head *head, struct sk_buff *skb)
15691569

15701570
NAPI_GRO_CB(skb)->is_atomic = !!(iph->frag_off & htons(IP_DF));
15711571
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-
*/
15761572
NAPI_GRO_CB(skb)->inner_network_offset = off;
15771573

15781574
/* Note : No need to call skb_gro_postpull_rcsum() here,

net/ipv4/tcp_offload.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,8 @@ struct sk_buff *tcp4_gro_receive(struct list_head *head, struct sk_buff *skb)
463463

464464
INDIRECT_CALLABLE_SCOPE int tcp4_gro_complete(struct sk_buff *skb, int thoff)
465465
{
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);
467468
struct tcphdr *th = tcp_hdr(skb);
468469

469470
if (unlikely(NAPI_GRO_CB(skb)->is_flist)) {

net/ipv6/ip6_offload.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static int ipv6_gro_pull_exthdrs(struct sk_buff *skb, int off, int proto)
6767
off += len;
6868
}
6969

70-
skb_gro_pull(skb, off - skb_network_offset(skb));
70+
skb_gro_pull(skb, off - skb_gro_receive_network_offset(skb));
7171
return proto;
7272
}
7373

@@ -236,7 +236,6 @@ INDIRECT_CALLABLE_SCOPE struct sk_buff *ipv6_gro_receive(struct list_head *head,
236236
if (unlikely(!iph))
237237
goto out;
238238

239-
skb_set_network_header(skb, off);
240239
NAPI_GRO_CB(skb)->inner_network_offset = off;
241240

242241
flush += ntohs(iph->payload_len) != skb->len - hlen;
@@ -260,7 +259,7 @@ INDIRECT_CALLABLE_SCOPE struct sk_buff *ipv6_gro_receive(struct list_head *head,
260259
NAPI_GRO_CB(skb)->proto = proto;
261260

262261
flush--;
263-
nlen = skb_network_header_len(skb);
262+
nlen = skb_gro_offset(skb) - off;
264263

265264
list_for_each_entry(p, head, list) {
266265
const struct ipv6hdr *iph2;

net/ipv6/tcpv6_offload.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ struct sk_buff *tcp6_gro_receive(struct list_head *head, struct sk_buff *skb)
7272

7373
INDIRECT_CALLABLE_SCOPE int tcp6_gro_complete(struct sk_buff *skb, int thoff)
7474
{
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);
7677
struct tcphdr *th = tcp_hdr(skb);
7778

7879
if (unlikely(NAPI_GRO_CB(skb)->is_flist)) {

0 commit comments

Comments
 (0)