be2net: Signal that the device cannot transmit during reconfiguration [Linux 4.9.188]

This Linux kernel change "be2net: Signal that the device cannot transmit during reconfiguration" is included in the Linux 4.9.188 release. This change is authored by Benjamin Poirier <bpoirier [at] suse.com> on Tue Jul 16 17:16:55 2019 +0900. The commit for this change in Linux stable tree is 0b4f4a4 (patch) which is from upstream commit 7429c6c. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 7429c6c.

be2net: Signal that the device cannot transmit during reconfiguration

[ Upstream commit 7429c6c0d9cb086d8e79f0d2a48ae14851d2115e ]

While changing the number of interrupt channels, be2net stops adapter
operation (including netif_tx_disable()) but it doesn't signal that it
cannot transmit. This may lead dev_watchdog() to falsely trigger during
that time.

Add the missing call to netif_carrier_off(), following the pattern used in
many other drivers. netif_carrier_on() is already taken care of in
be_open().

Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>

There are 6 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/net/ethernet/emulex/benet/be_main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index b2eeecb..289560b 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -4701,8 +4701,12 @@ int be_update_queues(struct be_adapter *adapter)
    struct net_device *netdev = adapter->netdev;
    int status;

-   if (netif_running(netdev))
+   if (netif_running(netdev)) {
+       /* device cannot transmit now, avoid dev_watchdog timeouts */
+       netif_carrier_off(netdev);
+
        be_close(netdev);
+   }

    be_cancel_worker(adapter);

Leave a Reply

Your email address will not be published. Required fields are marked *