net: sched: update default qdisc visibility after Tx queue cnt changes
Subsystems (7)
Jakub Kicinski
maintainercover net: sched: update default qdisc visibility after Tx queue cnt changes
Matthew noticed that number of children reported by mq does not match number of queues on reconfigured interfaces. For example if mq is instantiated when there is 8 queues it will always show 8 children, regardless of config being changed:
# ethtool -L eth0 combined 8 # tc qdisc replace dev eth0 root handle 100: mq # tc qdisc show dev eth0 qdisc mq 100: root qdisc pfifo_fast 0: parent 100:8 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:7 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:6 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:5 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:4 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:3 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:2 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:1 bands 3 priomap 1 2 ... # ethtool -L eth0 combined 1 # tc qdisc show dev eth0 qdisc mq 100: root qdisc pfifo_fast 0: parent 100:8 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:7 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:6 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:5 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:4 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:3 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:2 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:1 bands 3 priomap 1 2 ... # ethtool -L eth0 combined 32 # tc qdisc show dev eth0 qdisc mq 100: root qdisc pfifo_fast 0: parent 100:8 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:7 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:6 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:5 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:4 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:3 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:2 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:1 bands 3 priomap 1 2 ...
This patchset fixes this by hashing and unhasing the default child qdiscs as number of queues gets adjusted.
Jakub Kicinski (3):
net: sched: update default qdisc visibility after Tx queue cnt changes
netdevsim: add ability to change channel count
selftests: net: test ethtool -L vs mq
drivers/net/netdevsim/ethtool.c | 28 +++++++ drivers/net/netdevsim/netdevsim.h | 1 + include/net/sch_generic.h | 4 + net/core/dev.c | 2 + net/sched/sch_generic.c | 9 +++ net/sched/sch_mq.c | 24 ++++++ net/sched/sch_mqprio.c | 23 ++++++ .../drivers/net/netdevsim/ethtool-common.sh | 2 +- .../drivers/net/netdevsim/tc-mq-visibility.sh | 77 +++++++++++++++++++ 9 files changed, 169 insertions(+), 1 deletion(-) create mode 100755 tools/testing/selftests/drivers/net/netdevsim/tc-mq-visibility.sh
Signature · 1 line
2.31.1
Jakub Kicinski
maintainerPATCH 1/3 net: sched: update default qdisc visibility after Tx queue cnt changes
mq / mqprio make the default child qdiscs visible. They only do so for the qdiscs which are within real_num_tx_queues when the device is registered. Depending on order of calls in the driver, or if user space changes config via ethtool -L the number of qdiscs visible under tc qdisc show will differ from the number of queues. This is confusing to users and potentially to system configuration scripts which try to make sure qdiscs have the right parameters.
Add a new Qdisc_ops callback and make relevant qdiscs TTRT.
Note that this uncovers the "shortcut" created by
commit 1f27cde313d7 ("net: sched: use pfifo_fast for non real queues") The default child qdiscs beyond initial real_num_tx are always pfifo_fast, no matter what the sysfs setting is. Fixing this gets a little tricky because we'd need to keep a reference on whatever the default qdisc was at the time of creation. In practice this is likely an non-issue the qdiscs likely have to be configured to non-default settings, so whatever user space is doing such configuration can replace the pfifos... now that it will see them.
--- include/net/sch_generic.h | 4 ++++ net/core/dev.c | 2 ++ net/sched/sch_generic.c | 9 +++++++++ net/sched/sch_mq.c | 24 ++++++++++++++++++++++++ net/sched/sch_mqprio.c | 23 +++++++++++++++++++++++ 5 files changed, 62 insertions(+)
include/net/sch_generic.h +4 -0
@@ -308,6 +308,8 @@ struct Qdisc_ops { struct netlink_ext_ack *extack);void (*attach)(struct Qdisc *sch);int (*change_tx_queue_len)(struct Qdisc *,unsigned int ); +void (*change_real_num_tx)(struct Qdisc *sch, +unsigned int new_real_tx);int (*dump)(struct Qdisc *,struct sk_buff *);int (*dump_stats)(struct Qdisc *,struct gnet_dump *);
@@ -684,6 +686,8 @@ void qdisc_class_hash_grow(struct Qdisc *, struct Qdisc_class_hash *);void qdisc_class_hash_destroy (struct Qdisc_class_hash *);int dev_qdisc_change_tx_queue_len (struct net_device *dev); +void dev_qdisc_change_real_num_tx (struct net_device *dev, +unsigned int new_real_tx);void dev_init_scheduler (struct net_device *dev);void dev_shutdown (struct net_device *dev);void dev_activate (struct net_device *dev);
net/core/dev.c +2 -0
@@ -2921,6 +2921,8 @@ int netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq)if (dev->num_tc)netif_setup_tc (dev, txq); +dev_qdisc_change_real_num_tx (dev, txq); + dev->real_num_tx_queues = txq;if (disabling) {
net/sched/sch_generic.c +9 -0
@@ -1330,6 +1330,15 @@ static int qdisc_change_tx_queue_len(struct net_device *dev,return 0 ; } +void dev_qdisc_change_real_num_tx (struct net_device *dev, +unsigned int new_real_tx) +{ +struct Qdisc *qdisc = dev->qdisc; + +if (qdisc->ops->change_real_num_tx) + qdisc->ops->change_real_num_tx (qdisc, new_real_tx); +} +int dev_qdisc_change_tx_queue_len (struct net_device *dev) {bool up = dev->flags &IFF_UP ;
net/sched/sch_mq.c +24 -0
@@ -125,6 +125,29 @@ static void mq_attach(struct Qdisc *sch) priv->qdiscs =NULL ; } +static void mq_change_real_num_tx (struct Qdisc *sch,unsigned int new_real_tx) +{ +#ifdef CONFIG_NET_SCHED +struct net_device *dev =qdisc_dev (sch); +struct Qdisc *qdisc; +unsigned int i; + +for (i = new_real_tx; i < dev->real_num_tx_queues; i++) { + qdisc =netdev_get_tx_queue (dev, i)->qdisc_sleeping; +/* Only update the default qdiscs we created, +* qdiscs with handles are always hashed. +*/ +if (qdisc != &noop_qdisc && !qdisc->handle) +qdisc_hash_del (qdisc); + } +for (i = dev->real_num_tx_queues; i < new_real_tx; i++) { + qdisc =netdev_get_tx_queue (dev, i)->qdisc_sleeping; +if (qdisc != &noop_qdisc && !qdisc->handle) +qdisc_hash_add (qdisc, false); + } +#endif +} +static int mq_dump (struct Qdisc *sch,struct sk_buff *skb) {struct net_device *dev =qdisc_dev (sch);
@@ -288,6 +311,7 @@ struct Qdisc_ops mq_qdisc_ops __read_mostly = { .init = mq_init, .destroy = mq_destroy, .attach = mq_attach, + .change_real_num_tx = mq_change_real_num_tx, .dump = mq_dump, .owner = THIS_MODULE, };
net/sched/sch_mqprio.c +23 -0
@@ -306,6 +306,28 @@ static void mqprio_attach(struct Qdisc *sch) priv->qdiscs =NULL ; } +static void mqprio_change_real_num_tx (struct Qdisc *sch, +unsigned int new_real_tx) +{ +struct net_device *dev =qdisc_dev (sch); +struct Qdisc *qdisc; +unsigned int i; + +for (i = new_real_tx; i < dev->real_num_tx_queues; i++) { + qdisc =netdev_get_tx_queue (dev, i)->qdisc_sleeping; +/* Only update the default qdiscs we created, +* qdiscs with handles are always hashed. +*/ +if (qdisc != &noop_qdisc && !qdisc->handle) +qdisc_hash_del (qdisc); + } +for (i = dev->real_num_tx_queues; i < new_real_tx; i++) { + qdisc =netdev_get_tx_queue (dev, i)->qdisc_sleeping; +if (qdisc != &noop_qdisc && !qdisc->handle) +qdisc_hash_add (qdisc, false); + } +} +static struct netdev_queue *mqprio_queue_get (struct Qdisc *sch,unsigned long cl) {
@@ -623,6 +645,7 @@ static struct Qdisc_ops mqprio_qdisc_ops __read_mostly = { .init = mqprio_init, .destroy = mqprio_destroy, .attach = mqprio_attach, + .change_real_num_tx = mqprio_change_real_num_tx, .dump = mqprio_dump, .owner = THIS_MODULE, };
Signature · 1 line
2.31.1
Jakub Kicinski
maintainerPATCH 2/3 netdevsim: add ability to change channel count
In reply to Jakub KicinskiFor testing visibility of mq/mqprio default children.
--- drivers/net/netdevsim/ethtool.c | 28 ++++++++++++++++++++++++++++ drivers/net/netdevsim/netdevsim.h | 1 + 2 files changed, 29 insertions(+)
drivers/net/netdevsim/ethtool.c +28 -0
@@ -81,6 +81,30 @@ static int nsim_set_ringparam(struct net_device *dev,return 0 ; } +static void +nsim_get_channels (struct net_device *dev,struct ethtool_channels *ch) +{ +struct netdevsim *ns =netdev_priv (dev); + + ch->max_combined = ns->nsim_bus_dev->num_queues; + ch->combined_count = ns->ethtool.channels; +} + +static int +nsim_set_channels (struct net_device *dev,struct ethtool_channels *ch) +{ +struct netdevsim *ns =netdev_priv (dev); +int err; + + err =netif_set_real_num_queues (dev, ch->combined_count, + ch->combined_count); +if (err) +return err; + + ns->ethtool.channels = ch->combined_count; +return 0 ; +} +static int nsim_get_fecparam (struct net_device *dev,struct ethtool_fecparam *fecparam) {
@@ -118,6 +142,8 @@ static const struct ethtool_ops nsim_ethtool_ops = { .get_coalesce = nsim_get_coalesce, .get_ringparam = nsim_get_ringparam, .set_ringparam = nsim_set_ringparam, + .get_channels = nsim_get_channels, + .set_channels = nsim_set_channels, .get_fecparam = nsim_get_fecparam, .set_fecparam = nsim_set_fecparam, };
@@ -141,6 +167,8 @@ void nsim_ethtool_init(struct netdevsim *ns) ns->ethtool.fec.fec =ETHTOOL_FEC_NONE ; ns->ethtool.fec.active_fec =ETHTOOL_FEC_NONE ; + ns->ethtool.channels = ns->nsim_bus_dev->num_queues; + ethtool =debugfs_create_dir ("ethtool" , ns->nsim_dev_port->ddir);debugfs_create_u32 ("get_err" ,0600 , ethtool, &ns->ethtool.get_err);
drivers/net/netdevsim/netdevsim.h +1 -0
@@ -62,6 +62,7 @@ struct nsim_ethtool_pauseparam {struct nsim_ethtool {u32 get_err;u32 set_err; +u32 channels;struct nsim_ethtool_pauseparam pauseparam;struct ethtool_coalesce coalesce;struct ethtool_ringparam ring;
Signature · 1 line
2.31.1
Jakub Kicinski
maintainerPATCH 3/3 selftests: net: test ethtool -L vs mq
In reply to Jakub KicinskiAdd a selftest for checking mq children are visible after ethtool -L.
--- .../drivers/net/netdevsim/ethtool-common.sh | 2 +- .../drivers/net/netdevsim/tc-mq-visibility.sh | 77 +++++++++++++++++++ 2 files changed, 78 insertions(+), 1 deletion(-) create mode 100755 tools/testing/selftests/drivers/net/netdevsim/tc-mq-visibility.sh
tools/testing/selftests/drivers/net/netdevsim/ethtool-common.sh +1 -1
@@ -50,7 +50,7 @@ function make_netdev { modprobe netdevsim fi - echo $NSIM_ID > /sys/bus/netdevsim/new_device + echo $NSIM_ID $@ > /sys/bus/netdevsim/new_device # get new device name ls /sys/bus/netdevsim/devices/netdevsim${NSIM_ID}/net/ }
tools/testing/selftests/drivers/net/netdevsim/tc-mq-visibility.sh new file +77 -0
77 lines not on this page · raw message
Signature · 1 line
2.31.1
This series was applied to netdev/net-next.git (refs/heads/master):
Hello:
This series was applied to netdev/net-next.git (refs/heads/master):
Quoted 40 lines · On Mon, 13 Sep 2021 15:53:29 -0700 you wrote:
Matthew noticed that number of children reported by mq does not match number of queues on reconfigured interfaces. For example if mq is instantiated when there is 8 queues it will always show 8 children, regardless of config being changed:
# ethtool -L eth0 combined 8 # tc qdisc replace dev eth0 root handle 100: mq # tc qdisc show dev eth0 qdisc mq 100: root qdisc pfifo_fast 0: parent 100:8 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:7 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:6 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:5 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:4 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:3 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:2 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:1 bands 3 priomap 1 2 ... # ethtool -L eth0 combined 1 # tc qdisc show dev eth0 qdisc mq 100: root qdisc pfifo_fast 0: parent 100:8 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:7 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:6 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:5 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:4 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:3 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:2 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:1 bands 3 priomap 1 2 ... # ethtool -L eth0 combined 32 # tc qdisc show dev eth0 qdisc mq 100: root qdisc pfifo_fast 0: parent 100:8 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:7 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:6 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:5 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:4 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:3 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:2 bands 3 priomap 1 2 ... qdisc pfifo_fast 0: parent 100:1 bands 3 priomap 1 2 ...
Quoted 1 line
[...]
Here is the summary with links:
- [net-next,1/3] net: sched: update default qdisc visibility after Tx queue cnt changes
https://git.kernel.org/netdev/net-next/c/1e080f17750d - [net-next,2/3] netdevsim: add ability to change channel count https://git.kernel.org/netdev/net-next/c/2e367522ce6b - [net-next,3/3] selftests: net: test ethtool -L vs mq https://git.kernel.org/netdev/net-next/c/2d6a58996ee2
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Quoted 12 lines · Jakub Kicinski
mq / mqprio make the default child qdiscs visible. They only do so for the qdiscs which are within
real_num_tx_queueswhen the device is registered. Depending on order of calls in the driver, or if user space changes config via ethtool -L the number of qdiscs visible under tc qdisc show will differ from the number of queues. This is confusing to users and potentially to system configuration scripts which try to make sure qdiscs have the right parameters.Add a new
Qdisc_opscallback and make relevant qdiscs TTRT.
Quoted 11 lines
Note that this uncovers the "shortcut" created by
commit1f27cde313d7("net: sched: usepfifo_fastfor non real queues") The default child qdiscs beyond initialreal_num_txare alwayspfifo_fast, no matter what the sysfs setting is. Fixing this gets a little tricky because we'd need to keep a reference on whatever the default qdisc was at the time of creation. In practice this is likely an non-issue the qdiscs likely have to be configured to non-default settings, so whatever user space is doing such configuration can replace the pfifos... now that it will see them.
Looks reasonable.
net/core/dev.c int netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq) · line 2925
Quoted 10 lines
net/core/dev.c +2
-0@@ -2921,6 +2921,8 @@ int netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq)if (dev->num_tc)netif_setup_tc (dev, txq); +dev_qdisc_change_real_num_tx (dev, txq); +
Don't we need to flip the device with dev_deactivate()+dev_activate()? It looks like the only thing this function resets is qdisc itself, and only partially.
Quoted 28 lines
net/core/dev.c +0
-0dev->real_num_tx_queues = txq;if (disabling) {net/sched/sch_generic.c +9
-0@@ -1330,6 +1330,15 @@ static int qdisc_change_tx_queue_len(struct net_device *dev,return 0 ; } +void dev_qdisc_change_real_num_tx (struct net_device *dev, +unsigned int new_real_tx) +{ +struct Qdisc *qdisc = dev->qdisc; + +if (qdisc->ops->change_real_num_tx) + qdisc->ops->change_real_num_tx (qdisc, new_real_tx); +} +int dev_qdisc_change_tx_queue_len (struct net_device *dev) {bool up = dev->flags &IFF_UP ;net/sched/sch_mq.c +0
-0
net/sched/sch_mq.c static void mq_attach(struct Qdisc *sch) · line 128
Quoted 4 lines
net/sched/sch_mq.c +1
-0@@ -125,6 +125,29 @@ static void mq_attach(struct Qdisc *sch) priv->qdiscs =NULL ; } +static void mq_change_real_num_tx (struct Qdisc *sch,unsigned int new_real_tx)
This is nearly identical to mqprio_change_real_num_tx(), can we reuse it?
Thanks.
Jakub Kicinski
maintainerQuoted 9 lines · On Wed, 15 Sep 2021 09:31:08 -0700 Cong Wang wrote:
Quoted 8 lines · Jakub Kicinski
net/core/dev.c +0
-0@@ -2921,6 +2921,8 @@ int netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq)if (dev->num_tc)netif_setup_tc (dev, txq);
Quoted 6 lines
net/core/dev.c int netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq) · line 2925
Quoted 2 lines
net/core/dev.c +2
-0+dev_qdisc_change_real_num_tx (dev, txq); +Don't we need to flip the device with dev_deactivate()+dev_activate()? It looks like the only thing this function resets is qdisc itself, and only partially.
We're only making the qdiscs visible, there should be no datapath-visible change.
Quoted 12 lines
Quoted 12 lines
net/core/dev.c +0
-0dev->real_num_tx_queues = txq;if (disabling) {net/sched/sch_mq.c +0
-0@@ -125,6 +125,29 @@ static void mq_attach(struct Qdisc *sch) priv->qdiscs =NULL ; }
Quoted 4 lines
net/sched/sch_mq.c static void mq_attach(struct Qdisc *sch) · line 128
Quoted 1 line
net/sched/sch_mq.c +1
-0+static void mq_change_real_num_tx (struct Qdisc *sch,unsigned int new_real_tx)This is nearly identical to
mqprio_change_real_num_tx(), can we reuse it?
Indeed, I was a little unsure where best to place the helper. Since mq is always built if mqprio is my instinct would be to export mq_change_real_num_tx and use it in mqprio. But I didn't see any existing exports (mq_attach(), mq_queue_get() are also identical and are not shared) so I just copy&pasted the logic.
LMK if (a) that's fine; (b) I should share the new code;
(c) I should post a patch to share all the code that's identical;...
Quoted 18 lines · Jakub Kicinski
Quoted 9 lines · On Wed, 15 Sep 2021 09:31:08 -0700 Cong Wang wrote:
Quoted 8 lines · Jakub Kicinski
net/core/dev.c +0
-0@@ -2921,6 +2921,8 @@ int netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq)if (dev->num_tc)netif_setup_tc (dev, txq);Quoted 6 lines
net/core/dev.c int netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq) · line 2925
Quoted 2 lines
net/core/dev.c +2
-0+dev_qdisc_change_real_num_tx (dev, txq); +Don't we need to flip the device with dev_deactivate()+dev_activate()? It looks like the only thing this function resets is qdisc itself, and only partially.
Quoted 2 lines
We're only making the qdiscs visible, there should be no datapath-visible change.
Isn't every qdisc under mq visible to datapath?
Packets can be pending in qdisc's, and qdisc's can be scheduled in TX softirq, so essentially we need to flip the device like other places.
Quoted 18 lines
Quoted 13 lines
Quoted 13 lines
net/core/dev.c +0
-0dev->real_num_tx_queues = txq;if (disabling) {net/sched/sch_mq.c +0
-0@@ -125,6 +125,29 @@ static void mq_attach(struct Qdisc *sch) priv->qdiscs =NULL ; }Quoted 4 lines
net/sched/sch_mq.c static void mq_attach(struct Qdisc *sch) · line 128
Quoted 1 line
net/sched/sch_mq.c +1
-0+static void mq_change_real_num_tx (struct Qdisc *sch,unsigned int new_real_tx)This is nearly identical to
mqprio_change_real_num_tx(), can we reuse it?
Quoted 5 lines
Indeed, I was a little unsure where best to place the helper. Since mq is always built if mqprio is my instinct would be to export
mq_change_real_num_txand use it in mqprio. But I didn't see any existing exports (mq_attach(),mq_queue_get()are also identical and are not shared) so I just copy&pasted the logic.
What about net/sched/sch_generic.c?
Quoted 3 lines
LMK if (a) that's fine; (b) I should share the new code;
(c) I should post a patch to share all the code that's identical;...
I think you can put the code in net/sched/sch_generic.c and export it for mqprio (mq is built-in so can just call it).
Thanks.
Jakub Kicinski
maintainerQuoted 6 lines · On Thu, 16 Sep 2021 22:46:42 -0700 Cong Wang wrote:
Quoted 5 lines · Jakub Kicinski
Quoted 3 lines · On Wed, 15 Sep 2021 09:31:08 -0700 Cong Wang wrote:
Don't we need to flip the device with dev_deactivate()+dev_activate()? It looks like the only thing this function resets is qdisc itself, and only partially.
Quoted 7 lines
Quoted 2 lines
We're only making the qdiscs visible, there should be no datapath-visible change.
Isn't every qdisc under mq visible to datapath?
Packets can be pending in qdisc's, and qdisc's can be scheduled in TX softirq, so essentially we need to flip the device like other
By visible I mean tc qdisc dump shows them. I'm adding/removing the qdiscs to netdev->qdisc_hash. That's only used by control paths to dump or find qdiscs by handle.
Quoted 9 lines
Quoted 8 lines
Quoted 2 lines
This is nearly identical to
mqprio_change_real_num_tx(), can we reuse it?Indeed, I was a little unsure where best to place the helper. Since mq is always built if mqprio is my instinct would be to export
mq_change_real_num_txand use it in mqprio. But I didn't see any existing exports (mq_attach(),mq_queue_get()are also identical and are not shared) so I just copy&pasted the logic.
Quoted 7 lines
What about
net/sched/sch_generic.c?Quoted 2 lines
LMK if (a) that's fine; (b) I should share the new code;
(c) I should post a patch to share all the code that's identical;...I think you can put the code in
net/sched/sch_generic.cand export it for mqprio (mq is built-in so can just call it).
Will do, thanks!
Quoted 11 lines · Jakub Kicinski
Quoted 9 lines · On Thu, 16 Sep 2021 22:46:42 -0700 Cong Wang wrote:
Quoted 7 lines · Jakub Kicinski
Quoted 3 lines · On Wed, 15 Sep 2021 09:31:08 -0700 Cong Wang wrote:
Don't we need to flip the device with dev_deactivate()+dev_activate()? It looks like the only thing this function resets is qdisc itself, and only partially.
We're only making the qdiscs visible, there should be no datapath-visible change.
Quoted 8 lines
Quoted 4 lines
Isn't every qdisc under mq visible to datapath?
Packets can be pending in qdisc's, and qdisc's can be scheduled in TX softirq, so essentially we need to flip the device like other
By visible I mean tc qdisc dump shows them. I'm adding/removing the qdiscs to
netdev->qdisc_hash. That's only used by control paths to dump or find qdiscs by handle.
Oh, I see, I missed this difference. If datapath can't see this change immediately, we don't need to flip it.
Thanks.