aboutsummaryrefslogtreecommitdiffstats
path: root/net/packet
diff options
context:
space:
mode:
Diffstat (limited to 'net/packet')
-rw-r--r--net/packet/af_packet.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 131545a06f05..fe1610ddeacf 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -1272,16 +1272,6 @@ static void packet_sock_destruct(struct sock *sk)
1272 sk_refcnt_debug_dec(sk); 1272 sk_refcnt_debug_dec(sk);
1273} 1273}
1274 1274
1275static int fanout_rr_next(struct packet_fanout *f, unsigned int num)
1276{
1277 int x = atomic_read(&f->rr_cur) + 1;
1278
1279 if (x >= num)
1280 x = 0;
1281
1282 return x;
1283}
1284
1285static unsigned int fanout_demux_hash(struct packet_fanout *f, 1275static unsigned int fanout_demux_hash(struct packet_fanout *f,
1286 struct sk_buff *skb, 1276 struct sk_buff *skb,
1287 unsigned int num) 1277 unsigned int num)
@@ -1293,13 +1283,9 @@ static unsigned int fanout_demux_lb(struct packet_fanout *f,
1293 struct sk_buff *skb, 1283 struct sk_buff *skb,
1294 unsigned int num) 1284 unsigned int num)
1295{ 1285{
1296 int cur, old; 1286 unsigned int val = atomic_inc_return(&f->rr_cur);
1297 1287
1298 cur = atomic_read(&f->rr_cur); 1288 return val % num;
1299 while ((old = atomic_cmpxchg(&f->rr_cur, cur,
1300 fanout_rr_next(f, num))) != cur)
1301 cur = old;
1302 return cur;
1303} 1289}
1304 1290
1305static unsigned int fanout_demux_cpu(struct packet_fanout *f, 1291static unsigned int fanout_demux_cpu(struct packet_fanout *f,