diff options
author | David S. Miller <davem@davemloft.net> | 2015-06-24 12:58:51 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-06-24 12:58:51 +0300 |
commit | 3a07bd6fead4f00f67b1bf5f551e686661c4f52c (patch) | |
tree | f8b8f257d928a9ae1aeb3fdbe748f03f1012f02e /net/packet | |
parent | 204621551b2a0060a013b92f7add4d5c452fa7cb (diff) | |
parent | f1590670ce069eefeb93916391a67643e6ad1630 (diff) | |
download | linux-3a07bd6fead4f00f67b1bf5f551e686661c4f52c.tar.xz |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts:
drivers/net/ethernet/mellanox/mlx4/main.c
net/packet/af_packet.c
Both conflicts were cases of simple overlapping changes.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/packet')
-rw-r--r-- | net/packet/af_packet.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index f5c87031b121..c9e8741226c6 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -1322,16 +1322,6 @@ static void packet_sock_destruct(struct sock *sk) sk_refcnt_debug_dec(sk); } -static int fanout_rr_next(struct packet_fanout *f, unsigned int num) -{ - int x = atomic_read(&f->rr_cur) + 1; - - if (x >= num) - x = 0; - - return x; -} - static bool fanout_flow_is_huge(struct packet_sock *po, struct sk_buff *skb) { u32 rxhash; @@ -1357,13 +1347,9 @@ static unsigned int fanout_demux_lb(struct packet_fanout *f, struct sk_buff *skb, unsigned int num) { - int cur, old; + unsigned int val = atomic_inc_return(&f->rr_cur); - cur = atomic_read(&f->rr_cur); - while ((old = atomic_cmpxchg(&f->rr_cur, cur, - fanout_rr_next(f, num))) != cur) - cur = old; - return cur; + return val % num; } static unsigned int fanout_demux_cpu(struct packet_fanout *f, @@ -1435,7 +1421,7 @@ static int packet_rcv_fanout(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) { struct packet_fanout *f = pt->af_packet_priv; - unsigned int num = f->num_members; + unsigned int num = READ_ONCE(f->num_members); struct packet_sock *po; unsigned int idx; |