r8152: fix side effect
Subsystems (3)
cover r8152: fix side effect
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: avoid using napi_disable after netif_napi_del.
drivers/net/usb/r8152.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
Signature · 1 line
2.21.0
PATCH 1/2 Revert "r8152: napi hangup fix after disconnect"
This reverts commit 0ee1f4734967af8321ecebaf9c74221ace34f2d5.
This conflicts with commit ffa9fec30ca0 ("r8152: set RTL8152_UNPLUG only for real disconnection").
--- drivers/net/usb/r8152.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/usb/r8152.c +1 -2
@@ -4018,8 +4018,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);
Signature · 1 line
2.21.0
PATCH 2/2 r8152: avoid using napi_disable after netif_napi_del.
In reply to Hayes WangExchange netif_napi_del() and unregister_netdev() in rtl8152_disconnect() to avoid using napi_disable() after netif_napi_del().
--- drivers/net/usb/r8152.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/usb/r8152.c +1 -1
@@ -5364,8 +5364,8 @@ static void rtl8152_disconnect(struct usb_interface *intf)if (tp) {rtl_set_unplug (tp); -netif_napi_del (&tp->napi);unregister_netdev (tp->netdev); +netif_napi_del (&tp->napi);cancel_delayed_work_sync (&tp->hw_phy_work); tp->rtl_ops.unload (tp);free_netdev (tp->netdev);
Signature · 1 line
2.21.0
David Miller
maintainerRe: [PATCH net 2/2] r8152: avoid using napi_disable after netif_napi_del.
From: Hayes Wang <[email protected]>
Date: Fri, 23 Aug 2019 16:53:02 +0800
Quoted 13 lines
Exchange
netif_napi_del()andunregister_netdev()inrtl8152_disconnect()to avoid usingnapi_disable()afternetif_napi_del().Signed-off-by Hayes Wang <[email protected]>--- drivers/net/usb/r8152.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/usb/r8152.c +0
-0
drivers/net/usb/r8152.c static void rtl8152_disconnect(struct usb_interface *intf) · line 5371
Quoted 9 lines
drivers/net/usb/r8152.c +1
-1@@ -5364,8 +5364,8 @@ static void rtl8152_disconnect(struct usb_interface *intf)if (tp) {rtl_set_unplug (tp); -netif_napi_del (&tp->napi);unregister_netdev (tp->netdev); +netif_napi_del (&tp->napi);cancel_delayed_work_sync (&tp->hw_phy_work); tp->rtl_ops.unload (tp);free_netdev (tp->netdev);
This is completely redundant because free_netdev() will perform all of the necessary netif_napi_del() calls.
v3 cover r8152: fix side effect
In reply to Hayes Wangv3:
Update the commit message for patch #1.
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(-)
Signature · 1 line
2.21.0
PATCH v3 1/2 Revert "r8152: napi hangup fix after disconnect"
This reverts commit 0ee1f4734967af8321ecebaf9c74221ace34f2d5.
The commit 0ee1f4734967 ("r8152: napi hangup fix after disconnect") adds a check about RTL8152_UNPLUG to determine if calling napi_disable() is invalid in rtl8152_close(), when rtl8152_disconnect() is called. This avoids to use napi_disable() after calling netif_napi_del().
Howver, commit ffa9fec30ca0 ("r8152: set RTL8152_UNPLUG only for real disconnection") causes that RTL8152_UNPLUG is not always set when calling rtl8152_disconnect(). Therefore, I have to revert commit 0ee1f4734967 ("r8152:
napi hangup fix after disconnect"), first. And submit another patch to fix it.
--- drivers/net/usb/r8152.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/usb/r8152.c +1 -2
@@ -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);
Signature · 1 line
2.21.0
PATCH v3 2/2 r8152: remove calling netif_napi_del
In reply to Hayes WangRemove unnecessary use of netif_napi_del. This also avoids to call napi_disable() after netif_napi_del().
--- drivers/net/usb/r8152.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/usb/r8152.c +0 -2
@@ -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);
Signature · 1 line
2.21.0
Quoted 6 lines · Hayes Wang
v3:
Update the commit message for patch #1.v2:
Replace patch #2 with "r8152: remove callingnetif_napi_del".
Quoted 8 lines
v1:
The commit0ee1f4734967("r8152: napi hangup fix after disconnect") add a check to avoid usingnapi_disableafternetif_napi_del. However, the commitffa9fec30ca0("r8152: setRTL8152_UNPLUGonly 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.
LGTM, seems like if we were to add a Fixes tag it'd point to the
ffa9fec30ca0 ("r8152: set RTL8152_UNPLUG only for real disconnection")
commit, then? So only net needs it, v5.2 is fine.
David Miller
maintainerFrom: Hayes Wang <[email protected]>
Date: Wed, 28 Aug 2019 09:51:40 +0800
Quoted 6 lines
v3:
Update the commit message for patch #1.v2:
Replace patch #2 with "r8152: remove callingnetif_napi_del".
Quoted 8 lines
v1:
The commit0ee1f4734967("r8152: napi hangup fix after disconnect") add a check to avoid usingnapi_disableafternetif_napi_del. However, the commitffa9fec30ca0("r8152: setRTL8152_UNPLUGonly 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.
Series applied, thank you.
v4 cover r8152: fix side effect
In reply to Hayes Wangv4:
Add Fixes tag for both patch #1 and #2.
v3:
Update the commit message for patch #1.
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(-)
Signature · 1 line
2.21.0
PATCH v4 1/2 Revert "r8152: napi hangup fix after disconnect"
This reverts commit 0ee1f4734967af8321ecebaf9c74221ace34f2d5.
The commit 0ee1f4734967 ("r8152: napi hangup fix after disconnect") adds a check about RTL8152_UNPLUG to determine if calling napi_disable() is invalid in rtl8152_close(), when rtl8152_disconnect() is called. This avoids to use napi_disable() after calling netif_napi_del().
However, commit ffa9fec30ca0 ("r8152: set RTL8152_UNPLUG only for real disconnection") causes that RTL8152_UNPLUG is not always set when calling rtl8152_disconnect(). Therefore, I have to revert commit 0ee1f4734967 ("r8152:
napi hangup fix after disconnect"), first. And submit another patch to fix it.
--- drivers/net/usb/r8152.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/usb/r8152.c +1 -2
@@ -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);
Signature · 1 line
2.21.0
PATCH v4 2/2 r8152: remove calling netif_napi_del
In reply to Hayes WangRemove unnecessary use of netif_napi_del. This also avoids to call napi_disable() after netif_napi_del().
--- drivers/net/usb/r8152.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/usb/r8152.c +0 -2
@@ -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);
Signature · 1 line
2.21.0
David Miller
maintainerFrom: Hayes Wang <[email protected]>
Date: Wed, 28 Aug 2019 20:56:11 +0800
Quoted 2 lines
v4:
Add Fixes tag for both patch #1 and #2.
I applied v3, sorry.
I think it is OK as I will backport things to v5.2 -stable anyways.
David Miller [mailto:[email protected]]
Quoted 1 line
Sent: Thursday, August 29, 2019 7:18 AM
[...]
Quoted 6 lines
Quoted 2 lines
v4:
Add Fixes tag for both patch #1 and #2.I applied v3, sorry.
I think it is OK as I will backport things to v5.2 -stable anyways.
Thanks.
Best Regards,
Hayes