aboutsummaryrefslogtreecommitdiffstats
path: root/net/8021q/vlan.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-07-21 11:19:50 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-21 11:19:50 -0400
commiteb6a12c2428d21a9f3e0f1a50e927d5fd80fc3d0 (patch)
tree5ac6f43899648abeab1d43aad3107f664e7f13d5 /net/8021q/vlan.h
parentc4762aba0b1f72659aae9ce37b772ca8bd8f06f4 (diff)
parent14b395e35d1afdd8019d11b92e28041fad591b71 (diff)
Merge branch 'linus' into cpus4096-for-linus
Conflicts: net/sunrpc/svc.c Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'net/8021q/vlan.h')
-rw-r--r--net/8021q/vlan.h86
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 */
13struct 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 */
33struct 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
50static 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 */
21struct net_device *__find_vlan_dev(struct net_device *real_dev, 70struct 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 */
25int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev, 73int 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);
27void vlan_dev_set_ingress_priority(const struct net_device *dev, 75void vlan_dev_set_ingress_priority(const struct net_device *dev,
28 u32 skb_prio, short vlan_prio); 76 u32 skb_prio, u16 vlan_prio);
29int vlan_dev_set_egress_priority(const struct net_device *dev, 77int vlan_dev_set_egress_priority(const struct net_device *dev,
30 u32 skb_prio, short vlan_prio); 78 u32 skb_prio, u16 vlan_prio);
31int vlan_dev_set_vlan_flag(const struct net_device *dev, 79int vlan_dev_change_flags(const struct net_device *dev, u32 flag, u32 mask);
32 u32 flag, short flag_val);
33void vlan_dev_get_realdev_name(const struct net_device *dev, char *result); 80void vlan_dev_get_realdev_name(const struct net_device *dev, char *result);
34void vlan_dev_get_vid(const struct net_device *dev, unsigned short *result);
35 81
36int vlan_check_real_dev(struct net_device *real_dev, unsigned short vlan_id); 82int vlan_check_real_dev(struct net_device *real_dev, u16 vlan_id);
37void vlan_setup(struct net_device *dev); 83void vlan_setup(struct net_device *dev);
38int register_vlan_dev(struct net_device *dev); 84int register_vlan_dev(struct net_device *dev);
39void unregister_vlan_dev(struct net_device *dev); 85void unregister_vlan_dev(struct net_device *dev);
40 86
87static 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
96extern int vlan_gvrp_request_join(const struct net_device *dev);
97extern void vlan_gvrp_request_leave(const struct net_device *dev);
98extern int vlan_gvrp_init_applicant(struct net_device *dev);
99extern void vlan_gvrp_uninit_applicant(struct net_device *dev);
100extern int vlan_gvrp_init(void);
101extern void vlan_gvrp_uninit(void);
102#else
103static inline int vlan_gvrp_request_join(const struct net_device *dev) { return 0; }
104static inline void vlan_gvrp_request_leave(const struct net_device *dev) {}
105static inline int vlan_gvrp_init_applicant(struct net_device *dev) { return 0; }
106static inline void vlan_gvrp_uninit_applicant(struct net_device *dev) {}
107static inline int vlan_gvrp_init(void) { return 0; }
108static inline void vlan_gvrp_uninit(void) {}
109#endif
110
41int vlan_netlink_init(void); 111int vlan_netlink_init(void);
42void vlan_netlink_fini(void); 112void vlan_netlink_fini(void);
43 113