mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
[NET_SCHED]: cls_flow: support classification based on VLAN tag
Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
181499356e
commit
9ec138101f
2 changed files with 13 additions and 0 deletions
|
@ -348,6 +348,7 @@ enum
|
||||||
FLOW_KEY_RTCLASSID,
|
FLOW_KEY_RTCLASSID,
|
||||||
FLOW_KEY_SKUID,
|
FLOW_KEY_SKUID,
|
||||||
FLOW_KEY_SKGID,
|
FLOW_KEY_SKGID,
|
||||||
|
FLOW_KEY_VLAN_TAG,
|
||||||
__FLOW_KEY_MAX,
|
__FLOW_KEY_MAX,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include <linux/in.h>
|
#include <linux/in.h>
|
||||||
#include <linux/ip.h>
|
#include <linux/ip.h>
|
||||||
#include <linux/ipv6.h>
|
#include <linux/ipv6.h>
|
||||||
|
#include <linux/if_vlan.h>
|
||||||
|
|
||||||
#include <net/pkt_cls.h>
|
#include <net/pkt_cls.h>
|
||||||
#include <net/ip.h>
|
#include <net/ip.h>
|
||||||
|
@ -270,6 +271,15 @@ static u32 flow_get_skgid(const struct sk_buff *skb)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static u32 flow_get_vlan_tag(const struct sk_buff *skb)
|
||||||
|
{
|
||||||
|
u16 uninitialized_var(tag);
|
||||||
|
|
||||||
|
if (vlan_get_tag(skb, &tag) < 0)
|
||||||
|
return 0;
|
||||||
|
return tag & VLAN_VID_MASK;
|
||||||
|
}
|
||||||
|
|
||||||
static u32 flow_key_get(const struct sk_buff *skb, int key)
|
static u32 flow_key_get(const struct sk_buff *skb, int key)
|
||||||
{
|
{
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
@ -305,6 +315,8 @@ static u32 flow_key_get(const struct sk_buff *skb, int key)
|
||||||
return flow_get_skuid(skb);
|
return flow_get_skuid(skb);
|
||||||
case FLOW_KEY_SKGID:
|
case FLOW_KEY_SKGID:
|
||||||
return flow_get_skgid(skb);
|
return flow_get_skgid(skb);
|
||||||
|
case FLOW_KEY_VLAN_TAG:
|
||||||
|
return flow_get_vlan_tag(skb);
|
||||||
default:
|
default:
|
||||||
WARN_ON(1);
|
WARN_ON(1);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue