netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Willy Tarreau <w@1wt.eu>
To: uke Kok <auke-jan.h.kok@intel.com>,
	"Brandeburg, Jesse" <jesse.brandeburg@intel.com>
Cc: netdev@vger.kernel.org
Subject: [PATCH] e100 module loads 1/2 times
Date: Mon, 13 Aug 2007 09:54:53 +0200	[thread overview]
Message-ID: <20070813075453.GA4257@1wt.eu> (raw)

Hi Auke, Jesse,

for a long time, I've been annoyed by version 3.5.17 of the e100 driver
which refuses to load on first time and only loads on second time. Since
I always had the original 2.3.43 driver in kernel 2.4, I did not care
that much. Recently, I encountered real troubles with 2.3.43 in a 802.1q
setup (basically it did not untag incoming frames). So I decided to give
3.5.17 a second try. Same problem, I had to load it twice.

I finally found the problem in e100_init_module(). Up to 3.5.14, the
return of pci_module_init() was returned. This one equals zero if
everything went fine, <0 otherwise, which is compatible with init_module().

With 3.5.17, the result comes from pci_register_driver(), which returns
the number of devices registered. So the problem now makes sense :

- first call: the driver registers itself and returns non-zero, which
  is an error for insmod

- second call: the driver cannot register again and returns zero new
  drivers, which is good for insmod.

Note that e1000 has a related bug : it uses the return from pci_module_init()
to decide whether or not to register a reboot notifier. Fortunately, the
test is performed with ret>=0, which matches ==0 and not <0 (errors), so
this works as a side effect.

The obvious fix for e100 reusing pci_module_init is below. Also, since
e100-2.3.43 does not work at all with vlans in 2.4, I was thinking about
upgrading it to 3.5.17. It would also be the same version as in 2.6,
simplifying its long-term maintenance. What do you think about this ?

Best regards,
Willy


--- e100-3.5.17/src/e100.c.orig	2007-08-13 08:53:18 +0200
+++ e100-3.5.17/src/e100.c	2007-08-13 09:24:56 +0200
@@ -2934,13 +2934,13 @@
 		printk(KERN_INFO PFX "%s\n", DRV_COPYRIGHT);
 	}
 #ifdef E100_USE_REBOOT_NOTIFIER
-	retval = pci_register_driver(&e100_driver);
-	if (retval >= 0)
+	retval = pci_module_init(&e100_driver);
+	if (retval == 0)
 		register_reboot_notifier(&e100_notifier_reboot);
 
 	return retval;
 #else
-	return pci_register_driver(&e100_driver);
+	return pci_module_init(&e100_driver);
 #endif
 }
 



                 reply	other threads:[~2007-08-13  7:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20070813075453.GA4257@1wt.eu \
    --to=w@1wt.eu \
    --cc=auke-jan.h.kok@intel.com \
    --cc=jesse.brandeburg@intel.com \
    --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;
as well as URLs for NNTP newsgroup(s).