linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steve.Glendinning@smsc.com
To: Sebastien Jan <s-jan@ti.com>
Cc: Simon Horman <horms@verge.net.au>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	davem@davemloft.net, Ian.Saturley@smsc.com
Subject: Re: [PATCH] smsc95xx: Add module parameter to override MAC address
Date: Fri, 25 Jun 2010 09:43:30 +0100	[thread overview]
Message-ID: <OF60E8D688.255F8F16-ON8025774D.002E17AA-8025774D.002FEC33@smsc.com> (raw)
In-Reply-To: <4C2452ED.8020307@ti.com>

Hi Sebastien,

> > I'm confused as to why this is desirable when the mac address
> > can already be configured after module insertion via
> > smsc95xx_netdev_ops.eth_mac_addr().
> 
> For example for booting over NFS using a pre-defined MAC address, with 
> a minimal setup (no initrd). Or is there another way to force a MAC
> address for this use-case?

I can't see an existing way of specifying this as a kernel parameter
in Documentation/kernel-parameters.txt. netdev= doesn't have a mac
address parameter.

During development I initially had smsc95xx driver using this logic to
select a MAC address:

1. If net->dev_addr has already been set to a valid mac address (i.e. by
an administrator before bringing the device up) then use that address.

2. If the device is already currently set to a valid mac address then
use that address.  This could have been set by either the device's
EEPROM or by a previously running bootloader.

3. Generate a random mac address.

Unfortunately, this doesn't work so well as the usbnet framework sets
net->dev_addr to the USB node_id before calling our bind function, so
we usually matched at step 1 (and not with the desired outcome).  So
I removed step 1 because, as Simon mentioned, it's possible to change
the mac address after the device is brought up.

I can see you have a different use case, but I don't think this specific
driver is the place for this logic.  I'd rather see it added to either
the usbnet framework or (preferably) the netdev framework so *all*
ethernet drivers can do this the same way.  otherwise we could end up
with slight variations of this code in every single driver!

Steve

  reply	other threads:[~2010-06-25  8:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-24  8:14 [PATCH] smsc95xx: Add module parameter to override MAC address Sebastien Jan
2010-06-25  1:25 ` Simon Horman
2010-06-25  6:55   ` Sebastien Jan
2010-06-25  8:43     ` Steve.Glendinning [this message]
2010-06-25 14:20       ` Sebastien Jan
2010-06-25 18:17         ` David 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=OF60E8D688.255F8F16-ON8025774D.002E17AA-8025774D.002FEC33@smsc.com \
    --to=steve.glendinning@smsc.com \
    --cc=Ian.Saturley@smsc.com \
    --cc=davem@davemloft.net \
    --cc=horms@verge.net.au \
    --cc=linux-omap@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=s-jan@ti.com \
    /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).