Re: [Patch net-next 1/2] net: dsa: microchip: enable port queues for tc mqprio

From: Paolo Abeni
Date: Thu Jan 19 2023 - 04:38:44 EST


On Tue, 2023-01-17 at 20:02 +0530, Arun Ramadoss wrote:
> LAN937x family of switches has 8 queues per port where the KSZ switches
> has 4 queues per port. By default, only one queue per port is enabled.
> The queues are configurable in 2, 4 or 8. This patch add 8 number of
> queues for LAN937x and 4 for other switches.
> In the tag_ksz.c file, prioirty of the packet is queried using the skb
> buffer and the corresponding value is updated in the tag.
>
> Signed-off-by: Arun Ramadoss <arun.ramadoss@xxxxxxxxxxxxx>
> ---
> drivers/net/dsa/microchip/ksz9477.c | 4 ++++
> drivers/net/dsa/microchip/ksz9477_reg.h | 5 ++++-
> drivers/net/dsa/microchip/ksz_common.c | 18 ++++++++++++++++++
> drivers/net/dsa/microchip/ksz_common.h | 1 +
> drivers/net/dsa/microchip/lan937x_main.c | 4 ++++
> drivers/net/dsa/microchip/lan937x_reg.h | 6 +++++-
> net/dsa/tag_ksz.c | 15 +++++++++++++++
> 7 files changed, 51 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
> index 47b54ecf2c6f..5a66d0be2876 100644
> --- a/drivers/net/dsa/microchip/ksz9477.c
> +++ b/drivers/net/dsa/microchip/ksz9477.c
> @@ -991,6 +991,10 @@ void ksz9477_port_setup(struct ksz_device *dev, int port, bool cpu_port)
> ksz_port_cfg(dev, port, REG_PORT_CTRL_0, PORT_TAIL_TAG_ENABLE,
> true);
>
> + /* Enable the Port Queue split */
> + ksz_prmw8(dev, port, REG_PORT_CTRL_0, PORT_QUEUE_SPLIT_MASK,
> + PORT_FOUR_QUEUE);

I think it would be nice here (and in lan937x_port_setup below)
explicitly checking that the owning ksz_device->num_tx_queues matches
the configured value.

Cheers,

Paolo