aboutsummaryrefslogtreecommitdiffstats
path: root/net/packet/af_packet.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-08-22 17:21:38 -0400
committerDavid S. Miller <davem@davemloft.net>2012-08-22 17:21:38 -0400
commit1304a7343b30fc4f16045412efdbb4179a3d9255 (patch)
tree83d667ac4f62e30f70305ce4cc7e030e3465f92e /net/packet/af_packet.c
parent1d76efe1577b4323609b1bcbfafa8b731eda071a (diff)
parent23dcfa61bac244e1200ff9ad19c6e9144dcb6bb5 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'net/packet/af_packet.c')
-rw-r--r--net/packet/af_packet.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 226b2cdfc339..fe0912f161ce 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -966,7 +966,7 @@ static void *packet_current_rx_frame(struct packet_sock *po,
966 default: 966 default:
967 WARN(1, "TPACKET version not supported\n"); 967 WARN(1, "TPACKET version not supported\n");
968 BUG(); 968 BUG();
969 return 0; 969 return NULL;
970 } 970 }
971} 971}
972 972
@@ -1161,6 +1161,14 @@ static void __fanout_unlink(struct sock *sk, struct packet_sock *po)
1161 spin_unlock(&f->lock); 1161 spin_unlock(&f->lock);
1162} 1162}
1163 1163
1164bool match_fanout_group(struct packet_type *ptype, struct sock * sk)
1165{
1166 if (ptype->af_packet_priv == (void*)((struct packet_sock *)sk)->fanout)
1167 return true;
1168
1169 return false;
1170}
1171
1164static int fanout_add(struct sock *sk, u16 id, u16 type_flags) 1172static int fanout_add(struct sock *sk, u16 id, u16 type_flags)
1165{ 1173{
1166 struct packet_sock *po = pkt_sk(sk); 1174 struct packet_sock *po = pkt_sk(sk);
@@ -1213,6 +1221,7 @@ static int fanout_add(struct sock *sk, u16 id, u16 type_flags)
1213 match->prot_hook.dev = po->prot_hook.dev; 1221 match->prot_hook.dev = po->prot_hook.dev;
1214 match->prot_hook.func = packet_rcv_fanout; 1222 match->prot_hook.func = packet_rcv_fanout;
1215 match->prot_hook.af_packet_priv = match; 1223 match->prot_hook.af_packet_priv = match;
1224 match->prot_hook.id_match = match_fanout_group;
1216 dev_add_pack(&match->prot_hook); 1225 dev_add_pack(&match->prot_hook);
1217 list_add(&match->list, &fanout_list); 1226 list_add(&match->list, &fanout_list);
1218 } 1227 }
@@ -1824,7 +1833,6 @@ static void tpacket_destruct_skb(struct sk_buff *skb)
1824 1833
1825 if (likely(po->tx_ring.pg_vec)) { 1834 if (likely(po->tx_ring.pg_vec)) {
1826 ph = skb_shinfo(skb)->destructor_arg; 1835 ph = skb_shinfo(skb)->destructor_arg;
1827 BUG_ON(__packet_get_status(po, ph) != TP_STATUS_SENDING);
1828 BUG_ON(atomic_read(&po->tx_ring.pending) == 0); 1836 BUG_ON(atomic_read(&po->tx_ring.pending) == 0);
1829 atomic_dec(&po->tx_ring.pending); 1837 atomic_dec(&po->tx_ring.pending);
1830 __packet_set_status(po, ph, TP_STATUS_AVAILABLE); 1838 __packet_set_status(po, ph, TP_STATUS_AVAILABLE);