Blob Blame History Raw
From: Jianbo Liu <jianbol@mellanox.com>
Date: Fri, 6 Jul 2018 05:38:12 +0000
Subject: net/flow_dissector: Save vlan ethertype from headers
Patch-mainline: v4.19-rc1
Git-commit: 2064c3d4c02026572d4975177f28a58052f0a8b7
References: bsc#1109837

Change vlan dissector key to save vlan tpid to support both 802.1Q
and 802.1AD ethertype.

Signed-off-by: Jianbo Liu <jianbol@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
 include/net/flow_dissector.h |    2 +-
 net/core/flow_dissector.c    |    2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

--- a/include/net/flow_dissector.h
+++ b/include/net/flow_dissector.h
@@ -46,7 +46,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 {
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -685,6 +685,7 @@ proto_again:
 		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;
@@ -723,6 +724,7 @@ proto_again:
 					(ntohs(vlan->h_vlan_TCI) &
 					 VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT;
 			}
+			key_vlan->vlan_tpid = saved_vlan_tpid;
 		}
 
 		fdret = FLOW_DISSECT_RET_PROTO_AGAIN;