From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jianbo Liu Subject: [PATCH net-next 1/5] net/flow_dissector: Save vlan ethertype from headers Date: Sat, 30 Jun 2018 09:53:13 +0000 Message-ID: <20180630095317.5691-2-jianbol@mellanox.com> References: <20180630095317.5691-1-jianbol@mellanox.com> Cc: Jianbo Liu , Jiri Pirko , Simon Horman , Jakub Kicinski , Tom Herbert , Paolo Abeni , John Crispin , Sven Eckelmann , WANG Cong , David Ahern , Jon Maloy To: netdev@vger.kernel.org, davem@davemloft.net, jiri@resnulli.us Return-path: Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:36779 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934577AbeF3Jxp (ORCPT ); Sat, 30 Jun 2018 05:53:45 -0400 In-Reply-To: <20180630095317.5691-1-jianbol@mellanox.com> Sender: netdev-owner@vger.kernel.org List-ID: Change vlan dissector key to save vlan tpid to support both 802.1Q and 802.1AD ethertype. Signed-off-by: Jianbo Liu Acked-by: Jiri Pirko --- include/net/flow_dissector.h | 2 +- net/core/flow_dissector.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h index adc24df5..8f89968 100644 --- a/include/net/flow_dissector.h +++ b/include/net/flow_dissector.h @@ -47,7 +47,7 @@ struct flow_dissector_key_tags { struct flow_dissector_key_vlan { u16 vlan_id:12, vlan_priority:3; - u16 padding; + __be16 vlan_tpid; }; struct flow_dissector_key_mpls { diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 4fc1e84..e068ccf 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -751,6 +751,7 @@ bool __skb_flow_dissect(const struct sk_buff *skb, const struct vlan_hdr *vlan; struct vlan_hdr _vlan; bool vlan_tag_present = skb && skb_vlan_tag_present(skb); + __be16 saved_vlan_tpid = proto; if (vlan_tag_present) proto = skb->protocol; @@ -789,6 +790,7 @@ bool __skb_flow_dissect(const struct sk_buff *skb, (ntohs(vlan->h_vlan_TCI) & VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT; } + key_vlan->vlan_tpid = saved_vlan_tpid; } fdret = FLOW_DISSECT_RET_PROTO_AGAIN; -- 2.9.5