From: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: Jiri Pirko <jiri@mellanox.com>,
Daniel Borkmann <daniel@iogearbox.net>,
Pravin Shelar <pshelar@ovn.org>,
Eric Dumazet <eric.dumazet@gmail.com>,
netdev@vger.kernel.org,
Shmulik Ladkani <shmulik.ladkani@gmail.com>
Subject: [PATCH v3 net-next 2/2] net: skbuff: Coding: Use eth_type_vlan() instead of open coding it
Date: Tue, 20 Sep 2016 12:48:37 +0300 [thread overview]
Message-ID: <1474364917-31710-2-git-send-email-shmulik.ladkani@gmail.com> (raw)
In-Reply-To: <1474364917-31710-1-git-send-email-shmulik.ladkani@gmail.com>
Fix 'skb_vlan_pop' to use eth_type_vlan instead of directly comparing
skb->protocol to ETH_P_8021Q or ETH_P_8021AD.
Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
---
net/core/skbuff.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 93d6c5c..d6d0da5 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -4564,8 +4564,7 @@ int skb_vlan_pop(struct sk_buff *skb)
if (likely(skb_vlan_tag_present(skb))) {
skb->vlan_tci = 0;
} else {
- if (unlikely(skb->protocol != htons(ETH_P_8021Q) &&
- skb->protocol != htons(ETH_P_8021AD)))
+ if (unlikely(!eth_type_vlan(skb->protocol)))
return 0;
err = __skb_vlan_pop(skb, &vlan_tci);
@@ -4573,8 +4572,7 @@ int skb_vlan_pop(struct sk_buff *skb)
return err;
}
/* move next vlan tag to hw accel tag */
- if (likely(skb->protocol != htons(ETH_P_8021Q) &&
- skb->protocol != htons(ETH_P_8021AD)))
+ if (likely(!eth_type_vlan(skb->protocol)))
return 0;
vlan_proto = skb->protocol;
--
1.9.1
next prev parent reply other threads:[~2016-09-20 9:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-20 9:48 [PATCH v3 net-next 1/2] net: skbuff: Remove errornous length validation in skb_vlan_pop() Shmulik Ladkani
2016-09-20 9:48 ` Shmulik Ladkani [this message]
2016-09-20 17:13 ` [PATCH v3 net-next 2/2] net: skbuff: Coding: Use eth_type_vlan() instead of open coding it pravin shelar
2016-09-22 5:36 ` David Miller
2016-09-20 17:12 ` [PATCH v3 net-next 1/2] net: skbuff: Remove errornous length validation in skb_vlan_pop() pravin shelar
2016-09-22 5:36 ` 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=1474364917-31710-2-git-send-email-shmulik.ladkani@gmail.com \
--to=shmulik.ladkani@ravellosystems.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=jiri@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=pshelar@ovn.org \
--cc=shmulik.ladkani@gmail.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).