diff options
Diffstat (limited to 'net/8021q/vlan.h')
-rw-r--r-- | net/8021q/vlan.h | 86 |
1 files changed, 78 insertions, 8 deletions
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h index 5229a72c7ea1..a6603a4d917f 100644 --- a/net/8021q/vlan.h +++ b/net/8021q/vlan.h | |||
@@ -3,6 +3,55 @@ | |||
3 | 3 | ||
4 | #include <linux/if_vlan.h> | 4 | #include <linux/if_vlan.h> |
5 | 5 | ||
6 | |||
7 | /** | ||
8 | * struct vlan_priority_tci_mapping - vlan egress priority mappings | ||
9 | * @priority: skb priority | ||
10 | * @vlan_qos: vlan priority: (skb->priority << 13) & 0xE000 | ||
11 | * @next: pointer to next struct | ||
12 | */ | ||
13 | struct vlan_priority_tci_mapping { | ||
14 | u32 priority; | ||
15 | u16 vlan_qos; | ||
16 | struct vlan_priority_tci_mapping *next; | ||
17 | }; | ||
18 | |||
19 | /** | ||
20 | * struct vlan_dev_info - VLAN private device data | ||
21 | * @nr_ingress_mappings: number of ingress priority mappings | ||
22 | * @ingress_priority_map: ingress priority mappings | ||
23 | * @nr_egress_mappings: number of egress priority mappings | ||
24 | * @egress_priority_map: hash of egress priority mappings | ||
25 | * @vlan_id: VLAN identifier | ||
26 | * @flags: device flags | ||
27 | * @real_dev: underlying netdevice | ||
28 | * @real_dev_addr: address of underlying netdevice | ||
29 | * @dent: proc dir entry | ||
30 | * @cnt_inc_headroom_on_tx: statistic - number of skb expansions on TX | ||
31 | * @cnt_encap_on_xmit: statistic - number of skb encapsulations on TX | ||
32 | */ | ||
33 | struct vlan_dev_info { | ||
34 | unsigned int nr_ingress_mappings; | ||
35 | u32 ingress_priority_map[8]; | ||
36 | unsigned int nr_egress_mappings; | ||
37 | struct vlan_priority_tci_mapping *egress_priority_map[16]; | ||
38 | |||
39 | u16 vlan_id; | ||
40 | u16 flags; | ||
41 | |||
42 | struct net_device *real_dev; | ||
43 | unsigned char real_dev_addr[ETH_ALEN]; | ||
44 | |||
45 | struct proc_dir_entry *dent; | ||
46 | unsigned long cnt_inc_headroom_on_tx; | ||
47 | unsigned long cnt_encap_on_xmit; | ||
48 | }; | ||
49 | |||
50 | static inline struct vlan_dev_info *vlan_dev_info(const struct net_device *dev) | ||
51 | { | ||
52 | return netdev_priv(dev); | ||
53 | } | ||
54 | |||
6 | #define VLAN_GRP_HASH_SHIFT 5 | 55 | #define VLAN_GRP_HASH_SHIFT 5 |
7 | #define VLAN_GRP_HASH_SIZE (1 << VLAN_GRP_HASH_SHIFT) | 56 | #define VLAN_GRP_HASH_SIZE (1 << VLAN_GRP_HASH_SHIFT) |
8 | #define VLAN_GRP_HASH_MASK (VLAN_GRP_HASH_SIZE - 1) | 57 | #define VLAN_GRP_HASH_MASK (VLAN_GRP_HASH_SIZE - 1) |
@@ -18,26 +67,47 @@ | |||
18 | * Must be invoked with rcu_read_lock (ie preempt disabled) | 67 | * Must be invoked with rcu_read_lock (ie preempt disabled) |
19 | * or with RTNL. | 68 | * or with RTNL. |
20 | */ | 69 | */ |
21 | struct net_device *__find_vlan_dev(struct net_device *real_dev, | 70 | struct net_device *__find_vlan_dev(struct net_device *real_dev, u16 vlan_id); |
22 | unsigned short VID); /* vlan.c */ | ||
23 | 71 | ||
24 | /* found in vlan_dev.c */ | 72 | /* found in vlan_dev.c */ |
25 | int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev, | 73 | int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev, |
26 | struct packet_type *ptype, struct net_device *orig_dev); | 74 | struct packet_type *ptype, struct net_device *orig_dev); |
27 | void vlan_dev_set_ingress_priority(const struct net_device *dev, | 75 | void vlan_dev_set_ingress_priority(const struct net_device *dev, |
28 | u32 skb_prio, short vlan_prio); | 76 | u32 skb_prio, u16 vlan_prio); |
29 | int vlan_dev_set_egress_priority(const struct net_device *dev, | 77 | int vlan_dev_set_egress_priority(const struct net_device *dev, |
30 | u32 skb_prio, short vlan_prio); | 78 | u32 skb_prio, u16 vlan_prio); |
31 | int vlan_dev_set_vlan_flag(const struct net_device *dev, | 79 | int vlan_dev_change_flags(const struct net_device *dev, u32 flag, u32 mask); |
32 | u32 flag, short flag_val); | ||
33 | void vlan_dev_get_realdev_name(const struct net_device *dev, char *result); | 80 | void vlan_dev_get_realdev_name(const struct net_device *dev, char *result); |
34 | void vlan_dev_get_vid(const struct net_device *dev, unsigned short *result); | ||
35 | 81 | ||
36 | int vlan_check_real_dev(struct net_device *real_dev, unsigned short vlan_id); | 82 | int vlan_check_real_dev(struct net_device *real_dev, u16 vlan_id); |
37 | void vlan_setup(struct net_device *dev); | 83 | void vlan_setup(struct net_device *dev); |
38 | int register_vlan_dev(struct net_device *dev); | 84 | int register_vlan_dev(struct net_device *dev); |
39 | void unregister_vlan_dev(struct net_device *dev); | 85 | void unregister_vlan_dev(struct net_device *dev); |
40 | 86 | ||
87 | static inline u32 vlan_get_ingress_priority(struct net_device *dev, | ||
88 | u16 vlan_tci) | ||
89 | { | ||
90 | struct vlan_dev_info *vip = vlan_dev_info(dev); | ||
91 | |||
92 | return vip->ingress_priority_map[(vlan_tci >> 13) & 0x7]; | ||
93 | } | ||
94 | |||
95 | #ifdef CONFIG_VLAN_8021Q_GVRP | ||
96 | extern int vlan_gvrp_request_join(const struct net_device *dev); | ||
97 | extern void vlan_gvrp_request_leave(const struct net_device *dev); | ||
98 | extern int vlan_gvrp_init_applicant(struct net_device *dev); | ||
99 | extern void vlan_gvrp_uninit_applicant(struct net_device *dev); | ||
100 | extern int vlan_gvrp_init(void); | ||
101 | extern void vlan_gvrp_uninit(void); | ||
102 | #else | ||
103 | static inline int vlan_gvrp_request_join(const struct net_device *dev) { return 0; } | ||
104 | static inline void vlan_gvrp_request_leave(const struct net_device *dev) {} | ||
105 | static inline int vlan_gvrp_init_applicant(struct net_device *dev) { return 0; } | ||
106 | static inline void vlan_gvrp_uninit_applicant(struct net_device *dev) {} | ||
107 | static inline int vlan_gvrp_init(void) { return 0; } | ||
108 | static inline void vlan_gvrp_uninit(void) {} | ||
109 | #endif | ||
110 | |||
41 | int vlan_netlink_init(void); | 111 | int vlan_netlink_init(void); |
42 | void vlan_netlink_fini(void); | 112 | void vlan_netlink_fini(void); |
43 | 113 | ||