Re: [PATCH net-next v2 07/10] net: dsa: realtek: rtl8365mb: add QoS baseline and DCB default prio
From: Linus Walleij
Date: Thu Nov 12 2026 - 19:01:23 EST
On Thu, Nov 12, 2026 at 9:37 AM Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx> wrote:
> Add a shared rtl83xx-qos.c layer and the rtl8365mb backend behind it.
> The backend programs the QoS classification tables and one
> priority-to-queue table at setup instead of leaving them at their reset
> state, and offloads the DCB default priority.
>
> The switch classifies traffic by the port default, by PCP and by DSCP.
> Each source numbers its values on its own scale. Use the IEEE 802.1Q
> traffic types as the meaning of the switch's 3-bit internal priority,
> and map every source onto them. Best Effort then outranks Background,
> instead of following the raw PCP number.
>
> Keep the driver-independent dcbnl handling and the ieee8021q priority
> conversions in rtl83xx-qos.c. That layer programs the chip only through the
> realtek_ops qos_* callbacks, so other realtek DSA backends can share one
> dcbnl implementation and only program their own chip registers.
>
> The baseline trusts only the port default. PCP and DSCP stay untrusted;
> classification by PCP or DSCP starts only once the port trusts it
> through dcb apptrust, offloaded by "net: dsa: realtek: rtl8365mb:
> offload DCB apptrust".
>
> Every port in use defaults to Best Effort, so all classified traffic
> takes one egress queue.
>
> Select NET_IEEE8021Q_HELPERS from NET_DSA_REALTEK, but not DCB. The new
> code calls no DCB-core function, and DSA installs the dcbnl ops only
> when CONFIG_DCB is set. The QoS baseline is programmed either way.
>
> Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
It's a nice patch!
> Q: Luiz, Linus: should the driver select DCB, as the Microchip KSZ
> driver does, or have it enabled by default?
> A: No. The QoS baseline is built and programmed without DCB on purpose.
> The code calls no DCB-core function, and only the dcbnl hookup in DSA
> depends on CONFIG_DCB. Whether DCB is enabled stays a choice of the
> kernel configuration.
OK!
> Q: Linus: can the port queue-number field and the priority-to-queue
> table use one index, as in the RTL8370 code?
> A: No. Measured on RTL8365MB-VC for every field value, the port field
> picks one of eight priority-to-queue tables: value v picks table v - 1,
> and 0 picks table 7. One shared index would make the port read another
> table than the one programmed. A field value of 1 did not limit the port
> to one queue, so the field is not a queue count. The driver programs
> table 7 only and points every port in use at it.
Thanks for looking into this, much appreciated!
Reviewed-by: Linus Walleij <linusw@xxxxxxxxxx>
Yours,
Linus Walleij