net/flow_dissector: Save vlan ethertype from headers
authorJianbo Liu <jianbol@mellanox.com>
Fri, 6 Jul 2018 05:38:12 +0000 (05:38 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 7 Jul 2018 11:51:53 +0000 (20:51 +0900)
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>
include/net/flow_dissector.h
net/core/flow_dissector.c

index adc24df56b907d4598a1b08d4ab5da01eddc0c85..8f899688a965ebe70a2465482dca1237cd9c21f8 100644 (file)
@@ -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 {
index 53f96e4f7bf593863b584e050eb7628d4023718a..18cb99b50cbac8405f98d93f8d63f949a30fc78b 100644 (file)
@@ -751,6 +751,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;
@@ -789,6 +790,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;