diff mbox series

[net-next,v2,3/3] use __netdev_notify_peers in hyperv

Message ID 20201214211930.80778-4-ljp@linux.ibm.com (mailing list archive)
State Accepted
Commit 935d8a0a43e3f928e3243ae22bc53cd7a014d515
Delegated to: Netdev Maintainers
Headers show
Series lockless version of netdev_notify_peers | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 31 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Lijun Pan Dec. 14, 2020, 9:19 p.m. UTC
Start to use the lockless version of netdev_notify_peers.
Call the helper where notify variable used to be set true.
Remove the notify bool variable and sort the variables
in reverse Christmas tree order.

Cc: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Lijun Pan <ljp@linux.ibm.com>
---
v2: call the helper where notify variable used to be set true
    according to Jakub's review suggestion.

 drivers/net/hyperv/netvsc_drv.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

Comments

Jakub Kicinski Dec. 14, 2020, 11:22 p.m. UTC | #1
On Mon, 14 Dec 2020 15:19:30 -0600 Lijun Pan wrote:
> Start to use the lockless version of netdev_notify_peers.
> Call the helper where notify variable used to be set true.
> Remove the notify bool variable and sort the variables
> in reverse Christmas tree order.
> 
> Cc: Haiyang Zhang <haiyangz@microsoft.com>
> Signed-off-by: Lijun Pan <ljp@linux.ibm.com>
> ---
> v2: call the helper where notify variable used to be set true
>     according to Jakub's review suggestion.

Can we get an ack for merging via net-next?

> diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
> index d17bbc75f5e7..f32f28311d57 100644
> --- a/drivers/net/hyperv/netvsc_drv.c
> +++ b/drivers/net/hyperv/netvsc_drv.c
> @@ -2050,11 +2050,11 @@ static void netvsc_link_change(struct work_struct *w)
>  		container_of(w, struct net_device_context, dwork.work);
>  	struct hv_device *device_obj = ndev_ctx->device_ctx;
>  	struct net_device *net = hv_get_drvdata(device_obj);
> +	unsigned long flags, next_reconfig, delay;
> +	struct netvsc_reconfig *event = NULL;
>  	struct netvsc_device *net_device;
>  	struct rndis_device *rdev;
> -	struct netvsc_reconfig *event = NULL;
> -	bool notify = false, reschedule = false;
> -	unsigned long flags, next_reconfig, delay;
> +	bool reschedule = false;
>  
>  	/* if changes are happening, comeback later */
>  	if (!rtnl_trylock()) {
> @@ -2103,7 +2103,7 @@ static void netvsc_link_change(struct work_struct *w)
>  			netif_carrier_on(net);
>  			netvsc_tx_enable(net_device, net);
>  		} else {
> -			notify = true;
> +			__netdev_notify_peers(net);
>  		}
>  		kfree(event);
>  		break;
> @@ -2132,9 +2132,6 @@ static void netvsc_link_change(struct work_struct *w)
>  
>  	rtnl_unlock();
>  
> -	if (notify)
> -		netdev_notify_peers(net);
> -
>  	/* link_watch only sends one notification with current state per
>  	 * second, handle next reconfig event in 2 seconds.
>  	 */
diff mbox series

Patch

diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index d17bbc75f5e7..f32f28311d57 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -2050,11 +2050,11 @@  static void netvsc_link_change(struct work_struct *w)
 		container_of(w, struct net_device_context, dwork.work);
 	struct hv_device *device_obj = ndev_ctx->device_ctx;
 	struct net_device *net = hv_get_drvdata(device_obj);
+	unsigned long flags, next_reconfig, delay;
+	struct netvsc_reconfig *event = NULL;
 	struct netvsc_device *net_device;
 	struct rndis_device *rdev;
-	struct netvsc_reconfig *event = NULL;
-	bool notify = false, reschedule = false;
-	unsigned long flags, next_reconfig, delay;
+	bool reschedule = false;
 
 	/* if changes are happening, comeback later */
 	if (!rtnl_trylock()) {
@@ -2103,7 +2103,7 @@  static void netvsc_link_change(struct work_struct *w)
 			netif_carrier_on(net);
 			netvsc_tx_enable(net_device, net);
 		} else {
-			notify = true;
+			__netdev_notify_peers(net);
 		}
 		kfree(event);
 		break;
@@ -2132,9 +2132,6 @@  static void netvsc_link_change(struct work_struct *w)
 
 	rtnl_unlock();
 
-	if (notify)
-		netdev_notify_peers(net);
-
 	/* link_watch only sends one notification with current state per
 	 * second, handle next reconfig event in 2 seconds.
 	 */