diff options
author | David S. Miller <davem@davemloft.net> | 2015-06-24 05:58:51 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-06-24 05:58:51 -0400 |
commit | 3a07bd6fead4f00f67b1bf5f551e686661c4f52c (patch) | |
tree | f8b8f257d928a9ae1aeb3fdbe748f03f1012f02e /net/packet | |
parent | 204621551b2a0060a013b92f7add4d5c452fa7cb (diff) | |
parent | f1590670ce069eefeb93916391a67643e6ad1630 (diff) |
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) | |||
1322 | sk_refcnt_debug_dec(sk); | 1322 | sk_refcnt_debug_dec(sk); |
1323 | } | 1323 | } |
1324 | 1324 | ||
1325 | static int fanout_rr_next(struct packet_fanout *f, unsigned int num) | ||
1326 | { | ||
1327 | int x = atomic_read(&f->rr_cur) + 1; | ||
1328 | |||
1329 | if (x >= num) | ||
1330 | x = 0; | ||
1331 | |||
1332 | return x; | ||
1333 | } | ||
1334 | |||
1335 | static bool fanout_flow_is_huge(struct packet_sock *po, struct sk_buff *skb) | 1325 | static bool fanout_flow_is_huge(struct packet_sock *po, struct sk_buff *skb) |
1336 | { | 1326 | { |
1337 | u32 rxhash; | 1327 | u32 rxhash; |
@@ -1357,13 +1347,9 @@ static unsigned int fanout_demux_lb(struct packet_fanout *f, | |||
1357 | struct sk_buff *skb, | 1347 | struct sk_buff *skb, |
1358 | unsigned int num) | 1348 | unsigned int num) |
1359 | { | 1349 | { |
1360 | int cur, old; | 1350 | unsigned int val = atomic_inc_return(&f->rr_cur); |
1361 | 1351 | ||
1362 | cur = atomic_read(&f->rr_cur); | 1352 | return val % num; |
1363 | while ((old = atomic_cmpxchg(&f->rr_cur, cur, | ||
1364 | fanout_rr_next(f, num))) != cur) | ||
1365 | cur = old; | ||
1366 | return cur; | ||
1367 | } | 1353 | } |
1368 | 1354 | ||
1369 | static unsigned int fanout_demux_cpu(struct packet_fanout *f, | 1355 | 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, | |||
1435 | struct packet_type *pt, struct net_device *orig_dev) | 1421 | struct packet_type *pt, struct net_device *orig_dev) |
1436 | { | 1422 | { |
1437 | struct packet_fanout *f = pt->af_packet_priv; | 1423 | struct packet_fanout *f = pt->af_packet_priv; |
1438 | unsigned int num = f->num_members; | 1424 | unsigned int num = READ_ONCE(f->num_members); |
1439 | struct packet_sock *po; | 1425 | struct packet_sock *po; |
1440 | unsigned int idx; | 1426 | unsigned int idx; |
1441 | 1427 | ||