public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <andrewm@uow.edu.au>
To: kuznet@ms2.inr.ac.ru
Cc: "David S. Miller" <davem@redhat.COM>, linux-kernel@vger.kernel.org
Subject: Re: NETDEV_CHANGE events when __LINK_STATE_NOCARRIER is modified
Date: Mon, 14 May 2001 11:43:39 +1000	[thread overview]
Message-ID: <3AFF384B.7382B436@uow.edu.au> (raw)
In-Reply-To: <15091.23655.488243.650394@pizda.ninka.net> from "David S. Miller" at May 5, 1 06:15:00 am <200105131819.WAA27939@ms2.inr.ac.ru>

kuznet@ms2.inr.ac.ru wrote:
> 
> BTW what did happen with Andrew's netdev registration patch?
> By some strange reason I believed it is already applied... Grrr.

Alan had it applied in his tree for a while.  It was a damn huge
patch though, and Jeff came up with a simpler version which is
now present in both 2.4 streams.

Jeff has introduced `alloc_etherdev()' which allocates storage
for a netdev but doesn't register it.  The one quirk with this
approach (and why it's vastly simpler than my thing) is that
the name of the interface is not known during probe, so the
drivers need to take care that the identifier which they emit
in their detection messages make sense.

Old code:

xxx_probe()
{
	dev = init_etherdev();
	< initialise stuff >
	printk("%s", dev->name);
	/*
	 * If we sleep here, we drop BKL and other tasks/CPUs
 	 * can open an unready device.  dev_probe_lock() plugs
	 * this for PCI/Cardbus devices only
	 */
	if (failed) {
		unregister_netdev(dev);
		return -EWHATEVER;
	}
	return 0;
}

New code:

xxx_probe(struct pci_dev *pdev, ...)
{
	dev = alloc_etherdev();
	<initialise stuff>
	/*
	 * Note that dev->name doesn't make sense at this time.
	 * So we use PCI locations.  Drivers which support
	 * EISA as well as PCI (eg 3c59x) will have a NULL
	 * pdev here and need to make something up.
	 */
	printk("%s", pdev->slot_name);
	/*
	 * If we sleep here, we're fine: the device isn't
	 * registered in the namespace yet
	 */
	...
	if (failed) {
		kfree(dev);
		return -EBUMMER;
	}
	return register_netdev(dev);
}

Not many drivers have been converted to the new interface yet.

The situation with old-style drivers which use net_device.init()
is a bit foggy.  ISTR that the init() method was inherently
immune to this race.  

-

  reply	other threads:[~2001-05-14  1:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <15091.23655.488243.650394@pizda.ninka.net>
2001-05-13 18:19 ` NETDEV_CHANGE events when __LINK_STATE_NOCARRIER is modified kuznet
2001-05-14  1:43   ` Andrew Morton [this message]
2001-05-14 17:47     ` kuznet
2001-05-14 18:12       ` Jeff Garzik
2001-05-14 18:40         ` kuznet
2001-05-14 19:27           ` Jeff Garzik
2001-05-14 19:42             ` kuznet
2001-05-14 20:34               ` Jeff Garzik
2001-05-14 23:51           ` Andrew Morton
2001-05-15  9:02             ` kuznet
2001-05-15 11:00               ` Andrew Morton
2001-05-15 11:15                 ` David S. Miller

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=3AFF384B.7382B436@uow.edu.au \
    --to=andrewm@uow.edu.au \
    --cc=davem@redhat.COM \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@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