From: Danny Kukawka <hidden> Date: 2012-02-08 21:15:28
The information if a device has a random MAC address is exported
to the userspace via /sys/class/net/*/addr_assign_type, which
export net_device->addr_assign_type.
Currently only a few driver really use dev_hw_addr_random() to
set addr_assign_type correctly to NET_ADDR_RANDOM.
This patch change the drivers which set random addresses to
change also addr_assign_type to NET_ADDR_RANDOM.
To reflect if the MAC was changed from userspace via SIOCSIFHWADDR,
which means it's no longer a random address set by the kernel,
this patch remove NET_ADDR_RANDOM from addr_assign_type in this
case.
With this patch tools from userspace can now detect devices with
random MAC addresses and change them to persistent addresses if
needed (as e.g. in case of smsc95xx on PandaBoard).
Maybe it makes sense to introduce a new state for addr_assign_type
to reflect the fact, that the MAC address was changed via a ioctl
from user space, e.g, with NET_ADDR_USERSPACE ?
Danny Kukawka (50):
eth: reset addr_assign_type if eth_mac_addr() called
smsc95xx: use dev_hw_addr_random() instead of random_ether_addr()
smsc75xx: se dev_hw_addr_random() instead of random_ether_addr()
adi/blackfin: set addr_assign_type correctly if random
UML net: set addr_assign_type if random_ether_addr() used
dummy: use dev_hw_addr_random() instead of random_ether_addr()
au1000_eth: use dev_hw_addr_random() instead of random_ether_addr()
bnx2x: use dev_hw_addr_random() instead of random_ether_addr()
Cadence MACB: use dev_hw_addr_random() instead of random_ether_addr()
Calxeda XGMAC: use dev_hw_addr_random() instead of
random_ether_addr()
ep93xx: use dev_hw_addr_random() instead of random_ether_addr()
dm9000: use dev_hw_addr_random() instead of random_ether_addr()
dnet: use dev_hw_addr_random() instead of random_ether_addr()
ethoc: set addr_assign_type if random_ether_addr() used
lantiq_etop: set addr_assign_type if random_ether_addr() used
pxa168_eth: use dev_hw_addr_random() instead of random_ether_addr()
enc28j60: use dev_hw_addr_random() instead of random_ether_addr()
mipsnet: use dev_hw_addr_random() instead of random_ether_addr()
macsonic: use dev_hw_addr_random() instead of random_ether_addr()
smsc911x: use dev_hw_addr_random() instead of random_ether_addr()
smsc9420: use dev_hw_addr_random() instead of random_ether_addr()
r6040: use dev_hw_addr_random() instead of random_ether_addr()
efx: use dev_hw_addr_random() instead of random_ether_addr()
sis900: use dev_hw_addr_random() instead of random_ether_addr()
via-rhine: use dev_hw_addr_random() instead of random_ether_addr()
faraday: use dev_hw_addr_random() instead of random_ether_addr()
davinci_emac: use dev_hw_addr_random() instead of random_ether_addr()
forcedeth: use dev_hw_addr_random() instead of random_ether_addr()
micrel eth: use dev_hw_addr_random() instead of random_ether_addr()
atheros eth: set addr_assign_type if random_ether_addr() used
tc35815: use dev_hw_addr_random() instead of random_ether_addr()
tile_net: use dev_hw_addr_random() instead of random_ether_addr()
stmmac: use dev_hw_addr_random() instead of random_ether_addr()
xilinx ll_temac: use dev_hw_addr_random() instead of
random_ether_addr()
ifb: use dev_hw_addr_random() instead of random_ether_addr()
igbvf: reset netdevice addr_assign_type if changed from random
usbnet: set addr_assign_type if random_ether_addr() used
g_ether: set addr_assign_type if random_ether_addr() used
veth: use dev_hw_addr_random() instead of random_ether_addr()
batman-adv: use dev_hw_addr_random() instead of random_ether_addr()
l2tp_eth: use dev_hw_addr_random() instead of random_ether_addr()
virtio_net: use dev_hw_addr_random() instead of random_ether_addr()
macvlan: use dev_hw_addr_random() instead of random_ether_addr()
team: use dev_hw_addr_random() instead of random_ether_addr()
tun: use dev_hw_addr_random() instead of random_ether_addr()
wan: use dev_hw_addr_random() instead of random_ether_addr()
bridge: use dev_hw_addr_random() instead of random_ether_addr()
ip_gre.c: use dev_hw_addr_random() instead of random_ether_addr()
openvswitch: use dev_hw_addr_random() instead of random_ether_addr()
use dev_hw_addr_random() instead of random_ether_addr()
arch/blackfin/mach-bf518/boards/ezbrd.c | 3 ++-
arch/blackfin/mach-bf518/boards/tcm-bf518.c | 3 ++-
arch/blackfin/mach-bf527/boards/ad7160eval.c | 3 ++-
arch/blackfin/mach-bf527/boards/cm_bf527.c | 3 ++-
arch/blackfin/mach-bf527/boards/ezbrd.c | 3 ++-
arch/blackfin/mach-bf527/boards/ezkit.c | 3 ++-
arch/blackfin/mach-bf527/boards/tll6527m.c | 3 ++-
arch/blackfin/mach-bf537/boards/cm_bf537e.c | 3 ++-
arch/blackfin/mach-bf537/boards/cm_bf537u.c | 3 ++-
arch/blackfin/mach-bf537/boards/dnp5370.c | 3 ++-
arch/blackfin/mach-bf537/boards/pnav10.c | 3 ++-
arch/blackfin/mach-bf537/boards/stamp.c | 3 ++-
arch/blackfin/mach-bf537/boards/tcm_bf537.c | 3 ++-
arch/um/drivers/net_kern.c | 11 ++++++++---
drivers/net/dummy.c | 4 +++-
drivers/net/ethernet/adi/bfin_mac.c | 10 +++++++---
drivers/net/ethernet/adi/bfin_mac.h | 2 +-
drivers/net/ethernet/amd/au1000_eth.c | 9 +++++----
drivers/net/ethernet/atheros/atl1c/atl1c_hw.c | 2 +-
drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 11 ++++++-----
drivers/net/ethernet/atheros/atlx/atl1.c | 12 +++++++++---
drivers/net/ethernet/atheros/atlx/atlx.c | 3 +++
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 2 ++
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 2 +-
drivers/net/ethernet/cadence/macb.c | 2 +-
drivers/net/ethernet/calxeda/xgmac.c | 4 +++-
drivers/net/ethernet/cirrus/ep93xx_eth.c | 2 +-
drivers/net/ethernet/cisco/enic/enic_main.c | 13 +++++++++++--
drivers/net/ethernet/davicom/dm9000.c | 2 +-
drivers/net/ethernet/dnet.c | 2 +-
drivers/net/ethernet/ethoc.c | 11 ++++++++++-
drivers/net/ethernet/faraday/ftgmac100.c | 2 +-
drivers/net/ethernet/faraday/ftmac100.c | 2 +-
drivers/net/ethernet/intel/igbvf/netdev.c | 2 ++
drivers/net/ethernet/lantiq_etop.c | 4 ++++
drivers/net/ethernet/marvell/pxa168_eth.c | 4 +++-
drivers/net/ethernet/micrel/ks8842.c | 4 +++-
drivers/net/ethernet/micrel/ks8851.c | 7 +++++--
drivers/net/ethernet/micrel/ks8851_mll.c | 4 +++-
drivers/net/ethernet/microchip/enc28j60.c | 5 ++++-
drivers/net/ethernet/mipsnet.c | 2 +-
drivers/net/ethernet/natsemi/macsonic.c | 2 +-
drivers/net/ethernet/nvidia/forcedeth.c | 4 +++-
drivers/net/ethernet/rdc/r6040.c | 2 +-
drivers/net/ethernet/sfc/efx.c | 4 +++-
drivers/net/ethernet/sis/sis900.c | 2 +-
drivers/net/ethernet/smsc/smsc911x.c | 4 +++-
drivers/net/ethernet/smsc/smsc9420.c | 2 +-
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
drivers/net/ethernet/ti/davinci_emac.c | 4 +++-
drivers/net/ethernet/tile/tilepro.c | 4 +++-
drivers/net/ethernet/toshiba/tc35815.c | 2 +-
drivers/net/ethernet/via/via-rhine.c | 2 +-
drivers/net/ethernet/xilinx/ll_temac_main.c | 11 +++++++++--
drivers/net/ifb.c | 2 +-
drivers/net/macvlan.c | 4 +++-
drivers/net/team/team.c | 5 ++++-
drivers/net/tun.c | 2 +-
drivers/net/usb/smsc75xx.c | 2 +-
drivers/net/usb/smsc95xx.c | 2 +-
drivers/net/usb/usbnet.c | 1 +
drivers/net/veth.c | 4 ++--
drivers/net/virtio_net.c | 2 +-
drivers/net/wan/hdlc_fr.c | 2 +-
drivers/net/wan/hdlc_raw_eth.c | 2 +-
drivers/usb/gadget/u_ether.c | 4 +++-
net/batman-adv/soft-interface.c | 7 ++++---
net/bridge/br_device.c | 6 +++++-
net/ethernet/eth.c | 4 ++++
net/ipv4/ip_gre.c | 2 +-
net/l2tp/l2tp_eth.c | 2 +-
net/openvswitch/vport-internal_dev.c | 4 +++-
72 files changed, 196 insertions(+), 85 deletions(-)
--
1.7.7.3
From: Danny Kukawka <hidden> Date: 2012-02-08 21:11:17
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 2 ++
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 2 +-
2 files changed, 3 insertions(+), 1 deletions(-)
From: Danny Kukawka <hidden> Date: 2012-02-08 21:11:18
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/cadence/macb.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
From: Danny Kukawka <hidden> Date: 2012-02-08 21:11:20
If eth_mac_addr() get called, usually if SIOCSIFHWADDR was
used to change the MAC of a ethernet device, reset the
addr_assign_type to NET_ADDR_PERM if the state was
NET_ADDR_RANDOM before. Reset the state since the MAC is
no longer random at least not from the kernel side.
Signed-off-by: Danny Kukawka <redacted>
---
net/ethernet/eth.c | 4 ++++
1 files changed, 5 insertions(+), 0 deletions(-)
@@ -288,6 +288,10 @@ int eth_mac_addr(struct net_device *dev, void *p)if(!is_valid_ether_addr(addr->sa_data))return-EADDRNOTAVAIL;memcpy(dev->dev_addr,addr->sa_data,ETH_ALEN);+/* if device marked as NET_ADDR_RANDOM, reset it */+if(dev->addr_assign_type&NET_ADDR_RANDOM)+dev->addr_assign_type^=NET_ADDR_RANDOM;+return0;}EXPORT_SYMBOL(eth_mac_addr);
From: Danny Kukawka <hidden> Date: 2012-02-08 21:11:21
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/usb/smsc95xx.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
@@ -614,7 +614,7 @@ static void smsc95xx_init_mac_address(struct usbnet *dev)}/* no eeprom, or eeprom values are invalid. generate random MAC */-random_ether_addr(dev->net->dev_addr);+dev_hw_addr_random(dev->net,dev->net->dev_addr);netif_dbg(dev,ifup,dev->net,"MAC address set to random_ether_addr\n");}
From: Danny Kukawka <hidden> Date: 2012-02-08 21:11:22
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/dummy.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
From: Danny Kukawka <hidden> Date: 2012-02-08 21:11:24
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/usb/smsc75xx.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
@@ -615,7 +615,7 @@ static void smsc75xx_init_mac_address(struct usbnet *dev)}/* no eeprom, or eeprom values are invalid. generate random MAC */-random_ether_addr(dev->net->dev_addr);+dev_hw_addr_random(dev->net,dev->net->dev_addr);netif_dbg(dev,ifup,dev->net,"MAC address set to random_ether_addr");}
@@ -821,7 +821,7 @@ void native_machine_restart(char *cmd)bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);}-voidbfin_get_ether_addr(char*addr)+intbfin_get_ether_addr(char*addr){/* the MAC is stored in OTP memory page 0xDF */u32ret;
@@ -730,9 +730,10 @@ void native_machine_restart(char *cmd)bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);}-voidbfin_get_ether_addr(char*addr)+intbfin_get_ether_addr(char*addr){random_ether_addr(addr);printk(KERN_WARNING"%s:%s: Setting Ethernet MAC to a random one\n",__FILE__,__func__);+return1;}EXPORT_SYMBOL(bfin_get_ether_addr);
@@ -846,7 +846,7 @@ void native_machine_restart(char *cmd)bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);}-voidbfin_get_ether_addr(char*addr)+intbfin_get_ether_addr(char*addr){/* the MAC is stored in OTP memory page 0xDF */u32ret;
@@ -983,9 +983,10 @@ void native_machine_restart(char *cmd)bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);}-voidbfin_get_ether_addr(char*addr)+intbfin_get_ether_addr(char*addr){random_ether_addr(addr);printk(KERN_WARNING"%s:%s: Setting Ethernet MAC to a random one\n",__FILE__,__func__);+return1;}EXPORT_SYMBOL(bfin_get_ether_addr);
@@ -870,7 +870,7 @@ void native_machine_restart(char *cmd)bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);}-voidbfin_get_ether_addr(char*addr)+intbfin_get_ether_addr(char*addr){/* the MAC is stored in OTP memory page 0xDF */u32ret;
@@ -1311,7 +1311,7 @@ void native_machine_restart(char *cmd)bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);}-voidbfin_get_ether_addr(char*addr)+intbfin_get_ether_addr(char*addr){/* the MAC is stored in OTP memory page 0xDF */u32ret;
@@ -931,7 +931,7 @@ void native_machine_restart(char *cmd)bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);}-voidbfin_get_ether_addr(char*addr)+intbfin_get_ether_addr(char*addr){/* the MAC is stored in OTP memory page 0xDF */u32ret;
@@ -813,9 +813,10 @@ void __init native_machine_early_platform_add_devices(void)ARRAY_SIZE(cm_bf537e_early_devices));}-voidbfin_get_ether_addr(char*addr)+intbfin_get_ether_addr(char*addr){random_ether_addr(addr);printk(KERN_WARNING"%s:%s: Setting Ethernet MAC to a random one\n",__FILE__,__func__);+return1;}EXPORT_SYMBOL(bfin_get_ether_addr);
@@ -790,9 +790,10 @@ void __init native_machine_early_platform_add_devices(void)ARRAY_SIZE(cm_bf537u_early_devices));}-voidbfin_get_ether_addr(char*addr)+intbfin_get_ether_addr(char*addr){random_ether_addr(addr);printk(KERN_WARNING"%s:%s: Setting Ethernet MAC to a random one\n",__FILE__,__func__);+return1;}EXPORT_SYMBOL(bfin_get_ether_addr);
@@ -535,9 +535,10 @@ void __init native_machine_early_platform_add_devices(void)ARRAY_SIZE(stamp_early_devices));}-voidbfin_get_ether_addr(char*addr)+intbfin_get_ether_addr(char*addr){random_ether_addr(addr);printk(KERN_WARNING"%s:%s: Setting Ethernet MAC to a random one\n",__FILE__,__func__);+return1;}EXPORT_SYMBOL(bfin_get_ether_addr);
@@ -780,9 +780,10 @@ void __init native_machine_early_platform_add_devices(void)ARRAY_SIZE(cm_bf537_early_devices));}-voidbfin_get_ether_addr(char*addr)+intbfin_get_ether_addr(char*addr){random_ether_addr(addr);printk(KERN_WARNING"%s:%s: Setting Ethernet MAC to a random one\n",__FILE__,__func__);+return1;}EXPORT_SYMBOL(bfin_get_ether_addr);
@@ -1496,12 +1498,14 @@ static int __devinit bfin_mac_probe(struct platform_device *pdev)*GrabtheMACfromtheboardsomehow*thisisdoneinthearch/blackfin/mach-bfxxx/boards/eth_mac.c*/-if(!is_valid_ether_addr(ndev->dev_addr))-bfin_get_ether_addr(ndev->dev_addr);+if(!is_valid_ether_addr(ndev->dev_addr)){+if(bfin_get_ether_addr(ndev->dev_addr))+ndev->addr_assign_type|=NET_ADDR_RANDOM;+}/* If still not valid, get a random one */if(!is_valid_ether_addr(ndev->dev_addr))-random_ether_addr(ndev->dev_addr);+dev_hw_addr_random(ndev,ndev->dev_addr);setup_mac_addr(ndev->dev_addr);
From: Danny Kukawka <hidden> Date: 2012-02-08 21:12:39
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/tile/tilepro.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
@@ -2190,6 +2190,8 @@ static int tile_net_set_mac_address(struct net_device *dev, void *p)/* ISSUE: Note that "dev_addr" is now a pointer. */memcpy(dev->dev_addr,addr->sa_data,dev->addr_len);+if(dev->addr_assign_type&NET_ADDR_RANDOM)+dev->addr_assign_type^=NET_ADDR_RANDOM;return0;}
@@ -2254,7 +2256,7 @@ static int tile_net_get_mac(struct net_device *dev)*can'tgetitsMACaddress,wearemostlikelyrunning*thesimulator,solet'sgeneratearandomMACaddress.*/-random_ether_addr(dev->dev_addr);+dev_hw_addr_random(dev,dev->dev_addr);}return0;
From: Danny Kukawka <hidden> Date: 2012-02-08 21:12:51
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/toshiba/tc35815.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
From: Danny Kukawka <hidden> Date: 2012-02-08 21:13:13
Set addr_assign_type correctly to NET_ADDR_RANDOM in case
a random MAC address was generated and assigned to the netdevice.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/atheros/atl1c/atl1c_hw.c | 2 +-
drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 11 ++++++-----
drivers/net/ethernet/atheros/atlx/atl1.c | 12 +++++++++---
drivers/net/ethernet/atheros/atlx/atlx.c | 3 +++
4 files changed, 19 insertions(+), 9 deletions(-)
@@ -467,6 +467,9 @@ static int atl1c_set_mac_addr(struct net_device *netdev, void *p)return-EBUSY;memcpy(netdev->dev_addr,addr->sa_data,netdev->addr_len);+/* reset to NET_ADDR_PERM if was random */+if(netdev->addr_assign_type&NET_ADDR_RANDOM)+netdev->addr_assign_type^=NET_ADDR_RANDOM;memcpy(adapter->hw.mac_addr,addr->sa_data,netdev->addr_len);atl1c_hw_set_mac_addr(&adapter->hw);
@@ -2746,10 +2749,9 @@ static int __devinit atl1c_probe(struct pci_dev *pdev,err=-EIO;gotoerr_reset;}-if(atl1c_read_mac_addr(&adapter->hw)!=0){-err=-EIO;-dev_err(&pdev->dev,"get mac address failed\n");-gotoerr_eeprom;+if(atl1c_read_mac_addr(&adapter->hw)){+/* got a random MAC address, set NET_ADDR_RANDOM to netdev */+netdev->addr_assign_type|=NET_ADDR_RANDOM;}memcpy(netdev->dev_addr,adapter->hw.mac_addr,netdev->addr_len);memcpy(netdev->perm_addr,adapter->hw.mac_addr,netdev->addr_len);
@@ -2774,7 +2776,6 @@ static int __devinit atl1c_probe(struct pci_dev *pdev,err_reset:err_register:err_sw_init:-err_eeprom:iounmap(adapter->hw.hw_addr);err_init_netdev:err_ioremap:
@@ -534,14 +534,17 @@ static int atl1_get_permanent_address(struct atl1_hw *hw)*/statics32atl1_read_mac_addr(structatl1_hw*hw){+s32ret=0;u16i;-if(atl1_get_permanent_address(hw))+if(atl1_get_permanent_address(hw)){random_ether_addr(hw->perm_mac_addr);+ret=1;+}for(i=0;i<ETH_ALEN;i++)hw->mac_addr[i]=hw->perm_mac_addr[i];-return0;+returnret;}/*
@@ -3007,7 +3010,10 @@ static int __devinit atl1_probe(struct pci_dev *pdev,}/* copy the MAC address out of the EEPROM */-atl1_read_mac_addr(&adapter->hw);+if(atl1_read_mac_addr(&adapter->hw)){+/* mark random mac */+netdev->addr_assign_type|=NET_ADDR_RANDOM;+}memcpy(netdev->dev_addr,adapter->hw.mac_addr,netdev->addr_len);if(!is_valid_ether_addr(netdev->dev_addr)){
@@ -83,6 +83,9 @@ static int atlx_set_mac(struct net_device *netdev, void *p)return-EADDRNOTAVAIL;memcpy(netdev->dev_addr,addr->sa_data,netdev->addr_len);+/* reset to NET_ADDR_PERM if was random */+if(netdev->addr_assign_type&NET_ADDR_RANDOM)+netdev->addr_assign_type^=NET_ADDR_RANDOM;memcpy(adapter->hw.mac_addr,addr->sa_data,netdev->addr_len);atlx_set_mac_addr(&adapter->hw);
From: Danny Kukawka <hidden> Date: 2012-02-08 21:13:20
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/micrel/ks8842.c | 4 +++-
drivers/net/ethernet/micrel/ks8851.c | 7 +++++--
drivers/net/ethernet/micrel/ks8851_mll.c | 4 +++-
3 files changed, 11 insertions(+), 4 deletions(-)
From: Danny Kukawka <hidden> Date: 2012-02-08 21:13:42
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/ti/davinci_emac.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
@@ -1260,6 +1260,8 @@ static int emac_dev_setmac_addr(struct net_device *ndev, void *addr)/* Store mac addr in priv and rx channel and set it in EMAC hw */memcpy(priv->mac_addr,sa->sa_data,ndev->addr_len);memcpy(ndev->dev_addr,sa->sa_data,ndev->addr_len);+if(ndev->addr_assign_type&NET_ADDR_RANDOM)+ndev->addr_assign_type^=NET_ADDR_RANDOM;/* MAC address is configured only after the interface is enabled. */if(netif_running(ndev)){
@@ -1897,7 +1899,7 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)if(!is_valid_ether_addr(priv->mac_addr)){/* Use random MAC if none passed */-random_ether_addr(priv->mac_addr);+dev_hw_addr_random(ndev,priv->mac_addr);dev_warn(&pdev->dev,"using random MAC addr: %pM\n",priv->mac_addr);}
From: Danny Kukawka <hidden> Date: 2012-02-08 21:15:26
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/amd/au1000_eth.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
@@ -1130,9 +1130,6 @@ static int __devinit au1000_probe(struct platform_device *pdev)au1000_setup_hw_rings(aup,aup->macdma);-/* set a random MAC now in case platform_data doesn't provide one */-random_ether_addr(dev->dev_addr);-writel(0,aup->enable);aup->mac_enabled=0;
@@ -1142,8 +1139,12 @@ static int __devinit au1000_probe(struct platform_device *pdev)" PHY search on MAC0\n");aup->phy1_search_mac0=1;}else{-if(is_valid_ether_addr(pd->mac))+if(is_valid_ether_addr(pd->mac)){memcpy(dev->dev_addr,pd->mac,6);+}else{+/*set a random MAC if not provided by platform_data*/+dev_hw_addr_random(dev,dev->dev_addr);+}aup->phy_static_config=pd->phy_static_config;aup->phy_search_highest_addr=pd->phy_search_highest_addr;
@@ -1289,7 +1289,7 @@ static int ftgmac100_probe(struct platform_device *pdev)netdev_info(netdev,"irq %d, mapped at %p\n",priv->irq,priv->base);if(!is_valid_ether_addr(netdev->dev_addr)){-random_ether_addr(netdev->dev_addr);+dev_hw_addr_random(netdev,netdev->dev_addr);netdev_info(netdev,"generated random MAC address %pM\n",netdev->dev_addr);}
@@ -1133,7 +1133,7 @@ static int ftmac100_probe(struct platform_device *pdev)netdev_info(netdev,"irq %d, mapped at %p\n",priv->irq,priv->base);if(!is_valid_ether_addr(netdev->dev_addr)){-random_ether_addr(netdev->dev_addr);+dev_hw_addr_random(netdev,netdev->dev_addr);netdev_info(netdev,"generated random MAC address %pM\n",netdev->dev_addr);}
From: Danny Kukawka <hidden> Date: 2012-02-08 21:17:07
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/nvidia/forcedeth.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
@@ -3022,6 +3022,8 @@ static int nv_set_mac_address(struct net_device *dev, void *addr)/* synchronized against open : rtnl_lock() held by caller */memcpy(dev->dev_addr,macaddr->sa_data,ETH_ALEN);+if(dev->addr_assign_type&NET_ADDR_RANDOM)+dev->addr_assign_type^=NET_ADDR_RANDOM;if(netif_running(dev)){netif_tx_lock_bh(dev);
@@ -5741,7 +5743,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_idev_err(&pci_dev->dev,"Invalid MAC address detected: %pM - Please complain to your hardware vendor.\n",dev->dev_addr);-random_ether_addr(dev->dev_addr);+dev_hw_addr_random(dev,dev->dev_addr);dev_err(&pci_dev->dev,"Using random MAC address: %pM\n",dev->dev_addr);}
From: Danny Kukawka <hidden> Date: 2012-02-08 21:17:13
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/marvell/pxa168_eth.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
@@ -1522,7 +1524,7 @@ static int pxa168_eth_probe(struct platform_device *pdev)INIT_WORK(&pep->tx_timeout_task,pxa168_eth_tx_timeout_task);printk(KERN_INFO"%s:Using random mac address\n",DRIVER_NAME);-random_ether_addr(dev->dev_addr);+dev_hw_addr_random(dev,dev->dev_addr);pep->pd=pdev->dev.platform_data;pep->rx_ring_size=NUM_RX_DESCS;
From: Danny Kukawka <hidden> Date: 2012-02-08 21:17:42
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/cisco/enic/enic_main.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
From: Danny Kukawka <hidden> Date: 2012-02-08 21:17:44
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
Signed-off-by: Danny Kukawka <redacted>
---
net/openvswitch/vport-internal_dev.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
From: Danny Kukawka <hidden> Date: 2012-02-08 21:17:48
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
Signed-off-by: Danny Kukawka <redacted>
---
net/bridge/br_device.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
@@ -172,6 +172,10 @@ static int br_set_mac_address(struct net_device *dev, void *p)spin_lock_bh(&br->lock);if(compare_ether_addr(dev->dev_addr,addr->sa_data)){memcpy(dev->dev_addr,addr->sa_data,ETH_ALEN);+if(dev->addr_assign_type&NET_ADDR_RANDOM){+/* set back to NET_ADDR_PERM */+dev->addr_assign_type^=NET_ADDR_RANDOM;+}br_fdb_change_mac_address(br,addr->sa_data);br_stp_change_bridge_id(br,addr->sa_data);}
From: Danny Kukawka <hidden> Date: 2012-02-08 21:17:52
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Signed-off-by: Danny Kukawka <redacted>
---
net/ipv4/ip_gre.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
From: Danny Kukawka <hidden> Date: 2012-02-08 21:18:21
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/microchip/enc28j60.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
@@ -1579,7 +1582,7 @@ static int __devinit enc28j60_probe(struct spi_device *spi)ret=-EIO;gotoerror_irq;}-random_ether_addr(dev->dev_addr);+dev_hw_addr_random(dev,dev->dev_addr);enc28j60_set_hw_macaddr(dev);/* Board setup must set the relevant edge trigger type;
From: Danny Kukawka <hidden> Date: 2012-02-08 21:18:29
Set addr_assign_type correctly to NET_ADDR_RANDOM in case
a random MAC address was generated and assigned to the netdevice.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/ethoc.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
@@ -780,6 +780,10 @@ static int ethoc_set_mac_address(struct net_device *dev, void *addr)(mac[4]<<8)|(mac[5]<<0));ethoc_write(priv,MAC_ADDR1,(mac[0]<<8)|(mac[1]<<0));+/* if device marked as NET_ADDR_RANDOM, reset it to NET_ADDR_PERM */+if(dev->addr_assign_type&NET_ADDR_RANDOM)+dev->addr_assign_type^=NET_ADDR_RANDOM;+return0;}
@@ -1050,10 +1055,14 @@ static int __devinit ethoc_probe(struct platform_device *pdev)/* Check the MAC again for validity, if it still isn't choose and*programarandomone.*/-if(!is_valid_ether_addr(netdev->dev_addr))+if(!is_valid_ether_addr(netdev->dev_addr)){random_ether_addr(netdev->dev_addr);+random_mac=true;+}ethoc_set_mac_address(netdev,netdev->dev_addr);+if(random_mac)+netdev->addr_assign_type|=NET_ADDR_RANDOM;/* register MII bus */priv->mdio=mdiobus_alloc();
From: Danny Kukawka <hidden> Date: 2012-02-08 21:20:23
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/dnet.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
From: Danny Kukawka <hidden> Date: 2012-02-08 21:20:30
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/calxeda/xgmac.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
@@ -1012,7 +1012,7 @@ static int xgmac_open(struct net_device *dev)*addressusingthefollowinglinuxcommand:*ifconfigeth0hwetherxx:xx:xx:xx:xx:xx*/if(!is_valid_ether_addr(dev->dev_addr)){-random_ether_addr(dev->dev_addr);+dev_hw_addr_random(dev,dev->dev_addr);netdev_dbg(priv->dev,"generated random MAC address %pM\n",dev->dev_addr);}
From: Danny Kukawka <hidden> Date: 2012-02-08 21:20:36
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/davicom/dm9000.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
From: Danny Kukawka <hidden> Date: 2012-02-08 21:20:48
Set addr_assign_type correctly to NET_ADDR_RANDOM in case
a random MAC address was generated and assigned to the netdevice.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/lantiq_etop.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
From: Danny Kukawka <hidden> Date: 2012-02-08 21:20:54
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/via/via-rhine.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
@@ -984,7 +984,7 @@ static int __devinit rhine_init_one(struct pci_dev *pdev,if(!is_valid_ether_addr(dev->dev_addr)){/* Report it and use a random ethernet address instead */netdev_err(dev,"Invalid MAC address: %pM\n",dev->dev_addr);-random_ether_addr(dev->dev_addr);+dev_hw_addr_random(dev,dev->dev_addr);netdev_info(dev,"Using random MAC address: %pM\n",dev->dev_addr);}
From: Danny Kukawka <hidden> Date: 2012-02-08 21:20:56
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/sis/sis900.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
@@ -527,7 +527,7 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev,ret=sis900_get_mac_addr(pci_dev,net_dev);if(!ret||!is_valid_ether_addr(net_dev->dev_addr)){-random_ether_addr(net_dev->dev_addr);+dev_hw_addr_random(net_dev,net_dev->dev_addr);printk(KERN_WARNING"%s: Unreadable or invalid MAC address,""using random generated one\n",dev_name);}
From: Danny Kukawka <hidden> Date: 2012-02-08 21:20:58
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/smsc/smsc9420.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
@@ -509,7 +509,7 @@ static void smsc9420_check_mac_address(struct net_device *dev)smsc_dbg(PROBE,"Mac Address is read from EEPROM");}else{/* eeprom values are invalid, generate random MAC */-random_ether_addr(dev->dev_addr);+dev_hw_addr_random(dev,dev->dev_addr);smsc9420_set_mac_address(dev);smsc_dbg(PROBE,"MAC Address is set to random_ether_addr");
From: Danny Kukawka <hidden> Date: 2012-02-08 21:21:01
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/mipsnet.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
From: Danny Kukawka <hidden> Date: 2012-02-08 21:21:04
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/natsemi/macsonic.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
@@ -307,7 +307,7 @@ static void __devinit mac_onboard_sonic_ethernet_addr(struct net_device *dev)printk(KERN_WARNING"macsonic: MAC address in CAM entry 15 ""seems invalid, will use a random MAC\n");-random_ether_addr(dev->dev_addr);+dev_hw_addr_random(dev,dev->dev_addr);}staticint__devinitmac_onboard_sonic_probe(structnet_device*dev)
From: Danny Kukawka <hidden> Date: 2012-02-08 21:21:08
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/rdc/r6040.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
@@ -1152,7 +1152,7 @@ static int __devinit r6040_init_one(struct pci_dev *pdev,if(!(adrp[0]||adrp[1]||adrp[2])){netdev_warn(dev,"MAC address not initialized, ""generating random\n");-random_ether_addr(dev->dev_addr);+dev_hw_addr_random(dev,dev->dev_addr);}/* Link new device into r6040_root_dev */
From: Danny Kukawka <hidden> Date: 2012-02-08 21:21:10
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/sfc/efx.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
@@ -940,7 +940,7 @@ static int efx_probe_port(struct efx_nic *efx)rc=-EINVAL;gotoerr;}-random_ether_addr(efx->net_dev->dev_addr);+dev_hw_addr_random(efx->net_dev,efx->net_dev->dev_addr);netif_info(efx,probe,efx->net_dev,"using locally-generated MAC %pM\n",efx->net_dev->dev_addr);
@@ -1858,6 +1858,8 @@ static int efx_set_mac_address(struct net_device *net_dev, void *data)}memcpy(net_dev->dev_addr,new_addr,net_dev->addr_len);+if(net_dev->addr_assign_type&NET_ADDR_RANDOM)+net_dev->addr_assign_type^=NET_ADDR_RANDOM;/* Reconfigure the MAC */mutex_lock(&efx->mac_lock);
From: Danny Kukawka <hidden> Date: 2012-02-08 21:21:21
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/tun.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
From: Danny Kukawka <hidden> Date: 2012-02-08 21:21:36
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/team/team.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
From: Danny Kukawka <hidden> Date: 2012-02-08 21:21:39
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/macvlan.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
@@ -373,6 +373,8 @@ static int macvlan_set_mac_address(struct net_device *dev, void *p)if(!(dev->flags&IFF_UP)){/* Just copy in the new address */memcpy(dev->dev_addr,addr->sa_data,ETH_ALEN);+if(dev->addr_assign_type&NET_ADDR_RANDOM)+dev->addr_assign_type^=NET_ADDR_RANDOM;}else{/* Rehash and update the device filters */if(macvlan_addr_busy(vlan->port,addr->sa_data))
@@ -687,7 +689,7 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev,return-EINVAL;if(!tb[IFLA_ADDRESS])-random_ether_addr(dev->dev_addr);+dev_hw_addr_random(dev,dev->dev_addr);if(!macvlan_port_exists(lowerdev)){err=macvlan_port_create(lowerdev);
From: Danny Kukawka <hidden> Date: 2012-02-08 21:21:42
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
Signed-off-by: Danny Kukawka <redacted>
---
net/batman-adv/soft-interface.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
From: Danny Kukawka <hidden> Date: 2012-02-08 21:21:53
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ifb.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
From: Danny Kukawka <hidden> Date: 2012-02-08 21:21:58
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/xilinx/ll_temac_main.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
@@ -322,12 +322,19 @@ out:staticinttemac_set_mac_address(structnet_device*ndev,void*address){structtemac_local*lp=netdev_priv(ndev);+boolset_random=false;if(address)memcpy(ndev->dev_addr,address,ETH_ALEN);-if(!is_valid_ether_addr(ndev->dev_addr))-random_ether_addr(ndev->dev_addr);+if(!is_valid_ether_addr(ndev->dev_addr)){+dev_hw_addr_random(ndev,ndev->dev_addr);+set_random=true;+}+if(!set_random){+if(ndev->addr_assign_type&NET_ADDR_RANDOM)+ndev->addr_assign_type^=NET_ADDR_RANDOM;+}/* set up unicast MAC address filter set its mac address */mutex_lock(&lp->indirect_mutex);
From: Danny Kukawka <hidden> Date: 2012-02-08 21:22:06
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Signed-off-by: Danny Kukawka <redacted>
---
net/l2tp/l2tp_eth.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
From: Danny Kukawka <hidden> Date: 2012-02-08 21:22:14
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/virtio_net.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
@@ -1061,7 +1061,7 @@ static int virtnet_probe(struct virtio_device *vdev)if(virtio_config_val_len(vdev,VIRTIO_NET_F_MAC,offsetof(structvirtio_net_config,mac),dev->dev_addr,dev->addr_len)<0)-random_ether_addr(dev->dev_addr);+dev_hw_addr_random(dev,dev->dev_addr);/* Set up our device-specific information */vi=netdev_priv(dev);
From: Danny Kukawka <hidden> Date: 2012-02-08 21:22:23
Reset the state of addr_assign_type to NET_ADDR_PERM as soon as
the MAC get changed via .ndo_set_mac_address.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/intel/igbvf/netdev.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
--
1.7.7.3
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
From: Danny Kukawka <hidden> Date: 2012-02-08 21:22:26
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
@@ -1087,7 +1087,7 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type)}if(type==ARPHRD_ETHER)-random_ether_addr(dev->dev_addr);+dev_hw_addr_random(dev,dev->dev_addr);else{*(__be16*)dev->dev_addr=htons(dlci);dlci_to_q922(dev->broadcast,dlci);
From: Danny Kukawka <hidden> Date: 2012-02-08 21:24:14
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/veth.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
From: Danny Kukawka <hidden> Date: 2012-02-08 21:24:49
Set addr_assign_type correctly to NET_ADDR_RANDOM in case
a random MAC address was generated and assigned to the netdevice.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/usb/usbnet.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
From: Danny Kukawka <hidden> Date: 2012-02-08 21:27:03
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/smsc/smsc911x.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
@@ -2486,7 +2488,7 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)"Mac Address is read from LAN911x EEPROM");}else{/* eeprom values are invalid, generate random MAC */-random_ether_addr(dev->dev_addr);+dev_hw_addr_random(dev,dev->dev_addr);smsc911x_set_hw_mac_address(pdata,dev->dev_addr);SMSC_TRACE(pdata,probe,"MAC Address is set to random_ether_addr");
From: Oliver Neukum <oliver@neukum.org> Date: 2012-02-08 21:28:01
Am Mittwoch, 8. Februar 2012, 22:10:44 schrieb Danny Kukawka:
quoted hunk
Set addr_assign_type correctly to NET_ADDR_RANDOM in case
a random MAC address was generated and assigned to the netdevice.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/usb/usbnet.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
From: Danny Kukawka <hidden> Date: 2012-02-08 21:29:01
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/cirrus/ep93xx_eth.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
From: Ben Hutchings <hidden> Date: 2012-02-08 21:29:46
On Wed, 2012-02-08 at 22:10 +0100, Danny Kukawka wrote:
quoted hunk
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/sfc/efx.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
@@ -940,7 +940,7 @@ static int efx_probe_port(struct efx_nic *efx)rc=-EINVAL;gotoerr;}-random_ether_addr(efx->net_dev->dev_addr);+dev_hw_addr_random(efx->net_dev,efx->net_dev->dev_addr);netif_info(efx,probe,efx->net_dev,"using locally-generated MAC %pM\n",efx->net_dev->dev_addr);
[...]
This code no longer exists in net-next.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
From: H Hartley Sweeten <hidden> Date: 2012-02-08 21:30:41
On Wednesday, February 08, 2012 2:10 PM, Danny Kukawka wrote:
quoted hunk
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/cirrus/ep93xx_eth.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
From: Danny Kukawka <hidden> Date: 2012-02-08 21:42:36
On Mittwoch, 8. Februar 2012, Oliver Neukum wrote:
Am Mittwoch, 8. Februar 2012, 22:10:44 schrieb Danny Kukawka:
quoted
Set addr_assign_type correctly to NET_ADDR_RANDOM in case
a random MAC address was generated and assigned to the netdevice.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/usb/usbnet.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
struct usb_device_id *prod) dev->net = net;
strcpy (net->name, "usb%d");
memcpy (net->dev_addr, node_id, sizeof node_id);
+ net->addr_assign_type |= NET_ADDR_RANDOM;
/* rx and tx sides can use different message sizes;
* bind() should set rx_urb_size in that case.
Don't you set the flag too early here? By that time we don't know
whether the device provides a real MAC, do we?
You're right. Maybe it's the wrong place. Better the drivers take care of
setting the correct addr_assign_type.
Danny
From: Stephen Hemminger <hidden> Date: 2012-02-08 22:52:45
On Wed, 8 Feb 2012 22:10:54 +0100
Danny Kukawka [off-list ref] wrote:
quoted hunk
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
Signed-off-by: Danny Kukawka <redacted>
---
net/bridge/br_device.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
@@ -172,6 +172,10 @@ static int br_set_mac_address(struct net_device *dev, void *p)spin_lock_bh(&br->lock);if(compare_ether_addr(dev->dev_addr,addr->sa_data)){memcpy(dev->dev_addr,addr->sa_data,ETH_ALEN);+if(dev->addr_assign_type&NET_ADDR_RANDOM){+/* set back to NET_ADDR_PERM */+dev->addr_assign_type^=NET_ADDR_RANDOM;+}br_fdb_change_mac_address(br,addr->sa_data);br_stp_change_bridge_id(br,addr->sa_data);}
From: Stephen Hemminger <hidden> Date: 2012-02-08 22:58:29
On Wed, 8 Feb 2012 22:10:07 +0100
Danny Kukawka [off-list ref] wrote:
The information if a device has a random MAC address is exported
to the userspace via /sys/class/net/*/addr_assign_type, which
export net_device->addr_assign_type.
Currently only a few driver really use dev_hw_addr_random() to
set addr_assign_type correctly to NET_ADDR_RANDOM.
This patch change the drivers which set random addresses to
change also addr_assign_type to NET_ADDR_RANDOM.
To reflect if the MAC was changed from userspace via SIOCSIFHWADDR,
which means it's no longer a random address set by the kernel,
this patch remove NET_ADDR_RANDOM from addr_assign_type in this
case.
With this patch tools from userspace can now detect devices with
random MAC addresses and change them to persistent addresses if
needed (as e.g. in case of smsc95xx on PandaBoard).
Maybe it makes sense to introduce a new state for addr_assign_type
to reflect the fact, that the MAC address was changed via a ioctl
from user space, e.g, with NET_ADDR_USERSPACE ?
This reminds me that passing dev->dev_addr to dev_hw_addr_rrandom is redundant
for all the instances you showed, so why is it ia parameter.
Also it should BUG() if address length is not 6 (ETH_ALEN).
From: David Miller <davem@davemloft.net> Date: 2012-02-08 23:29:53
50 patches is way too many patches to submit and expect people
to review at one time.
You must do one of two things:
1) Condense the series down to a smaller number of more managable
patches. Perhaps combine all the completely trivial conversion
cases into one single patch, and post the non-trivial cases
seperately.
2) Only submit a few of these changes at a time, not all at once.
It's your choice, but what you did here is unacceptable.
Hi Danny,
On Thu, Feb 9, 2012 at 5:10 AM, Danny Kukawka [off-list ref] wrote:
Set the addr_assign_type for adi driver correctly to
NET_ADDR_RANDOM if a random MAC address was generated.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
Signed-off-by: Danny Kukawka <redacted>
---
arch/blackfin/mach-bf518/boards/ezbrd.c | 3 ++-
arch/blackfin/mach-bf518/boards/tcm-bf518.c | 3 ++-
arch/blackfin/mach-bf527/boards/ad7160eval.c | 3 ++-
arch/blackfin/mach-bf527/boards/cm_bf527.c | 3 ++-
arch/blackfin/mach-bf527/boards/ezbrd.c | 3 ++-
arch/blackfin/mach-bf527/boards/ezkit.c | 3 ++-
arch/blackfin/mach-bf527/boards/tll6527m.c | 3 ++-
arch/blackfin/mach-bf537/boards/cm_bf537e.c | 3 ++-
arch/blackfin/mach-bf537/boards/cm_bf537u.c | 3 ++-
arch/blackfin/mach-bf537/boards/dnp5370.c | 3 ++-
arch/blackfin/mach-bf537/boards/pnav10.c | 3 ++-
arch/blackfin/mach-bf537/boards/stamp.c | 3 ++-
arch/blackfin/mach-bf537/boards/tcm_bf537.c | 3 ++-
drivers/net/ethernet/adi/bfin_mac.c | 10 +++++++---
drivers/net/ethernet/adi/bfin_mac.h | 2 +-
Would you please split this into two patches, one for arch/blackfin
and the other
for drivers/net.
This can make our maintain simpler and clearer.
if (netif_running(dev))
return -EBUSY;
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
+ if (dev->addr_assign_type & NET_ADDR_RANDOM)
+ dev->addr_assign_type ^= NET_ADDR_RANDOM;
setup_mac_addr(dev->dev_addr);
return 0;
}
@@ -1496,12 +1498,14 @@ static int __devinit bfin_mac_probe(struct platform_device *pdev)
* Grab the MAC from the board somehow
* this is done in the arch/blackfin/mach-bfxxx/boards/eth_mac.c
*/
- if (!is_valid_ether_addr(ndev->dev_addr))
- bfin_get_ether_addr(ndev->dev_addr);
+ if (!is_valid_ether_addr(ndev->dev_addr)) {
+ if (bfin_get_ether_addr(ndev->dev_addr))
+ ndev->addr_assign_type |= NET_ADDR_RANDOM;
+ }
/* If still not valid, get a random one */
if (!is_valid_ether_addr(ndev->dev_addr))
- random_ether_addr(ndev->dev_addr);
+ dev_hw_addr_random(ndev, ndev->dev_addr);
setup_mac_addr(ndev->dev_addr);
From: Mike Frysinger <hidden> Date: 2012-02-09 04:05:16
On Wednesday 08 February 2012 16:10:11 Danny Kukawka wrote:
quoted hunk
--- a/arch/blackfin/mach-bf537/boards/cm_bf537e.c+++ b/arch/blackfin/mach-bf537/boards/cm_bf537e.c
-void bfin_get_ether_addr(char *addr)
+int bfin_get_ether_addr(char *addr)
{
random_ether_addr(addr);
printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n",
__FILE__, __func__);
+ return 1;
}
these boards that just call random_ether_addr() should be changed to only
return 1 ...
if it returned non-zero, then the mac addr is still invalid, so down below ...
/* If still not valid, get a random one */
if (!is_valid_ether_addr(ndev->dev_addr))
- random_ether_addr(ndev->dev_addr);
+ dev_hw_addr_random(ndev, ndev->dev_addr);
... we call dev_hw_addr_random(), so explicitly setting NET_ADDR_RANDOM
ourselves is unnecessary
i think the logic should read:
if (!is_valid_ether_addr(ndev->dev_addr)) {
if (bfin_get_ether_addr(ndev->dev_addr))
goto random_mac;
if (!is_valid_ether_addr(ndev->dev_addr))
random_mac:
dev_hw_addr_random(ndev, ndev->dev_addr);
-mike
From: Nicolas Ferre <hidden> Date: 2012-02-09 08:25:23
On 02/08/2012 10:10 PM, Danny Kukawka :
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Signed-off-by: Danny Kukawka <redacted>
Danny,
You can add my "Acked-by" even if you rework this series...
Acked-by: Nicolas Ferre <redacted>
Thanks, best regards,
From: Sven Eckelmann <sven@narfation.org> Date: 2012-02-09 08:52:45
On Wednesday 08 February 2012 22:10:47 Danny Kukawka wrote:
quoted hunk
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
Signed-off-by: Danny Kukawka <redacted>
---
net/batman-adv/soft-interface.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/batman-adv/soft-interface.c
b/net/batman-adv/soft-interface.c index 987c75a..865a485 100644
Why not something like
dev->addr_assign_type &= ~NET_ADDR_RANDOM;
? It is a relative common way inside the kernel to do this kind of stuff.
Thanks,
Sven
PS: For the batman-adv people. This functionality was introduced with 2.6.36.
From: "Michael S. Tsirkin" <mst@redhat.com> Date: 2012-02-09 09:36:14
On Wed, Feb 08, 2012 at 10:10:49PM +0100, Danny Kukawka wrote:
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Signed-off-by: Danny Kukawka <redacted>
@@ -1061,7 +1061,7 @@ static int virtnet_probe(struct virtio_device *vdev)if(virtio_config_val_len(vdev,VIRTIO_NET_F_MAC,offsetof(structvirtio_net_config,mac),dev->dev_addr,dev->addr_len)<0)-random_ether_addr(dev->dev_addr);+dev_hw_addr_random(dev,dev->dev_addr);/* Set up our device-specific information */vi=netdev_priv(dev);
@@ -614,7 +614,7 @@ static void smsc95xx_init_mac_address(struct usbnet *dev)}/* no eeprom, or eeprom values are invalid. generate random MAC */-random_ether_addr(dev->net->dev_addr);+dev_hw_addr_random(dev->net,dev->net->dev_addr);
From: Danny Kukawka <hidden> Date: 2012-02-09 12:19:32
On Donnerstag, 9. Februar 2012, David Miller wrote:
50 patches is way too many patches to submit and expect people
to review at one time.
You must do one of two things:
1) Condense the series down to a smaller number of more managable
patches. Perhaps combine all the completely trivial conversion
cases into one single patch, and post the non-trivial cases
seperately.
2) Only submit a few of these changes at a time, not all at once.
It's your choice, but what you did here is unacceptable.
Could you at least comment on these points from the cover letter, before I
change/update the patches?
- Should NET_ADDR_RANDOM get reset (to NET_ADDR_PERM) if the MAC address
get changed via SIOCSIFHWADDR/.ndo_set_mac_address and was random before?
- Would it make sense to add a new state (e.g. NET_ADDR_USERSPACE)
if the net address get changed via SIOCSIFHWADDR/.ndo_set_mac_address
from userspace?
Thanks,
Danny
From: Danny Kukawka <hidden> Date: 2012-02-09 15:00:03
On Mittwoch, 8. Februar 2012, Stephen Hemminger wrote:
On Wed, 8 Feb 2012 22:10:07 +0100
Danny Kukawka [off-list ref] wrote:
quoted
The information if a device has a random MAC address is exported
to the userspace via /sys/class/net/*/addr_assign_type, which
export net_device->addr_assign_type.
Currently only a few driver really use dev_hw_addr_random() to
set addr_assign_type correctly to NET_ADDR_RANDOM.
This patch change the drivers which set random addresses to
change also addr_assign_type to NET_ADDR_RANDOM.
To reflect if the MAC was changed from userspace via SIOCSIFHWADDR,
which means it's no longer a random address set by the kernel,
this patch remove NET_ADDR_RANDOM from addr_assign_type in this
case.
With this patch tools from userspace can now detect devices with
random MAC addresses and change them to persistent addresses if
needed (as e.g. in case of smsc95xx on PandaBoard).
Maybe it makes sense to introduce a new state for addr_assign_type
to reflect the fact, that the MAC address was changed via a ioctl
from user space, e.g, with NET_ADDR_USERSPACE ?
This reminds me that passing dev->dev_addr to dev_hw_addr_rrandom is
redundant for all the instances you showed, so why is it ia parameter.
There are two places in the existing code where it's used in a different way
in ixgbevf and igbvf, but thats changeable. I will take a look at it and
change dev_hw_addr_random to take simply a net_device ands set everything
directly.
Also it should BUG() if address length is not 6 (ETH_ALEN).
Not needed if I change it to:
static inline void dev_hw_addr_random(struct net_device *dev)
Danny
From: Stephen Hemminger <hidden> Date: 2012-02-09 16:06:44
On Thu, 9 Feb 2012 15:59:05 +0100
Danny Kukawka [off-list ref] wrote:
On Mittwoch, 8. Februar 2012, Stephen Hemminger wrote:
quoted
On Wed, 8 Feb 2012 22:10:07 +0100
Danny Kukawka [off-list ref] wrote:
quoted
The information if a device has a random MAC address is exported
to the userspace via /sys/class/net/*/addr_assign_type, which
export net_device->addr_assign_type.
Currently only a few driver really use dev_hw_addr_random() to
set addr_assign_type correctly to NET_ADDR_RANDOM.
This patch change the drivers which set random addresses to
change also addr_assign_type to NET_ADDR_RANDOM.
To reflect if the MAC was changed from userspace via SIOCSIFHWADDR,
which means it's no longer a random address set by the kernel,
this patch remove NET_ADDR_RANDOM from addr_assign_type in this
case.
With this patch tools from userspace can now detect devices with
random MAC addresses and change them to persistent addresses if
needed (as e.g. in case of smsc95xx on PandaBoard).
Maybe it makes sense to introduce a new state for addr_assign_type
to reflect the fact, that the MAC address was changed via a ioctl
from user space, e.g, with NET_ADDR_USERSPACE ?
This reminds me that passing dev->dev_addr to dev_hw_addr_rrandom is
redundant for all the instances you showed, so why is it ia parameter.
There are two places in the existing code where it's used in a different way
in ixgbevf and igbvf, but thats changeable. I will take a look at it and
change dev_hw_addr_random to take simply a net_device ands set everything
directly.
quoted
Also it should BUG() if address length is not 6 (ETH_ALEN).
Not needed if I change it to:
static inline void dev_hw_addr_random(struct net_device *dev)
Danny
It is still needed to prevent some device driver that uses
some longer address (like Infiniband) from the thinking it is
a generic routine. Maybe even renaming int eth_hw_addr_random()
From: David Miller <davem@davemloft.net> Date: 2012-02-09 18:37:31
From: Danny Kukawka <redacted>
Date: Thu, 9 Feb 2012 13:18:35 +0100
On Donnerstag, 9. Februar 2012, David Miller wrote:
quoted
50 patches is way too many patches to submit and expect people
to review at one time.
You must do one of two things:
1) Condense the series down to a smaller number of more managable
patches. Perhaps combine all the completely trivial conversion
cases into one single patch, and post the non-trivial cases
seperately.
2) Only submit a few of these changes at a time, not all at once.
It's your choice, but what you did here is unacceptable.
Could you at least comment on these points from the cover letter, before I
change/update the patches?
- Should NET_ADDR_RANDOM get reset (to NET_ADDR_PERM) if the MAC address
get changed via SIOCSIFHWADDR/.ndo_set_mac_address and was random before?
Probably, yes.
- Would it make sense to add a new state (e.g. NET_ADDR_USERSPACE)
if the net address get changed via SIOCSIFHWADDR/.ndo_set_mac_address
from userspace?
@@ -527,7 +527,7 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev,ret=sis900_get_mac_addr(pci_dev,net_dev);if(!ret||!is_valid_ether_addr(net_dev->dev_addr)){-random_ether_addr(net_dev->dev_addr);+dev_hw_addr_random(net_dev,net_dev->dev_addr);printk(KERN_WARNING"%s: Unreadable or invalid MAC address,""using random generated one\n",dev_name);}
From: Marek Lindner <hidden> Date: 2012-02-11 11:18:56
On Thursday, February 09, 2012 05:10:47 Danny Kukawka wrote:
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
Applied (with minor modification) in revision 910ccac.
Thanks,
Marek