Skip to content

Commit 564df7a

Browse files
nbd168opsiff
authored andcommitted
net: move skb_gro_receive_list from udp to core
mainline inclusion from mainline-v6.10-rc1 category: other 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> (cherry picked from commit 8928756) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent 8209bf1 commit 564df7a

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
@@ -442,6 +442,7 @@ static inline __wsum ip6_gro_compute_pseudo(struct sk_buff *skb, int proto)
442442
}
443443

444444
int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb);
445+
int skb_gro_receive_list(struct sk_buff *p, struct sk_buff *skb);
445446

446447
/* Pass the currently batched GRO_NORMAL SKBs up to the stack. */
447448
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
@@ -225,6 +225,33 @@ int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb)
225225
return 0;
226226
}
227227

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

229256
static void napi_gro_complete(struct napi_struct *napi, struct sk_buff *skb)
230257
{

net/ipv4/udp_offload.c

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -525,33 +525,6 @@ static struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb,
525525
return segs;
526526
}
527527

528-
static int skb_gro_receive_list(struct sk_buff *p, struct sk_buff *skb)
529-
{
530-
if (unlikely(p->len + skb->len >= 65536))
531-
return -E2BIG;
532-
533-
if (NAPI_GRO_CB(p)->last == p)
534-
skb_shinfo(p)->frag_list = skb;
535-
else
536-
NAPI_GRO_CB(p)->last->next = skb;
537-
538-
skb_pull(skb, skb_gro_offset(skb));
539-
540-
NAPI_GRO_CB(p)->last = skb;
541-
NAPI_GRO_CB(p)->count++;
542-
p->data_len += skb->len;
543-
544-
/* sk ownership - if any - completely transferred to the aggregated packet */
545-
skb->destructor = NULL;
546-
skb->sk = NULL;
547-
p->truesize += skb->truesize;
548-
p->len += skb->len;
549-
550-
NAPI_GRO_CB(skb)->same_flow = 1;
551-
552-
return 0;
553-
}
554-
555528

556529
#define UDP_GRO_CNT_MAX 64
557530
static struct sk_buff *udp_gro_receive_segment(struct list_head *head,

0 commit comments

Comments
 (0)