Skip to content

Commit

Permalink
smsc95xx: generate random MAC address once, not every ifup
Browse files Browse the repository at this point in the history
The smsc95xx driver currently generates a new random MAC address
every time the interface is brought up. This makes it impossible to
override using the standard `ifconfig hw ether` approach.

Past patches tried to make the MAC address a module parameter or
base it off the die ID, but it seems to me much simpler (and
hopefully less controversial) to stick with the current random
generation scheme, but allow the user to change the address.

This patch does exactly that - it moves the random address
generation from smsc95xx_reset() into smsc95xx_bind(), so that it is
done once on module load, not on every ifup. The user can then
override this using the standard mechanisms.

Applies against 2.6.35 and linux-2.6 head.

Signed-off-by: Bernard Blackham <b-omap@largestprime.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Bernard Blackham authored and David S. Miller committed Oct 21, 2010
1 parent fdb246f commit f4e8ab7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/usb/smsc95xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -805,8 +805,6 @@ static int smsc95xx_reset(struct usbnet *dev)
return ret;
}

smsc95xx_init_mac_address(dev);

ret = smsc95xx_set_mac_address(dev);
if (ret < 0)
return ret;
Expand Down Expand Up @@ -1047,6 +1045,8 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf)
pdata->use_tx_csum = DEFAULT_TX_CSUM_ENABLE;
pdata->use_rx_csum = DEFAULT_RX_CSUM_ENABLE;

smsc95xx_init_mac_address(dev);

/* Init all registers */
ret = smsc95xx_reset(dev);

Expand Down

0 comments on commit f4e8ab7

Please sign in to comment.