Re: [PATCH] usb:smsc: preserve MAC address when resetting device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Attachment: pgpDPJudgVXRa.pgp
Description: PGP signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux