[PKT_SCHED]: vlan tag match

Provide a way to use tc filters on vlan tag even if tag is buried in
skb due to hardware acceleration.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by Stephen Hemminger and committed by David S. Miller 3113e88c dded9161

+20 -1
+2 -1
include/linux/pkt_cls.h
··· 459 459 #define TCF_EM_U32 3 460 460 #define TCF_EM_META 4 461 461 #define TCF_EM_TEXT 5 462 - #define TCF_EM_MAX 5 462 + #define TCF_EM_VLAN 6 463 + #define TCF_EM_MAX 6 463 464 464 465 enum 465 466 {
+1
include/linux/tc_ematch/tc_em_meta.h
··· 81 81 TCF_META_ID_SK_SNDTIMEO, 82 82 TCF_META_ID_SK_SENDMSG_OFF, 83 83 TCF_META_ID_SK_WRITE_PENDING, 84 + TCF_META_ID_VLAN_TAG, 84 85 __TCF_META_ID_MAX 85 86 }; 86 87 #define TCF_META_ID_MAX (__TCF_META_ID_MAX - 1)
+17
net/sched/em_meta.c
··· 65 65 #include <linux/string.h> 66 66 #include <linux/skbuff.h> 67 67 #include <linux/random.h> 68 + #include <linux/if_vlan.h> 68 69 #include <linux/tc_ematch/tc_em_meta.h> 69 70 #include <net/dst.h> 70 71 #include <net/route.h> ··· 169 168 { 170 169 *err = var_dev(skb->dev, dst); 171 170 } 171 + 172 + /************************************************************************** 173 + * vlan tag 174 + **************************************************************************/ 175 + 176 + META_COLLECTOR(int_vlan_tag) 177 + { 178 + unsigned short tag; 179 + if (vlan_get_tag(skb, &tag) < 0) 180 + *err = -1; 181 + else 182 + dst->value = tag; 183 + } 184 + 185 + 172 186 173 187 /************************************************************************** 174 188 * skb attributes ··· 536 520 [META_ID(SK_SNDTIMEO)] = META_FUNC(int_sk_sndtimeo), 537 521 [META_ID(SK_SENDMSG_OFF)] = META_FUNC(int_sk_sendmsg_off), 538 522 [META_ID(SK_WRITE_PENDING)] = META_FUNC(int_sk_write_pend), 523 + [META_ID(VLAN_TAG)] = META_FUNC(int_vlan_tag), 539 524 } 540 525 }; 541 526