linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2 0/2] r8152: fix side effect
@ 2019-08-26  8:41 Hayes Wang
  2019-08-26  8:41 ` [PATCH net v2 1/2] Revert "r8152: napi hangup fix after disconnect" Hayes Wang
  2019-08-26  8:41 ` [PATCH net v2 2/2] r8152: remove calling netif_napi_del Hayes Wang
  0 siblings, 2 replies; 6+ messages in thread
From: Hayes Wang @ 2019-08-26  8:41 UTC (permalink / raw)
  To: netdev; +Cc: nic_swsd, linux-kernel, jslaby, Hayes Wang

v2:
Replace patch #2 with "r8152: remove calling netif_napi_del".

v1:
The commit 0ee1f4734967 ("r8152: napi hangup fix after disconnect")
add a check to avoid using napi_disable after netif_napi_del. However,
the commit ffa9fec30ca0 ("r8152: set RTL8152_UNPLUG only for real
disconnection") let the check useless.

Therefore, I revert commit 0ee1f4734967 ("r8152: napi hangup fix
after disconnect") first, and add another patch to fix it.

Hayes Wang (2):
  Revert "r8152: napi hangup fix after disconnect"
  r8152: remove calling netif_napi_del

 drivers/net/usb/r8152.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

-- 
2.21.0


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

* [PATCH net v2 1/2] Revert "r8152: napi hangup fix after disconnect"
  2019-08-26  8:41 [PATCH net v2 0/2] r8152: fix side effect Hayes Wang
@ 2019-08-26  8:41 ` Hayes Wang
  2019-08-26  8:55   ` Jiri Slaby
  2019-08-26  8:41 ` [PATCH net v2 2/2] r8152: remove calling netif_napi_del Hayes Wang
  1 sibling, 1 reply; 6+ messages in thread
From: Hayes Wang @ 2019-08-26  8:41 UTC (permalink / raw)
  To: netdev; +Cc: nic_swsd, linux-kernel, jslaby, Hayes Wang

This reverts commit 0ee1f4734967af8321ecebaf9c74221ace34f2d5.

This conflicts with commit ffa9fec30ca0 ("r8152: set
RTL8152_UNPLUG only for real disconnection").

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
 drivers/net/usb/r8152.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index eee0f5007ee3..ad3abe26b51b 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -4021,8 +4021,7 @@ static int rtl8152_close(struct net_device *netdev)
 #ifdef CONFIG_PM_SLEEP
 	unregister_pm_notifier(&tp->pm_notifier);
 #endif
-	if (!test_bit(RTL8152_UNPLUG, &tp->flags))
-		napi_disable(&tp->napi);
+	napi_disable(&tp->napi);
 	clear_bit(WORK_ENABLE, &tp->flags);
 	usb_kill_urb(tp->intr_urb);
 	cancel_delayed_work_sync(&tp->schedule);
-- 
2.21.0


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

* [PATCH net v2 2/2] r8152: remove calling netif_napi_del
  2019-08-26  8:41 [PATCH net v2 0/2] r8152: fix side effect Hayes Wang
  2019-08-26  8:41 ` [PATCH net v2 1/2] Revert "r8152: napi hangup fix after disconnect" Hayes Wang
@ 2019-08-26  8:41 ` Hayes Wang
  1 sibling, 0 replies; 6+ messages in thread
From: Hayes Wang @ 2019-08-26  8:41 UTC (permalink / raw)
  To: netdev; +Cc: nic_swsd, linux-kernel, jslaby, Hayes Wang

Remove unnecessary use of netif_napi_del. This also avoids to call
napi_disable() after netif_napi_del().

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
 drivers/net/usb/r8152.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index ad3abe26b51b..04137ac373b0 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -5352,7 +5352,6 @@ static int rtl8152_probe(struct usb_interface *intf,
 	return 0;
 
 out1:
-	netif_napi_del(&tp->napi);
 	usb_set_intfdata(intf, NULL);
 out:
 	free_netdev(netdev);
@@ -5367,7 +5366,6 @@ static void rtl8152_disconnect(struct usb_interface *intf)
 	if (tp) {
 		rtl_set_unplug(tp);
 
-		netif_napi_del(&tp->napi);
 		unregister_netdev(tp->netdev);
 		cancel_delayed_work_sync(&tp->hw_phy_work);
 		tp->rtl_ops.unload(tp);
-- 
2.21.0


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

* Re: [PATCH net v2 1/2] Revert "r8152: napi hangup fix after disconnect"
  2019-08-26  8:41 ` [PATCH net v2 1/2] Revert "r8152: napi hangup fix after disconnect" Hayes Wang
@ 2019-08-26  8:55   ` Jiri Slaby
  2019-08-26  9:43     ` Hayes Wang
  0 siblings, 1 reply; 6+ messages in thread
From: Jiri Slaby @ 2019-08-26  8:55 UTC (permalink / raw)
  To: Hayes Wang, netdev; +Cc: nic_swsd, linux-kernel

On 26. 08. 19, 10:41, Hayes Wang wrote:
> This reverts commit 0ee1f4734967af8321ecebaf9c74221ace34f2d5.
> 
> This conflicts with commit ffa9fec30ca0 ("r8152: set
> RTL8152_UNPLUG only for real disconnection").

Could you clarify *why* it conflicts? And how is the problem fixed by
0ee1f473496 avoided now?

> Signed-off-by: Hayes Wang <hayeswang@realtek.com>
> ---
>  drivers/net/usb/r8152.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
> index eee0f5007ee3..ad3abe26b51b 100644
> --- a/drivers/net/usb/r8152.c
> +++ b/drivers/net/usb/r8152.c
> @@ -4021,8 +4021,7 @@ static int rtl8152_close(struct net_device *netdev)
>  #ifdef CONFIG_PM_SLEEP
>  	unregister_pm_notifier(&tp->pm_notifier);
>  #endif
> -	if (!test_bit(RTL8152_UNPLUG, &tp->flags))
> -		napi_disable(&tp->napi);
> +	napi_disable(&tp->napi);
>  	clear_bit(WORK_ENABLE, &tp->flags);
>  	usb_kill_urb(tp->intr_urb);
>  	cancel_delayed_work_sync(&tp->schedule);
> 

thanks,
-- 
js
suse labs

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

* RE: [PATCH net v2 1/2] Revert "r8152: napi hangup fix after disconnect"
  2019-08-26  8:55   ` Jiri Slaby
@ 2019-08-26  9:43     ` Hayes Wang
  2019-08-26 20:55       ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Hayes Wang @ 2019-08-26  9:43 UTC (permalink / raw)
  To: Jiri Slaby, netdev; +Cc: nic_swsd, linux-kernel

Jiri Slaby [mailto:jslaby@suse.cz]
> Sent: Monday, August 26, 2019 4:55 PM
[...]
> Could you clarify *why* it conflicts? And how is the problem fixed by
> 0ee1f473496 avoided now?

In rtl8152_disconnect(), the flow would be as following.

static void rtl8152_disconnect(struct usb_interface *intf)
{
	...
	- netif_napi_del(&tp->napi);
	- unregister_netdev(tp->netdev);
	   - rtl8152_close
	      - napi_disable

Therefore you add a checking of RTL8152_UNPLUG to avoid
calling napi_disable() after netif_napi_del(). However,
after commit ffa9fec30ca0 ("r8152: set RTL8152_UNPLUG
only for real disconnection"), RTL8152_UNPLUG is not
always set when calling rtl8152_disconnect(). That is,
napi_disable() would be called after netif_napi_del(),
if RTL8152_UNPLUG is not set.

The best way is to avoid calling netif_napi_del() before
calling unregister_netdev(). And I has submitted such
patch following this one.

Best Regards,
Hayes



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

* Re: [PATCH net v2 1/2] Revert "r8152: napi hangup fix after disconnect"
  2019-08-26  9:43     ` Hayes Wang
@ 2019-08-26 20:55       ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2019-08-26 20:55 UTC (permalink / raw)
  To: hayeswang; +Cc: jslaby, netdev, nic_swsd, linux-kernel

From: Hayes Wang <hayeswang@realtek.com>
Date: Mon, 26 Aug 2019 09:43:32 +0000

> Jiri Slaby [mailto:jslaby@suse.cz]
>> Sent: Monday, August 26, 2019 4:55 PM
> [...]
>> Could you clarify *why* it conflicts? And how is the problem fixed by
>> 0ee1f473496 avoided now?
> 
> In rtl8152_disconnect(), the flow would be as following.
> 
> static void rtl8152_disconnect(struct usb_interface *intf)
> {
> 	...
> 	- netif_napi_del(&tp->napi);
> 	- unregister_netdev(tp->netdev);
> 	   - rtl8152_close
> 	      - napi_disable
> 
> Therefore you add a checking of RTL8152_UNPLUG to avoid
> calling napi_disable() after netif_napi_del(). However,
> after commit ffa9fec30ca0 ("r8152: set RTL8152_UNPLUG
> only for real disconnection"), RTL8152_UNPLUG is not
> always set when calling rtl8152_disconnect(). That is,
> napi_disable() would be called after netif_napi_del(),
> if RTL8152_UNPLUG is not set.
> 
> The best way is to avoid calling netif_napi_del() before
> calling unregister_netdev(). And I has submitted such
> patch following this one.

These details belong in the commit message, always.

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

end of thread, other threads:[~2019-08-26 20:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-26  8:41 [PATCH net v2 0/2] r8152: fix side effect Hayes Wang
2019-08-26  8:41 ` [PATCH net v2 1/2] Revert "r8152: napi hangup fix after disconnect" Hayes Wang
2019-08-26  8:55   ` Jiri Slaby
2019-08-26  9:43     ` Hayes Wang
2019-08-26 20:55       ` David Miller
2019-08-26  8:41 ` [PATCH net v2 2/2] r8152: remove calling netif_napi_del Hayes Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).