@@ -72,6 +72,7 @@ struct fl_flow_key {
72
72
} tp_range ;
73
73
struct flow_dissector_key_ct ct ;
74
74
struct flow_dissector_key_hash hash ;
75
+ struct flow_dissector_key_num_of_vlans num_of_vlans ;
75
76
} __aligned (BITS_PER_LONG / 8 ); /* Ensure that we can do comparisons as longs. */
76
77
77
78
struct fl_flow_mask_range {
@@ -712,6 +713,7 @@ static const struct nla_policy fl_policy[TCA_FLOWER_MAX + 1] = {
712
713
[TCA_FLOWER_FLAGS ] = { .type = NLA_U32 },
713
714
[TCA_FLOWER_KEY_HASH ] = { .type = NLA_U32 },
714
715
[TCA_FLOWER_KEY_HASH_MASK ] = { .type = NLA_U32 },
716
+ [TCA_FLOWER_KEY_NUM_OF_VLANS ] = { .type = NLA_U8 },
715
717
716
718
};
717
719
@@ -1615,6 +1617,11 @@ static int fl_set_key(struct net *net, struct nlattr **tb,
1615
1617
fl_set_key_val (tb , key -> eth .src , TCA_FLOWER_KEY_ETH_SRC ,
1616
1618
mask -> eth .src , TCA_FLOWER_KEY_ETH_SRC_MASK ,
1617
1619
sizeof (key -> eth .src ));
1620
+ fl_set_key_val (tb , & key -> num_of_vlans ,
1621
+ TCA_FLOWER_KEY_NUM_OF_VLANS ,
1622
+ & mask -> num_of_vlans ,
1623
+ TCA_FLOWER_UNSPEC ,
1624
+ sizeof (key -> num_of_vlans ));
1618
1625
1619
1626
if (is_vlan_key (tb [TCA_FLOWER_KEY_ETH_TYPE ], & ethertype , key , mask )) {
1620
1627
fl_set_key_vlan (tb , ethertype , TCA_FLOWER_KEY_VLAN_ID ,
@@ -1906,6 +1913,8 @@ static void fl_init_dissector(struct flow_dissector *dissector,
1906
1913
FLOW_DISSECTOR_KEY_CT , ct );
1907
1914
FL_KEY_SET_IF_MASKED (mask , keys , cnt ,
1908
1915
FLOW_DISSECTOR_KEY_HASH , hash );
1916
+ FL_KEY_SET_IF_MASKED (mask , keys , cnt ,
1917
+ FLOW_DISSECTOR_KEY_NUM_OF_VLANS , num_of_vlans );
1909
1918
1910
1919
skb_flow_dissector_init (dissector , keys , cnt );
1911
1920
}
@@ -2994,6 +3003,11 @@ static int fl_dump_key(struct sk_buff *skb, struct net *net,
2994
3003
sizeof (key -> basic .n_proto )))
2995
3004
goto nla_put_failure ;
2996
3005
3006
+ if (mask -> num_of_vlans .num_of_vlans ) {
3007
+ if (nla_put_u8 (skb , TCA_FLOWER_KEY_NUM_OF_VLANS , key -> num_of_vlans .num_of_vlans ))
3008
+ goto nla_put_failure ;
3009
+ }
3010
+
2997
3011
if (fl_dump_key_mpls (skb , & key -> mpls , & mask -> mpls ))
2998
3012
goto nla_put_failure ;
2999
3013
0 commit comments