Skip to contentSkip to conversation

vlan: vlan device not reading gso max size of parent.

PATCH In review Jeff Kirsher 5 participants 8 messages Sep 12, 2008

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 vlan: vlan device not reading gso max size of parent.

From: Alexander Duyck <[email protected]>

The vlan devices are not reading the gso max size of the parent device. As a result devices that do not support 64K max gso size are currently failing.

This issue is seen on 2.6.26 kernels as well and the same patch should be able to be applied without any issues.

---

 net/8021q/vlan.c     |    1 +
 net/8021q/vlan_dev.c |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
net/8021q/vlan.c +1 -0
index b661f47..f0e335a 100644
@@ -394,6 +394,7 @@ static void vlan_transfer_features(struct net_device *dev,
 
 	vlandev->features &= ~dev->vlan_features;
 	vlandev->features |= dev->features & dev->vlan_features;
+	vlandev->gso_max_size = dev->gso_max_size;
 
 	if (old_features != vlandev->features)
 		netdev_features_change(vlandev);
net/8021q/vlan_dev.c +1 -0
index 4bf014e..97688cd 100644
@@ -607,6 +607,7 @@ static int vlan_dev_init(struct net_device *dev)
 		      (1<<__LINK_STATE_PRESENT);
 
 	dev->features |= real_dev->features & real_dev->vlan_features;
+	dev->gso_max_size = real_dev->gso_max_size;
 
 	/* ipv6 shared card related stuff */
 	dev->dev_id = real_dev->dev_id;
#1 lore raw

PATCH 2/3 pkt_sched: Add multiqueue scheduler support

From: Alexander Duyck <[email protected]>

This patch is intended to add a qdisc to support the new tx multiqueue architecture by providing a band for each hardware queue. By doing this it is possible to support a different qdisc per physical hardware queue.

This qdisc uses the skb->queue_mapping to select which band to place the traffic onto. It then uses a round robin w/ a check to see if the subqueue is stopped to determine which band to dequeue the packet from.

---

 Documentation/networking/multiqueue.txt |   47 +++
 include/linux/pkt_sched.h               |    7 
 net/sched/Kconfig                       |    9 +
 net/sched/Makefile                      |    1 
 net/sched/sch_multiq.c                  |  469 +++++++++++++++++++++++++++++++
 5 files changed, 532 insertions(+), 1 deletions(-)
 create mode 100644 net/sched/sch_multiq.c
Documentation/networking/multiqueue.txt +46 -1
index d391ea6..5787ee6 100644
@@ -24,4 +24,49 @@ netif_{start|stop|wake}_subqueue() functions to manage each queue while the
 device is still operational.  netdev->queue_lock is still used when the device
 comes online or when it's completely shut down (unregister_netdev(), etc.).
 
-Author: Peter P. Waskiewicz Jr. <[email protected]>
+
+Section 2: Qdisc support for multiqueue devices
+
+-----------------------------------------------
+
+Currently two qdiscs support multiqueue devices.  The first is the default
+pfifo_fast qdisc.  This qdisc supports one qdisc per hardware queue.  A new
+round-robin qdisc, sch_multiq also supports multiple hardware queues. The
+qdisc is responsible for classifying the skb's and then directing the skb's to
+bands and queues based on the value in skb->queue_mapping.  Use this field in
+the base driver to determine which queue to send the skb to.
+
+sch_multiq has been added for hardware that wishes to avoid unnecessary
+requeuing.  It will cycle though the bands and verify that the hardware queue
+associated with the band is not stopped prior to dequeuing a packet.
+
+On qdisc load, the number of bands is based on the number of queues on the
+hardware.  Once the association is made, any skb with skb->queue_mapping set,
+will be queued to the band associated with the hardware queue.
+
+
+Section 3: Brief howto using MULTIQ for multiqueue devices
+---------------------------------------------------------------
+
+The userspace command 'tc,' part of the iproute2 package, is used to configure
+qdiscs.  To add the MULTIQ qdisc to your network device, assuming the device
+is called eth0, run the following command:
+
+# tc qdisc add dev eth0 root handle 1: multiq
+
+The qdisc will allocate the number of bands to equal the number of queues that
+the device reports, and bring the qdisc online.  Assuming eth0 has 4 Tx
+queues, the band mapping would look like:
+
+band 0 => queue 0
+band 1 => queue 1
+band 2 => queue 2
+band 3 => queue 3
+
+Traffic will begin flowing through each queue if your base device has either
+the default simple_tx_hash or a custom netdev->select_queue() defined.
+
+The behavior of tc filters remains the same.
+
+Author: Alexander Duyck <[email protected]>
+Original Author: Peter P. Waskiewicz Jr. <[email protected]>
include/linux/pkt_sched.h +7 -0
index e5de421..5d921fa 100644
@@ -123,6 +123,13 @@ struct tc_prio_qopt
 	__u8	priomap[TC_PRIO_MAX+1];	/* Map: logical priority -> PRIO band */
 };
 
+/* MULTIQ section */
+
+struct tc_multiq_qopt {
+	__u16	bands;			/* Number of bands */
+	__u16	max_bands;		/* Maximum number of queues */
+};
+
 /* TBF section */
 
 struct tc_tbf_qopt
net/sched/Kconfig +9 -0
index 9437b27..efaa7a7 100644
@@ -106,6 +106,15 @@ config NET_SCH_PRIO
 	  To compile this code as a module, choose M here: the
 	  module will be called sch_prio.
 
+config NET_SCH_MULTIQ
+	tristate "Hardware Multiqueue-aware Multi Band Queuing (MULTIQ)"
+	---help---
+	  Say Y here if you want to use an n-band queue packet scheduler
+	  to support devices that have multiple hardware transmit queues.
+
+	  To compile this code as a module, choose M here: the
+	  module will be called sch_multiq.
+
 config NET_SCH_RED
 	tristate "Random Early Detection (RED)"
 	---help---
net/sched/Makefile +1 -0
index 1d2b0f7..3d9b953 100644
@@ -26,6 +26,7 @@ obj-$(CONFIG_NET_SCH_SFQ)	+= sch_sfq.o
 obj-$(CONFIG_NET_SCH_TBF)	+= sch_tbf.o
 obj-$(CONFIG_NET_SCH_TEQL)	+= sch_teql.o
 obj-$(CONFIG_NET_SCH_PRIO)	+= sch_prio.o
+obj-$(CONFIG_NET_SCH_MULTIQ)	+= sch_multiq.o
 obj-$(CONFIG_NET_SCH_ATM)	+= sch_atm.o
 obj-$(CONFIG_NET_SCH_NETEM)	+= sch_netem.o
 obj-$(CONFIG_NET_CLS_U32)	+= cls_u32.o
net/sched/sch_multiq.c new file +469 -0

469 lines not on this page · raw message

#6 lore raw

PATCH 3/3 pkt_action: add new action skbedit

In reply to Jeff Kirsher

From: Alexander Duyck <[email protected]>

This new action will have the ability to change the priority and/or queue_mapping fields on an sk_buff.

---

 Documentation/networking/multiqueue.txt |    9 +
 include/linux/tc_act/Kbuild             |    1 
 include/linux/tc_act/tc_skbedit.h       |   44 +++++++
 include/net/tc_act/tc_skbedit.h         |   34 +++++
 net/sched/Kconfig                       |   11 ++
 net/sched/Makefile                      |    1 
 net/sched/act_skbedit.c                 |  203 +++++++++++++++++++++++++++++++
 7 files changed, 302 insertions(+), 1 deletions(-)
 create mode 100644 include/linux/tc_act/tc_skbedit.h
 create mode 100644 include/net/tc_act/tc_skbedit.h
 create mode 100644 net/sched/act_skbedit.c
Documentation/networking/multiqueue.txt +8 -1
index 5787ee6..10113ff 100644
@@ -66,7 +66,14 @@ band 3 => queue 3
 Traffic will begin flowing through each queue if your base device has either
 the default simple_tx_hash or a custom netdev->select_queue() defined.
 
-The behavior of tc filters remains the same.
+The behavior of tc filters remains the same.  However a new tc action,
+skbedit, has been added.  Assuming you wanted to route all traffic to a
+specific host, for example 192.168.0.3, though a specific queue you could use
+this action and establish a filter such as:
+
+tc filter add dev eth0 parent 1: protocol ip prio 1 u32 \
+	match ip dst 192.168.0.3 \
+	action skbedit queue_mapping 3
 
 Author: Alexander Duyck <[email protected]>
 Original Author: Peter P. Waskiewicz Jr. <[email protected]>
include/linux/tc_act/Kbuild +1 -0
index 6dac0d7..7699093 100644
@@ -3,3 +3,4 @@ header-y += tc_ipt.h
 header-y += tc_mirred.h
 header-y += tc_pedit.h
 header-y += tc_nat.h
+header-y += tc_skbedit.h
include/linux/tc_act/tc_skbedit.h new file +44 -0

44 lines not on this page · raw message

include/net/tc_act/tc_skbedit.h new file +34 -0
new file mode 100644
index 0000000..6abb3ed
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2008, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * Author: Alexander Duyck <[email protected]>
+ */
+
+#ifndef __NET_TC_SKBEDIT_H
+#define __NET_TC_SKBEDIT_H
+
+#include <net/act_api.h>
+
+struct tcf_skbedit {
+	struct tcf_common	common;
+	u32			flags;
+	u32     		priority;
+	u16			queue_mapping;
+};
+#define to_skbedit(pc) \
+	container_of(pc, struct tcf_skbedit, common)
+
+#endif /* __NET_TC_SKBEDIT_H */
net/sched/Kconfig +11 -0
index efaa7a7..6767e54 100644
@@ -485,6 +485,17 @@ config NET_ACT_SIMP
 	  To compile this code as a module, choose M here: the
 	  module will be called simple.
 
+config NET_ACT_SKBEDIT
+        tristate "SKB Editing"
+        depends on NET_CLS_ACT
+        ---help---
+	  Say Y here to change skb priority or queue_mapping settings.
+
+	  If unsure, say N.
+
+	  To compile this code as a module, choose M here: the
+	  module will be called skbedit.
+
 config NET_CLS_IND
 	bool "Incoming device classification"
 	depends on NET_CLS_U32 || NET_CLS_FW
net/sched/Makefile +1 -0
index 3d9b953..e60c992 100644
@@ -14,6 +14,7 @@ obj-$(CONFIG_NET_ACT_IPT)	+= act_ipt.o
 obj-$(CONFIG_NET_ACT_NAT)	+= act_nat.o
 obj-$(CONFIG_NET_ACT_PEDIT)	+= act_pedit.o
 obj-$(CONFIG_NET_ACT_SIMP)	+= act_simple.o
+obj-$(CONFIG_NET_ACT_SKBEDIT)	+= act_skbedit.o
 obj-$(CONFIG_NET_SCH_FIFO)	+= sch_fifo.o
 obj-$(CONFIG_NET_SCH_CBQ)	+= sch_cbq.o
 obj-$(CONFIG_NET_SCH_HTB)	+= sch_htb.o
net/sched/act_skbedit.c new file +203 -0

203 lines not on this page · raw message

maintainer
#7 lore raw
In reply to Jeff Kirsher

From: Jeff Kirsher <[email protected]>
Date: Thu, 11 Sep 2008 20:07:47 -0700

Quoted 11 lines

From: Alexander Duyck <[email protected]>

The vlan devices are not reading the gso max size of the parent device. As a result devices that do not support 64K max gso size are currently failing.

This issue is seen on 2.6.26 kernels as well and the same patch should be able to be applied without any issues.

Good catch, applied to net-next-2.6

maintainer
#2 lore raw

Re: [NET-NEXT PATCH 2/3][UPDATED] pkt_sched: Add multiqueue scheduler support

In reply to Jeff Kirsher

From: Jeff Kirsher <[email protected]>
Date: Thu, 11 Sep 2008 20:08:31 -0700

Quoted 7 lines

From: Alexander Duyck <[email protected]>

This patch is intended to add a qdisc to support the new tx multiqueue architecture by providing a band for each hardware queue. By doing this it is possible to support a different qdisc per physical hardware queue.

Quoted 6 lines

This qdisc uses the skb->queue_mapping to select which band to place the traffic onto. It then uses a round robin w/ a check to see if the subqueue is stopped to determine which band to dequeue the packet from.

I'm more and more agreeing with Jarek that the root-only restriction is rediculious.

What if I want to do PRIO multiqueue for certain classes of traffic?

If I want to shoot myself in the foot trying to use a setup like that, this thing damn well better let me. You don't unilaterally know better than the user.

#3 lore raw

Re: [NET-NEXT PATCH 2/3][UPDATED] pkt_sched: Add multiqueue scheduler support

Quoted 8 lines · David Miller

I'm more and more agreeing with Jarek that the root-only restriction is rediculious.

What if I want to do PRIO multiqueue for certain classes of traffic?

If I want to shoot myself in the foot trying to use a setup like that, this thing damn well better let me. You don't unilaterally know better than the user.

I will submit an additional patch in the next day or so to pull the root-only requirement.

#4 lore raw

Re: [NET-NEXT PATCH 2/3][UPDATED] pkt_sched: Add multiqueue scheduler support

In reply to Jeff Kirsher

Jeff Kirsher wrote, On 09/12/2008 05:08 AM:

Quoted 1 line

From: Alexander Duyck <[email protected]>

...

Quoted 5 lines
Documentation/networking/multiqueue.txt +0 -0
index d391ea6..5787ee6 100644

Documentation/networking/multiqueue.txt netif_{start|stop|wake}_subqueue() functions to manage each queue while the · line 32

Quoted 10 lines
Documentation/networking/multiqueue.txt +6 -1
@@ -24,4 +24,49 @@ netif_{start|stop|wake}_subqueue() functions to manage each queue while the
 device is still operational.  netdev->queue_lock is still used when the device
 comes online or when it's completely shut down (unregister_netdev(), etc.).
 
-Author: Peter P. Waskiewicz Jr. <[email protected]>
+
+Section 2: Qdisc support for multiqueue devices
+
+-----------------------------------------------
+
+Currently two qdiscs support multiqueue devices.

This looks like a bit misleading: one could think it's necessary to use one of these two with mq devices.

Documentation/networking/multiqueue.txt netif_{start|stop|wake}_subqueue() functions to manage each queue while the

Quoted 9 lines
Documentation/networking/multiqueue.txt +8 -0
 The first is the default
+pfifo_fast qdisc.  This qdisc supports one qdisc per hardware queue.  A new
+round-robin qdisc, sch_multiq also supports multiple hardware queues. The
+qdisc is responsible for classifying the skb's and then directing the skb's to
+bands and queues based on the value in skb->queue_mapping.  Use this field in
+the base driver to determine which queue to send the skb to.
+
+sch_multiq has been added for hardware that wishes to avoid unnecessary
+requeuing.

This could suggest that other qdiscs don't wish the same or even generate excessive requeuing, which IMHO could be true, but it's not proven, and might be only temporary situation anyway...

Anyway, I wonder why you don't mention here anything from your first nice explantion to my doubts around the first attempt to restore multiqueue to prio, like EEDC/DCB/etc?

Quoted 18 lines

It will cycle though the bands and verify that the hardware queue

Documentation/networking/multiqueue.txt +17 -0
+associated with the band is not stopped prior to dequeuing a packet.
+
+On qdisc load, the number of bands is based on the number of queues on the
+hardware.  Once the association is made, any skb with skb->queue_mapping set,
+will be queued to the band associated with the hardware queue.
+
+
+Section 3: Brief howto using MULTIQ for multiqueue devices
+---------------------------------------------------------------
+
+The userspace command 'tc,' part of the iproute2 package, is used to configure
+qdiscs.  To add the MULTIQ qdisc to your network device, assuming the device
+is called eth0, run the following command:
+
+# tc qdisc add dev eth0 root handle 1: multiq
+
+The qdisc will allocate the number of bands to equal the number of queues that

Documentation/networking/multiqueue.txt netif_{start|stop|wake}_subqueue() functions to manage each queue while the · line 67

Quoted 10 lines
Documentation/networking/multiqueue.txt +10 -0
+the device reports, and bring the qdisc online.  Assuming eth0 has 4 Tx
+queues, the band mapping would look like:
+
+band 0 => queue 0
+band 1 => queue 1
+band 2 => queue 2
+band 3 => queue 3
+
+Traffic will begin flowing through each queue if your base device has either
+the default simple_tx_hash or a custom netdev->select_queue() defined.

I think a device doesn't need to have simple_tx_hash defined?

...

Quoted 12 lines
Documentation/networking/multiqueue.txt +12 -0
+static int multiq_tune(struct Qdisc *sch, struct nlattr *opt)
+{
+	struct multiq_sched_data *q = qdisc_priv(sch);
+	struct tc_multiq_qopt *qopt;
+	int i;
+
+	if (sch->parent != TC_H_ROOT)
+		return -EINVAL;
+	if (!netif_is_multiqueue(qdisc_dev(sch)))
+		return -EINVAL;
+	if (nla_len(opt) < sizeof(*qopt))
+		return -EINVAL;

Documentation/networking/multiqueue.txt

Quoted 10 lines
Documentation/networking/multiqueue.txt +10 -0
+
+	qopt = nla_data(opt);
+
+	qopt->bands = qdisc_dev(sch)->real_num_tx_queues;
+
+	sch_tree_lock(sch);
+	q->bands = qopt->bands;
+	for (i = q->bands; i < q->max_bands; i++) {
+		struct Qdisc *child = xchg(&q->queues[i], &noop_qdisc);
+		if (child != &noop_qdisc) {

Or maybe?:

		if (q->queues[i] != &noop_qdisc) {
			struct Qdisc *child = xchg(&q->queues[i], &noop_qdisc);
Quoted 4 lines
Documentation/networking/multiqueue.txt +4 -0
+			qdisc_tree_decrease_qlen(child, child->q.qlen);
+			qdisc_destroy(child);
+		}
+	}

...

Quoted 9 lines
Documentation/networking/multiqueue.txt +9 -0
+static int multiq_init(struct Qdisc *sch, struct nlattr *opt)
+{
+	struct multiq_sched_data *q = qdisc_priv(sch);
+	int i;
+
+	q->queues = NULL;
+
+	if (opt == NULL)
+		return -EINVAL;

Documentation/networking/multiqueue.txt

Quoted 10 lines
Documentation/networking/multiqueue.txt +10 -0
+
+	q->max_bands = qdisc_dev(sch)->num_tx_queues;
+
+	q->queues = kcalloc(q->max_bands, sizeof(struct Qdisc *), GFP_KERNEL);
+	if (!q->queues)
+		return -ENOBUFS;
+	for (i = 0; i < q->max_bands; i++)
+		q->queues[i] = &noop_qdisc;
+
+	return multiq_tune(sch, opt);

But multiq_tune() can EINVAL, so kfree is needed here.

Jarek P.

PS: to save some "paper" a typo, I guess, from PATCH 3/3:

Documentation/networking/multiqueue.txt

Quoted 3 lines
Documentation/networking/multiqueue.txt +3 -0
+The behavior of tc filters remains the same.  However a new tc action,
+skbedit, has been added.  Assuming you wanted to route all traffic to a
+specific host, for example 192.168.0.3, though a specific queue you could use

+specific host, for example 192.168.0.3, through a specific queue you could use

#5 lore raw

RE: [NET-NEXT PATCH 2/3][UPDATED] pkt_sched: Add multiqueue scheduler support

Jarek Poplawski wrote:
----------------------------------------------

Quoted 6 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+Currently two qdiscs support multiqueue devices.

This looks like a bit misleading: one could think it's necessary to use one of these two with mq devices.

How about I change this from "support" to "are optimized for". Would that work better for you?

Quoted 11 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+
+sch_multiq has been added for hardware that wishes to avoid
+unnecessary requeuing.

This could suggest that other qdiscs don't wish the same or even generate excessive requeuing, which IMHO could be true, but it's not proven, and might be only temporary situation anyway...

Anyway, I wonder why you don't mention here anything from your first nice explantion to my doubts around the first attempt to restore multiqueue to prio, like EEDC/DCB/etc?

Actually this was just a poor choice of words on my part. I should probably replace "unnecessary requeueing" with "head-of-line blocking".

Quoted 5 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+Traffic will begin flowing through each queue if your base device
+has either the default simple_tx_hash or a custom
+netdev->select_queue() defined.

I think a device doesn't need to have simple_tx_hash defined?

Actually simple_tx_hash is the default hash function that netdev uses if select_queue is not defined. Another poor choice of wording. It Should have been "..each queue via either the default simple_tx_hash or the netdev->select_queue function if you have it defined".

Quoted 4 lines

net/sched/sch_multiq.c line 220

Quoted 3 lines
net/sched/sch_multiq.c new file +3 -0
+     for (i = q->bands; i < q->max_bands; i++) {
+             struct Qdisc *child = xchg(&q->queues[i], &noop_qdisc);
+             if (child != &noop_qdisc) {
Quoted 9 lines

Or maybe?:

                if (q->queues[i] != &noop_qdisc) {
                        struct Qdisc *child = xchg(&q->queues[i],
                                                   &noop_qdisc);
Quoted 4 lines
net/sched/sch_multiq.c new file +4 -0
+                     qdisc_tree_decrease_qlen(child, child->q.qlen);
+                     qdisc_destroy(child);
+             }
+     }

I suppose I can make this change since we are already protected by the tree lock already.

Quoted 10 lines
Quoted 10 lines
net/sched/sch_multiq.c new file +10 -0
+static int multiq_init(struct Qdisc *sch, struct nlattr *opt) +{
+     struct multiq_sched_data *q = qdisc_priv(sch); +     int i;
+
+     q->queues = NULL;
+
+     if (opt == NULL)
+             return -EINVAL;
+
+     q->max_bands = qdisc_dev(sch)->num_tx_queues; +
+     q->queues = kcalloc(q->max_bands, sizeof(struct Qdisc *),

...

Quoted 4 lines

net/sched/sch_multiq.c line 270

Quoted 2 lines
net/sched/sch_multiq.c new file +2 -0
+
+     return multiq_tune(sch, opt);

But multiq_tune() can EINVAL, so kfree is needed here.

Noted and corrected.

Quoted 9 lines

Jarek P.

PS: to save some "paper" a typo, I guess, from PATCH 3/3:

Review

Quoted 2 lines
(quoted diff) +2 -0
+specific host, for example 192.168.0.3, though a specific queue
+you could use

+specific host, for example 192.168.0.3, through a specific queue
you could use

Typo noted and will be corrected shortly.

Thanks,

Alex