All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: dsa: sja1105: Make HOSTPRIO a kernel config
@ 2019-11-12 21:25 Vladimir Oltean
  2019-11-14 10:18 ` Vladimir Oltean
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Oltean @ 2019-11-12 21:25 UTC (permalink / raw)
  To: andrew, f.fainelli, vivien.didelot, davem; +Cc: netdev, Vladimir Oltean

Unfortunately with this hardware, there is no way to transmit in-band
QoS hints with management frames (i.e. VLAN PCP is ignored). The traffic
class for these is fixed in the static config (which in turn requires a
reset to change).

With the new ability to add time gates for individual traffic classes,
there is a real danger that the user might unknowingly turn off the
traffic class for PTP, BPDUs, LLDP etc.

So we need to manage this situation the best we can. There isn't any
knob in Linux for this, and changing it at runtime probably isn't worth
it either. So just make the setting loud enough by promoting it to a
Kconfig, which the user can customize to their particular setup.

Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
---
 Documentation/networking/dsa/sja1105.rst |  4 ++--
 drivers/net/dsa/sja1105/Kconfig          | 11 +++++++++++
 drivers/net/dsa/sja1105/sja1105_main.c   |  2 +-
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/Documentation/networking/dsa/sja1105.rst b/Documentation/networking/dsa/sja1105.rst
index eef20d0bcf7c..2eaa6edf9c5b 100644
--- a/Documentation/networking/dsa/sja1105.rst
+++ b/Documentation/networking/dsa/sja1105.rst
@@ -181,8 +181,8 @@ towards the switch, with the VLAN PCP bits set appropriately.
 Management traffic (having DMAC 01-80-C2-xx-xx-xx or 01-19-1B-xx-xx-xx) is the
 notable exception: the switch always treats it with a fixed priority and
 disregards any VLAN PCP bits even if present. The traffic class for management
-traffic has a value of 7 (highest priority) at the moment, which is not
-configurable in the driver.
+traffic is configurable through ``CONFIG_NET_DSA_SJA1105_HOSTPRIO``, which by
+default has a value of 7 (highest priority).
 
 Below is an example of configuring a 500 us cyclic schedule on egress port
 ``swp5``. The traffic class gate for management traffic (7) is open for 100 us,
diff --git a/drivers/net/dsa/sja1105/Kconfig b/drivers/net/dsa/sja1105/Kconfig
index 0fe1ae173aa1..ac63054f578e 100644
--- a/drivers/net/dsa/sja1105/Kconfig
+++ b/drivers/net/dsa/sja1105/Kconfig
@@ -17,6 +17,17 @@ tristate "NXP SJA1105 Ethernet switch family support"
 	    - SJA1105R (Gen. 2, SGMII, No TT-Ethernet)
 	    - SJA1105S (Gen. 2, SGMII, TT-Ethernet)
 
+config NET_DSA_SJA1105_HOSTPRIO
+	int "Traffic class for management traffic"
+	range 0 7
+	default 7
+	depends on NET_DSA_SJA1105
+	help
+	  Configure the traffic class which will be used for management
+	  (link-local) traffic injected and trapped to/from the CPU.
+
+	  Higher is better as long as you care about your PTP frames.
+
 config NET_DSA_SJA1105_PTP
 	bool "Support for the PTP clock on the NXP SJA1105 Ethernet switch"
 	depends on NET_DSA_SJA1105
diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c
index b60224c55244..907babeb8c8a 100644
--- a/drivers/net/dsa/sja1105/sja1105_main.c
+++ b/drivers/net/dsa/sja1105/sja1105_main.c
@@ -388,7 +388,7 @@ static int sja1105_init_general_params(struct sja1105_private *priv)
 		/* Priority queue for link-local management frames
 		 * (both ingress to and egress from CPU - PTP, STP etc)
 		 */
-		.hostprio = 7,
+		.hostprio = CONFIG_NET_DSA_SJA1105_HOSTPRIO,
 		.mac_fltres1 = SJA1105_LINKLOCAL_FILTER_A,
 		.mac_flt1    = SJA1105_LINKLOCAL_FILTER_A_MASK,
 		.incl_srcpt1 = false,
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: dsa: sja1105: Make HOSTPRIO a kernel config
  2019-11-12 21:25 [PATCH net-next] net: dsa: sja1105: Make HOSTPRIO a kernel config Vladimir Oltean
@ 2019-11-14 10:18 ` Vladimir Oltean
  2019-11-14 13:36   ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Oltean @ 2019-11-14 10:18 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli, Vivien Didelot, David S. Miller; +Cc: netdev

On Tue, 12 Nov 2019 at 23:25, Vladimir Oltean <olteanv@gmail.com> wrote:
>
> Unfortunately with this hardware, there is no way to transmit in-band
> QoS hints with management frames (i.e. VLAN PCP is ignored). The traffic
> class for these is fixed in the static config (which in turn requires a
> reset to change).
>
> With the new ability to add time gates for individual traffic classes,
> there is a real danger that the user might unknowingly turn off the
> traffic class for PTP, BPDUs, LLDP etc.
>
> So we need to manage this situation the best we can. There isn't any
> knob in Linux for this, and changing it at runtime probably isn't worth
> it either. So just make the setting loud enough by promoting it to a
> Kconfig, which the user can customize to their particular setup.
>
> Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
> ---
>  Documentation/networking/dsa/sja1105.rst |  4 ++--
>  drivers/net/dsa/sja1105/Kconfig          | 11 +++++++++++
>  drivers/net/dsa/sja1105/sja1105_main.c   |  2 +-
>  3 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/networking/dsa/sja1105.rst b/Documentation/networking/dsa/sja1105.rst
> index eef20d0bcf7c..2eaa6edf9c5b 100644
> --- a/Documentation/networking/dsa/sja1105.rst
> +++ b/Documentation/networking/dsa/sja1105.rst
> @@ -181,8 +181,8 @@ towards the switch, with the VLAN PCP bits set appropriately.
>  Management traffic (having DMAC 01-80-C2-xx-xx-xx or 01-19-1B-xx-xx-xx) is the
>  notable exception: the switch always treats it with a fixed priority and
>  disregards any VLAN PCP bits even if present. The traffic class for management
> -traffic has a value of 7 (highest priority) at the moment, which is not
> -configurable in the driver.
> +traffic is configurable through ``CONFIG_NET_DSA_SJA1105_HOSTPRIO``, which by
> +default has a value of 7 (highest priority).
>
>  Below is an example of configuring a 500 us cyclic schedule on egress port
>  ``swp5``. The traffic class gate for management traffic (7) is open for 100 us,
> diff --git a/drivers/net/dsa/sja1105/Kconfig b/drivers/net/dsa/sja1105/Kconfig
> index 0fe1ae173aa1..ac63054f578e 100644
> --- a/drivers/net/dsa/sja1105/Kconfig
> +++ b/drivers/net/dsa/sja1105/Kconfig
> @@ -17,6 +17,17 @@ tristate "NXP SJA1105 Ethernet switch family support"
>             - SJA1105R (Gen. 2, SGMII, No TT-Ethernet)
>             - SJA1105S (Gen. 2, SGMII, TT-Ethernet)
>
> +config NET_DSA_SJA1105_HOSTPRIO
> +       int "Traffic class for management traffic"
> +       range 0 7
> +       default 7
> +       depends on NET_DSA_SJA1105
> +       help
> +         Configure the traffic class which will be used for management
> +         (link-local) traffic injected and trapped to/from the CPU.
> +
> +         Higher is better as long as you care about your PTP frames.
> +
>  config NET_DSA_SJA1105_PTP
>         bool "Support for the PTP clock on the NXP SJA1105 Ethernet switch"
>         depends on NET_DSA_SJA1105
> diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c
> index b60224c55244..907babeb8c8a 100644
> --- a/drivers/net/dsa/sja1105/sja1105_main.c
> +++ b/drivers/net/dsa/sja1105/sja1105_main.c
> @@ -388,7 +388,7 @@ static int sja1105_init_general_params(struct sja1105_private *priv)
>                 /* Priority queue for link-local management frames
>                  * (both ingress to and egress from CPU - PTP, STP etc)
>                  */
> -               .hostprio = 7,
> +               .hostprio = CONFIG_NET_DSA_SJA1105_HOSTPRIO,
>                 .mac_fltres1 = SJA1105_LINKLOCAL_FILTER_A,
>                 .mac_flt1    = SJA1105_LINKLOCAL_FILTER_A_MASK,
>                 .incl_srcpt1 = false,
> --
> 2.17.1
>

Would a devlink property be better for this?

Thanks,
-Vladimir

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: dsa: sja1105: Make HOSTPRIO a kernel config
  2019-11-14 10:18 ` Vladimir Oltean
@ 2019-11-14 13:36   ` Andrew Lunn
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2019-11-14 13:36 UTC (permalink / raw)
  To: Vladimir Oltean; +Cc: Florian Fainelli, Vivien Didelot, David S. Miller, netdev

> Would a devlink property be better for this?

Yes, more flexible than a kernel config. And the plumbing is now in
place, so it should not be too much effort.

       Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-14 13:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-12 21:25 [PATCH net-next] net: dsa: sja1105: Make HOSTPRIO a kernel config Vladimir Oltean
2019-11-14 10:18 ` Vladimir Oltean
2019-11-14 13:36   ` Andrew Lunn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.