diff options
author | Eric Dumazet <edumazet@google.com> | 2021-11-15 09:05:54 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-11-16 13:16:54 +0000 |
commit | 587652bbdd06ab38a4c1b85e40f933d2cf4a1147 (patch) | |
tree | a5ce4facf54cc2ecedad1c80888191cede81087f /include/net/gro.h | |
parent | e456a18a390b96f22b0de2acd4d0f49c72ed2280 (diff) | |
download | lwn-587652bbdd06ab38a4c1b85e40f933d2cf4a1147.tar.gz lwn-587652bbdd06ab38a4c1b85e40f933d2cf4a1147.zip |
net: gro: populate net/core/gro.c
Move gro code and data from net/core/dev.c to net/core/gro.c
to ease maintenance.
gro_normal_list() and gro_normal_one() are inlined
because they are called from both files.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/gro.h')
-rw-r--r-- | include/net/gro.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/net/gro.h b/include/net/gro.h index f988bf3440f8..d0e7df691a80 100644 --- a/include/net/gro.h +++ b/include/net/gro.h @@ -416,4 +416,26 @@ static inline __wsum ip6_gro_compute_pseudo(struct sk_buff *skb, int proto) int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb); +/* Pass the currently batched GRO_NORMAL SKBs up to the stack. */ +static inline void gro_normal_list(struct napi_struct *napi) +{ + if (!napi->rx_count) + return; + netif_receive_skb_list_internal(&napi->rx_list); + INIT_LIST_HEAD(&napi->rx_list); + napi->rx_count = 0; +} + +/* Queue one GRO_NORMAL SKB up for list processing. If batch size exceeded, + * pass the whole batch up to the stack. + */ +static inline void gro_normal_one(struct napi_struct *napi, struct sk_buff *skb, int segs) +{ + list_add_tail(&skb->list, &napi->rx_list); + napi->rx_count += segs; + if (napi->rx_count >= gro_normal_batch) + gro_normal_list(napi); +} + + #endif /* _NET_IPV6_GRO_H */ |