diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-03-04 16:16:49 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-03-04 16:16:49 -0500 |
commit | 6d04e3b04b6ab569cabeb5ca28ad1be11777e895 (patch) | |
tree | aaee636d71492f36fdef9977488c85a64063f8c4 /include/linux | |
parent | 42270035c6550101f7dc742a630c2590dd2d3ae0 (diff) | |
parent | 5c15bdec5c38f4ccf73ef2585fc80a6164de9554 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6:
[VLAN]: Avoid a 4-order allocation.
[HDLC] Fix dev->header_cache_update having a random value.
[NetLabel]: Verify sensitivity level has a valid CIPSO mapping
[PPPOE]: Key connections properly on local device.
[AF_UNIX]: Test against sk_max_ack_backlog properly.
[NET]: Fix bugs in "Whether sock accept queue is full" checking
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/if_vlan.h | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 35cb38573583..d103580c72d2 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h | |||
@@ -70,15 +70,34 @@ extern void vlan_ioctl_set(int (*hook)(void __user *)); | |||
70 | * depends on completely exhausting the VLAN identifier space. Thus | 70 | * depends on completely exhausting the VLAN identifier space. Thus |
71 | * it gives constant time look-up, but in many cases it wastes memory. | 71 | * it gives constant time look-up, but in many cases it wastes memory. |
72 | */ | 72 | */ |
73 | #define VLAN_GROUP_ARRAY_LEN 4096 | 73 | #define VLAN_GROUP_ARRAY_LEN 4096 |
74 | #define VLAN_GROUP_ARRAY_SPLIT_PARTS 8 | ||
75 | #define VLAN_GROUP_ARRAY_PART_LEN (VLAN_GROUP_ARRAY_LEN/VLAN_GROUP_ARRAY_SPLIT_PARTS) | ||
74 | 76 | ||
75 | struct vlan_group { | 77 | struct vlan_group { |
76 | int real_dev_ifindex; /* The ifindex of the ethernet(like) device the vlan is attached to. */ | 78 | int real_dev_ifindex; /* The ifindex of the ethernet(like) device the vlan is attached to. */ |
77 | struct hlist_node hlist; /* linked list */ | 79 | struct hlist_node hlist; /* linked list */ |
78 | struct net_device *vlan_devices[VLAN_GROUP_ARRAY_LEN]; | 80 | struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS]; |
79 | struct rcu_head rcu; | 81 | struct rcu_head rcu; |
80 | }; | 82 | }; |
81 | 83 | ||
84 | static inline struct net_device *vlan_group_get_device(struct vlan_group *vg, int vlan_id) | ||
85 | { | ||
86 | struct net_device **array; | ||
87 | array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN]; | ||
88 | return array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN]; | ||
89 | } | ||
90 | |||
91 | static inline void vlan_group_set_device(struct vlan_group *vg, int vlan_id, | ||
92 | struct net_device *dev) | ||
93 | { | ||
94 | struct net_device **array; | ||
95 | if (!vg) | ||
96 | return; | ||
97 | array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN]; | ||
98 | array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] = dev; | ||
99 | } | ||
100 | |||
82 | struct vlan_priority_tci_mapping { | 101 | struct vlan_priority_tci_mapping { |
83 | unsigned long priority; | 102 | unsigned long priority; |
84 | unsigned short vlan_qos; /* This should be shifted when first set, so we only do it | 103 | unsigned short vlan_qos; /* This should be shifted when first set, so we only do it |
@@ -160,7 +179,7 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb, | |||
160 | return NET_RX_DROP; | 179 | return NET_RX_DROP; |
161 | } | 180 | } |
162 | 181 | ||
163 | skb->dev = grp->vlan_devices[vlan_tag & VLAN_VID_MASK]; | 182 | skb->dev = vlan_group_get_device(grp, vlan_tag & VLAN_VID_MASK); |
164 | if (skb->dev == NULL) { | 183 | if (skb->dev == NULL) { |
165 | dev_kfree_skb_any(skb); | 184 | dev_kfree_skb_any(skb); |
166 | 185 | ||