🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
6 messages
6 total messages Started by Lorenzo Bianconi Mon, 12 Oct 2026 21:14
[PATCH net-next] net: stmmac: fix mqprio and cbs combination
#2519
Author: Lorenzo Bianconi
Date: Mon, 12 Oct 2026 21:14
99 lines
15386 bytes
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>
Re: [PATCH net-next] net: stmmac: fix mqprio and cbs combination
#2722
Author: Daniel Thompson
Date: Tue, 13 Oct 2026 09:51
33 lines
10273 bytes
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.
Re: [PATCH net-next] net: stmmac: fix mqprio and cbs combination
#2725
Author: Lorenzo Bianconi
Date: Tue, 13 Oct 2026 10:21
148 lines
17447 bytes
--kEZubP9inIt+EcXY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Oct 13, Daniel Machon wrote:
> Hi Lorenzo,
>=20
> Just a question:
>=20
> > 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.
> >=20
> > 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:
>=20
> Looks to me like these checks are shared by multiple cores. Are the MTL s=
ettings
> 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

>=20
> >=20
> >   $ 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
> >=20
> > Fixes: 47891d501e34 ("net: stmmac: add tc mqprio hw queue priority offl=
oad")
> > 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(-)
> >=20
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/driver=
s/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;
> > =20
> > -	if (priv->xmit_qdisc.prio_offload) {
> > -		for (i =3D priv->plat->tx_queues_to_use; i < tx_cnt; i++) {
> > -			if (priv->plat->tx_queues_cfg[i].mode_to_use =3D=3D
> > -			    MTL_QUEUE_AVB)
> > -				return -EINVAL;
> > -		}
> > -	}
> > -
> >  	if (netif_running(dev))
> >  		stmmac_release(dev);
> > =20
> > 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;
> > =20
> > -	if (qopt->enable && priv->xmit_qdisc.prio_offload)
> > -		return -EOPNOTSUPP;
> > -
> >  	port_transmit_rate_kbps =3D qopt->idleslope - qopt->sendslope;
> > =20
> >  	if (qopt->enable) {
> > @@ -1340,7 +1337,6 @@ static void tc_mqprio_config_queue_prio(struct st=
mmac_priv *priv,
> >  static int tc_mqprio_validate_chan_mode(struct stmmac_priv *priv,
> >  					struct tc_mqprio_qopt_offload *mqprio)
> >  {
> > -	struct plat_stmmacenet_data *pdata =3D priv->plat;
> >  	struct tc_mqprio_qopt *qopt =3D &mqprio->qopt;
> >  	int i;
> > =20
> > @@ -1350,18 +1346,6 @@ static int tc_mqprio_validate_chan_mode(struct s=
tmmac_priv *priv,
> >  		return -EOPNOTSUPP;
> >  	}
> > =20
> > -	/* Forcing strict priority conflicts with the CBS algorithm
> > -	 * of AVB queues, so reject the offload when any queue is
> > -	 * configured as AVB.
> > -	 */
> > -	for (i =3D 0; i < pdata->tx_queues_to_use; i++) {
> > -		if (pdata->tx_queues_cfg[i].mode_to_use =3D=3D MTL_QUEUE_AVB) {
> > -			NL_SET_ERR_MSG_MOD(mqprio->extack,
> > -					   "SP conflicts with AVB queues");
> > -			return -EOPNOTSUPP;
> > -		}
> > -	}
> > -
> >  	for (i =3D 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
> >=20
> > ---
> > base-commit: d0bd617658ddfa5a115e64d1ab687bf155f6331f
> > change-id: 20261012-stmmac-mqprio-cbs-combo-341f12749ce2
> >=20
> > Best regards,
> > --=20
> > Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
> >=20
>=20
> /Daniel

--kEZubP9inIt+EcXY
Content-Type: application/pgp-signature; name=signature.asc

-----BEGIN PGP SIGNATURE-----

iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCas4GJQAKCRA6cBh0uS2t
rL5PAP96OeU3WRJ+TomdoC9LeM8yGVHFcEqblfYZI9SX0VBt0wEAjcs9EIgh1j6f
yQB9U+DWjdpb/AWwTIFJgUtAxr5M3Qk=
=VGRf
-----END PGP SIGNATURE-----

--kEZubP9inIt+EcXY--
Re: [PATCH net-next] net: stmmac: fix mqprio and cbs combination
#2794
Author: Lorenzo Bianconi
Date: Tue, 13 Oct 2026 12:24
177 lines
18587 bytes
--N9isKUosey8taFli
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

> > On Oct 13, Daniel Machon wrote:
> > > Hi Lorenzo,
> > >=20
> > > Just a question:
> > >=20
> > > > The channel-mode mqprio offload and the CBS offload can currently n=
ot 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, a=
nd
> > > > tc_setup_cbs() refuses to enable CBS while the strict-priority sche=
duler
> > > > is active. As a result the combination is rejected whichever order =
the
> > > > two are configured in.
> > > >=20
> > > > The strict-priority scheduler selected by the channel-mode mqprio
> > > > offload and the per-queue CBS shaper are independent MTL settings a=
nd do
> > > > not conflict, so drop the checks and let the combination be offload=
ed.
> > > > The following configuration, which was previously refused, now work=
s:
> > >=20
> > > Looks to me like these checks are shared by multiple cores. Are the M=
TL settings
> > > independent on all of them?
> >=20
> > 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) configu=
red
> > in MTL_QUEUE_DCB mode.
>=20
> Sorry for being vague. I meant the MAC cores. So, dwmac510_tc_ops is bein=
g used
> by GMAC, XGMAC, XLGMAC. My question was whether the claim that the commit
> description gives (per-queue CBS shaper are independent MTL settings) app=
ly 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

>=20
> >=20
> > Regards,
> > Lorenzo
> >=20
> > >=20
> > > >=20
> > > >   $ 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
> > > >=20
> > > > 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(-)
> > > >=20
> > > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/dr=
ivers/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;
> > > > =20
> > > > -	if (priv->xmit_qdisc.prio_offload) {
> > > > -		for (i =3D priv->plat->tx_queues_to_use; i < tx_cnt; i++) {
> > > > -			if (priv->plat->tx_queues_cfg[i].mode_to_use =3D=3D
> > > > -			    MTL_QUEUE_AVB)
> > > > -				return -EINVAL;
> > > > -		}
> > > > -	}
> > > > -
> > > >  	if (netif_running(dev))
> > > >  		stmmac_release(dev);
> > > > =20
> > > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/driv=
ers/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 *pri=
v,
> > > >  	if (!priv->dma_cap.av)
> > > >  		return -EOPNOTSUPP;
> > > > =20
> > > > -	if (qopt->enable && priv->xmit_qdisc.prio_offload)
> > > > -		return -EOPNOTSUPP;
> > > > -
> > > >  	port_transmit_rate_kbps =3D qopt->idleslope - qopt->sendslope;
> > > > =20
> > > >  	if (qopt->enable) {
> > > > @@ -1340,7 +1337,6 @@ static void tc_mqprio_config_queue_prio(struc=
t 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 =3D priv->plat;
> > > >  	struct tc_mqprio_qopt *qopt =3D &mqprio->qopt;
> > > >  	int i;
> > > > =20
> > > > @@ -1350,18 +1346,6 @@ static int tc_mqprio_validate_chan_mode(stru=
ct stmmac_priv *priv,
> > > >  		return -EOPNOTSUPP;
> > > >  	}
> > > > =20
> > > > -	/* Forcing strict priority conflicts with the CBS algorithm
> > > > -	 * of AVB queues, so reject the offload when any queue is
> > > > -	 * configured as AVB.
> > > > -	 */
> > > > -	for (i =3D 0; i < pdata->tx_queues_to_use; i++) {
> > > > -		if (pdata->tx_queues_cfg[i].mode_to_use =3D=3D MTL_QUEUE_AVB) {
> > > > -			NL_SET_ERR_MSG_MOD(mqprio->extack,
> > > > -					   "SP conflicts with AVB queues");
> > > > -			return -EOPNOTSUPP;
> > > > -		}
> > > > -	}
> > > > -
> > > >  	for (i =3D 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
> > > >=20
> > > > ---
> > > > base-commit: d0bd617658ddfa5a115e64d1ab687bf155f6331f
> > > > change-id: 20261012-stmmac-mqprio-cbs-combo-341f12749ce2
> > > >=20
> > > > Best regards,
> > > > --=20
> > > > Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
> > > >=20
> > >=20
> > > /Daniel
>=20
>=20

--N9isKUosey8taFli
Content-Type: application/pgp-signature; name=signature.asc

-----BEGIN PGP SIGNATURE-----

iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCas4jDQAKCRA6cBh0uS2t
rCkRAP45m7SIjwOdxBQYPN15+CQ4puHY3w4+MjjuXw34i24K6AD8DaivhbgUtFls
WzPW9+mrIyv8adf5/ND4CeqMcwXH4Q8=
=HtK7
-----END PGP SIGNATURE-----

--N9isKUosey8taFli--
Re: [PATCH net-next] net: stmmac: fix mqprio and cbs combination
#2953
Author: netdev-bot+sashiko
Date: Tue, 13 Oct 2026 21:15
128 lines
10422 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 1 · Medium: 0 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [High] The commit message says the strict-priority scheduler selected
  by the channel-mode mqprio offload and the per-queue CBS shaper "are…

--

net: stmmac: fix mqprio and cbs combination

This patch removes the checks that stopped the channel-mode mqprio offload
and the CBS offload from being enabled together. It drops the AVB queue
rejection in tc_mqprio_validate_chan_mode(), the prio_offload check in
tc_setup_cbs(), and the matching AVB check in stmmac_reinit_queues().

> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
> index ea1f97d6f0bd5..175236ba379d0 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c

[ ... ]

> @@ -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;
> -		}
> -	}
> -

[Severity: High]

The commit message says:

  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

Is that true on XGMAC/XLGMAC cores? They use dwmac510_tc_ops, so both
tc_setup_dwmac510_mqprio() and tc_setup_cbs() can be reached on them.

On XGMAC, SP and CBS look like two values of the same per-TC TSA field.
dwxgmac2_prog_mtl_tx_algorithms() rewrites that field on every TC:

drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c:dwxgmac2_prog_mtl_tx_algorithms() {
    ...
	for (i = 0; i < MTL_MAX_TX_QUEUES; i++) {
		value = readl(ioaddr + XGMAC_MTL_TCx_ETS_CONTROL(i));
		value &= ~XGMAC_TSA;
		if (ets)
			value |= XGMAC_ETS;
		writel(value, ioaddr + XGMAC_MTL_TCx_ETS_CONTROL(i));
	}
}

dwxgmac2_config_cbs() turns CBS on by writing the same field:

drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c:dwxgmac2_config_cbs() {
    ...
	value = readl(ioaddr + XGMAC_MTL_TCx_ETS_CONTROL(queue));
	value &= ~XGMAC_TSA;
	value |= XGMAC_CC | XGMAC_CBS;
	writel(value, ioaddr + XGMAC_MTL_TCx_ETS_CONTROL(queue));
}

With this check gone, what happens if a TX queue is already in AVB mode?
One way to get there is a DT mtl-tx-config queue with snps,avb-algorithm.
In that case stmmac_open()->stmmac_mtl_configuration() programs CBS for the
queue when the device is opened.

After that, "tc qdisc replace ... mqprio ... mode channel hw 1" now
succeeds and runs:

tc_setup_dwmac510_mqprio()
  tc_mqprio_validate_chan_mode()
  tc_mqprio_config_queue_prio()
    stmmac_prog_mtl_tx_algorithms(priv, priv->hw, MTL_TX_ALGORITHM_SP)
      dwxgmac2_prog_mtl_tx_algorithms()

Would this also clear TSA on the AVB queue and turn CBS off in hardware?
Nothing calls stmmac_configure_cbs() again afterwards. Meanwhile
tx_queues_cfg[].mode_to_use still says MTL_QUEUE_AVB, so the driver state
and the hardware would disagree until the next ndo_open.

Removing mqprio seems to cause the same problem. prio_offload can now be
true while AVB queues exist, and stmmac_reset_tc_mqprio() then does:

	stmmac_prog_mtl_tx_algorithms(priv, priv->hw,
				      priv->plat->tx_sched_algorithm);

On XGMAC this rewrites TSA on every TC again (to ETS or SP). That would
wipe CBS on any AVB queue and not restore it.

The example in the commit message (mqprio first, then the cbs children)
works because config_cbs runs after the SP write.

On dwmac4/EQoS the claim does seem to hold.
dwmac4_prog_mtl_tx_algorithms() only touches MTL_OPERATION_SCHALG_MASK, and
CBS is enabled separately through MTL_ETS_CTRL_AVALG.

The commit in the Fixes: tag added these checks on purpose:

  Forcing strict priority conflicts with the CBS algorithm of AVB queues

Should the checks be kept for XGMAC? Or could the mqprio set and reset
paths call stmmac_configure_cbs() again after reprogramming the TX
algorithm?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261012-stmmac-mqprio-cbs-combo-v1-1-831e323eb4ef%40oss.qualcomm.com
Re: [PATCH net-next] net: stmmac: fix mqprio and cbs combination
#3138
Author: Lorenzo Bianconi
Date: Wed, 14 Oct 2026 09:04
162 lines
17665 bytes
--n3UHTxbxQXy0YYKA
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

> Thank you for your contribution! Sashiko AI review found 1 potential
> issue(s) to consider.
>=20
> Critical: 0 =C2=B7 High: 1 =C2=B7 Medium: 0 =C2=B7 Low: 0
>=20
> If you believe none of the issues are legitimate, please reply to each
> issue of Medium severity or higher and explain why the AI is wrong.
> If any of them are legitimate and you plan to respin, please let patchwork
> know by including "pw-bot: cr" as a separate line at the end of your reply
> (one such reply per series is enough).
>=20
> - [High] The commit message says the strict-priority scheduler selected
>   by the channel-mode mqprio offload and the per-queue CBS shaper "are=E2=
=80=A6
>=20
> --
>=20
> net: stmmac: fix mqprio and cbs combination
>=20
> This patch removes the checks that stopped the channel-mode mqprio offload
> and the CBS offload from being enabled together. It drops the AVB queue
> rejection in tc_mqprio_validate_chan_mode(), the prio_offload check in
> tc_setup_cbs(), and the matching AVB check in stmmac_reinit_queues().
>=20
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/=
net/ethernet/stmicro/stmmac/stmmac_tc.c
> > index ea1f97d6f0bd5..175236ba379d0 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
>=20
> [ ... ]
>=20
> > @@ -1350,18 +1346,6 @@ static int tc_mqprio_validate_chan_mode(struct s=
tmmac_priv *priv,
> >  		return -EOPNOTSUPP;
> >  	}
> > =20
> > -	/* Forcing strict priority conflicts with the CBS algorithm
> > -	 * of AVB queues, so reject the offload when any queue is
> > -	 * configured as AVB.
> > -	 */
> > -	for (i =3D 0; i < pdata->tx_queues_to_use; i++) {
> > -		if (pdata->tx_queues_cfg[i].mode_to_use =3D=3D MTL_QUEUE_AVB) {
> > -			NL_SET_ERR_MSG_MOD(mqprio->extack,
> > -					   "SP conflicts with AVB queues");
> > -			return -EOPNOTSUPP;
> > -		}
> > -	}
> > -
>=20
> [Severity: High]
>=20
> The commit message says:
>=20
>   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
>=20
> Is that true on XGMAC/XLGMAC cores? They use dwmac510_tc_ops, so both
> tc_setup_dwmac510_mqprio() and tc_setup_cbs() can be reached on them.
>=20
> On XGMAC, SP and CBS look like two values of the same per-TC TSA field.
> dwxgmac2_prog_mtl_tx_algorithms() rewrites that field on every TC:
>=20
> drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c:dwxgmac2_prog_mtl_tx_=
algorithms() {
>     ...
> 	for (i =3D 0; i < MTL_MAX_TX_QUEUES; i++) {
> 		value =3D readl(ioaddr + XGMAC_MTL_TCx_ETS_CONTROL(i));
> 		value &=3D ~XGMAC_TSA;
> 		if (ets)
> 			value |=3D XGMAC_ETS;
> 		writel(value, ioaddr + XGMAC_MTL_TCx_ETS_CONTROL(i));
> 	}
> }
>=20
> dwxgmac2_config_cbs() turns CBS on by writing the same field:
>=20
> drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c:dwxgmac2_config_cbs()=
 {
>     ...
> 	value =3D readl(ioaddr + XGMAC_MTL_TCx_ETS_CONTROL(queue));
> 	value &=3D ~XGMAC_TSA;
> 	value |=3D XGMAC_CC | XGMAC_CBS;
> 	writel(value, ioaddr + XGMAC_MTL_TCx_ETS_CONTROL(queue));
> }
>=20
> With this check gone, what happens if a TX queue is already in AVB mode?
> One way to get there is a DT mtl-tx-config queue with snps,avb-algorithm.
> In that case stmmac_open()->stmmac_mtl_configuration() programs CBS for t=
he
> queue when the device is opened.

I guess the only case that is not covered yet is if the user configures CBS
via the device-tree and then applies mqprio via tc on top of it.
I will fix in v2.

Regards,
Lorenzo

>=20
> After that, "tc qdisc replace ... mqprio ... mode channel hw 1" now
> succeeds and runs:
>=20
> tc_setup_dwmac510_mqprio()
>   tc_mqprio_validate_chan_mode()
>   tc_mqprio_config_queue_prio()
>     stmmac_prog_mtl_tx_algorithms(priv, priv->hw, MTL_TX_ALGORITHM_SP)
>       dwxgmac2_prog_mtl_tx_algorithms()
>=20
> Would this also clear TSA on the AVB queue and turn CBS off in hardware?
> Nothing calls stmmac_configure_cbs() again afterwards. Meanwhile
> tx_queues_cfg[].mode_to_use still says MTL_QUEUE_AVB, so the driver state
> and the hardware would disagree until the next ndo_open.
>=20
> Removing mqprio seems to cause the same problem. prio_offload can now be
> true while AVB queues exist, and stmmac_reset_tc_mqprio() then does:
>=20
> 	stmmac_prog_mtl_tx_algorithms(priv, priv->hw,
> 				      priv->plat->tx_sched_algorithm);
>=20
> On XGMAC this rewrites TSA on every TC again (to ETS or SP). That would
> wipe CBS on any AVB queue and not restore it.
>=20
> The example in the commit message (mqprio first, then the cbs children)
> works because config_cbs runs after the SP write.
>=20
> On dwmac4/EQoS the claim does seem to hold.
> dwmac4_prog_mtl_tx_algorithms() only touches MTL_OPERATION_SCHALG_MASK, a=
nd
> CBS is enabled separately through MTL_ETS_CTRL_AVALG.
>=20
> The commit in the Fixes: tag added these checks on purpose:
>=20
>   Forcing strict priority conflicts with the CBS algorithm of AVB queues
>=20
> Should the checks be kept for XGMAC? Or could the mqprio set and reset
> paths call stmmac_configure_cbs() again after reprogramming the TX
> algorithm?
>=20
> --=20
> Sashiko AI review =C2=B7 https://netdev-ai.bots.linux.dev/sashiko/#/patch=
set/20261012-stmmac-mqprio-cbs-combo-v1-1-831e323eb4ef%40oss.qualcomm.com

--n3UHTxbxQXy0YYKA
Content-Type: application/pgp-signature; name=signature.asc

-----BEGIN PGP SIGNATURE-----

iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCas9FpwAKCRA6cBh0uS2t
rGZPAP98x72otE4qA4N1TGw3slHXH9KEzgmf4M4VZf0q5OUz6AD/cxcAm5sdDz7I
xoiNkdA1JAF4hqpK3e/kZFVzTHNjbw4=
=Rw3M
-----END PGP SIGNATURE-----

--n3UHTxbxQXy0YYKA--
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads