[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191230143028.27313-21-alobakin@dlink.ru>
Date: Mon, 30 Dec 2019 17:30:28 +0300
From: Alexander Lobakin <alobakin@...nk.ru>
To: "David S. Miller" <davem@...emloft.net>
Cc: Edward Cree <ecree@...arflare.com>, Andrew Lunn <andrew@...n.ch>,
Vivien Didelot <vivien.didelot@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
Hauke Mehrtens <hauke@...ke-m.de>,
Sean Wang <sean.wang@...iatek.com>,
Matthias Brugger <matthias.bgg@...il.com>,
Jiri Pirko <jiri@...lanox.com>,
Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>,
Jakub Kicinski <jakub.kicinski@...ronome.com>,
Alexander Lobakin <alobakin@...nk.ru>,
Taehee Yoo <ap420073@...il.com>,
Stephen Hemminger <stephen@...workplumber.org>,
Stanislav Fomichev <sdf@...gle.com>,
Daniel Borkmann <daniel@...earbox.net>,
Song Liu <songliubraving@...com>,
Matteo Croce <mcroce@...hat.com>,
Jakub Sitnicki <jakub@...udflare.com>,
Paul Blakey <paulb@...lanox.com>,
Yoshiki Komachi <komachi.yoshiki@...il.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org
Subject: [PATCH RFC net-next 20/20] net: core: add (unlikely) DSA support in napi_gro_frags()
Make napi_gro_frags() available for DSA-enabled device drivers by adding
the same condition for them as the one in eth_type_trans().
Signed-off-by: Alexander Lobakin <alobakin@...nk.ru>
---
net/core/dev.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index f1b8afcfbc0f..923b930a4506 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -142,6 +142,7 @@
#include <linux/net_namespace.h>
#include <linux/indirect_call_wrapper.h>
#include <net/devlink.h>
+#include <net/dsa.h>
#include "net-sysfs.h"
@@ -5951,6 +5952,7 @@ static gro_result_t napi_frags_finish(struct napi_struct *napi,
*/
static struct sk_buff *napi_frags_skb(struct napi_struct *napi)
{
+ struct net_device *dev = napi->dev;
struct sk_buff *skb = napi->skb;
const struct ethhdr *eth;
unsigned int hlen = sizeof(*eth);
@@ -5964,7 +5966,7 @@ static struct sk_buff *napi_frags_skb(struct napi_struct *napi)
eth = skb_gro_header_slow(skb, hlen, 0);
if (unlikely(!eth)) {
net_warn_ratelimited("%s: dropping impossible skb from %s\n",
- __func__, napi->dev->name);
+ __func__, dev->name);
napi_reuse_skb(napi, skb);
return NULL;
}
@@ -5978,10 +5980,13 @@ static struct sk_buff *napi_frags_skb(struct napi_struct *napi)
/*
* This works because the only protocols we care about don't require
- * special handling.
+ * special handling... except for DSA.
* We'll fix it up properly in napi_frags_finish()
*/
- skb->protocol = eth->h_proto;
+ if (unlikely(netdev_uses_dsa(dev)) && dsa_can_decode(skb, dev))
+ skb->protocol = htons(ETH_P_XDSA);
+ else
+ skb->protocol = eth->h_proto;
return skb;
}
--
2.24.1
Powered by blists - more mailing lists