From: Ilya Shchepetkov <shchepetkov@ispras.ru>
To: "David S. Miller" <davem@davemloft.net>
Cc: Ilya Shchepetkov <shchepetkov@ispras.ru>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
ldv-project@ispras.ru
Subject: [PATCH 4/5] sungem: Call netif_carrier_off() after register_netdev()
Date: Tue, 14 Aug 2012 14:28:54 +0400 [thread overview]
Message-ID: <1344940135-17079-5-git-send-email-shchepetkov@ispras.ru> (raw)
In-Reply-To: <1344940135-17079-1-git-send-email-shchepetkov@ispras.ru>
For carrier detection to work properly when binding the driver with a
cable unplugged, netif_carrier_off() should be called after
register_netdev(), not before.
Calling netif_carrier_off() before register_netdev() was causing the
network interface to miss a linkwatch pending event leading to an
inconsistent state if the link is not up when interface is initialized.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Ilya Shchepetkov <shchepetkov@ispras.ru>
---
drivers/net/ethernet/sun/sungem.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/sun/sungem.c b/drivers/net/ethernet/sun/sungem.c
index 9ae12d0..c57c9f6 100644
--- a/drivers/net/ethernet/sun/sungem.c
+++ b/drivers/net/ethernet/sun/sungem.c
@@ -2909,7 +2909,6 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
gp->lstate = link_down;
gp->timer_ticks = 0;
- netif_carrier_off(dev);
gp->regs = ioremap(gemreg_base, gemreg_len);
if (!gp->regs) {
@@ -2988,6 +2987,9 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
goto err_out_free_consistent;
}
+ /* Turn off carrier */
+ netif_carrier_off(dev);
+
/* Undo the get_cell with appropriate locking (we could use
* ndo_init/uninit but that would be even more clumsy imho)
*/
--
1.7.7
next prev parent reply other threads:[~2012-08-14 10:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-14 10:28 [PATCH 0/5] Call netif_carrier_off() after register_netdev() Ilya Shchepetkov
2012-08-14 10:28 ` [PATCH 2/5] de2104x: " Ilya Shchepetkov
2012-08-14 10:28 ` [PATCH 3/5] net/mlx4_en: " Ilya Shchepetkov
2012-08-14 12:36 ` Sathya.Perla
2012-08-14 14:56 ` Ben Hutchings
2012-08-14 10:28 ` Ilya Shchepetkov [this message]
2012-08-14 10:28 ` [PATCH 5/5] net/hyperv: " Ilya Shchepetkov
2012-08-14 15:32 ` Haiyang Zhang
2012-08-14 21:00 ` [PATCH 0/5] " David Miller
2012-08-14 22:47 ` Ben Hutchings
2012-08-15 11:40 ` Bjørn Mork
2012-08-17 7:55 ` Ilya Shchepetkov
2012-08-17 16:20 ` Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1344940135-17079-5-git-send-email-shchepetkov@ispras.ru \
--to=shchepetkov@ispras.ru \
--cc=davem@davemloft.net \
--cc=ldv-project@ispras.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox