[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110201112425.GA3407894@jupiter.n2.diac24.net>
Date: Tue, 1 Feb 2011 12:24:25 +0100
From: David Lamparter <equinox@...c24.net>
To: Sergiy Kibrik <sakib@...a.ua>
Cc: Steve Glendinning <steve.glendinning@...c.com>,
netdev@...r.kernel.org, linux-usb@...r.kernel.org
Subject: Re: [PATCH] usb:smsc: preserve MAC address when resetting device
On Tue, Feb 01, 2011 at 12:34:17PM +0200, Sergiy Kibrik wrote:
> Initialize MAC address only once, when device opened first time
> to avoid generation random addresses when failed to read one from ROM.
>
> Some hardware hasn't hw address in ROM, e.g. Pandaboard (http://pandaboard.org),
> so every time device is up, its address is regenerated again.
> It makeis impossible to set custom hw address and also makes DHCP servers and switches crazy.
[snip]
> +++ b/drivers/net/usb/smsc75xx.c
> @@ -77,6 +77,7 @@ struct usb_context {
> };
>
> static int turbo_mode = true;
> +static int first_reset = true;
> module_param(turbo_mode, bool, 0644);
> MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction");
>
> @@ -836,7 +837,10 @@ static int smsc75xx_reset(struct usbnet *dev)
>
> netif_dbg(dev, ifup, dev->net, "PHY reset complete");
>
> - smsc75xx_init_mac_address(dev);
> + if (first_reset){
> + smsc75xx_init_mac_address(dev);
> + first_reset = false;
> + }
[snip]
You cannot do that. Imagine if I plug in two devices. Only the first one
will get a MAC properly. Or imagine if i plug a device, unplug it and
plug it back. It will have an uninitialized mac address.
You need to move the init_mac_address call to happen on device plug-in.
-David
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists