netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Disable TSO for non standard qdiscs
@ 2008-01-31 12:46 Andi Kleen
  2008-01-31 17:23 ` Stephen Hemminger
  2008-01-31 18:26 ` Rick Jones
  0 siblings, 2 replies; 50+ messages in thread
From: Andi Kleen @ 2008-01-31 12:46 UTC (permalink / raw)
  To: netdev, davem


TSO interacts badly with many queueing disciplines because they rely on 
reordering packets from different streams and the large TSO packets can 
make this difficult. This patch disables TSO for sockets that send over 
devices with non standard queueing disciplines. That's anything but noop 
or pfifo_fast and pfifo right now.

Longer term other queueing disciplines could be checked if they
are also ok with TSO. If yes they can set the TCQ_F_GSO_OK flag too.

It is still enabled for the standard pfifo_fast because that will never
reorder packets with the same type-of-service. This means 99+% of all users
will still be able to use TSO just fine.

The status is only set up at socket creation so a shifted route
will not reenable TSO on a existing socket. I don't think that's a 
problem though.

Signed-off-by: Andi Kleen <ak@suse.de>

---
 include/net/sch_generic.h |    1 +
 net/core/sock.c           |    3 +++
 net/sched/sch_generic.c   |    5 +++--
 3 files changed, 7 insertions(+), 2 deletions(-)

Index: linux/include/net/sch_generic.h
===================================================================
--- linux.orig/include/net/sch_generic.h
+++ linux/include/net/sch_generic.h
@@ -31,6 +31,7 @@ struct Qdisc
 #define TCQ_F_BUILTIN	1
 #define TCQ_F_THROTTLED	2
 #define TCQ_F_INGRESS	4
+#define TCQ_F_GSO_OK	8
 	int			padded;
 	struct Qdisc_ops	*ops;
 	u32			handle;
Index: linux/net/sched/sch_generic.c
===================================================================
--- linux.orig/net/sched/sch_generic.c
+++ linux/net/sched/sch_generic.c
@@ -307,7 +307,7 @@ struct Qdisc_ops noop_qdisc_ops __read_m
 struct Qdisc noop_qdisc = {
 	.enqueue	=	noop_enqueue,
 	.dequeue	=	noop_dequeue,
-	.flags		=	TCQ_F_BUILTIN,
+	.flags		=	TCQ_F_BUILTIN | TCQ_F_GSO_OK,
 	.ops		=	&noop_qdisc_ops,
 	.list		=	LIST_HEAD_INIT(noop_qdisc.list),
 };
@@ -325,7 +325,7 @@ static struct Qdisc_ops noqueue_qdisc_op
 static struct Qdisc noqueue_qdisc = {
 	.enqueue	=	NULL,
 	.dequeue	=	noop_dequeue,
-	.flags		=	TCQ_F_BUILTIN,
+	.flags		=	TCQ_F_BUILTIN | TCQ_F_GSO_OK,
 	.ops		=	&noqueue_qdisc_ops,
 	.list		=	LIST_HEAD_INIT(noqueue_qdisc.list),
 };
@@ -538,6 +538,7 @@ void dev_activate(struct net_device *dev
 				printk(KERN_INFO "%s: activation failed\n", dev->name);
 				return;
 			}
+			qdisc->flags |= TCQ_F_GSO_OK;
 			list_add_tail(&qdisc->list, &dev->qdisc_list);
 		} else {
 			qdisc =  &noqueue_qdisc;
Index: linux/net/core/sock.c
===================================================================
--- linux.orig/net/core/sock.c
+++ linux/net/core/sock.c
@@ -112,6 +112,7 @@
 #include <linux/tcp.h>
 #include <linux/init.h>
 #include <linux/highmem.h>
+#include <net/sch_generic.h>
 
 #include <asm/uaccess.h>
 #include <asm/system.h>
@@ -1062,6 +1063,8 @@ void sk_setup_caps(struct sock *sk, stru
 {
 	__sk_dst_set(sk, dst);
 	sk->sk_route_caps = dst->dev->features;
+	if (!(dst->dev->qdisc->flags & TCQ_F_GSO_OK))
+		sk->sk_route_caps &= ~NETIF_F_GSO_MASK;
 	if (sk->sk_route_caps & NETIF_F_GSO)
 		sk->sk_route_caps |= NETIF_F_GSO_SOFTWARE;
 	if (sk_can_gso(sk)) {
Index: linux/net/sched/sch_fifo.c
===================================================================
--- linux.orig/net/sched/sch_fifo.c
+++ linux/net/sched/sch_fifo.c
@@ -62,6 +62,7 @@ static int fifo_init(struct Qdisc *sch, 
 
 		q->limit = ctl->limit;
 	}
+	sch->flags |= TCQ_F_GSO_OK;
 
 	return 0;
 }

^ permalink raw reply	[flat|nested] 50+ messages in thread

end of thread, other threads:[~2008-02-03  9:00 UTC | newest]

Thread overview: 50+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-31 12:46 [PATCH] Disable TSO for non standard qdiscs Andi Kleen
2008-01-31 17:23 ` Stephen Hemminger
2008-01-31 18:33   ` Andi Kleen
2008-01-31 18:01     ` Patrick McHardy
2008-01-31 18:37       ` Andi Kleen
2008-01-31 18:08         ` Stephen Hemminger
2008-01-31 18:11           ` Patrick McHardy
2008-01-31 18:53           ` Andi Kleen
2008-01-31 18:21             ` Patrick McHardy
2008-01-31 19:01               ` Andi Kleen
2008-01-31 18:47                 ` Waskiewicz Jr, Peter P
2008-01-31 19:34                   ` Andi Kleen
2008-01-31 19:39                     ` Waskiewicz Jr, Peter P
2008-01-31 23:10                       ` Arnaldo Carvalho de Melo
2008-01-31 23:42                         ` Waskiewicz Jr, Peter P
2008-02-01  4:26                           ` Patrick McHardy
2008-02-01  4:35                           ` Andi Kleen
2008-02-01  4:36                         ` Andi Kleen
2008-01-31 20:33                     ` Jarek Poplawski
2008-01-31 23:04                       ` Jarek Poplawski
2008-02-01  7:42                         ` Jarek Poplawski
2008-02-01  9:28                           ` Waskiewicz Jr, Peter P
2008-02-01 21:47                             ` Jarek Poplawski
2008-02-01  5:01                       ` Andi Kleen
2008-02-01  6:35                     ` Glen Turner
2008-02-01  6:46                       ` Patrick McHardy
2008-02-01  7:46                       ` Andi Kleen
2008-02-01  7:25                         ` Patrick McHardy
2008-02-01  9:37                           ` Waskiewicz Jr, Peter P
2008-02-01  9:56                             ` Patrick McHardy
2008-02-01 12:06                               ` jamal
2008-02-01 19:02                                 ` Waskiewicz Jr, Peter P
2008-02-01 22:56                                 ` Jarek Poplawski
2008-02-02  1:51                                   ` Waskiewicz Jr, Peter P
2008-02-02  5:20                                 ` Andi Kleen
2008-02-01 14:34                             ` Andi Kleen
2008-02-01 17:24                               ` Stephen Hemminger
2008-01-31 18:48                 ` Patrick McHardy
2008-02-02 22:57             ` Herbert Xu
2008-02-03  9:35               ` Andi Kleen
2008-01-31 18:26 ` Rick Jones
2008-01-31 19:03   ` Andi Kleen
2008-01-31 18:35     ` Rick Jones
2008-01-31 19:25       ` Andi Kleen
2008-01-31 19:14         ` Rick Jones
2008-02-01  1:04           ` Andy Furniss
2008-02-01  4:31           ` Andi Kleen
2008-02-02 22:59             ` Herbert Xu
2008-02-01 21:58     ` Rick Jones
2008-02-02  4:10       ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).