diff options
Diffstat (limited to 'net/packet/af_packet.c')
-rw-r--r-- | net/packet/af_packet.c | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 8a1605ae4029..226b2cdfc339 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -207,24 +207,6 @@ static void prb_fill_vlan_info(struct tpacket_kbdq_core *, | |||
207 | struct tpacket3_hdr *); | 207 | struct tpacket3_hdr *); |
208 | static void packet_flush_mclist(struct sock *sk); | 208 | static void packet_flush_mclist(struct sock *sk); |
209 | 209 | ||
210 | #define PACKET_FANOUT_MAX 256 | ||
211 | |||
212 | struct packet_fanout { | ||
213 | #ifdef CONFIG_NET_NS | ||
214 | struct net *net; | ||
215 | #endif | ||
216 | unsigned int num_members; | ||
217 | u16 id; | ||
218 | u8 type; | ||
219 | u8 defrag; | ||
220 | atomic_t rr_cur; | ||
221 | struct list_head list; | ||
222 | struct sock *arr[PACKET_FANOUT_MAX]; | ||
223 | spinlock_t lock; | ||
224 | atomic_t sk_ref; | ||
225 | struct packet_type prot_hook ____cacheline_aligned_in_smp; | ||
226 | }; | ||
227 | |||
228 | struct packet_skb_cb { | 210 | struct packet_skb_cb { |
229 | unsigned int origlen; | 211 | unsigned int origlen; |
230 | union { | 212 | union { |
@@ -1148,7 +1130,8 @@ static int packet_rcv_fanout(struct sk_buff *skb, struct net_device *dev, | |||
1148 | return po->prot_hook.func(skb, dev, &po->prot_hook, orig_dev); | 1130 | return po->prot_hook.func(skb, dev, &po->prot_hook, orig_dev); |
1149 | } | 1131 | } |
1150 | 1132 | ||
1151 | static DEFINE_MUTEX(fanout_mutex); | 1133 | DEFINE_MUTEX(fanout_mutex); |
1134 | EXPORT_SYMBOL_GPL(fanout_mutex); | ||
1152 | static LIST_HEAD(fanout_list); | 1135 | static LIST_HEAD(fanout_list); |
1153 | 1136 | ||
1154 | static void __fanout_link(struct sock *sk, struct packet_sock *po) | 1137 | static void __fanout_link(struct sock *sk, struct packet_sock *po) |
@@ -1260,9 +1243,9 @@ static void fanout_release(struct sock *sk) | |||
1260 | if (!f) | 1243 | if (!f) |
1261 | return; | 1244 | return; |
1262 | 1245 | ||
1246 | mutex_lock(&fanout_mutex); | ||
1263 | po->fanout = NULL; | 1247 | po->fanout = NULL; |
1264 | 1248 | ||
1265 | mutex_lock(&fanout_mutex); | ||
1266 | if (atomic_dec_and_test(&f->sk_ref)) { | 1249 | if (atomic_dec_and_test(&f->sk_ref)) { |
1267 | list_del(&f->list); | 1250 | list_del(&f->list); |
1268 | dev_remove_pack(&f->prot_hook); | 1251 | dev_remove_pack(&f->prot_hook); |