diff options
Diffstat (limited to 'include/linux/if_vlan.h')
| -rw-r--r-- | include/linux/if_vlan.h | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 3d870fda8c4f..c2f3a72712ce 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #ifdef __KERNEL__ | 16 | #ifdef __KERNEL__ |
| 17 | #include <linux/netdevice.h> | 17 | #include <linux/netdevice.h> |
| 18 | #include <linux/etherdevice.h> | 18 | #include <linux/etherdevice.h> |
| 19 | #include <linux/rtnetlink.h> | ||
| 19 | 20 | ||
| 20 | #define VLAN_HLEN 4 /* The additional bytes (on top of the Ethernet header) | 21 | #define VLAN_HLEN 4 /* The additional bytes (on top of the Ethernet header) |
| 21 | * that VLAN requires. | 22 | * that VLAN requires. |
| @@ -68,6 +69,7 @@ static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb) | |||
| 68 | #define VLAN_CFI_MASK 0x1000 /* Canonical Format Indicator */ | 69 | #define VLAN_CFI_MASK 0x1000 /* Canonical Format Indicator */ |
| 69 | #define VLAN_TAG_PRESENT VLAN_CFI_MASK | 70 | #define VLAN_TAG_PRESENT VLAN_CFI_MASK |
| 70 | #define VLAN_VID_MASK 0x0fff /* VLAN Identifier */ | 71 | #define VLAN_VID_MASK 0x0fff /* VLAN Identifier */ |
| 72 | #define VLAN_N_VID 4096 | ||
| 71 | 73 | ||
| 72 | /* found in socket.c */ | 74 | /* found in socket.c */ |
| 73 | extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *)); | 75 | extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *)); |
| @@ -76,9 +78,8 @@ extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *)); | |||
| 76 | * depends on completely exhausting the VLAN identifier space. Thus | 78 | * depends on completely exhausting the VLAN identifier space. Thus |
| 77 | * it gives constant time look-up, but in many cases it wastes memory. | 79 | * it gives constant time look-up, but in many cases it wastes memory. |
| 78 | */ | 80 | */ |
| 79 | #define VLAN_GROUP_ARRAY_LEN 4096 | ||
| 80 | #define VLAN_GROUP_ARRAY_SPLIT_PARTS 8 | 81 | #define VLAN_GROUP_ARRAY_SPLIT_PARTS 8 |
| 81 | #define VLAN_GROUP_ARRAY_PART_LEN (VLAN_GROUP_ARRAY_LEN/VLAN_GROUP_ARRAY_SPLIT_PARTS) | 82 | #define VLAN_GROUP_ARRAY_PART_LEN (VLAN_N_VID/VLAN_GROUP_ARRAY_SPLIT_PARTS) |
| 82 | 83 | ||
| 83 | struct vlan_group { | 84 | struct vlan_group { |
| 84 | struct net_device *real_dev; /* The ethernet(like) device | 85 | struct net_device *real_dev; /* The ethernet(like) device |
| @@ -114,12 +115,24 @@ static inline void vlan_group_set_device(struct vlan_group *vg, | |||
| 114 | #define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT) | 115 | #define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT) |
| 115 | 116 | ||
| 116 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) | 117 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) |
| 118 | /* Must be invoked with rcu_read_lock or with RTNL. */ | ||
| 119 | static inline struct net_device *vlan_find_dev(struct net_device *real_dev, | ||
| 120 | u16 vlan_id) | ||
| 121 | { | ||
| 122 | struct vlan_group *grp = rcu_dereference_rtnl(real_dev->vlgrp); | ||
| 123 | |||
| 124 | if (grp) | ||
| 125 | return vlan_group_get_device(grp, vlan_id); | ||
| 126 | |||
| 127 | return NULL; | ||
| 128 | } | ||
| 129 | |||
| 117 | extern struct net_device *vlan_dev_real_dev(const struct net_device *dev); | 130 | extern struct net_device *vlan_dev_real_dev(const struct net_device *dev); |
| 118 | extern u16 vlan_dev_vlan_id(const struct net_device *dev); | 131 | extern u16 vlan_dev_vlan_id(const struct net_device *dev); |
| 119 | 132 | ||
| 120 | extern int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, | 133 | extern int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, |
| 121 | u16 vlan_tci, int polling); | 134 | u16 vlan_tci, int polling); |
| 122 | extern int vlan_hwaccel_do_receive(struct sk_buff *skb); | 135 | extern bool vlan_hwaccel_do_receive(struct sk_buff **skb); |
| 123 | extern gro_result_t | 136 | extern gro_result_t |
| 124 | vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp, | 137 | vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp, |
| 125 | unsigned int vlan_tci, struct sk_buff *skb); | 138 | unsigned int vlan_tci, struct sk_buff *skb); |
| @@ -128,6 +141,12 @@ vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp, | |||
| 128 | unsigned int vlan_tci); | 141 | unsigned int vlan_tci); |
| 129 | 142 | ||
| 130 | #else | 143 | #else |
| 144 | static inline struct net_device *vlan_find_dev(struct net_device *real_dev, | ||
| 145 | u16 vlan_id) | ||
| 146 | { | ||
| 147 | return NULL; | ||
| 148 | } | ||
| 149 | |||
| 131 | static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev) | 150 | static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev) |
| 132 | { | 151 | { |
| 133 | BUG(); | 152 | BUG(); |
| @@ -147,9 +166,11 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, | |||
| 147 | return NET_XMIT_SUCCESS; | 166 | return NET_XMIT_SUCCESS; |
| 148 | } | 167 | } |
| 149 | 168 | ||
| 150 | static inline int vlan_hwaccel_do_receive(struct sk_buff *skb) | 169 | static inline bool vlan_hwaccel_do_receive(struct sk_buff **skb) |
| 151 | { | 170 | { |
| 152 | return 0; | 171 | if ((*skb)->vlan_tci & VLAN_VID_MASK) |
| 172 | (*skb)->pkt_type = PACKET_OTHERHOST; | ||
| 173 | return false; | ||
| 153 | } | 174 | } |
| 154 | 175 | ||
| 155 | static inline gro_result_t | 176 | static inline gro_result_t |
