From: Jiri Benc <jbenc@redhat.com>
To: netdev@vger.kernel.org
Cc: pravin shelar <pshelar@ovn.org>, Eric Garver <e@erig.me>
Subject: [PATCH net-next v2 1/3] openvswitch: normalize vlan rx path
Date: Wed, 5 Oct 2016 15:07:26 +0200 [thread overview]
Message-ID: <c7f44c08104958c86c68d98f1e093d754b0ca61b.1475672569.git.jbenc@redhat.com> (raw)
In-Reply-To: <cover.1475672568.git.jbenc@redhat.com>
Similarly to how the core networking stack behaves, let the first vlan tag
be always stored in skb->vlan_tci. This is already ensured in
__netif_receive_skb_core for packets that were received from the kernel and
honored by skb_vlan_push and skb_vlan_pop. The only remaining place are
packets received from the user space. Just do the same things with vlan
frames as __netif_receive_skb_core does.
Signed-off-by: Jiri Benc <jbenc@redhat.com>
---
net/openvswitch/datapath.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 4d67ea856067..c47b3da8ecf2 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -594,6 +594,16 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
else
packet->protocol = htons(ETH_P_802_2);
+ if (eth_type_vlan(packet->protocol)) {
+ __skb_pull(packet, ETH_HLEN);
+ skb_reset_network_header(packet);
+ skb_reset_mac_len(packet);
+ packet = skb_vlan_untag(packet);
+ if (unlikely(!packet))
+ goto err;
+ skb_push(packet, ETH_HLEN);
+ }
+
/* Set packet's mru */
if (a[OVS_PACKET_ATTR_MRU]) {
mru = nla_get_u16(a[OVS_PACKET_ATTR_MRU]);
--
1.8.3.1
next prev parent reply other threads:[~2016-10-05 13:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-05 13:07 [PATCH net-next v2 0/3] openvswitch: make vlan handling consistent Jiri Benc
2016-10-05 13:07 ` Jiri Benc [this message]
2016-10-05 14:18 ` [PATCH net-next v2 1/3] openvswitch: normalize vlan rx path Eyal Birger
2016-10-05 17:23 ` Jiri Benc
2016-10-05 17:31 ` Eyal Birger
2016-10-05 18:44 ` Eric Garver
2016-10-05 19:07 ` Jiri Benc
2016-10-05 19:21 ` Eric Garver
2016-10-05 21:07 ` Jiri Benc
2016-10-05 13:07 ` [PATCH net-next v2 2/3] openvswitch: remove unreachable code in vlan parsing Jiri Benc
2016-10-06 5:22 ` Pravin Shelar
2016-10-06 9:08 ` Jiri Benc
2016-10-05 13:07 ` [PATCH net-next v2 3/3] openvswitch: fix vlan subtraction from packet length Jiri Benc
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=c7f44c08104958c86c68d98f1e093d754b0ca61b.1475672569.git.jbenc@redhat.com \
--to=jbenc@redhat.com \
--cc=e@erig.me \
--cc=netdev@vger.kernel.org \
--cc=pshelar@ovn.org \
/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).