From patchwork Mon Dec 14 21:19:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lijun Pan X-Patchwork-Id: 11973125 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5327C4361B for ; Mon, 14 Dec 2020 21:20:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6AF4D224B0 for ; Mon, 14 Dec 2020 21:20:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388036AbgLNVUZ (ORCPT ); Mon, 14 Dec 2020 16:20:25 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:3058 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2503456AbgLNVUO (ORCPT ); Mon, 14 Dec 2020 16:20:14 -0500 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0BEL3SeE022532 for ; Mon, 14 Dec 2020 16:19:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=g/UGOVxkTb7+BI1rK7MXmu9Hy/Oazee+sp1yohbwXRs=; b=TkND/T+NuTE3g+W6MtIuxHiz/BUDDzSnhB/lSB5VRXZKfTmrlAt9e3VheamxTL/zlOH/ nfqv6pmE1GukATyxMgP8wuyIFZO7RPEromhz7iTSOxmKS+wPf8dKYD8NN/mVlcQMmLwP ZeRqkG7d1e1BRDRKMwcQqHa4MehRRB8mZLhNRXzLm/e2d4zwqHrxRP2WiBIPKoT20ijI 4A1eqUXIHdq+ZzPGAsGf85YYjqD8vIbaui5bToULjj/Jjxe8i4Qx0M/e5HyaNx4DG6ix nVACnAX1BZ/LbzZXg+oUfGG9zo5BnKjfDGAgThg5JnV0KlhoCRbZ/22yHKi8Ep/rZgF+ eA== Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0b-001b2d01.pphosted.com with ESMTP id 35ebf6fvck-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 14 Dec 2020 16:19:33 -0500 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0BELGpw7019562 for ; Mon, 14 Dec 2020 21:19:32 GMT Received: from b01cxnp22034.gho.pok.ibm.com (b01cxnp22034.gho.pok.ibm.com [9.57.198.24]) by ppma02dal.us.ibm.com with ESMTP id 35d525hqy1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 14 Dec 2020 21:19:32 +0000 Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0BELJVRa30081324 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 Dec 2020 21:19:31 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 92CE52805A; Mon, 14 Dec 2020 21:19:31 +0000 (GMT) Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4BE6628059; Mon, 14 Dec 2020 21:19:31 +0000 (GMT) Received: from pompom.ibm.com (unknown [9.80.237.30]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 14 Dec 2020 21:19:31 +0000 (GMT) From: Lijun Pan To: netdev@vger.kernel.org Cc: Lijun Pan , Nathan Lynch Subject: [PATCH net-next v2 1/3] net: core: introduce __netdev_notify_peers Date: Mon, 14 Dec 2020 15:19:28 -0600 Message-Id: <20201214211930.80778-2-ljp@linux.ibm.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20201214211930.80778-1-ljp@linux.ibm.com> References: <20201214211930.80778-1-ljp@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343,18.0.737 definitions=2020-12-14_11:2020-12-11,2020-12-14 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 phishscore=0 adultscore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 impostorscore=0 bulkscore=0 suspectscore=0 priorityscore=1501 mlxlogscore=999 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012140137 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org There are some use cases for netdev_notify_peers in the context when rtnl lock is already held. Introduce lockless version of netdev_notify_peers call to save the extra code to call call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, dev); call_netdevice_notifiers(NETDEV_RESEND_IGMP, dev); After that, convert netdev_notify_peers to call the new helper. Suggested-by: Nathan Lynch Signed-off-by: Lijun Pan --- include/linux/netdevice.h | 1 + net/core/dev.c | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 7bf167993c05..259be67644e3 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -4547,6 +4547,7 @@ void __dev_set_rx_mode(struct net_device *dev); int dev_set_promiscuity(struct net_device *dev, int inc); int dev_set_allmulti(struct net_device *dev, int inc); void netdev_state_change(struct net_device *dev); +void __netdev_notify_peers(struct net_device *dev); void netdev_notify_peers(struct net_device *dev); void netdev_features_change(struct net_device *dev); /* Load a device via the kmod */ diff --git a/net/core/dev.c b/net/core/dev.c index bde98cfd166f..43e3b176a30a 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -1456,6 +1456,25 @@ void netdev_state_change(struct net_device *dev) } EXPORT_SYMBOL(netdev_state_change); +/** + * __netdev_notify_peers - notify network peers about existence of @dev, + * to be called when rtnl lock is already held. + * @dev: network device + * + * Generate traffic such that interested network peers are aware of + * @dev, such as by generating a gratuitous ARP. This may be used when + * a device wants to inform the rest of the network about some sort of + * reconfiguration such as a failover event or virtual machine + * migration. + */ +void __netdev_notify_peers(struct net_device *dev) +{ + ASSERT_RTNL(); + call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, dev); + call_netdevice_notifiers(NETDEV_RESEND_IGMP, dev); +} +EXPORT_SYMBOL(__netdev_notify_peers); + /** * netdev_notify_peers - notify network peers about existence of @dev * @dev: network device @@ -1469,8 +1488,7 @@ EXPORT_SYMBOL(netdev_state_change); void netdev_notify_peers(struct net_device *dev) { rtnl_lock(); - call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, dev); - call_netdevice_notifiers(NETDEV_RESEND_IGMP, dev); + __netdev_notify_peers(dev); rtnl_unlock(); } EXPORT_SYMBOL(netdev_notify_peers); From patchwork Mon Dec 14 21:19:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lijun Pan X-Patchwork-Id: 11973123 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 508DDC4361B for ; Mon, 14 Dec 2020 21:20:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1A892224B0 for ; Mon, 14 Dec 2020 21:20:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503563AbgLNVUS (ORCPT ); Mon, 14 Dec 2020 16:20:18 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:64604 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2503389AbgLNVUO (ORCPT ); Mon, 14 Dec 2020 16:20:14 -0500 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0BEL2KPE030290 for ; Mon, 14 Dec 2020 16:19:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=sHfdJcD0HtWtLtVy2YpmetkRLVIhAH7D2Td5mc5nE7A=; b=TvDozhzkGRfgqJ2E8EFtQRQxlpt/Fz8YABuOSasZ3s83k/q2X56QbxCIwcs3elPKeT8y t5G8wEv9xwx1+HWurLe4znjRqxIKx6IC3o9eYrXwup0J5I2n6XZOPx7wCySJ2qMGpLT6 jfVNkI5SWLCKAlb9LOiR3unYhdo4guJzs+JcGdqQT9jdwe0PG2N/6b1QzQR1/xKaUF25 JyEzdZOtZogtothLrgbZe04vnCePgzeE8lINxwOmoQxFaZmj2aVP13X4YbLObXnSZj94 bA80bWaQZRX1/uXpCb1rSFiZLPy4B1N7aiIONI5sCM+kKFX3ykVUFQ49ogeXKYgTYiPY Ag== Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0b-001b2d01.pphosted.com with ESMTP id 35edn1uqp3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 14 Dec 2020 16:19:33 -0500 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0BELHvnX006647 for ; Mon, 14 Dec 2020 21:19:32 GMT Received: from b01cxnp22035.gho.pok.ibm.com (b01cxnp22035.gho.pok.ibm.com [9.57.198.25]) by ppma03wdc.us.ibm.com with ESMTP id 35cng92rs3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 14 Dec 2020 21:19:32 +0000 Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0BELJWsm27656656 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 Dec 2020 21:19:32 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F28BC2805A; Mon, 14 Dec 2020 21:19:31 +0000 (GMT) Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AABD828059; Mon, 14 Dec 2020 21:19:31 +0000 (GMT) Received: from pompom.ibm.com (unknown [9.80.237.30]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 14 Dec 2020 21:19:31 +0000 (GMT) From: Lijun Pan To: netdev@vger.kernel.org Cc: Lijun Pan Subject: [PATCH net-next v2 2/3] use __netdev_notify_peers in ibmvnic Date: Mon, 14 Dec 2020 15:19:29 -0600 Message-Id: <20201214211930.80778-3-ljp@linux.ibm.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20201214211930.80778-1-ljp@linux.ibm.com> References: <20201214211930.80778-1-ljp@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343,18.0.737 definitions=2020-12-14_11:2020-12-11,2020-12-14 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 suspectscore=0 priorityscore=1501 phishscore=0 clxscore=1015 spamscore=0 mlxlogscore=999 malwarescore=0 lowpriorityscore=0 impostorscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012140137 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Start to use the lockless version of netdev_notify_peers. Signed-off-by: Lijun Pan --- drivers/net/ethernet/ibm/ibmvnic.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index a2191392ca4f..f302504faa8a 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -2171,10 +2171,8 @@ static int do_reset(struct ibmvnic_adapter *adapter, napi_schedule(&adapter->napi[i]); if (adapter->reset_reason == VNIC_RESET_FAILOVER || - adapter->reset_reason == VNIC_RESET_MOBILITY) { - call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, netdev); - call_netdevice_notifiers(NETDEV_RESEND_IGMP, netdev); - } + adapter->reset_reason == VNIC_RESET_MOBILITY) + __netdev_notify_peers(netdev); rc = 0; @@ -2249,8 +2247,7 @@ static int do_hard_reset(struct ibmvnic_adapter *adapter, goto out; } - call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, netdev); - call_netdevice_notifiers(NETDEV_RESEND_IGMP, netdev); + __netdev_notify_peers(netdev); out: /* restore adapter state if reset failed */ if (rc) From patchwork Mon Dec 14 21:19:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lijun Pan X-Patchwork-Id: 11973127 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F00EC4361B for ; Mon, 14 Dec 2020 21:20:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0C41C2247F for ; Mon, 14 Dec 2020 21:20:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503584AbgLNVUn (ORCPT ); Mon, 14 Dec 2020 16:20:43 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:21106 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388027AbgLNVUQ (ORCPT ); Mon, 14 Dec 2020 16:20:16 -0500 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0BEL0jgh127933; Mon, 14 Dec 2020 16:19:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=bS3VsFV+7RuJhvo6TiDT+URTbhFxHi00DyDxf7ajcr8=; b=YQaVwQdu/ZEjw5yHAjR0QZwHb9y1W4yVH2X9jfN5uB1eeyRw0hqgffBtGsLJTLkqR1Mq gU6eJCeV1BZXKLhlVwF9NxYqpWzwN2j4lyGZApSDePwfUuHP7iNBykVTzh0oQOSukAgC CxPbNIRYyPVyks7BvnTwosV9lPZmmjnAUMWHk640IruegniCbGusfSCoVZtOhR/g6sZp xJWX7PDw+QiWBvv2lPd2wNDYvY1sNDdG/bfZ1B/+rJwraOFfjPez8jrvkZTQSbSStcFp 0Ce3ByEcvMXpgsyGud5cVwS+B1gExevkJPaoeFT7v5IkA7XqwokdthW4vzP+lhyh6W0Z lg== Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0a-001b2d01.pphosted.com with ESMTP id 35edr3unan-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 14 Dec 2020 16:19:34 -0500 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0BELGmeC019495; Mon, 14 Dec 2020 21:19:33 GMT Received: from b01cxnp22035.gho.pok.ibm.com (b01cxnp22035.gho.pok.ibm.com [9.57.198.25]) by ppma02dal.us.ibm.com with ESMTP id 35d525hqy5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 14 Dec 2020 21:19:33 +0000 Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0BELJWI427591150 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 Dec 2020 21:19:32 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6D7172805C; Mon, 14 Dec 2020 21:19:32 +0000 (GMT) Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 167DE28058; Mon, 14 Dec 2020 21:19:32 +0000 (GMT) Received: from pompom.ibm.com (unknown [9.80.237.30]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 14 Dec 2020 21:19:32 +0000 (GMT) From: Lijun Pan To: netdev@vger.kernel.org Cc: Lijun Pan , Haiyang Zhang Subject: [PATCH net-next v2 3/3] use __netdev_notify_peers in hyperv Date: Mon, 14 Dec 2020 15:19:30 -0600 Message-Id: <20201214211930.80778-4-ljp@linux.ibm.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20201214211930.80778-1-ljp@linux.ibm.com> References: <20201214211930.80778-1-ljp@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343,18.0.737 definitions=2020-12-14_11:2020-12-11,2020-12-14 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 lowpriorityscore=0 adultscore=0 phishscore=0 impostorscore=0 mlxscore=0 malwarescore=0 clxscore=1015 suspectscore=0 priorityscore=1501 bulkscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012140137 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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 Signed-off-by: Lijun Pan --- 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(-) 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. */