From: Florian Fainelli <f.fainelli@gmail.com>
To: netdev@vger.kernel.org
Cc: Florian Fainelli <f.fainelli@gmail.com>,
Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
linux-kernel@vger.kernel.org (open list),
vladimir.oltean@nxp.com, olteanv@gmail.com
Subject: [PATCH net-next 3/4] net: dsa: Obtain VLAN protocol from skb->protocol
Date: Thu, 1 Oct 2020 19:42:14 -0700 [thread overview]
Message-ID: <20201002024215.660240-4-f.fainelli@gmail.com> (raw)
In-Reply-To: <20201002024215.660240-1-f.fainelli@gmail.com>
Now that dsa_untag_bridge_pvid() is called after eth_type_trans() we are
guaranteed that skb->protocol will be set to a correct value, thus
allowing us to avoid calling vlan_eth_hdr().
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
net/dsa/dsa_priv.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index 0348dbab4131..d6ce8c2a2590 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -201,7 +201,6 @@ dsa_slave_to_master(const struct net_device *dev)
static inline struct sk_buff *dsa_untag_bridge_pvid(struct sk_buff *skb)
{
struct dsa_port *dp = dsa_slave_to_port(skb->dev);
- struct vlan_ethhdr *hdr = vlan_eth_hdr(skb);
struct net_device *br = dp->bridge_dev;
struct net_device *dev = skb->dev;
struct net_device *upper_dev;
@@ -217,7 +216,7 @@ static inline struct sk_buff *dsa_untag_bridge_pvid(struct sk_buff *skb)
return skb;
/* Move VLAN tag from data to hwaccel */
- if (!skb_vlan_tag_present(skb) && hdr->h_vlan_proto == htons(proto)) {
+ if (!skb_vlan_tag_present(skb) && skb->protocol == htons(proto)) {
skb = skb_vlan_untag(skb);
if (!skb)
return NULL;
--
2.25.1
next prev parent reply other threads:[~2020-10-02 2:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-02 2:42 [PATCH net-next 0/4] net: dsa: Improve dsa_untag_bridge_pvid() Florian Fainelli
2020-10-02 2:42 ` [PATCH net-next 1/4] net: dsa: Call dsa_untag_bridge_pvid() from dsa_switch_rcv() Florian Fainelli
2020-10-02 8:39 ` Vladimir Oltean
2020-10-02 2:42 ` [PATCH net-next 2/4] net: dsa: b53: Set untag_bridge_pvid Florian Fainelli
2020-10-02 8:40 ` Vladimir Oltean
2020-10-02 2:42 ` Florian Fainelli [this message]
2020-10-02 8:41 ` [PATCH net-next 3/4] net: dsa: Obtain VLAN protocol from skb->protocol Vladimir Oltean
2020-10-02 2:42 ` [PATCH net-next 4/4] net: dsa: Utilize __vlan_find_dev_deep_rcu() Florian Fainelli
2020-10-02 8:42 ` Vladimir Oltean
2020-10-02 20:36 ` [PATCH net-next 0/4] net: dsa: Improve dsa_untag_bridge_pvid() David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201002024215.660240-4-f.fainelli@gmail.com \
--to=f.fainelli@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=vivien.didelot@gmail.com \
--cc=vladimir.oltean@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).