NET: Multiple queue hardware support
Subsystems (4)
PATCH 1/1 NET: Multiple queue hardware support
Please consider these patches for 2.6.23 inclusion.
Updates since the last submission:
1. skb->queue_mapping moved into the iff cacheline. I looked at moving iff and queue_mapping, but there wasn't enough room anywhere else to logically group these in a different cacheline that I could see. Thanks Patrick McHardy.
2. netdev->egress_subqueue is now indexed thanks to Dave Miller.
3. sch_rr is now a MODULE_ALIAS of sch_prio. Thanks Patrick McHardy.
4. Both sch_rr and multiqueue sch_prio expect the number of bands to equal the number of queues on the netdev.
This patchset is an updated version of previous multiqueue network device support patches. The general approach of introducing a new API for multiqueue network devices to register with the stack has remained. The changes include adding a round-robin qdisc, heavily based on sch_prio, which will allow queueing to hardware with no OS-enforced queuing policy. sch_prio still has the multiqueue code in it, but has a Kconfig option to compile it out of the qdisc. This allows people with hardware containing scheduling policies to use sch_rr (round-robin), and others without scheduling policies in hardware to continue using sch_prio if they wish to have some notion of scheduling priority.
The patches being sent are split into Documentation, Qdisc changes, and core stack changes. The requested e1000 changes are still being resolved, and will be sent at a later date.
I did not modify other users of netif_queue_stopped() in net/core/netpoll.c, net/core/dev.c, or net/core/pktgen.c, since no classification occurs for the skb being sent to the device. Therefore, packets should always be ending up in queue 0, so there's no need to check the subqueue status either.
The patches to iproute2 for tc will be sent separately, to support sch_rr.
Signature · 1 line
PJ Waskiewicz <[email protected]>
PATCH 1/3 NET: [DOC] Multiqueue hardware support documentation
Add a brief howto to Documentation/networking for multiqueue. It explains how to use the multiqueue API in a driver to support multiqueue paths from the stack, as well as the qdiscs to use for feeding a multiqueue device.
---
Documentation/networking/multiqueue.txt | 100 +++++++++++++++++++++++++++++++ 1 files changed, 100 insertions(+), 0 deletions(-)
Documentation/networking/multiqueue.txt new file +100 -0
@@ -0,0 +1,100 @@ + + HOWTO for multiqueue network device support + =========================================== + +Section 1: Base driver requirements for implementing multiqueue support +Section 2: Qdisc support for multiqueue devices +Section 3: Brief howto using PRIO or RR for multiqueue devices + + +Intro: Kernel support for multiqueue devices +--------------------------------------------------------- + +Kernel support for multiqueue devices is only an API that is presented to the +netdevice layer for base drivers to implement. This feature is part of the +core networking stack, and all network devices will be running on the +multiqueue-aware stack. If a base driver only has one queue, then these +changes are transparent to that driver. + + +Section 1: Base driver requirements for implementing multiqueue support +----------------------------------------------------------------------- + +Base drivers are required to use the new alloc_etherdev_mq() or +alloc_netdev_mq() functions to allocate the subqueues for the device. The +underlying kernel API will take care of the allocation and deallocation of +the subqueue memory, as well as netdev configuration of where the queues +exist in memory. + +The base driver will also need to manage the queues as it does the global +netdev->queue_lock today. Therefore base drivers should use the +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.). + +Finally, the base driver should indicate that it is a multiqueue device. The +feature flag NETIF_F_MULTI_QUEUE should be added to the netdev->features +bitmap on device initialization. Below is an example from e1000: + +#ifdef CONFIG_E1000_MQ + if ( (adapter->hw.mac.type == e1000_82571) || + (adapter->hw.mac.type == e1000_82572) || + (adapter->hw.mac.type == e1000_80003es2lan)) + netdev->features |= NETIF_F_MULTI_QUEUE; +#endif + + +Section 2: Qdisc support for multiqueue devices +----------------------------------------------- + +Currently two qdiscs support multiqueue devices. A new round-robin qdisc, +sch_rr, and sch_prio. The qdisc is responsible for classifying the skb's to +bands and queues, and will store the queue mapping into skb->queue_mapping. +Use this field in the base driver to determine which queue to send the skb +to. + +sch_rr has been added for hardware that doesn't want scheduling policies from +software, so it's a straight round-robin qdisc. It uses the same syntax and +classification priomap that sch_prio uses, so it should be intuitive to +configure for people who've used sch_prio. + +The PRIO qdisc naturally plugs into a multiqueue device. If PRIO has been +built with NET_SCH_PRIO_MQ, then upon load, it will make sure the number of +bands requested is equal to the number of queues on the hardware. If they +are equal, it sets a one-to-one mapping up between the queues and bands. If +they're not equal, it will not load the qdisc. This is the same behavior +for RR. Once the association is made, any skb that is classified will have +skb->queue_mapping set, which will allow the driver to properly queue skb's +to multiple queues. + + +Section 3: Brief howto using PRIO and RR for multiqueue devices +--------------------------------------------------------------- + +The userspace command 'tc,' part of the iproute2 package, is used to configure +qdiscs. To add the PRIO qdisc to your network device, assuming the device is +called eth0, run the following command: + +# tc qdisc add dev eth0 root handle 1: prio bands 4 + +This will create 4 bands, 0 being highest priority, and associate those bands +to the queues on your NIC. 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 TOS values are assigning +traffic across the various bands. For example, ssh traffic will always try to +go out band 0 based on TOS -> Linux priority conversion (realtime traffic), +so it will be sent out queue 0. ICMP traffic (pings) fall into the "normal" +traffic classification, which is band 1. Therefore pings will be send out +queue 1 on the NIC. + +The behavior of tc filters remains the same, where it will override TOS priority +classification. + + +Author: Peter P. Waskiewicz Jr. <[email protected]>
PATCH 2/3 NET: [CORE] Stack changes to add multiqueue hardware support API
In reply to PJ WaskiewiczAdd the multiqueue hardware device support API to the core network stack. Allow drivers to allocate multiple queues and manage them at the netdev level if they choose to do so.
Added a new field to sk_buff, namely queue_mapping, for drivers to know which tx_ring to select based on OS classification of the flow.
---
include/linux/etherdevice.h | 3 +- include/linux/netdevice.h | 62 ++++++++++++++++++++++++++++++++++++++++++- include/linux/skbuff.h | 4 ++- net/core/dev.c | 20 ++++++++++---- net/core/skbuff.c | 3 ++ net/ethernet/eth.c | 9 +++--- 6 files changed, 87 insertions(+), 14 deletions(-)
include/linux/etherdevice.h +2 -1
@@ -39,7 +39,8 @@ extern void eth_header_cache_update(struct hh_cache *hh, struct net_device *devextern int eth_header_cache (struct neighbour *neigh,struct hh_cache *hh); -extern struct net_device *alloc_etherdev (int sizeof_priv); +extern struct net_device *alloc_etherdev_mq (int sizeof_priv,int queue_count); +#define alloc_etherdev (sizeof_priv) alloc_etherdev_mq(sizeof_priv, 1)/** * is_zero_ether_addr - Determine if give Ethernet address is all zeros.
include/linux/netdevice.h +60 -2
92 lines not on this page · raw message
include/linux/skbuff.h +3 -1
@@ -197,6 +197,7 @@ typedef unsigned char *sk_buff_data_t;* @tstamp: Time we arrived * @dev: Device we arrived on/are leaving by * @iif: ifindex of device we arrived on +* @queue_mapping: Queue mapping for multiqueue devices * @transport_header: Transport layer header * @network_header: Network layer header * @mac_header: Link layer header
@@ -246,7 +247,8 @@ struct sk_buff {ktime_t tstamp;struct net_device *dev;int iif; -/* 4 byte hole on 64 bit*/ +__u16 queue_mapping; +/* 2 byte hole on 64 bit*/ struct dst_entry *dst;struct sec_path *sp;
net/core/dev.c +14 -6
@@ -1545,6 +1545,8 @@ gso:spin_lock (&dev->queue_lock); q = dev->qdisc;if (q->enqueue) { +/* reset queue_mapping to zero */ + skb->queue_mapping =0 ; rc = q->enqueue (skb, q);qdisc_run (dev);spin_unlock (&dev->queue_lock);
@@ -3343,16 +3345,18 @@ static struct net_device_stats *internal_stats(struct net_device *dev) }/** -* alloc_netdev - allocate network device +* alloc_netdev_mq - allocate network device * @sizeof_priv: size of private data to allocate space for * @name: device name format string * @setup: callback to initialize device +* @queue_count: the number of subqueues to allocate * * Allocates a struct net_device with private data area for driver use -* and performs basic initialization. +* and performs basic initialization. Also allocates subqueue structs +* for each queue on the device at the end of the netdevice. */ -struct net_device *alloc_netdev (int sizeof_priv,const char *name, -void (*setup)(struct net_device *)) +struct net_device *alloc_netdev_mq (int sizeof_priv,const char *name, +void (*setup)(struct net_device *),int queue_count) {void *p;struct net_device *dev;
@@ -3361,7 +3365,9 @@ struct net_device *alloc_netdev(int sizeof_priv, const char *name,BUG_ON (strlen (name) >=sizeof (dev->name));/* ensure 32-byte alignment of both the device and private area */ - alloc_size = (sizeof (*dev) +NETDEV_ALIGN_CONST ) & ~NETDEV_ALIGN_CONST ; + alloc_size = (sizeof (*dev) +NETDEV_ALIGN_CONST + + (sizeof (struct net_device_subqueue ) * (queue_count -1 ))) & + ~NETDEV_ALIGN_CONST ; alloc_size += sizeof_priv +NETDEV_ALIGN_CONST ; p =kzalloc (alloc_size,GFP_KERNEL );
@@ -3377,12 +3383,14 @@ struct net_device *alloc_netdev(int sizeof_priv, const char *name,if (sizeof_priv) dev->priv =netdev_priv (dev); + dev->egress_subqueue_count = queue_count; + dev->get_stats = internal_stats;setup (dev);strcpy (dev->name, name);return dev; } -EXPORT_SYMBOL (alloc_netdev); +EXPORT_SYMBOL (alloc_netdev_mq);/** * free_netdev - free network device
net/core/skbuff.c +3 -0
@@ -418,6 +418,7 @@ struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask) n->nohdr =0 ;C (pkt_type);C (ip_summed); +C (queue_mapping);C (priority);#if defined(CONFIG_IP_VS ) || defined(CONFIG_IP_VS_MODULE )C (ipvs_property);
@@ -459,6 +460,7 @@ static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old)#endif new->sk =NULL ; new->dev = old->dev; + new->queue_mapping = old->queue_mapping; new->priority = old->priority; new->protocol = old->protocol; new->dst =dst_clone (old->dst);
@@ -1925,6 +1927,7 @@ struct sk_buff *skb_segment(struct sk_buff *skb, int features) tail = nskb; nskb->dev = skb->dev; + nskb->queue_mapping = skb->queue_mapping; nskb->priority = skb->priority; nskb->protocol = skb->protocol; nskb->dst =dst_clone (skb->dst);
net/ethernet/eth.c +5 -4
@@ -316,9 +316,10 @@ void ether_setup(struct net_device *dev)EXPORT_SYMBOL (ether_setup);/** -* alloc_etherdev - Allocates and sets up an Ethernet device +* alloc_etherdev_mq - Allocates and sets up an Ethernet device * @sizeof_priv: Size of additional driver-private structure to be allocated * for this Ethernet device +* @queue_count: The number of queues this device has. * * Fill in the fields of the device structure with Ethernet-generic * values. Basically does everything except registering the device.
@@ -328,8 +329,8 @@ EXPORT_SYMBOL(ether_setup);* this private data area. */ -struct net_device *alloc_etherdev (int sizeof_priv) +struct net_device *alloc_etherdev_mq (int sizeof_priv,int queue_count) { -return alloc_netdev (sizeof_priv,"eth%d" , ether_setup); +return alloc_netdev_mq (sizeof_priv,"eth%d" , ether_setup, queue_count); } -EXPORT_SYMBOL (alloc_etherdev); +EXPORT_SYMBOL (alloc_etherdev_mq);
PATCH 3/3 NET: [SCHED] Qdisc changes and sch_rr added for multiqueue
In reply to PJ WaskiewiczAdd the new sch_rr qdisc for multiqueue network device support. Allow sch_prio to be compiled with or without multiqueue hardware support.
sch_rr is part of sch_prio, and is referenced from MODULE_ALIAS. This was done since sch_prio and sch_rr only differ in their dequeue routine.
---
net/sched/Kconfig | 32 ++++++++++++ net/sched/sch_generic.c | 3 + net/sched/sch_prio.c | 123 ++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 150 insertions(+), 8 deletions(-)
net/sched/Kconfig +32 -0
@@ -102,8 +102,16 @@ config NET_SCH_ATM To compile this code as a module, choose M here: the module will be called sch_atm. +config NET_SCH_BANDS + bool "Multi Band Queueing (PRIO and RR)" + ---help--- + Say Y here if you want to use n-band multiqueue packet + schedulers. These include a priority-based scheduler and + a round-robin scheduler. + config NET_SCH_PRIO tristate "Multi Band Priority Queueing (PRIO)" + depends on NET_SCH_BANDS ---help--- Say Y here if you want to use an n-band priority queue packet scheduler.
@@ -111,6 +119,30 @@ config NET_SCH_PRIO To compile this code as a module, choose M here: the module will be called sch_prio. +config NET_SCH_PRIO_MQ + bool "Multiple hardware queue support for PRIO" + depends on NET_SCH_PRIO + ---help--- + Say Y here if you want to allow the PRIO qdisc to assign + flows to multiple hardware queues on an ethernet device. This + will still work on devices with 1 queue. + + Consider this scheduler for devices that do not use + hardware-based scheduling policies. Otherwise, use NET_SCH_RR. + + Most people will say N here. + +config NET_SCH_RR + bool "Multi Band Round Robin Queuing (RR)" + depends on NET_SCH_BANDS && NET_SCH_PRIO + ---help--- + Say Y here if you want to use an n-band round robin packet + scheduler. + + The module uses sch_prio for its framework and is aliased as + sch_rr, so it will load sch_prio, although it is referred + to using sch_rr. + config NET_SCH_RED tristate "Random Early Detection (RED)" ---help---
net/sched/sch_generic.c +2 -1
@@ -168,7 +168,8 @@ static inline int qdisc_restart(struct net_device *dev)spin_unlock (&dev->queue_lock); ret =NETDEV_TX_BUSY ; -if (!netif_queue_stopped (dev)) +if (!netif_queue_stopped (dev) && + !netif_subqueue_stopped (dev, skb->queue_mapping))/* churn baby churn .. */ ret =dev_hard_start_xmit (skb, dev);
net/sched/sch_prio.c +116 -7
197 lines not on this page · raw message
Re: [PATCH 3/3] NET: [SCHED] Qdisc changes and sch_rr added for multiqueue
Quoted 39 lines · PJ Waskiewicz
net/sched/Kconfig +22
-0@@ -102,8 +102,16 @@ config NET_SCH_ATM To compile this code as a module, choose M here: the module will be called sch_atm. +config NET_SCH_BANDS + bool "Multi Band Queueing (PRIO and RR)" + ---help--- + Say Y here if you want to use n-band multiqueue packet + schedulers. These include a priority-based scheduler and + a round-robin scheduler. + config NET_SCH_PRIO tristate "Multi Band Priority Queueing (PRIO)" + depends on NET_SCH_BANDS ---help--- Say Y here if you want to use an n-band priority queue packet scheduler.@@ -111,6 +119,30 @@ config NET_SCH_PRIO To compile this code as a module, choose M here: the module will be called sch_prio. +config NET_SCH_PRIO_MQ + bool "Multiple hardware queue support for PRIO" + depends on NET_SCH_PRIO + ---help--- + Say Y here if you want to allow the PRIO qdisc to assign + flows to multiple hardware queues on an ethernet device. This + will still work on devices with 1 queue. + + Consider this scheduler for devices that do not use + hardware-based scheduling policies. Otherwise, use NET_SCH_RR. + + Most people will say N here. + +config NET_SCH_RR
net/sched/Kconfig config NET_SCH_PRIO · line 145
Quoted 10 lines
net/sched/Kconfig +9
-0+ bool "Multi Band Round Robin Queuing (RR)" + depends on NET_SCH_BANDS && NET_SCH_PRIO + ---help--- + Say Y here if you want to use an n-band round robin packet + scheduler. + + The module uses sch_prio for its framework and is aliased as + sch_rr, so it will load sch_prio, although it is referred + to using sch_rr.
The dependencies seem to be very confused. SCHED_PRIO does not depend on anything new, SCH_RR also doesn't depend on anything. SCH_PRIO_MQ and SCH_RR_MQ (which is missing) depend on SCH_PRIO/SCH_RR. A single NET_SCH_MULTIQUEUE option seems better than adding one per scheduler though.
net/sched/sch_prio.c line 14
Quoted 9 lines
net/sched/sch_prio.c +2
-0@@ -9,6 +9,8 @@* Authors: Alexey Kuznetsov, <[email protected]> * Fixes: 19990609: J Hadi Salim <[email protected]>: * Init -- EINVAL when opt undefined +* Additions: Peter P. Waskiewicz Jr. <[email protected]> +* Added round-robin scheduling for selection at load-time
git keeps changelogs, please don't add it here.
Quoted 5 lines
net/sched/sch_prio.c +0
-0*/ #include <
linux/module.h>net/sched/sch_prio.c +0
-0@@ -40,9 +42,13 @@struct prio_sched_data
net/sched/sch_prio.c line 52
Quoted 10 lines
net/sched/sch_prio.c +4
-0{int bands; +#ifdef CONFIG_NET_SCH_RR +int curband;/* for round-robin */ +#endif struct tcf_proto *filter_list;u8 prio2band[TC_PRIO_MAX +1 ];struct Qdisc *queues[TCQ_PRIO_BANDS ]; +u16 band2queue[TC_PRIO_MAX +1 ];
Why is this still here? Its a 1:1 mapping.
Quoted 10 lines
net/sched/sch_prio.c +6
-0@@ -211,6 +265,22 @@ static int prio_tune(struct Qdisc *sch, struct rtattr *opt)return -EINVAL ; } +/* If we're prio multiqueue or are using round-robin, make +* sure the number of incoming bands matches the number of +* queues on the device we're associating with. +*/ +#ifdef CONFIG_NET_SCH_RR +if (strcmp ("rr" , sch->ops->id) ==0 )
net/sched/sch_prio.c static int prio_tune(struct Qdisc *sch, struct rtattr *opt) · line 283
Quoted 10 lines
net/sched/sch_prio.c +9
-0+if (qopt->bands != sch->dev->egress_subqueue_count) +return -EINVAL ; +#endif + +#ifdef CONFIG_NET_SCH_PRIO_MQ +if (strcmp ("prio" , sch->ops->id) ==0 ) +if (qopt->bands != sch->dev->egress_subqueue_count) +return -EINVAL ; +#endif
For the tenth time now, the user should enable this at runtime. You can't just break things dependant on config options.
RE: [PATCH 3/3] NET: [SCHED] Qdisc changes and sch_rr added for multiqueue
Quoted 5 lines
The dependencies seem to be very confused.
SCHED_PRIOdoes not depend on anything new,SCH_RRalso doesn't depend on anything.SCH_PRIO_MQandSCH_RR_MQ(which is missing) depend on SCH_PRIO/SCH_RR. A singleNET_SCH_MULTIQUEUEoption seems better than adding one per scheduler though.
I agree with a NET_SCH_MULTIQUEUE option. However, SCH_RR does depend on SCH_PRIO being built since it's the same code, doesn't it? Maybe I'm not understanding something about the build process. I'll clean this up.
Quoted 9 lines
net/sched/sch_prio.c line 12
Quoted 8 lines
net/sched/sch_prio.c +1
-0@@ -9,6 +9,8 @@* Authors: Alexey Kuznetsov, <[email protected]> * Fixes: 19990609: J Hadi Salim <[email protected]>: * Init -- EINVAL when opt undefined +* Additions: Peter P. Waskiewicz Jr.
Quoted 4 lines
net/sched/sch_prio.c line 15
Quoted 2 lines
net/sched/sch_prio.c +1
-0+* Added round-robin scheduling for selection at load-time git keeps changelogs, please don't add it here.
Roger.
Quoted 7 lines
net/sched/sch_prio.c line 51
Quoted 5 lines
net/sched/sch_prio.c +0
-0struct tcf_proto *filter_list;u8 prio2band[TC_PRIO_MAX +1 ];net/sched/sch_prio.c +1
-0struct Qdisc *queues[TCQ_PRIO_BANDS ]; +u16 band2queue[TC_PRIO_MAX +1 ];Why is this still here? Its a 1:1 mapping.
I'll fix this.
Quoted 16 lines
net/sched/sch_prio.c static int prio_tune(struct Qdisc
Quoted 1 line
net/sched/sch_prio.c +0
-0@@ -211,6 +265,22 @@ static int prio_tune(struct Qdisc*sch, struct rtattr *opt)
Quoted 14 lines
net/sched/sch_prio.c +11
-0return -EINVAL ; } +/* If we're prio multiqueue or are using round-robin, make +* sure the number of incoming bands matches the number of +* queues on the device we're associating with. +*/ +#ifdef CONFIG_NET_SCH_RR +if (strcmp ("rr" , sch->ops->id) ==0 ) +if (qopt->bands != sch->dev->egress_subqueue_count) +return -EINVAL ; +#endif + +#ifdef CONFIG_NET_SCH_PRIO_MQ
Quoted 8 lines
net/sched/sch_prio.c static int prio_tune(struct Qdisc *sch, struct rtattr *opt)
Quoted 5 lines
net/sched/sch_prio.c +4
-0+if (strcmp ("prio" , sch->ops->id) ==0 ) +if (qopt->bands != sch->dev->egress_subqueue_count) +return -EINVAL ; +#endif For the tenth time now, the user should enable this at runtime. You can't just break things dependant on config options.
I had this in sch_prio and tc before, and was told to remove it because of ABI issues. I can put it back in, but I'm not sure what those previous ABI issues were. Was it backwards compatibility that you referred to before that was broken?
As always, the feedback is very much appreciated. I'll get these fixes in as soon as possible.
-PJ
Re: [PATCH 3/3] NET: [SCHED] Qdisc changes and sch_rr added for multiqueue
Quoted 7 lines · Peter P
Quoted 2 lines
The dependencies seem to be very confused.
SCHED_PRIOdoes not depend on anything new,SCH_RRalso doesn't depend on anything.SCH_PRIO_MQandSCH_RR_MQ(which is missing) depend on SCH_PRIO/SCH_RR. A singleNET_SCH_MULTIQUEUEoption seems better than adding one per scheduler though.I agree with a
NET_SCH_MULTIQUEUEoption. However,SCH_RRdoes depend onSCH_PRIObeing built since it's the same code, doesn't it? Maybe I'm not understanding something about the build process. I'll clean this up.
The easiest solution is to select SCH_PRIO from SCH_RR. I head something else in mind initially but that is needlessly complicated.
Quoted 8 lines
Quoted 3 lines
For the tenth time now, the user should enable this at runtime. You can't just break things dependant on config options.
I had this in
sch_prioand tc before, and was told to remove it because of ABI issues. I can put it back in, but I'm not sure what those previous ABI issues were. Was it backwards compatibility that you referred to before that was broken?
Your tc changes changed the structure in a way that old tc binaries wouldn't work anymore. This version breaks configurations that use a number of bands not matching the HW queues when the user enables the multiqueue compile time option.
Unfortunately prio does not use nested attributes, so the easiest way is extending struct tc_prio_qopt at the end and checking the attribute size to decide whether its an old or a new version.
A better fix would be to introduce a new qdisc configuration attribute that takes precedence before TCA_OPTIONS and have userspace send both the old non-nested structure and a new nested configuration. That would make sure we never run into this problem again.
RE: [PATCH 3/3] NET: [SCHED] Qdisc changes and sch_rr added for multiqueue
In reply to Patrick McHardyQuoted 7 lines
Quoted 7 lines
#include <
linux/module.h>net/sched/sch_prio.c +2
-0@@ -40,9 +42,13 @@struct prio_sched_data {int bands; +#ifdef CONFIG_NET_SCH_RR +int curband;/* for round-robin */
Quoted 8 lines
net/sched/sch_prio.c line 53
Quoted 6 lines
net/sched/sch_prio.c +2
-0+#endif struct tcf_proto *filter_list;u8 prio2band[TC_PRIO_MAX +1 ];struct Qdisc *queues[TCQ_PRIO_BANDS ]; +u16 band2queue[TC_PRIO_MAX +1 ];Why is this still here? Its a 1:1 mapping.
Thought about this more last night and this morning. As far as I can tell, I still need this. If the qdisc gets loaded with multiqueue turned on, I can just use the value of band to assign skb->queue_mapping. But if the qdisc is loaded without multiqueue support, then I need to assign a value of zero to queue_mapping, or not assign it at all (it will be zero'd out before the call to ->enqueue() in dev_queue_xmit()). But I'd rather not have a conditional in the hotpath checking if the qdisc is multiqueue; I'd rather have the array to match the bands so I can just do an assignment.
What do you think?
Thanks,
-PJ
Re: [PATCH 3/3] NET: [SCHED] Qdisc changes and sch_rr added for multiqueue
Quoted 27 lines · Peter P
Quoted 7 lines
Quoted 7 lines
#include <
linux/module.h>(quoted diff) +0
-0@@ -40,9 +42,13 @@struct
prio_sched_data{ int bands;net/sched/sch_prio.c +2
-0+#ifdef CONFIG_NET_SCH_RR +int curband;/* for round-robin */ Quoted 8 lines
net/sched/sch_prio.c line 51
Quoted 6 lines
+#endif
struct tcf_proto *filter_list; u8 prio2band[TC_PRIO_MAX+1]; struct Qdisc *queues[TCQ_PRIO_BANDS];net/sched/sch_prio.c +1
-0+u16 band2queue[TC_PRIO_MAX +1 ];Why is this still here? Its a 1:1 mapping.
Thought about this more last night and this morning. As far as I can tell, I still need this. If the qdisc gets loaded with multiqueue turned on, I can just use the value of band to assign
skb->queue_mapping. But if the qdisc is loaded without multiqueue support, then I need to assign a value of zero toqueue_mapping, or not assign it at all (it will be zero'd out before the call to ->enqueue() indev_queue_xmit()). But I'd rather not have a conditional in the hotpath checking if the qdisc is multiqueue; I'd rather have the array to match the bands so I can just do an assignment.
Quoted 1 line
What do you think?
I very much doubt that it has any measurable impact. You can also add a small inline function
void skb_set_queue_mapping(struct sk_buff *skb, unsigned int queue) {
#ifdef CONFIG_NET_SCH_MULTIQUEUE skb->queue_mapping = queue; #else skb->queue_mapping = 0;
#endif
}
Re: [PATCH 3/3] NET: [SCHED] Qdisc changes and sch_rr added for multiqueue
Quoted 7 lines · Patrick McHardy
void
skb_set_queue_mapping(struct sk_buff *skb, unsigned int queue){#ifdef CONFIG_NET_SCH_MULTIQUEUE skb->queue_mapping = queue; #else skb->queue_mapping = 0;#endif
Maybe even use it everywhere and guard skb->queue_mapping by an #ifdef, on 32 bit it does enlarge the skb.
Re: [PATCH 3/3] NET: [SCHED] Qdisc changes and sch_rr added for multiqueue
In reply to Patrick McHardyQuoted 12 lines · Patrick McHardy
Quoted 10 lines · Peter P
Thought about this more last night and this morning. As far as I can tell, I still need this. If the qdisc gets loaded with multiqueue turned on, I can just use the value of band to assign
skb->queue_mapping. But if the qdisc is loaded without multiqueue support, then I need to assign a value of zero toqueue_mapping, or not assign it at all (it will be zero'd out before the call to ->enqueue() indev_queue_xmit()). But I'd rather not have a conditional in the hotpath checking if the qdisc is multiqueue; I'd rather have the array to match the bands so I can just do an assignment.
Quoted 8 lines
Quoted 1 line
What do you think?
I very much doubt that it has any measurable impact. You can also add a small inline function
void
skb_set_queue_mapping(struct sk_buff *skb, unsigned int queue)
OK I didn't really listen obviously :) A compile time option won't help. Just remove it and assign it conditionally.
RE: [PATCH 3/3] NET: [SCHED] Qdisc changes and sch_rr added for multiqueue
Quoted 20 lines
Quoted 3 lines · Patrick McHardy
Quoted 1 line · Peter P
Thought about this more last night and this morning. As
far as I can
Quoted 8 lines
Quoted 8 lines
tell, I still need this. If the qdisc gets loaded with multiqueue turned on, I can just use the value of band to assign
skb->queue_mapping. But if the qdisc is loaded without multiqueue support, then I need to assign a value of zero toqueue_mapping, or not assign it at all (it will be zero'd out before the call to ->enqueue() indev_queue_xmit()). But I'd rather not have a conditional in the hotpath checking if the qdisc is multiqueue; I'd rather have the array to match the bands so I can just doan assignment.
Quoted 6 lines
Quoted 2 lines
What do you think?
I very much doubt that it has any measurable impact. You
Quoted 8 lines
can also add
Quoted 3 lines
a small inline function
void
skb_set_queue_mapping(struct sk_buff *skb, unsigned int queue)OK I didn't really listen obviously :) A compile time option won't help. Just remove it and assign it conditionally.
Sounds good. Thanks Patrick.
-PJ
Quoted 5 lines · PJ Waskiewicz
I did not modify other users of
netif_queue_stopped()innet/core/netpoll.c,net/core/dev.c, ornet/core/pktgen.c, since no classification occurs for the skb being sent to the device. Therefore, packets should always be ending up in queue 0, so there's no need to check the subqueue status either.
Thats not correct. Subqueue 0 may be full and the queue still running.
I'll look over the patches later.
Quoted 11 lines
Quoted 4 lines · PJ Waskiewicz
I did not modify other users of
netif_queue_stopped()innet/core/netpoll.c,net/core/dev.c, ornet/core/pktgen.c, since no classification occurs for the skb being sent to the device. Therefore, packets should always be ending up in queue 0,so there's no need to check the subqueue status either.
Quoted 1 line
Thats not correct. Subqueue 0 may be full and the queue still running.
I'll look over the patches later.
I'm working something up to address this. The last time I thought about this, I had issues with software devices, such as loopback. They weren't allocating any subqueues at all, so they would call netif_subqueue_stopped() and panic the kernel. However, now with Dave's request to index egress_subqueue, the first queue is allocated for everyone, so loopback and other software devices should be happy. Let me put these checks back in, test it out, and resend if I don't see any issues.
Sorry for the thrash,
-PJ Waskiewicz