* [PATCH net-next] net: stmmac: fix mqprio and cbs combination
@ 2026-10-12 21:14 Lorenzo Bianconi
2026-10-13 9:51 ` Daniel Thompson
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Lorenzo Bianconi @ 2026-10-12 21:14 UTC (permalink / raw)
To: Maxime Chevallier, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Alexandre Torgue,
Davide Caratti, Lorenzo Bianconi
Cc: netdev, linux-arm-kernel, Daniel Thompson
The channel-mode mqprio offload and the CBS offload can currently not be
enabled at the same time. tc_mqprio_validate_chan_mode() refuses the
mqprio offload as soon as any TX queue is configured in AVB mode, and
tc_setup_cbs() refuses to enable CBS while the strict-priority scheduler
is active. As a result the combination is rejected whichever order the
two are configured in.
The strict-priority scheduler selected by the channel-mode mqprio
offload and the per-queue CBS shaper are independent MTL settings and do
not conflict, so drop the checks and let the combination be offloaded.
The following configuration, which was previously refused, now works:
$ tc qdisc replace dev eth0 handle 100 parent root mqprio num_tc 4 \
map 0 0 0 0 0 1 2 3 0 0 0 0 0 0 0 0 \
queues 1@0 1@1 1@2 1@3 mode channel hw 1
$ tc qdisc replace dev eth0 parent 100:2 handle 102: cbs \
idleslope 800000 sendslope -1700000 hicredit 494 locredit -1049 offload 0
$ tc qdisc replace dev eth0 parent 100:3 handle 103: cbs \
idleslope 400000 sendslope -2100000 hicredit 247 locredit -1296 offload 1
$ tc qdisc replace dev eth0 parent 100:4 handle 104: cbs \
idleslope 200000 sendslope -2300000 hicredit 124 locredit -1419 offload 1
Fixes: 47891d501e34 ("net: stmmac: add tc mqprio hw queue priority offload")
Tested-by: Daniel Thompson <daniel@riscstar.com>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 --------
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 16 ----------------
2 files changed, 24 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 56d89a696272..51d502930219 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7740,14 +7740,6 @@ int stmmac_reinit_queues(struct net_device *dev, u8 rx_cnt, u8 tx_cnt)
tx_cnt < priv->xmit_qdisc.num_tx_queues)
return -EINVAL;
- if (priv->xmit_qdisc.prio_offload) {
- for (i = priv->plat->tx_queues_to_use; i < tx_cnt; i++) {
- if (priv->plat->tx_queues_cfg[i].mode_to_use ==
- MTL_QUEUE_AVB)
- return -EINVAL;
- }
- }
-
if (netif_running(dev))
stmmac_release(dev);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
index ea1f97d6f0bd..175236ba379d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
@@ -346,9 +346,6 @@ static int tc_setup_cbs(struct stmmac_priv *priv,
if (!priv->dma_cap.av)
return -EOPNOTSUPP;
- if (qopt->enable && priv->xmit_qdisc.prio_offload)
- return -EOPNOTSUPP;
-
port_transmit_rate_kbps = qopt->idleslope - qopt->sendslope;
if (qopt->enable) {
@@ -1340,7 +1337,6 @@ static void tc_mqprio_config_queue_prio(struct stmmac_priv *priv,
static int tc_mqprio_validate_chan_mode(struct stmmac_priv *priv,
struct tc_mqprio_qopt_offload *mqprio)
{
- struct plat_stmmacenet_data *pdata = priv->plat;
struct tc_mqprio_qopt *qopt = &mqprio->qopt;
int i;
@@ -1350,18 +1346,6 @@ static int tc_mqprio_validate_chan_mode(struct stmmac_priv *priv,
return -EOPNOTSUPP;
}
- /* Forcing strict priority conflicts with the CBS algorithm
- * of AVB queues, so reject the offload when any queue is
- * configured as AVB.
- */
- for (i = 0; i < pdata->tx_queues_to_use; i++) {
- if (pdata->tx_queues_cfg[i].mode_to_use == MTL_QUEUE_AVB) {
- NL_SET_ERR_MSG_MOD(mqprio->extack,
- "SP conflicts with AVB queues");
- return -EOPNOTSUPP;
- }
- }
-
for (i = 0; i < qopt->num_tc; i++) {
/* The offload switches the MTL scheduler to strict
* priority, which only supports a 1:1 TC to TX queue
---
base-commit: d0bd617658ddfa5a115e64d1ab687bf155f6331f
change-id: 20261012-stmmac-mqprio-cbs-combo-341f12749ce2
Best regards,
--
Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net-next] net: stmmac: fix mqprio and cbs combination
2026-10-12 21:14 [PATCH net-next] net: stmmac: fix mqprio and cbs combination Lorenzo Bianconi
@ 2026-10-13 9:51 ` Daniel Thompson
2026-10-13 9:58 ` Maxime Chevallier
2026-10-13 10:10 ` Daniel Machon
2 siblings, 0 replies; 7+ messages in thread
From: Daniel Thompson @ 2026-10-13 9:51 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: Maxime Chevallier, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Alexandre Torgue,
Davide Caratti, netdev, linux-arm-kernel
On Mon, Oct 12, 2026 at 11:14:06PM +0200, Lorenzo Bianconi wrote:
> The channel-mode mqprio offload and the CBS offload can currently not be
> enabled at the same time. tc_mqprio_validate_chan_mode() refuses the
> mqprio offload as soon as any TX queue is configured in AVB mode, and
> tc_setup_cbs() refuses to enable CBS while the strict-priority scheduler
> is active. As a result the combination is rejected whichever order the
> two are configured in.
>
> The strict-priority scheduler selected by the channel-mode mqprio
> offload and the per-queue CBS shaper are independent MTL settings and do
> not conflict, so drop the checks and let the combination be offloaded.
> The following configuration, which was previously refused, now works:
>
> $ tc qdisc replace dev eth0 handle 100 parent root mqprio num_tc 4 \
> map 0 0 0 0 0 1 2 3 0 0 0 0 0 0 0 0 \
> queues 1@0 1@1 1@2 1@3 mode channel hw 1
> $ tc qdisc replace dev eth0 parent 100:2 handle 102: cbs \
> idleslope 800000 sendslope -1700000 hicredit 494 locredit -1049 offload 0
> $ tc qdisc replace dev eth0 parent 100:3 handle 103: cbs \
> idleslope 400000 sendslope -2100000 hicredit 247 locredit -1296 offload 1
> $ tc qdisc replace dev eth0 parent 100:4 handle 104: cbs \
> idleslope 200000 sendslope -2300000 hicredit 124 locredit -1419 offload 1
>
> Fixes: 47891d501e34 ("net: stmmac: add tc mqprio hw queue priority offload")
> Tested-by: Daniel Thompson <daniel@riscstar.com>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Also FWIW:
Reviewed-by: Daniel Thompson <daniel@riscstar.com>
Daniel.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next] net: stmmac: fix mqprio and cbs combination
2026-10-12 21:14 [PATCH net-next] net: stmmac: fix mqprio and cbs combination Lorenzo Bianconi
2026-10-13 9:51 ` Daniel Thompson
@ 2026-10-13 9:58 ` Maxime Chevallier
2026-10-13 10:10 ` Daniel Machon
2 siblings, 0 replies; 7+ messages in thread
From: Maxime Chevallier @ 2026-10-13 9:58 UTC (permalink / raw)
To: Lorenzo Bianconi, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Alexandre Torgue,
Davide Caratti
Cc: netdev, linux-arm-kernel, Daniel Thompson
Hi,
On 10/12/26 23:14, Lorenzo Bianconi wrote:
> The channel-mode mqprio offload and the CBS offload can currently not be
> enabled at the same time. tc_mqprio_validate_chan_mode() refuses the
> mqprio offload as soon as any TX queue is configured in AVB mode, and
> tc_setup_cbs() refuses to enable CBS while the strict-priority scheduler
> is active. As a result the combination is rejected whichever order the
> two are configured in.
>
> The strict-priority scheduler selected by the channel-mode mqprio
> offload and the per-queue CBS shaper are independent MTL settings and do
> not conflict, so drop the checks and let the combination be offloaded.
> The following configuration, which was previously refused, now works:
>
> $ tc qdisc replace dev eth0 handle 100 parent root mqprio num_tc 4 \
> map 0 0 0 0 0 1 2 3 0 0 0 0 0 0 0 0 \
> queues 1@0 1@1 1@2 1@3 mode channel hw 1
> $ tc qdisc replace dev eth0 parent 100:2 handle 102: cbs \
> idleslope 800000 sendslope -1700000 hicredit 494 locredit -1049 offload 0
> $ tc qdisc replace dev eth0 parent 100:3 handle 103: cbs \
> idleslope 400000 sendslope -2100000 hicredit 247 locredit -1296 offload 1
> $ tc qdisc replace dev eth0 parent 100:4 handle 104: cbs \
> idleslope 200000 sendslope -2300000 hicredit 124 locredit -1419 offload 1
>
> Fixes: 47891d501e34 ("net: stmmac: add tc mqprio hw queue priority offload")
> Tested-by: Daniel Thompson <daniel@riscstar.com>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Thank you Lorenzo,
Maxime
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next] net: stmmac: fix mqprio and cbs combination
2026-10-12 21:14 [PATCH net-next] net: stmmac: fix mqprio and cbs combination Lorenzo Bianconi
2026-10-13 9:51 ` Daniel Thompson
2026-10-13 9:58 ` Maxime Chevallier
@ 2026-10-13 10:10 ` Daniel Machon
2026-10-13 10:21 ` Lorenzo Bianconi
2 siblings, 1 reply; 7+ messages in thread
From: Daniel Machon @ 2026-10-13 10:10 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: Maxime Chevallier, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Alexandre Torgue,
Davide Caratti, netdev, linux-arm-kernel, Daniel Thompson
Hi Lorenzo,
Just a question:
> The channel-mode mqprio offload and the CBS offload can currently not be
> enabled at the same time. tc_mqprio_validate_chan_mode() refuses the
> mqprio offload as soon as any TX queue is configured in AVB mode, and
> tc_setup_cbs() refuses to enable CBS while the strict-priority scheduler
> is active. As a result the combination is rejected whichever order the
> two are configured in.
>
> The strict-priority scheduler selected by the channel-mode mqprio
> offload and the per-queue CBS shaper are independent MTL settings and do
> not conflict, so drop the checks and let the combination be offloaded.
> The following configuration, which was previously refused, now works:
Looks to me like these checks are shared by multiple cores. Are the MTL settings
independent on all of them?
>
> $ tc qdisc replace dev eth0 handle 100 parent root mqprio num_tc 4 \
> map 0 0 0 0 0 1 2 3 0 0 0 0 0 0 0 0 \
> queues 1@0 1@1 1@2 1@3 mode channel hw 1
> $ tc qdisc replace dev eth0 parent 100:2 handle 102: cbs \
> idleslope 800000 sendslope -1700000 hicredit 494 locredit -1049 offload 0
> $ tc qdisc replace dev eth0 parent 100:3 handle 103: cbs \
> idleslope 400000 sendslope -2100000 hicredit 247 locredit -1296 offload 1
> $ tc qdisc replace dev eth0 parent 100:4 handle 104: cbs \
> idleslope 200000 sendslope -2300000 hicredit 124 locredit -1419 offload 1
>
> Fixes: 47891d501e34 ("net: stmmac: add tc mqprio hw queue priority offload")
> Tested-by: Daniel Thompson <daniel@riscstar.com>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 --------
> drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 16 ----------------
> 2 files changed, 24 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 56d89a696272..51d502930219 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -7740,14 +7740,6 @@ int stmmac_reinit_queues(struct net_device *dev, u8 rx_cnt, u8 tx_cnt)
> tx_cnt < priv->xmit_qdisc.num_tx_queues)
> return -EINVAL;
>
> - if (priv->xmit_qdisc.prio_offload) {
> - for (i = priv->plat->tx_queues_to_use; i < tx_cnt; i++) {
> - if (priv->plat->tx_queues_cfg[i].mode_to_use ==
> - MTL_QUEUE_AVB)
> - return -EINVAL;
> - }
> - }
> -
> if (netif_running(dev))
> stmmac_release(dev);
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
> index ea1f97d6f0bd..175236ba379d 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
> @@ -346,9 +346,6 @@ static int tc_setup_cbs(struct stmmac_priv *priv,
> if (!priv->dma_cap.av)
> return -EOPNOTSUPP;
>
> - if (qopt->enable && priv->xmit_qdisc.prio_offload)
> - return -EOPNOTSUPP;
> -
> port_transmit_rate_kbps = qopt->idleslope - qopt->sendslope;
>
> if (qopt->enable) {
> @@ -1340,7 +1337,6 @@ static void tc_mqprio_config_queue_prio(struct stmmac_priv *priv,
> static int tc_mqprio_validate_chan_mode(struct stmmac_priv *priv,
> struct tc_mqprio_qopt_offload *mqprio)
> {
> - struct plat_stmmacenet_data *pdata = priv->plat;
> struct tc_mqprio_qopt *qopt = &mqprio->qopt;
> int i;
>
> @@ -1350,18 +1346,6 @@ static int tc_mqprio_validate_chan_mode(struct stmmac_priv *priv,
> return -EOPNOTSUPP;
> }
>
> - /* Forcing strict priority conflicts with the CBS algorithm
> - * of AVB queues, so reject the offload when any queue is
> - * configured as AVB.
> - */
> - for (i = 0; i < pdata->tx_queues_to_use; i++) {
> - if (pdata->tx_queues_cfg[i].mode_to_use == MTL_QUEUE_AVB) {
> - NL_SET_ERR_MSG_MOD(mqprio->extack,
> - "SP conflicts with AVB queues");
> - return -EOPNOTSUPP;
> - }
> - }
> -
> for (i = 0; i < qopt->num_tc; i++) {
> /* The offload switches the MTL scheduler to strict
> * priority, which only supports a 1:1 TC to TX queue
>
> ---
> base-commit: d0bd617658ddfa5a115e64d1ab687bf155f6331f
> change-id: 20261012-stmmac-mqprio-cbs-combo-341f12749ce2
>
> Best regards,
> --
> Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
>
/Daniel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next] net: stmmac: fix mqprio and cbs combination
2026-10-13 10:10 ` Daniel Machon
@ 2026-10-13 10:21 ` Lorenzo Bianconi
2026-10-13 10:43 ` Daniel Machon
0 siblings, 1 reply; 7+ messages in thread
From: Lorenzo Bianconi @ 2026-10-13 10:21 UTC (permalink / raw)
To: Daniel Machon
Cc: Maxime Chevallier, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Alexandre Torgue,
Davide Caratti, netdev, linux-arm-kernel, Daniel Thompson
[-- Attachment #1: Type: text/plain, Size: 4973 bytes --]
On Oct 13, Daniel Machon wrote:
> Hi Lorenzo,
>
> Just a question:
>
> > The channel-mode mqprio offload and the CBS offload can currently not be
> > enabled at the same time. tc_mqprio_validate_chan_mode() refuses the
> > mqprio offload as soon as any TX queue is configured in AVB mode, and
> > tc_setup_cbs() refuses to enable CBS while the strict-priority scheduler
> > is active. As a result the combination is rejected whichever order the
> > two are configured in.
> >
> > The strict-priority scheduler selected by the channel-mode mqprio
> > offload and the per-queue CBS shaper are independent MTL settings and do
> > not conflict, so drop the checks and let the combination be offloaded.
> > The following configuration, which was previously refused, now works:
>
> Looks to me like these checks are shared by multiple cores. Are the MTL settings
> independent on all of them?
Can you please explain what you mean?
What I mean with this patch is we can have a given queue (e.g. queue X)
configured in MTL_QUEUE_AVB mode and another one (e.g. queue Y) configured
in MTL_QUEUE_DCB mode.
Regards,
Lorenzo
>
> >
> > $ tc qdisc replace dev eth0 handle 100 parent root mqprio num_tc 4 \
> > map 0 0 0 0 0 1 2 3 0 0 0 0 0 0 0 0 \
> > queues 1@0 1@1 1@2 1@3 mode channel hw 1
> > $ tc qdisc replace dev eth0 parent 100:2 handle 102: cbs \
> > idleslope 800000 sendslope -1700000 hicredit 494 locredit -1049 offload 0
> > $ tc qdisc replace dev eth0 parent 100:3 handle 103: cbs \
> > idleslope 400000 sendslope -2100000 hicredit 247 locredit -1296 offload 1
> > $ tc qdisc replace dev eth0 parent 100:4 handle 104: cbs \
> > idleslope 200000 sendslope -2300000 hicredit 124 locredit -1419 offload 1
> >
> > Fixes: 47891d501e34 ("net: stmmac: add tc mqprio hw queue priority offload")
> > Tested-by: Daniel Thompson <daniel@riscstar.com>
> > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
> > ---
> > drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 --------
> > drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 16 ----------------
> > 2 files changed, 24 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > index 56d89a696272..51d502930219 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > @@ -7740,14 +7740,6 @@ int stmmac_reinit_queues(struct net_device *dev, u8 rx_cnt, u8 tx_cnt)
> > tx_cnt < priv->xmit_qdisc.num_tx_queues)
> > return -EINVAL;
> >
> > - if (priv->xmit_qdisc.prio_offload) {
> > - for (i = priv->plat->tx_queues_to_use; i < tx_cnt; i++) {
> > - if (priv->plat->tx_queues_cfg[i].mode_to_use ==
> > - MTL_QUEUE_AVB)
> > - return -EINVAL;
> > - }
> > - }
> > -
> > if (netif_running(dev))
> > stmmac_release(dev);
> >
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
> > index ea1f97d6f0bd..175236ba379d 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
> > @@ -346,9 +346,6 @@ static int tc_setup_cbs(struct stmmac_priv *priv,
> > if (!priv->dma_cap.av)
> > return -EOPNOTSUPP;
> >
> > - if (qopt->enable && priv->xmit_qdisc.prio_offload)
> > - return -EOPNOTSUPP;
> > -
> > port_transmit_rate_kbps = qopt->idleslope - qopt->sendslope;
> >
> > if (qopt->enable) {
> > @@ -1340,7 +1337,6 @@ static void tc_mqprio_config_queue_prio(struct stmmac_priv *priv,
> > static int tc_mqprio_validate_chan_mode(struct stmmac_priv *priv,
> > struct tc_mqprio_qopt_offload *mqprio)
> > {
> > - struct plat_stmmacenet_data *pdata = priv->plat;
> > struct tc_mqprio_qopt *qopt = &mqprio->qopt;
> > int i;
> >
> > @@ -1350,18 +1346,6 @@ static int tc_mqprio_validate_chan_mode(struct stmmac_priv *priv,
> > return -EOPNOTSUPP;
> > }
> >
> > - /* Forcing strict priority conflicts with the CBS algorithm
> > - * of AVB queues, so reject the offload when any queue is
> > - * configured as AVB.
> > - */
> > - for (i = 0; i < pdata->tx_queues_to_use; i++) {
> > - if (pdata->tx_queues_cfg[i].mode_to_use == MTL_QUEUE_AVB) {
> > - NL_SET_ERR_MSG_MOD(mqprio->extack,
> > - "SP conflicts with AVB queues");
> > - return -EOPNOTSUPP;
> > - }
> > - }
> > -
> > for (i = 0; i < qopt->num_tc; i++) {
> > /* The offload switches the MTL scheduler to strict
> > * priority, which only supports a 1:1 TC to TX queue
> >
> > ---
> > base-commit: d0bd617658ddfa5a115e64d1ab687bf155f6331f
> > change-id: 20261012-stmmac-mqprio-cbs-combo-341f12749ce2
> >
> > Best regards,
> > --
> > Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
> >
>
> /Daniel
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next] net: stmmac: fix mqprio and cbs combination
2026-10-13 10:21 ` Lorenzo Bianconi
@ 2026-10-13 10:43 ` Daniel Machon
2026-10-13 12:24 ` Lorenzo Bianconi
0 siblings, 1 reply; 7+ messages in thread
From: Daniel Machon @ 2026-10-13 10:43 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: Maxime Chevallier, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Alexandre Torgue,
Davide Caratti, netdev, linux-arm-kernel, Daniel Thompson
> On Oct 13, Daniel Machon wrote:
> > Hi Lorenzo,
> >
> > Just a question:
> >
> > > The channel-mode mqprio offload and the CBS offload can currently not be
> > > enabled at the same time. tc_mqprio_validate_chan_mode() refuses the
> > > mqprio offload as soon as any TX queue is configured in AVB mode, and
> > > tc_setup_cbs() refuses to enable CBS while the strict-priority scheduler
> > > is active. As a result the combination is rejected whichever order the
> > > two are configured in.
> > >
> > > The strict-priority scheduler selected by the channel-mode mqprio
> > > offload and the per-queue CBS shaper are independent MTL settings and do
> > > not conflict, so drop the checks and let the combination be offloaded.
> > > The following configuration, which was previously refused, now works:
> >
> > Looks to me like these checks are shared by multiple cores. Are the MTL settings
> > independent on all of them?
>
> Can you please explain what you mean?
> What I mean with this patch is we can have a given queue (e.g. queue X)
> configured in MTL_QUEUE_AVB mode and another one (e.g. queue Y) configured
> in MTL_QUEUE_DCB mode.
Sorry for being vague. I meant the MAC cores. So, dwmac510_tc_ops is being used
by GMAC, XGMAC, XLGMAC. My question was whether the claim that the commit
description gives (per-queue CBS shaper are independent MTL settings) apply to
all of these 3?
>
> Regards,
> Lorenzo
>
> >
> > >
> > > $ tc qdisc replace dev eth0 handle 100 parent root mqprio num_tc 4 \
> > > map 0 0 0 0 0 1 2 3 0 0 0 0 0 0 0 0 \
> > > queues 1@0 1@1 1@2 1@3 mode channel hw 1
> > > $ tc qdisc replace dev eth0 parent 100:2 handle 102: cbs \
> > > idleslope 800000 sendslope -1700000 hicredit 494 locredit -1049 offload 0
> > > $ tc qdisc replace dev eth0 parent 100:3 handle 103: cbs \
> > > idleslope 400000 sendslope -2100000 hicredit 247 locredit -1296 offload 1
> > > $ tc qdisc replace dev eth0 parent 100:4 handle 104: cbs \
> > > idleslope 200000 sendslope -2300000 hicredit 124 locredit -1419 offload 1
> > >
> > > Fixes: 47891d501e34 ("net: stmmac: add tc mqprio hw queue priority offload")
> > > Tested-by: Daniel Thompson <daniel@riscstar.com>
> > > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
> > > ---
> > > drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 --------
> > > drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 16 ----------------
> > > 2 files changed, 24 deletions(-)
> > >
> > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > > index 56d89a696272..51d502930219 100644
> > > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > > @@ -7740,14 +7740,6 @@ int stmmac_reinit_queues(struct net_device *dev, u8 rx_cnt, u8 tx_cnt)
> > > tx_cnt < priv->xmit_qdisc.num_tx_queues)
> > > return -EINVAL;
> > >
> > > - if (priv->xmit_qdisc.prio_offload) {
> > > - for (i = priv->plat->tx_queues_to_use; i < tx_cnt; i++) {
> > > - if (priv->plat->tx_queues_cfg[i].mode_to_use ==
> > > - MTL_QUEUE_AVB)
> > > - return -EINVAL;
> > > - }
> > > - }
> > > -
> > > if (netif_running(dev))
> > > stmmac_release(dev);
> > >
> > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
> > > index ea1f97d6f0bd..175236ba379d 100644
> > > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
> > > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
> > > @@ -346,9 +346,6 @@ static int tc_setup_cbs(struct stmmac_priv *priv,
> > > if (!priv->dma_cap.av)
> > > return -EOPNOTSUPP;
> > >
> > > - if (qopt->enable && priv->xmit_qdisc.prio_offload)
> > > - return -EOPNOTSUPP;
> > > -
> > > port_transmit_rate_kbps = qopt->idleslope - qopt->sendslope;
> > >
> > > if (qopt->enable) {
> > > @@ -1340,7 +1337,6 @@ static void tc_mqprio_config_queue_prio(struct stmmac_priv *priv,
> > > static int tc_mqprio_validate_chan_mode(struct stmmac_priv *priv,
> > > struct tc_mqprio_qopt_offload *mqprio)
> > > {
> > > - struct plat_stmmacenet_data *pdata = priv->plat;
> > > struct tc_mqprio_qopt *qopt = &mqprio->qopt;
> > > int i;
> > >
> > > @@ -1350,18 +1346,6 @@ static int tc_mqprio_validate_chan_mode(struct stmmac_priv *priv,
> > > return -EOPNOTSUPP;
> > > }
> > >
> > > - /* Forcing strict priority conflicts with the CBS algorithm
> > > - * of AVB queues, so reject the offload when any queue is
> > > - * configured as AVB.
> > > - */
> > > - for (i = 0; i < pdata->tx_queues_to_use; i++) {
> > > - if (pdata->tx_queues_cfg[i].mode_to_use == MTL_QUEUE_AVB) {
> > > - NL_SET_ERR_MSG_MOD(mqprio->extack,
> > > - "SP conflicts with AVB queues");
> > > - return -EOPNOTSUPP;
> > > - }
> > > - }
> > > -
> > > for (i = 0; i < qopt->num_tc; i++) {
> > > /* The offload switches the MTL scheduler to strict
> > > * priority, which only supports a 1:1 TC to TX queue
> > >
> > > ---
> > > base-commit: d0bd617658ddfa5a115e64d1ab687bf155f6331f
> > > change-id: 20261012-stmmac-mqprio-cbs-combo-341f12749ce2
> > >
> > > Best regards,
> > > --
> > > Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
> > >
> >
> > /Daniel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next] net: stmmac: fix mqprio and cbs combination
2026-10-13 10:43 ` Daniel Machon
@ 2026-10-13 12:24 ` Lorenzo Bianconi
0 siblings, 0 replies; 7+ messages in thread
From: Lorenzo Bianconi @ 2026-10-13 12:24 UTC (permalink / raw)
To: Daniel Machon
Cc: Maxime Chevallier, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Alexandre Torgue,
Davide Caratti, netdev, linux-arm-kernel, Daniel Thompson
[-- Attachment #1: Type: text/plain, Size: 5970 bytes --]
> > On Oct 13, Daniel Machon wrote:
> > > Hi Lorenzo,
> > >
> > > Just a question:
> > >
> > > > The channel-mode mqprio offload and the CBS offload can currently not be
> > > > enabled at the same time. tc_mqprio_validate_chan_mode() refuses the
> > > > mqprio offload as soon as any TX queue is configured in AVB mode, and
> > > > tc_setup_cbs() refuses to enable CBS while the strict-priority scheduler
> > > > is active. As a result the combination is rejected whichever order the
> > > > two are configured in.
> > > >
> > > > The strict-priority scheduler selected by the channel-mode mqprio
> > > > offload and the per-queue CBS shaper are independent MTL settings and do
> > > > not conflict, so drop the checks and let the combination be offloaded.
> > > > The following configuration, which was previously refused, now works:
> > >
> > > Looks to me like these checks are shared by multiple cores. Are the MTL settings
> > > independent on all of them?
> >
> > Can you please explain what you mean?
> > What I mean with this patch is we can have a given queue (e.g. queue X)
> > configured in MTL_QUEUE_AVB mode and another one (e.g. queue Y) configured
> > in MTL_QUEUE_DCB mode.
>
> Sorry for being vague. I meant the MAC cores. So, dwmac510_tc_ops is being used
> by GMAC, XGMAC, XLGMAC. My question was whether the claim that the commit
> description gives (per-queue CBS shaper are independent MTL settings) apply to
> all of these 3?
Yes, according to my understanding. MTL_QUEUE_AVB and MTL_QUEUE_DCB are
mutually exclusive for a specific queue, but there is no restriction on two
different hw queues (MTL_QUEUE_AVB and MTL_QUEUE_DCB can be mixed).
Regards,
Lorenzo
>
> >
> > Regards,
> > Lorenzo
> >
> > >
> > > >
> > > > $ tc qdisc replace dev eth0 handle 100 parent root mqprio num_tc 4 \
> > > > map 0 0 0 0 0 1 2 3 0 0 0 0 0 0 0 0 \
> > > > queues 1@0 1@1 1@2 1@3 mode channel hw 1
> > > > $ tc qdisc replace dev eth0 parent 100:2 handle 102: cbs \
> > > > idleslope 800000 sendslope -1700000 hicredit 494 locredit -1049 offload 0
> > > > $ tc qdisc replace dev eth0 parent 100:3 handle 103: cbs \
> > > > idleslope 400000 sendslope -2100000 hicredit 247 locredit -1296 offload 1
> > > > $ tc qdisc replace dev eth0 parent 100:4 handle 104: cbs \
> > > > idleslope 200000 sendslope -2300000 hicredit 124 locredit -1419 offload 1
> > > >
> > > > Fixes: 47891d501e34 ("net: stmmac: add tc mqprio hw queue priority offload")
> > > > Tested-by: Daniel Thompson <daniel@riscstar.com>
> > > > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
> > > > ---
> > > > drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 --------
> > > > drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 16 ----------------
> > > > 2 files changed, 24 deletions(-)
> > > >
> > > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > > > index 56d89a696272..51d502930219 100644
> > > > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > > > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > > > @@ -7740,14 +7740,6 @@ int stmmac_reinit_queues(struct net_device *dev, u8 rx_cnt, u8 tx_cnt)
> > > > tx_cnt < priv->xmit_qdisc.num_tx_queues)
> > > > return -EINVAL;
> > > >
> > > > - if (priv->xmit_qdisc.prio_offload) {
> > > > - for (i = priv->plat->tx_queues_to_use; i < tx_cnt; i++) {
> > > > - if (priv->plat->tx_queues_cfg[i].mode_to_use ==
> > > > - MTL_QUEUE_AVB)
> > > > - return -EINVAL;
> > > > - }
> > > > - }
> > > > -
> > > > if (netif_running(dev))
> > > > stmmac_release(dev);
> > > >
> > > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
> > > > index ea1f97d6f0bd..175236ba379d 100644
> > > > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
> > > > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
> > > > @@ -346,9 +346,6 @@ static int tc_setup_cbs(struct stmmac_priv *priv,
> > > > if (!priv->dma_cap.av)
> > > > return -EOPNOTSUPP;
> > > >
> > > > - if (qopt->enable && priv->xmit_qdisc.prio_offload)
> > > > - return -EOPNOTSUPP;
> > > > -
> > > > port_transmit_rate_kbps = qopt->idleslope - qopt->sendslope;
> > > >
> > > > if (qopt->enable) {
> > > > @@ -1340,7 +1337,6 @@ static void tc_mqprio_config_queue_prio(struct stmmac_priv *priv,
> > > > static int tc_mqprio_validate_chan_mode(struct stmmac_priv *priv,
> > > > struct tc_mqprio_qopt_offload *mqprio)
> > > > {
> > > > - struct plat_stmmacenet_data *pdata = priv->plat;
> > > > struct tc_mqprio_qopt *qopt = &mqprio->qopt;
> > > > int i;
> > > >
> > > > @@ -1350,18 +1346,6 @@ static int tc_mqprio_validate_chan_mode(struct stmmac_priv *priv,
> > > > return -EOPNOTSUPP;
> > > > }
> > > >
> > > > - /* Forcing strict priority conflicts with the CBS algorithm
> > > > - * of AVB queues, so reject the offload when any queue is
> > > > - * configured as AVB.
> > > > - */
> > > > - for (i = 0; i < pdata->tx_queues_to_use; i++) {
> > > > - if (pdata->tx_queues_cfg[i].mode_to_use == MTL_QUEUE_AVB) {
> > > > - NL_SET_ERR_MSG_MOD(mqprio->extack,
> > > > - "SP conflicts with AVB queues");
> > > > - return -EOPNOTSUPP;
> > > > - }
> > > > - }
> > > > -
> > > > for (i = 0; i < qopt->num_tc; i++) {
> > > > /* The offload switches the MTL scheduler to strict
> > > > * priority, which only supports a 1:1 TC to TX queue
> > > >
> > > > ---
> > > > base-commit: d0bd617658ddfa5a115e64d1ab687bf155f6331f
> > > > change-id: 20261012-stmmac-mqprio-cbs-combo-341f12749ce2
> > > >
> > > > Best regards,
> > > > --
> > > > Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
> > > >
> > >
> > > /Daniel
>
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-10-13 12:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-12 21:14 [PATCH net-next] net: stmmac: fix mqprio and cbs combination Lorenzo Bianconi
2026-10-13 9:51 ` Daniel Thompson
2026-10-13 9:58 ` Maxime Chevallier
2026-10-13 10:10 ` Daniel Machon
2026-10-13 10:21 ` Lorenzo Bianconi
2026-10-13 10:43 ` Daniel Machon
2026-10-13 12:24 ` Lorenzo Bianconi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox