[PATCH net-next v3 06/10] net: dsa: realtek: rtl8365mb: store the egress queue count per chip
From: Oleksij Rempel
Date: Mon Nov 16 2026 - 14:11:27 EST
Store the number of egress queues in the per-chip info structure and
advertise it through ds->num_tx_queues, following the ksz driver
(struct ksz_chip_data.num_tx_queues).
The queue count is a per-chip hardware property, and this driver supports
several chips of the rtl8367c family. All currently supported chips expose
eight queues, but keeping the count in chip_info lets the QoS code that
follows program the priority-to-queue map via the ieee8021q helpers for
whatever queue count a chip carries, so the 802.1Q collapse is correct
rather than hard-coded to eight.
Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
Reviewed-by: Linus Walleij <linusw@xxxxxxxxxx>
Reviewed-by: Luiz Angelo Daros de Luca <luizluca@xxxxxxxxx>
Reviewed-by: Alvin Šipraga <alvin.sipraga@xxxxxxxxxx>
---
Q: Linus: why is the queue count not in struct realtek_variant?
A: The count is per chip, while realtek_variant is per subdriver, and
rtl8365mb serves several chips. The QoS code added later in this series
reads ds->num_tx_queues, as Linus suggested in his v1 review, so
RTL8366RB can advertise its own count the same way.
Changes in v3:
- No changes.
Changes in v2:
- drop the num_tx_queues comment, which restated the assignment
- keep the Reviewed-by tags: v2 only drops a comment
---
drivers/net/dsa/realtek/rtl8365mb_main.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/net/dsa/realtek/rtl8365mb_main.c b/drivers/net/dsa/realtek/rtl8365mb_main.c
index b57b306cbf5e931a36f52ab6b57de881b5dd94d8..7010e51d63fae7fd416bcde44e506b68f250ae50 100644
--- a/drivers/net/dsa/realtek/rtl8365mb_main.c
+++ b/drivers/net/dsa/realtek/rtl8365mb_main.c
@@ -711,6 +711,7 @@ struct rtl8365mb_extint {
* @extints: available external interfaces
* @jam_table: chip-specific initialization jam table
* @jam_size: size of the chip's jam table
+ * @num_tx_queues: number of egress queues exposed by the chip
*
* These data are specific to a given chip in the family of switches supported
* by this driver. When adding support for another chip in the family, a new
@@ -724,6 +725,7 @@ struct rtl8365mb_chip_info {
const struct rtl8365mb_extint extints[RTL8365MB_MAX_NUM_EXTINTS];
const struct rtl8365mb_jam_tbl_entry *jam_table;
size_t jam_size;
+ unsigned int num_tx_queues;
};
/* Chip info for each supported switch in the family */
@@ -747,6 +749,7 @@ static const struct rtl8365mb_chip_info rtl8365mb_chip_infos[] = {
},
.jam_table = rtl8365mb_init_jam_8365mb_vc,
.jam_size = ARRAY_SIZE(rtl8365mb_init_jam_8365mb_vc),
+ .num_tx_queues = 8,
},
{
.name = "RTL8367S",
@@ -760,6 +763,7 @@ static const struct rtl8365mb_chip_info rtl8365mb_chip_infos[] = {
},
.jam_table = rtl8365mb_init_jam_8365mb_vc,
.jam_size = ARRAY_SIZE(rtl8365mb_init_jam_8365mb_vc),
+ .num_tx_queues = 8,
},
{
.name = "RTL8367SB",
@@ -775,6 +779,7 @@ static const struct rtl8365mb_chip_info rtl8365mb_chip_infos[] = {
},
.jam_table = rtl8365mb_init_jam_8365mb_vc,
.jam_size = ARRAY_SIZE(rtl8365mb_init_jam_8365mb_vc),
+ .num_tx_queues = 8,
},
{
.name = "RTL8367RB-VB",
@@ -789,6 +794,7 @@ static const struct rtl8365mb_chip_info rtl8365mb_chip_infos[] = {
},
.jam_table = rtl8365mb_init_jam_8365mb_vc,
.jam_size = ARRAY_SIZE(rtl8365mb_init_jam_8365mb_vc),
+ .num_tx_queues = 8,
},
};
@@ -3284,6 +3290,8 @@ static int rtl8365mb_setup(struct dsa_switch *ds)
goto out_teardown_irq;
}
+ ds->num_tx_queues = mb->chip_info->num_tx_queues;
+
/* Start statistics counter polling */
ret = rtl8365mb_stats_setup(priv);
if (ret) {
--
2.47.3