diff mbox series

[net-next,6/8] net: dsa: ocelot: use ds->num_tx_queues = OCELOT_NUM_TC for all models

Message ID 20240530163333.2458884-7-vladimir.oltean@nxp.com (mailing list archive)
State Accepted
Commit 4ca54dd96eca57adea961c0e6cca28bf76168429
Delegated to: Netdev Maintainers
Headers show
Series Probing cleanup for the Felix DSA driver | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 902 this patch: 902
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 12 of 12 maintainers
netdev/build_clang success Errors and warnings before: 906 this patch: 906
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 906 this patch: 906
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 53 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-05-31--03-00 (tests: 1040)

Commit Message

Vladimir Oltean May 30, 2024, 4:33 p.m. UTC
Russell King points out that seville_vsc9953 populates
felix->info->num_tx_queues = 8, but this doesn't make it all the way
into ds->num_tx_queues (which is how the user interface netdev queues
get allocated) [1].

[1]: https://lore.kernel.org/all/20240415160150.yejcazpjqvn7vhxu@skbuf/

When num_tx_queues=0 for seville, this is implicitly converted to 1 by
dsa_user_create(), and this is good enough for basic operation for a
switch port. The tc qdisc offload layer works with netdev TX queues,
so for QoS offload we need to pretend we have multiple TX queues. The
VSC9953, like ocelot_ext, doesn't export QoS offload, so it doesn't
really matter. But we can definitely set num_tx_queues=8 for all
switches.

The felix->info->num_tx_queues construct itself seems unnecessary.
It was introduced by commit de143c0e274b ("net: dsa: felix: Configure
Time-Aware Scheduler via taprio offload") at a time when vsc9959
(LS1028A) was the only switch supported by the driver.

8 traffic classes, and 1 queue per traffic class, is a common
architectural feature of all switches in the family. So they could
all just set OCELOT_NUM_TC and be fine.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/dsa/ocelot/felix.h           | 1 -
 drivers/net/dsa/ocelot/felix_vsc9959.c   | 4 ++--
 drivers/net/dsa/ocelot/ocelot_ext.c      | 3 +--
 drivers/net/dsa/ocelot/seville_vsc9953.c | 3 ++-
 4 files changed, 5 insertions(+), 6 deletions(-)

Comments

Colin Foster May 30, 2024, 4:47 p.m. UTC | #1
On Thu, May 30, 2024 at 07:33:31PM +0300, Vladimir Oltean wrote:
> Russell King points out that seville_vsc9953 populates
> felix->info->num_tx_queues = 8, but this doesn't make it all the way
> into ds->num_tx_queues (which is how the user interface netdev queues
> get allocated) [1].
> 
> [1]: https://lore.kernel.org/all/20240415160150.yejcazpjqvn7vhxu@skbuf/
> 
> When num_tx_queues=0 for seville, this is implicitly converted to 1 by
> dsa_user_create(), and this is good enough for basic operation for a
> switch port. The tc qdisc offload layer works with netdev TX queues,
> so for QoS offload we need to pretend we have multiple TX queues. The
> VSC9953, like ocelot_ext, doesn't export QoS offload, so it doesn't
> really matter. But we can definitely set num_tx_queues=8 for all
> switches.
> 
> The felix->info->num_tx_queues construct itself seems unnecessary.
> It was introduced by commit de143c0e274b ("net: dsa: felix: Configure
> Time-Aware Scheduler via taprio offload") at a time when vsc9959
> (LS1028A) was the only switch supported by the driver.
> 
> 8 traffic classes, and 1 queue per traffic class, is a common
> architectural feature of all switches in the family. So they could
> all just set OCELOT_NUM_TC and be fine.
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---
>  drivers/net/dsa/ocelot/felix.h           | 1 -
>  drivers/net/dsa/ocelot/felix_vsc9959.c   | 4 ++--
>  drivers/net/dsa/ocelot/ocelot_ext.c      | 3 +--
> --- a/drivers/net/dsa/ocelot/ocelot_ext.c
> +++ b/drivers/net/dsa/ocelot/ocelot_ext.c
> @@ -57,7 +57,6 @@ static const struct felix_info vsc7512_info = {
>  	.vcap				= vsc7514_vcap_props,
>  	.num_mact_rows			= 1024,
>  	.num_ports			= VSC7514_NUM_PORTS,
> -	.num_tx_queues			= OCELOT_NUM_TC,
>  	.port_modes			= vsc7512_port_modes,
>  	.phylink_mac_config		= ocelot_phylink_mac_config,
>  	.configure_serdes		= ocelot_port_configure_serdes,
> @@ -90,7 +89,7 @@ static int ocelot_ext_probe(struct platform_device *pdev)
>  
>  	ds->dev = dev;
>  	ds->num_ports = felix->info->num_ports;
> -	ds->num_tx_queues = felix->info->num_tx_queues;
> +	ds->num_tx_queues = OCELOT_NUM_TC;
>  
>  	ds->ops = &felix_switch_ops;
>  	ds->phylink_mac_ops = &felix_phylink_mac_ops;

For ocelot_ext

Reviewed-by: Colin Foster <colin.foster@in-advantage.com>
Colin Foster June 3, 2024, 2:02 a.m. UTC | #2
On Thu, May 30, 2024 at 07:33:31PM +0300, Vladimir Oltean wrote:
> Russell King points out that seville_vsc9953 populates
> felix->info->num_tx_queues = 8, but this doesn't make it all the way
> into ds->num_tx_queues (which is how the user interface netdev queues
> get allocated) [1].
> 
> [1]: https://lore.kernel.org/all/20240415160150.yejcazpjqvn7vhxu@skbuf/
> 
> When num_tx_queues=0 for seville, this is implicitly converted to 1 by
> dsa_user_create(), and this is good enough for basic operation for a
> switch port. The tc qdisc offload layer works with netdev TX queues,
> so for QoS offload we need to pretend we have multiple TX queues. The
> VSC9953, like ocelot_ext, doesn't export QoS offload, so it doesn't
> really matter. But we can definitely set num_tx_queues=8 for all
> switches.
> 
> The felix->info->num_tx_queues construct itself seems unnecessary.
> It was introduced by commit de143c0e274b ("net: dsa: felix: Configure
> Time-Aware Scheduler via taprio offload") at a time when vsc9959
> (LS1028A) was the only switch supported by the driver.
> 
> 8 traffic classes, and 1 queue per traffic class, is a common
> architectural feature of all switches in the family. So they could
> all just set OCELOT_NUM_TC and be fine.
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---
>  drivers/net/dsa/ocelot/felix.h           | 1 -
>  drivers/net/dsa/ocelot/felix_vsc9959.c   | 4 ++--
>  drivers/net/dsa/ocelot/ocelot_ext.c      | 3 +--

Tested-by: Colin Foster <colin.foster@in-advantage.com>
diff mbox series

Patch

diff --git a/drivers/net/dsa/ocelot/felix.h b/drivers/net/dsa/ocelot/felix.h
index e67a25f6f816..e0bfea10ff52 100644
--- a/drivers/net/dsa/ocelot/felix.h
+++ b/drivers/net/dsa/ocelot/felix.h
@@ -32,7 +32,6 @@  struct felix_info {
 	const u32			*port_modes;
 	int				num_mact_rows;
 	int				num_ports;
-	int				num_tx_queues;
 	struct vcap_props		*vcap;
 	u16				vcap_pol_base;
 	u16				vcap_pol_max;
diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c
index 20563abd617f..ec8b124e8f61 100644
--- a/drivers/net/dsa/ocelot/felix_vsc9959.c
+++ b/drivers/net/dsa/ocelot/felix_vsc9959.c
@@ -2658,7 +2658,6 @@  static const struct felix_info felix_info_vsc9959 = {
 	.vcap_pol_max2		= 0,
 	.num_mact_rows		= 2048,
 	.num_ports		= VSC9959_NUM_PORTS,
-	.num_tx_queues		= OCELOT_NUM_TC,
 	.quirks			= FELIX_MAC_QUIRKS,
 	.quirk_no_xtr_irq	= true,
 	.ptp_caps		= &vsc9959_ptp_caps,
@@ -2711,7 +2710,8 @@  static int felix_pci_probe(struct pci_dev *pdev,
 
 	ds->dev = dev;
 	ds->num_ports = felix->info->num_ports;
-	ds->num_tx_queues = felix->info->num_tx_queues;
+	ds->num_tx_queues = OCELOT_NUM_TC;
+
 	ds->ops = &felix_switch_ops;
 	ds->phylink_mac_ops = &felix_phylink_mac_ops;
 	ds->priv = ocelot;
diff --git a/drivers/net/dsa/ocelot/ocelot_ext.c b/drivers/net/dsa/ocelot/ocelot_ext.c
index c893f3ee238b..9cd24f77dc49 100644
--- a/drivers/net/dsa/ocelot/ocelot_ext.c
+++ b/drivers/net/dsa/ocelot/ocelot_ext.c
@@ -57,7 +57,6 @@  static const struct felix_info vsc7512_info = {
 	.vcap				= vsc7514_vcap_props,
 	.num_mact_rows			= 1024,
 	.num_ports			= VSC7514_NUM_PORTS,
-	.num_tx_queues			= OCELOT_NUM_TC,
 	.port_modes			= vsc7512_port_modes,
 	.phylink_mac_config		= ocelot_phylink_mac_config,
 	.configure_serdes		= ocelot_port_configure_serdes,
@@ -90,7 +89,7 @@  static int ocelot_ext_probe(struct platform_device *pdev)
 
 	ds->dev = dev;
 	ds->num_ports = felix->info->num_ports;
-	ds->num_tx_queues = felix->info->num_tx_queues;
+	ds->num_tx_queues = OCELOT_NUM_TC;
 
 	ds->ops = &felix_switch_ops;
 	ds->phylink_mac_ops = &felix_phylink_mac_ops;
diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c
index e63247d3dfdb..83bd0e1ee692 100644
--- a/drivers/net/dsa/ocelot/seville_vsc9953.c
+++ b/drivers/net/dsa/ocelot/seville_vsc9953.c
@@ -963,7 +963,6 @@  static const struct felix_info seville_info_vsc9953 = {
 	.quirks			= FELIX_MAC_QUIRKS,
 	.num_mact_rows		= 2048,
 	.num_ports		= VSC9953_NUM_PORTS,
-	.num_tx_queues		= OCELOT_NUM_TC,
 	.mdio_bus_alloc		= vsc9953_mdio_bus_alloc,
 	.mdio_bus_free		= vsc9953_mdio_bus_free,
 	.port_modes		= vsc9953_port_modes,
@@ -1002,6 +1001,8 @@  static int seville_probe(struct platform_device *pdev)
 
 	ds->dev = dev;
 	ds->num_ports = felix->info->num_ports;
+	ds->num_tx_queues = OCELOT_NUM_TC;
+
 	ds->ops = &felix_switch_ops;
 	ds->phylink_mac_ops = &felix_phylink_mac_ops;
 	ds->priv = ocelot;