Thread (14 messages) flat view 14 messages, 6 authors, 2006-08-18
STALE7316d

[PATCH 3/7] [I/OAT] Don't offload copies for loopback traffic

From: Chris Leech <hidden>
Date: 2006-08-16 00:45:59
Also in: lkml
Subsystem: networking [general], networking [tcp], the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Neal Cardwell, Linus Torvalds

Local traffic (loopback) is generally in cache anyway, and the overhead
cost of offloading the copy is worse than just doing it with the CPU.

Signed-off-by: Chris Leech <redacted>
---

 net/ipv4/tcp.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 36f6b64..7971e73 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1107,6 +1107,7 @@ int tcp_recvmsg(struct kiocb *iocb, stru
 	int copied_early = 0;
 	int available = 0;
 	struct sk_buff *skb;
+	struct dst_entry *dst;
 
 	lock_sock(sk);
 
@@ -1136,7 +1137,8 @@ int tcp_recvmsg(struct kiocb *iocb, stru
 	skb = skb_peek_tail(&sk->sk_receive_queue);
 	if (skb)
 		available = TCP_SKB_CB(skb)->seq + skb->len - (*seq);
-	if ((available < target) &&
+	dst = __sk_dst_get(sk);
+	if ((available < target) && (!dst || (dst->dev != &loopback_dev)) &&
 	    (len > sysctl_tcp_dma_copybreak) && !(flags & MSG_PEEK) &&
 	    !sysctl_tcp_low_latency && __get_cpu_var(softnet_data).net_dma) {
 		preempt_enable_no_resched();
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help