0147-Updated-smsc95xx-driver-to-check-for-a-valid-MAC-add.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. From 97c4f995a385631934b1d732271997d44fab0c87 Mon Sep 17 00:00:00 2001
  2. From: Craig Roberts <cjr@craigroberts.net>
  3. Date: Tue, 16 Feb 2016 10:03:42 +0000
  4. Subject: [PATCH 147/381] Updated smsc95xx driver to check for a valid MAC
  5. address in eeprom before using smsc95xx.macaddr parameter passed on command
  6. line.
  7. The built-in RPi adaptor will still get a MAC address based on the parameter passed on the command line as the RPi hardware does not have an eeprom,
  8. however usb->ethernet adaptors using the same driver should have an eeprom with MAC address as part of their hardware and therefore will use this
  9. meaning they don't end up with the same MAC address as the built-in RPi adaptor.
  10. ---
  11. drivers/net/usb/smsc95xx.c | 10 +++++-----
  12. 1 file changed, 5 insertions(+), 5 deletions(-)
  13. --- a/drivers/net/usb/smsc95xx.c
  14. +++ b/drivers/net/usb/smsc95xx.c
  15. @@ -817,10 +817,6 @@ static int smsc95xx_is_macaddr_param(str
  16. static void smsc95xx_init_mac_address(struct usbnet *dev)
  17. {
  18. - /* Check module parameters */
  19. - if (smsc95xx_is_macaddr_param(dev, dev->net->dev_addr))
  20. - return;
  21. -
  22. /* try reading mac address from EEPROM */
  23. if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
  24. dev->net->dev_addr) == 0) {
  25. @@ -831,7 +827,11 @@ static void smsc95xx_init_mac_address(st
  26. }
  27. }
  28. - /* no eeprom, or eeprom values are invalid. generate random MAC */
  29. + /* Check module parameters */
  30. + if (smsc95xx_is_macaddr_param(dev, dev->net->dev_addr))
  31. + return;
  32. +
  33. + /* no eeprom, or eeprom values are invalid, and no module parameter specified to set MAC. Generate random MAC */
  34. eth_hw_addr_random(dev->net);
  35. netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n");
  36. }