All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v2] r8169: skip DASH fw status checks when DASH is disabled
@ 2024-03-28  5:51 Atlas Yu
  2024-03-28  6:49 ` Heiner Kallweit
  2024-03-29 19:50 ` [PATCH net v2] r8169: skip DASH fw status checks when DASH is disabled patchwork-bot+netdevbpf
  0 siblings, 2 replies; 4+ messages in thread
From: Atlas Yu @ 2024-03-28  5:51 UTC (permalink / raw)
  To: nic_swsd, hkallweit1, davem, edumazet, kuba, pabeni; +Cc: netdev, Atlas Yu

On devices that support DASH, the current code in the "rtl_loop_wait" function
raises false alarms when DASH is disabled. This occurs because the function
attempts to wait for the DASH firmware to be ready, even though it's not
relevant in this case.

r8169 0000:0c:00.0 eth0: RTL8168ep/8111ep, 38:7c:76:49:08:d9, XID 502, IRQ 86
r8169 0000:0c:00.0 eth0: jumbo features [frames: 9194 bytes, tx checksumming: ko]
r8169 0000:0c:00.0 eth0: DASH disabled
...
r8169 0000:0c:00.0 eth0: rtl_ep_ocp_read_cond == 0 (loop: 30, delay: 10000).

This patch modifies the driver start/stop functions to skip checking the DASH
firmware status when DASH is explicitly disabled. This prevents unnecessary
delays and false alarms.

The patch has been tested on several ThinkStation P8/PX workstations.

Fixes: 0ab0c45d8aae ("r8169: add handling DASH when DASH is disabled")
Signed-off-by: Atlas Yu <atlas.yu@canonical.com>
---
 drivers/net/ethernet/realtek/r8169_main.c | 31 ++++++++++++++++++++---
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index 5c879a5c86d7..4ac444eb269f 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -1314,17 +1314,40 @@ static void rtl8168ep_stop_cmac(struct rtl8169_private *tp)
 	RTL_W8(tp, IBCR0, RTL_R8(tp, IBCR0) & ~0x01);
 }
 
+static void rtl_dash_loop_wait(struct rtl8169_private *tp,
+			       const struct rtl_cond *c,
+			       unsigned long usecs, int n, bool high)
+{
+	if (!tp->dash_enabled)
+		return;
+	rtl_loop_wait(tp, c, usecs, n, high);
+}
+
+static void rtl_dash_loop_wait_high(struct rtl8169_private *tp,
+				    const struct rtl_cond *c,
+				    unsigned long d, int n)
+{
+	rtl_dash_loop_wait(tp, c, d, n, true);
+}
+
+static void rtl_dash_loop_wait_low(struct rtl8169_private *tp,
+				   const struct rtl_cond *c,
+				   unsigned long d, int n)
+{
+	rtl_dash_loop_wait(tp, c, d, n, false);
+}
+
 static void rtl8168dp_driver_start(struct rtl8169_private *tp)
 {
 	r8168dp_oob_notify(tp, OOB_CMD_DRIVER_START);
-	rtl_loop_wait_high(tp, &rtl_dp_ocp_read_cond, 10000, 10);
+	rtl_dash_loop_wait_high(tp, &rtl_dp_ocp_read_cond, 10000, 10);
 }
 
 static void rtl8168ep_driver_start(struct rtl8169_private *tp)
 {
 	r8168ep_ocp_write(tp, 0x01, 0x180, OOB_CMD_DRIVER_START);
 	r8168ep_ocp_write(tp, 0x01, 0x30, r8168ep_ocp_read(tp, 0x30) | 0x01);
-	rtl_loop_wait_high(tp, &rtl_ep_ocp_read_cond, 10000, 30);
+	rtl_dash_loop_wait_high(tp, &rtl_ep_ocp_read_cond, 10000, 30);
 }
 
 static void rtl8168_driver_start(struct rtl8169_private *tp)
@@ -1338,7 +1361,7 @@ static void rtl8168_driver_start(struct rtl8169_private *tp)
 static void rtl8168dp_driver_stop(struct rtl8169_private *tp)
 {
 	r8168dp_oob_notify(tp, OOB_CMD_DRIVER_STOP);
-	rtl_loop_wait_low(tp, &rtl_dp_ocp_read_cond, 10000, 10);
+	rtl_dash_loop_wait_low(tp, &rtl_dp_ocp_read_cond, 10000, 10);
 }
 
 static void rtl8168ep_driver_stop(struct rtl8169_private *tp)
@@ -1346,7 +1369,7 @@ static void rtl8168ep_driver_stop(struct rtl8169_private *tp)
 	rtl8168ep_stop_cmac(tp);
 	r8168ep_ocp_write(tp, 0x01, 0x180, OOB_CMD_DRIVER_STOP);
 	r8168ep_ocp_write(tp, 0x01, 0x30, r8168ep_ocp_read(tp, 0x30) | 0x01);
-	rtl_loop_wait_low(tp, &rtl_ep_ocp_read_cond, 10000, 10);
+	rtl_dash_loop_wait_low(tp, &rtl_ep_ocp_read_cond, 10000, 10);
 }
 
 static void rtl8168_driver_stop(struct rtl8169_private *tp)
-- 
2.40.1


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

* Re: [PATCH net v2] r8169: skip DASH fw status checks when DASH is disabled
  2024-03-28  5:51 [PATCH net v2] r8169: skip DASH fw status checks when DASH is disabled Atlas Yu
@ 2024-03-28  6:49 ` Heiner Kallweit
  2024-03-28  8:12   ` Should be PATCH v3 instead of PATCH v2 Atlas Yu
  2024-03-29 19:50 ` [PATCH net v2] r8169: skip DASH fw status checks when DASH is disabled patchwork-bot+netdevbpf
  1 sibling, 1 reply; 4+ messages in thread
From: Heiner Kallweit @ 2024-03-28  6:49 UTC (permalink / raw)
  To: Atlas Yu, nic_swsd, davem, edumazet, kuba, pabeni; +Cc: netdev

On 28.03.2024 06:51, Atlas Yu wrote:
> On devices that support DASH, the current code in the "rtl_loop_wait" function
> raises false alarms when DASH is disabled. This occurs because the function
> attempts to wait for the DASH firmware to be ready, even though it's not
> relevant in this case.
> 
> r8169 0000:0c:00.0 eth0: RTL8168ep/8111ep, 38:7c:76:49:08:d9, XID 502, IRQ 86
> r8169 0000:0c:00.0 eth0: jumbo features [frames: 9194 bytes, tx checksumming: ko]
> r8169 0000:0c:00.0 eth0: DASH disabled
> ...
> r8169 0000:0c:00.0 eth0: rtl_ep_ocp_read_cond == 0 (loop: 30, delay: 10000).
> 
> This patch modifies the driver start/stop functions to skip checking the DASH
> firmware status when DASH is explicitly disabled. This prevents unnecessary
> delays and false alarms.
> 
> The patch has been tested on several ThinkStation P8/PX workstations.
> 
> Fixes: 0ab0c45d8aae ("r8169: add handling DASH when DASH is disabled")
> Signed-off-by: Atlas Yu <atlas.yu@canonical.com>

You sent a v2 already, so I think this is v3. And the change log is missing.
But as the change is more or less trivial, no need to resubmit IMO.

> ---
>  drivers/net/ethernet/realtek/r8169_main.c | 31 ++++++++++++++++++++---
>  1 file changed, 27 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
> index 5c879a5c86d7..4ac444eb269f 100644
> --- a/drivers/net/ethernet/realtek/r8169_main.c
> +++ b/drivers/net/ethernet/realtek/r8169_main.c
> @@ -1314,17 +1314,40 @@ static void rtl8168ep_stop_cmac(struct rtl8169_private *tp)
>  	RTL_W8(tp, IBCR0, RTL_R8(tp, IBCR0) & ~0x01);
>  }
>  
> +static void rtl_dash_loop_wait(struct rtl8169_private *tp,
> +			       const struct rtl_cond *c,
> +			       unsigned long usecs, int n, bool high)
> +{
> +	if (!tp->dash_enabled)
> +		return;
> +	rtl_loop_wait(tp, c, usecs, n, high);
> +}
> +
> +static void rtl_dash_loop_wait_high(struct rtl8169_private *tp,
> +				    const struct rtl_cond *c,
> +				    unsigned long d, int n)
> +{
> +	rtl_dash_loop_wait(tp, c, d, n, true);
> +}
> +
> +static void rtl_dash_loop_wait_low(struct rtl8169_private *tp,
> +				   const struct rtl_cond *c,
> +				   unsigned long d, int n)
> +{
> +	rtl_dash_loop_wait(tp, c, d, n, false);
> +}
> +
>  static void rtl8168dp_driver_start(struct rtl8169_private *tp)
>  {
>  	r8168dp_oob_notify(tp, OOB_CMD_DRIVER_START);
> -	rtl_loop_wait_high(tp, &rtl_dp_ocp_read_cond, 10000, 10);
> +	rtl_dash_loop_wait_high(tp, &rtl_dp_ocp_read_cond, 10000, 10);
>  }
>  
>  static void rtl8168ep_driver_start(struct rtl8169_private *tp)
>  {
>  	r8168ep_ocp_write(tp, 0x01, 0x180, OOB_CMD_DRIVER_START);
>  	r8168ep_ocp_write(tp, 0x01, 0x30, r8168ep_ocp_read(tp, 0x30) | 0x01);
> -	rtl_loop_wait_high(tp, &rtl_ep_ocp_read_cond, 10000, 30);
> +	rtl_dash_loop_wait_high(tp, &rtl_ep_ocp_read_cond, 10000, 30);
>  }
>  
>  static void rtl8168_driver_start(struct rtl8169_private *tp)
> @@ -1338,7 +1361,7 @@ static void rtl8168_driver_start(struct rtl8169_private *tp)
>  static void rtl8168dp_driver_stop(struct rtl8169_private *tp)
>  {
>  	r8168dp_oob_notify(tp, OOB_CMD_DRIVER_STOP);
> -	rtl_loop_wait_low(tp, &rtl_dp_ocp_read_cond, 10000, 10);
> +	rtl_dash_loop_wait_low(tp, &rtl_dp_ocp_read_cond, 10000, 10);
>  }
>  
>  static void rtl8168ep_driver_stop(struct rtl8169_private *tp)
> @@ -1346,7 +1369,7 @@ static void rtl8168ep_driver_stop(struct rtl8169_private *tp)
>  	rtl8168ep_stop_cmac(tp);
>  	r8168ep_ocp_write(tp, 0x01, 0x180, OOB_CMD_DRIVER_STOP);
>  	r8168ep_ocp_write(tp, 0x01, 0x30, r8168ep_ocp_read(tp, 0x30) | 0x01);
> -	rtl_loop_wait_low(tp, &rtl_ep_ocp_read_cond, 10000, 10);
> +	rtl_dash_loop_wait_low(tp, &rtl_ep_ocp_read_cond, 10000, 10);
>  }
>  
>  static void rtl8168_driver_stop(struct rtl8169_private *tp)

Reviewed-by: Heiner Kallweit <hkallweit1@gmail.com>


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

* RE: Should be PATCH v3 instead of PATCH v2
  2024-03-28  6:49 ` Heiner Kallweit
@ 2024-03-28  8:12   ` Atlas Yu
  0 siblings, 0 replies; 4+ messages in thread
From: Atlas Yu @ 2024-03-28  8:12 UTC (permalink / raw)
  To: hkallweit1; +Cc: atlas.yu, davem, edumazet, kuba, netdev, nic_swsd, pabeni

On Thu, Mar 28, 2024 at 2:49 PM Heiner Kallweit <hkallweit1@gmail.com> wrote:

> You sent a v2 already, so I think this is v3. And the change log is missing.
> But as the change is more or less trivial, no need to resubmit IMO.

I'm sorry for the confusion. I throught that v2 does not count, since I sent
that within 24 hours and instead of creating a new thread, I just replied to
the original thread.

I will make sure to include the change log in the next patch submission. Let
me check other contributors' patches to see how they format their change log.

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

* Re: [PATCH net v2] r8169: skip DASH fw status checks when DASH is disabled
  2024-03-28  5:51 [PATCH net v2] r8169: skip DASH fw status checks when DASH is disabled Atlas Yu
  2024-03-28  6:49 ` Heiner Kallweit
@ 2024-03-29 19:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-03-29 19:50 UTC (permalink / raw)
  To: Atlas Yu; +Cc: nic_swsd, hkallweit1, davem, edumazet, kuba, pabeni, netdev

Hello:

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

On Thu, 28 Mar 2024 13:51:52 +0800 you wrote:
> On devices that support DASH, the current code in the "rtl_loop_wait" function
> raises false alarms when DASH is disabled. This occurs because the function
> attempts to wait for the DASH firmware to be ready, even though it's not
> relevant in this case.
> 
> r8169 0000:0c:00.0 eth0: RTL8168ep/8111ep, 38:7c:76:49:08:d9, XID 502, IRQ 86
> r8169 0000:0c:00.0 eth0: jumbo features [frames: 9194 bytes, tx checksumming: ko]
> r8169 0000:0c:00.0 eth0: DASH disabled
> ...
> r8169 0000:0c:00.0 eth0: rtl_ep_ocp_read_cond == 0 (loop: 30, delay: 10000).
> 
> [...]

Here is the summary with links:
  - [net,v2] r8169: skip DASH fw status checks when DASH is disabled
    https://git.kernel.org/netdev/net/c/5e864d90b208

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2024-03-29 19:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-28  5:51 [PATCH net v2] r8169: skip DASH fw status checks when DASH is disabled Atlas Yu
2024-03-28  6:49 ` Heiner Kallweit
2024-03-28  8:12   ` Should be PATCH v3 instead of PATCH v2 Atlas Yu
2024-03-29 19:50 ` [PATCH net v2] r8169: skip DASH fw status checks when DASH is disabled patchwork-bot+netdevbpf

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.