aboutsummaryrefslogtreecommitdiffstats
path: root/net/packet/af_packet.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/packet/af_packet.c')
-rw-r--r--net/packet/af_packet.c23
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 *);
208static void packet_flush_mclist(struct sock *sk); 208static void packet_flush_mclist(struct sock *sk);
209 209
210#define PACKET_FANOUT_MAX 256
211
212struct 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
228struct packet_skb_cb { 210struct 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
1151static DEFINE_MUTEX(fanout_mutex); 1133DEFINE_MUTEX(fanout_mutex);
1134EXPORT_SYMBOL_GPL(fanout_mutex);
1152static LIST_HEAD(fanout_list); 1135static LIST_HEAD(fanout_list);
1153 1136
1154static void __fanout_link(struct sock *sk, struct packet_sock *po) 1137static 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);