Skip to content

Commit 8928756

Browse files
nbd168Paolo Abeni
authored andcommitted
net: move skb_gro_receive_list from udp to core
This helper function will be used for TCP fraglist GRO support Acked-by: Paolo Abeni <pabeni@redhat.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Felix Fietkau <nbd@nbd.name> Reviewed-by: David Ahern <dsahern@kernel.org> Reviewed-by: Willem de Bruijn <willemb@google.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent b1de3c0 commit 8928756

3 files changed

Lines changed: 28 additions & 27 deletions

File tree

include/net/gro.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ static inline __wsum ip6_gro_compute_pseudo(const struct sk_buff *skb,
438438
}
439439

440440
int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb);
441+
int skb_gro_receive_list(struct sk_buff *p, struct sk_buff *skb);
441442

442443
/* Pass the currently batched GRO_NORMAL SKBs up to the stack. */
443444
static inline void gro_normal_list(struct napi_struct *napi)

net/core/gro.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,33 @@ int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb)
231231
return 0;
232232
}
233233

234+
int skb_gro_receive_list(struct sk_buff *p, struct sk_buff *skb)
235+
{
236+
if (unlikely(p->len + skb->len >= 65536))
237+
return -E2BIG;
238+
239+
if (NAPI_GRO_CB(p)->last == p)
240+
skb_shinfo(p)->frag_list = skb;
241+
else
242+
NAPI_GRO_CB(p)->last->next = skb;
243+
244+
skb_pull(skb, skb_gro_offset(skb));
245+
246+
NAPI_GRO_CB(p)->last = skb;
247+
NAPI_GRO_CB(p)->count++;
248+
p->data_len += skb->len;
249+
250+
/* sk ownership - if any - completely transferred to the aggregated packet */
251+
skb->destructor = NULL;
252+
skb->sk = NULL;
253+
p->truesize += skb->truesize;
254+
p->len += skb->len;
255+
256+
NAPI_GRO_CB(skb)->same_flow = 1;
257+
258+
return 0;
259+
}
260+
234261

235262
static void napi_gro_complete(struct napi_struct *napi, struct sk_buff *skb)
236263
{

net/ipv4/udp_offload.c

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -433,33 +433,6 @@ static struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb,
433433
return segs;
434434
}
435435

436-
static int skb_gro_receive_list(struct sk_buff *p, struct sk_buff *skb)
437-
{
438-
if (unlikely(p->len + skb->len >= 65536))
439-
return -E2BIG;
440-
441-
if (NAPI_GRO_CB(p)->last == p)
442-
skb_shinfo(p)->frag_list = skb;
443-
else
444-
NAPI_GRO_CB(p)->last->next = skb;
445-
446-
skb_pull(skb, skb_gro_offset(skb));
447-
448-
NAPI_GRO_CB(p)->last = skb;
449-
NAPI_GRO_CB(p)->count++;
450-
p->data_len += skb->len;
451-
452-
/* sk ownership - if any - completely transferred to the aggregated packet */
453-
skb->destructor = NULL;
454-
skb->sk = NULL;
455-
p->truesize += skb->truesize;
456-
p->len += skb->len;
457-
458-
NAPI_GRO_CB(skb)->same_flow = 1;
459-
460-
return 0;
461-
}
462-
463436

464437
#define UDP_GRO_CNT_MAX 64
465438
static struct sk_buff *udp_gro_receive_segment(struct list_head *head,

0 commit comments

Comments
 (0)