[net-next] net: dsa: qca8k: add support for additional modes for netdev trigger

Message ID 20230621095409.25859-1-ansuelsmth@gmail.com
State New
Headers
Series [net-next] net: dsa: qca8k: add support for additional modes for netdev trigger |

Commit Message

Christian Marangi June 21, 2023, 9:54 a.m. UTC
  The QCA8K switch supports additional modes that can be handled in
hardware for the LED netdev trigger.

Add these additional modes to further support the Switch LEDs and
offload more blink modes.

Add additional modes:
- link_10
- link_100
- link_1000
- half_duplex
- full_duplex

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
 drivers/net/dsa/qca/qca8k-leds.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
  

Comments

Andrew Lunn June 22, 2023, 12:56 p.m. UTC | #1
On Wed, Jun 21, 2023 at 11:54:09AM +0200, Christian Marangi wrote:
> The QCA8K switch supports additional modes that can be handled in
> hardware for the LED netdev trigger.
> 
> Add these additional modes to further support the Switch LEDs and
> offload more blink modes.
> 
> Add additional modes:
> - link_10
> - link_100
> - link_1000
> - half_duplex
> - full_duplex
> 
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
  
Florian Fainelli June 22, 2023, 3:35 p.m. UTC | #2
On 6/21/2023 10:54 AM, Christian Marangi wrote:
> The QCA8K switch supports additional modes that can be handled in
> hardware for the LED netdev trigger.
> 
> Add these additional modes to further support the Switch LEDs and
> offload more blink modes.
> 
> Add additional modes:
> - link_10
> - link_100
> - link_1000
> - half_duplex
> - full_duplex
> 
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>

Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
  
Jakub Kicinski June 23, 2023, 2:31 a.m. UTC | #3
On Wed, 21 Jun 2023 11:54:09 +0200 Christian Marangi wrote:
> The QCA8K switch supports additional modes that can be handled in
> hardware for the LED netdev trigger.
> 
> Add these additional modes to further support the Switch LEDs and
> offload more blink modes.

Something may be funny with the date on your system, FWIW, because your
patches seem to arrive almost a day in the past.
  
patchwork-bot+netdevbpf@kernel.org June 23, 2023, 3 a.m. UTC | #4
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 21 Jun 2023 11:54:09 +0200 you wrote:
> The QCA8K switch supports additional modes that can be handled in
> hardware for the LED netdev trigger.
> 
> Add these additional modes to further support the Switch LEDs and
> offload more blink modes.
> 
> Add additional modes:
> - link_10
> - link_100
> - link_1000
> - half_duplex
> - full_duplex
> 
> [...]

Here is the summary with links:
  - [net-next] net: dsa: qca8k: add support for additional modes for netdev trigger
    https://git.kernel.org/netdev/net-next/c/2555f35a4f42

You are awesome, thank you!
  
Christian Marangi June 23, 2023, 3:10 a.m. UTC | #5
On Thu, Jun 22, 2023 at 07:31:20PM -0700, Jakub Kicinski wrote:
> On Wed, 21 Jun 2023 11:54:09 +0200 Christian Marangi wrote:
> > The QCA8K switch supports additional modes that can be handled in
> > hardware for the LED netdev trigger.
> > 
> > Add these additional modes to further support the Switch LEDs and
> > offload more blink modes.
> 
> Something may be funny with the date on your system, FWIW, because your
> patches seem to arrive almost a day in the past.

Lovely WSL istance (Windows Subsystem for Linux) that goes out of sync with
the host machine sometimes. Does the time cause any problem? I will
check that in the future before sending patches...
  
Christian Marangi June 23, 2023, 3:30 p.m. UTC | #6
On Fri, Jun 23, 2023 at 08:34:42AM -0700, Jakub Kicinski wrote:
> On Fri, 23 Jun 2023 05:10:47 +0200 Christian Marangi wrote:
> > > Something may be funny with the date on your system, FWIW, because your
> > > patches seem to arrive almost a day in the past.  
> > 
> > Lovely WSL istance (Windows Subsystem for Linux) that goes out of sync with
> > the host machine sometimes. Does the time cause any problem? I will
> > check that in the future before sending patches...
> 
> Unfortunately for some reason patchwork orders patches by send time,
> not by the time the patches arrived, and we use a time-bound query to
> fetch new patches. So if the date is too far back the patches won't get
> fetched for the build tester.

!!! No idea! Sorry for any problem that I might have caused. Will make
sure this won't happen again.
  
Jakub Kicinski June 23, 2023, 3:34 p.m. UTC | #7
On Fri, 23 Jun 2023 05:10:47 +0200 Christian Marangi wrote:
> > Something may be funny with the date on your system, FWIW, because your
> > patches seem to arrive almost a day in the past.  
> 
> Lovely WSL istance (Windows Subsystem for Linux) that goes out of sync with
> the host machine sometimes. Does the time cause any problem? I will
> check that in the future before sending patches...

Unfortunately for some reason patchwork orders patches by send time,
not by the time the patches arrived, and we use a time-bound query to
fetch new patches. So if the date is too far back the patches won't get
fetched for the build tester.
  

Patch

diff --git a/drivers/net/dsa/qca/qca8k-leds.c b/drivers/net/dsa/qca/qca8k-leds.c
index 6f02029b454b..1261e0bb21ef 100644
--- a/drivers/net/dsa/qca/qca8k-leds.c
+++ b/drivers/net/dsa/qca/qca8k-leds.c
@@ -68,6 +68,16 @@  qca8k_parse_netdev(unsigned long rules, u32 *offload_trigger)
 		*offload_trigger |= QCA8K_LED_TX_BLINK_MASK;
 	if (test_bit(TRIGGER_NETDEV_RX, &rules))
 		*offload_trigger |= QCA8K_LED_RX_BLINK_MASK;
+	if (test_bit(TRIGGER_NETDEV_LINK_10, &rules))
+		*offload_trigger |= QCA8K_LED_LINK_10M_EN_MASK;
+	if (test_bit(TRIGGER_NETDEV_LINK_100, &rules))
+		*offload_trigger |= QCA8K_LED_LINK_100M_EN_MASK;
+	if (test_bit(TRIGGER_NETDEV_LINK_1000, &rules))
+		*offload_trigger |= QCA8K_LED_LINK_1000M_EN_MASK;
+	if (test_bit(TRIGGER_NETDEV_HALF_DUPLEX, &rules))
+		*offload_trigger |= QCA8K_LED_HALF_DUPLEX_MASK;
+	if (test_bit(TRIGGER_NETDEV_FULL_DUPLEX, &rules))
+		*offload_trigger |= QCA8K_LED_FULL_DUPLEX_MASK;
 
 	if (rules && !*offload_trigger)
 		return -EOPNOTSUPP;
@@ -322,6 +332,16 @@  qca8k_cled_hw_control_get(struct led_classdev *ldev, unsigned long *rules)
 		set_bit(TRIGGER_NETDEV_TX, rules);
 	if (val & QCA8K_LED_RX_BLINK_MASK)
 		set_bit(TRIGGER_NETDEV_RX, rules);
+	if (val & QCA8K_LED_LINK_10M_EN_MASK)
+		set_bit(TRIGGER_NETDEV_LINK_10, rules);
+	if (val & QCA8K_LED_LINK_100M_EN_MASK)
+		set_bit(TRIGGER_NETDEV_LINK_100, rules);
+	if (val & QCA8K_LED_LINK_1000M_EN_MASK)
+		set_bit(TRIGGER_NETDEV_LINK_1000, rules);
+	if (val & QCA8K_LED_HALF_DUPLEX_MASK)
+		set_bit(TRIGGER_NETDEV_HALF_DUPLEX, rules);
+	if (val & QCA8K_LED_FULL_DUPLEX_MASK)
+		set_bit(TRIGGER_NETDEV_FULL_DUPLEX, rules);
 
 	return 0;
 }