aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Bohrer <sbohrer@rgmadvisors.com>2013-10-07 12:01:38 -0400
committerDavid S. Miller <davem@davemloft.net>2013-10-08 16:27:33 -0400
commit005ec9743394010cd37d86c3fd2e81978231cdbf (patch)
tree2d551f452fbb3cd1aa0ffb3443abf217dee22549
parent2c8c8e6f9d534a77f97df4d7148561cb902c0f83 (diff)
udp: Only allow busy read/poll on connected sockets
UDP sockets can receive packets from multiple endpoints and thus may be received on multiple receive queues. Since packets packets can arrive on multiple receive queues we should not mark the napi_id for all packets. This makes busy read/poll only work for connected UDP sockets. This additionally enables busy read/poll for UDP multicast packets as long as the socket is connected by moving the check into __udp_queue_rcv_skb(). Signed-off-by: Shawn Bohrer <sbohrer@rgmadvisors.com> Suggested-by: Eric Dumazet <edumazet@google.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv4/udp.c5
-rw-r--r--net/ipv6/udp.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index c41833e9c083..5950e12bd3ab 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1405,8 +1405,10 @@ static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
1405{ 1405{
1406 int rc; 1406 int rc;
1407 1407
1408 if (inet_sk(sk)->inet_daddr) 1408 if (inet_sk(sk)->inet_daddr) {
1409 sock_rps_save_rxhash(sk, skb); 1409 sock_rps_save_rxhash(sk, skb);
1410 sk_mark_napi_id(sk, skb);
1411 }
1410 1412
1411 rc = sock_queue_rcv_skb(sk, skb); 1413 rc = sock_queue_rcv_skb(sk, skb);
1412 if (rc < 0) { 1414 if (rc < 0) {
@@ -1716,7 +1718,6 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
1716 if (sk != NULL) { 1718 if (sk != NULL) {
1717 int ret; 1719 int ret;
1718 1720
1719 sk_mark_napi_id(sk, skb);
1720 ret = udp_queue_rcv_skb(sk, skb); 1721 ret = udp_queue_rcv_skb(sk, skb);
1721 sock_put(sk); 1722 sock_put(sk);
1722 1723
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 8119791e8a95..37532478e3ba 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -549,8 +549,10 @@ static int __udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
549{ 549{
550 int rc; 550 int rc;
551 551
552 if (!ipv6_addr_any(&inet6_sk(sk)->daddr)) 552 if (!ipv6_addr_any(&inet6_sk(sk)->daddr)) {
553 sock_rps_save_rxhash(sk, skb); 553 sock_rps_save_rxhash(sk, skb);
554 sk_mark_napi_id(sk, skb);
555 }
554 556
555 rc = sock_queue_rcv_skb(sk, skb); 557 rc = sock_queue_rcv_skb(sk, skb);
556 if (rc < 0) { 558 if (rc < 0) {
@@ -844,7 +846,6 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
844 if (sk != NULL) { 846 if (sk != NULL) {
845 int ret; 847 int ret;
846 848
847 sk_mark_napi_id(sk, skb);
848 ret = udpv6_queue_rcv_skb(sk, skb); 849 ret = udpv6_queue_rcv_skb(sk, skb);
849 sock_put(sk); 850 sock_put(sk);
850 851