From mboxrd@z Thu Jan 1 00:00:00 1970 From: Edward Cree Subject: [PATCH v3 net-next 4/4] net/core: handle GRO_NORMAL skbs as a list in napi_gro_receive_list Date: Wed, 14 Nov 2018 18:10:10 +0000 Message-ID: <730c567e-d669-77eb-b2b8-2889d23eba60@solarflare.com> References: <8e9ea3c4-82e0-a34c-08ea-32a387e4c9e1@solarflare.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Cc: , To: , Return-path: Received: from dispatch1-us1.ppe-hosted.com ([148.163.129.52]:49600 "EHLO dispatch1-us1.ppe-hosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727576AbeKOEOa (ORCPT ); Wed, 14 Nov 2018 23:14:30 -0500 In-Reply-To: <8e9ea3c4-82e0-a34c-08ea-32a387e4c9e1@solarflare.com> Content-Language: en-GB Sender: netdev-owner@vger.kernel.org List-ID: Allows GRO-using drivers to get the benefits of batching for non-GROable traffic. Signed-off-by: Edward Cree --- net/core/dev.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index 35427167f6fb..65bfe28fbc81 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -5664,6 +5664,7 @@ EXPORT_SYMBOL(napi_gro_receive); int napi_gro_receive_list(struct napi_struct *napi, struct list_head *head) { struct sk_buff *skb, *next; + struct list_head sublist; gro_result_t result; int kept = 0; @@ -5673,14 +5674,26 @@ int napi_gro_receive_list(struct napi_struct *napi, struct list_head *head) skb_gro_reset_offset(skb); } + INIT_LIST_HEAD(&sublist); 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++; + if (result == GRO_NORMAL) { + list_add_tail(&skb->list, &sublist); + continue; + } else { + if (!list_empty(&sublist)) { + /* Handle the GRO_NORMAL skbs to prevent OoO */ + kept += netif_receive_skb_list_internal(&sublist); + INIT_LIST_HEAD(&sublist); + } + result = napi_skb_finish(result, skb); + if (result != GRO_DROP) + kept++; + } } + kept += netif_receive_skb_list_internal(&sublist); return kept; } EXPORT_SYMBOL(napi_gro_receive_list);