lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <4f2650b2-e1ef-4662-d3b0-bda5a167d160@solarflare.com> Date: Thu, 30 Aug 2018 20:59:43 +0100 From: Edward Cree <ecree@...arflare.com> To: <linux-net-drivers@...arflare.com>, <davem@...emloft.net> CC: <netdev@...r.kernel.org> Subject: [RFC PATCH net-next 1/4] net: introduce list entry point for GRO Also export napi_frags_skb() so that drivers using the napi_gro_frags() interface can prepare their SKBs properly for submitting on such a list. Signed-off-by: Edward Cree <ecree@...arflare.com> --- include/linux/netdevice.h | 2 ++ net/core/dev.c | 28 +++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index ca5ab98053c8..a4f55142d3eb 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -3521,8 +3521,10 @@ int netif_receive_skb(struct sk_buff *skb); int netif_receive_skb_core(struct sk_buff *skb); void netif_receive_skb_list(struct list_head *head); gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb); +int napi_gro_receive_list(struct napi_struct *napi, struct list_head *head); void napi_gro_flush(struct napi_struct *napi, bool flush_old); struct sk_buff *napi_get_frags(struct napi_struct *napi); +struct sk_buff *napi_frags_skb(struct napi_struct *napi); gro_result_t napi_gro_frags(struct napi_struct *napi); struct packet_offload *gro_find_receive_by_type(__be16 type); struct packet_offload *gro_find_complete_by_type(__be16 type); diff --git a/net/core/dev.c b/net/core/dev.c index 325fc5088370..d1e55bef84eb 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -5596,6 +5596,31 @@ gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb) } EXPORT_SYMBOL(napi_gro_receive); +/* Returns the number of SKBs on the list successfully received */ +int napi_gro_receive_list(struct napi_struct *napi, struct list_head *head) +{ + struct sk_buff *skb, *next; + gro_result_t result; + int kept = 0; + + list_for_each_entry(skb, head, list) { + skb_mark_napi_id(skb, napi); + trace_napi_gro_receive_entry(skb); + skb_gro_reset_offset(skb); + } + + list_for_each_entry_safe(skb, next, head, list) { + list_del(&skb->list); + skb->next = NULL; + result = dev_gro_receive(napi, skb); + result = napi_skb_finish(result, skb); + if (result != GRO_DROP) + kept++; + } + return kept; +} +EXPORT_SYMBOL(napi_gro_receive_list); + static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb) { if (unlikely(skb->pfmemalloc)) { @@ -5667,7 +5692,7 @@ static gro_result_t napi_frags_finish(struct napi_struct *napi, * Drivers could call both napi_gro_frags() and napi_gro_receive() * We copy ethernet header into skb->data to have a common layout. */ -static struct sk_buff *napi_frags_skb(struct napi_struct *napi) +struct sk_buff *napi_frags_skb(struct napi_struct *napi) { struct sk_buff *skb = napi->skb; const struct ethhdr *eth; @@ -5703,6 +5728,7 @@ static struct sk_buff *napi_frags_skb(struct napi_struct *napi) return skb; } +EXPORT_SYMBOL(napi_frags_skb); gro_result_t napi_gro_frags(struct napi_struct *napi) {
Powered by blists - more mailing lists