aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2008-02-05 06:20:13 -0500
committerDavid S. Miller <davem@davemloft.net>2008-02-05 06:20:13 -0500
commit3113e88c3cb3c0a22920b621f8e4d1f2ccc07f1e (patch)
tree241192a6492a5254cd1a2fb8fff8e87969ef0420
parentdded91611a728d65721cdab3dd41d801a356fa15 (diff)
[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>
-rw-r--r--include/linux/pkt_cls.h3
-rw-r--r--include/linux/tc_ematch/tc_em_meta.h1
-rw-r--r--net/sched/em_meta.c17
3 files changed, 20 insertions, 1 deletions
diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h
index 1c1dba9ea5fb..40fac8c4559d 100644
--- a/include/linux/pkt_cls.h
+++ b/include/linux/pkt_cls.h
@@ -459,7 +459,8 @@ enum
459#define TCF_EM_U32 3 459#define TCF_EM_U32 3
460#define TCF_EM_META 4 460#define TCF_EM_META 4
461#define TCF_EM_TEXT 5 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
464enum 465enum
465{ 466{
diff --git a/include/linux/tc_ematch/tc_em_meta.h b/include/linux/tc_ematch/tc_em_meta.h
index e21937cf91d0..c50d2ba5caf0 100644
--- a/include/linux/tc_ematch/tc_em_meta.h
+++ b/include/linux/tc_ematch/tc_em_meta.h
@@ -81,6 +81,7 @@ enum
81 TCF_META_ID_SK_SNDTIMEO, 81 TCF_META_ID_SK_SNDTIMEO,
82 TCF_META_ID_SK_SENDMSG_OFF, 82 TCF_META_ID_SK_SENDMSG_OFF,
83 TCF_META_ID_SK_WRITE_PENDING, 83 TCF_META_ID_SK_WRITE_PENDING,
84 TCF_META_ID_VLAN_TAG,
84 __TCF_META_ID_MAX 85 __TCF_META_ID_MAX
85}; 86};
86#define TCF_META_ID_MAX (__TCF_META_ID_MAX - 1) 87#define TCF_META_ID_MAX (__TCF_META_ID_MAX - 1)
diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c
index a1e5619b1876..9c2ec1992a2a 100644
--- a/net/sched/em_meta.c
+++ b/net/sched/em_meta.c
@@ -65,6 +65,7 @@
65#include <linux/string.h> 65#include <linux/string.h>
66#include <linux/skbuff.h> 66#include <linux/skbuff.h>
67#include <linux/random.h> 67#include <linux/random.h>
68#include <linux/if_vlan.h>
68#include <linux/tc_ematch/tc_em_meta.h> 69#include <linux/tc_ematch/tc_em_meta.h>
69#include <net/dst.h> 70#include <net/dst.h>
70#include <net/route.h> 71#include <net/route.h>
@@ -170,6 +171,21 @@ META_COLLECTOR(var_dev)
170} 171}
171 172
172/************************************************************************** 173/**************************************************************************
174 * vlan tag
175 **************************************************************************/
176
177META_COLLECTOR(int_vlan_tag)
178{
179 unsigned short tag;
180 if (vlan_get_tag(skb, &tag) < 0)
181 *err = -1;
182 else
183 dst->value = tag;
184}
185
186
187
188/**************************************************************************
173 * skb attributes 189 * skb attributes
174 **************************************************************************/ 190 **************************************************************************/
175 191
@@ -520,6 +536,7 @@ static struct meta_ops __meta_ops[TCF_META_TYPE_MAX+1][TCF_META_ID_MAX+1] = {
520 [META_ID(SK_SNDTIMEO)] = META_FUNC(int_sk_sndtimeo), 536 [META_ID(SK_SNDTIMEO)] = META_FUNC(int_sk_sndtimeo),
521 [META_ID(SK_SENDMSG_OFF)] = META_FUNC(int_sk_sendmsg_off), 537 [META_ID(SK_SENDMSG_OFF)] = META_FUNC(int_sk_sendmsg_off),
522 [META_ID(SK_WRITE_PENDING)] = META_FUNC(int_sk_write_pend), 538 [META_ID(SK_WRITE_PENDING)] = META_FUNC(int_sk_write_pend),
539 [META_ID(VLAN_TAG)] = META_FUNC(int_vlan_tag),
523 } 540 }
524}; 541};
525 542