From: Danny Kukawka <hidden> Date: 2012-02-17 15:43:54
The fourth part of my patch series to fix the handling of
addr_assign_type for random MAC addresses.
This most of the patches in this series are for slightly
more complex cases to handle addr_assign_type and the
reset to NET_ADDR_PERM as soon as the MAC get changed via
.ndo_set_mac_address where eth_mac_addr wasn't used.
Danny Kukawka (10):
au1000_eth: use eth_hw_addr_random() instead of random_ether_addr()
lantiq_etop: set addr_assign_type if random_ether_addr() used
davinci_emac: use eth_hw_addr_random() instead of random_ether_addr()
xilinx ll_temac: use eth_hw_addr_random() instead of
random_ether_addr()
igbvf: reset netdevice addr_assign_type if changed
batman-adv: use eth_hw_addr_random() instead of random_ether_addr()
cisco/enic: use eth_hw_addr_random() instead of random_ether_addr()
ethoc: set addr_assign_type if random_ether_addr() used
atheros eth: set addr_assign_type if random_ether_addr() used
UML net: set addr_assign_type if random_ether_addr() used
arch/um/drivers/net_kern.c | 11 ++++++++---
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 | 9 ++++-----
drivers/net/ethernet/atheros/atlx/atl1.c | 12 +++++++++---
drivers/net/ethernet/atheros/atlx/atlx.c | 1 +
drivers/net/ethernet/cisco/enic/enic_main.c | 14 ++++++++++++--
drivers/net/ethernet/ethoc.c | 20 ++++++++++++++++++--
drivers/net/ethernet/intel/igbvf/netdev.c | 1 +
drivers/net/ethernet/lantiq_etop.c | 7 +++++++
drivers/net/ethernet/ti/davinci_emac.c | 5 +++--
drivers/net/ethernet/xilinx/ll_temac_main.c | 4 +++-
net/batman-adv/soft-interface.c | 5 ++---
13 files changed, 74 insertions(+), 26 deletions(-)
--
1.7.8.3
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
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-17 15:43:50
Set addr_assign_type correctly to NET_ADDR_RANDOM in case
a random MAC address was generated and assigned to the netdevice.
v2: added comment, renamed bool variable to random_mac
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/lantiq_etop.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
From: Danny Kukawka <hidden> Date: 2012-02-17 15:43:52
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Couldn't replace random_ether_addr() in enic_probe() since
enic_set_mac_addr() is used which would reset addr_assign_type.
Instead set addr_assign_type directly to NET_ADDR_RANDOM in
case of random mac after call enic_set_mac_addr().
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
v2: use bitops, adapt to eth_hw_addr_random(), add a comment
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/cisco/enic/enic_main.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
@@ -2476,6 +2480,12 @@ static int __devinit enic_probe(struct pci_dev *pdev,dev_err(dev,"Invalid MAC address, aborting\n");gotoerr_out_dev_deinit;}+#ifdef CONFIG_PCI_IOV+if(random_mac){+/*Couldn't use eth_hw_addr_random() due to enic_set_mac_addr()*/+netdev->addr_assign_type|=NET_ADDR_RANDOM;+}+#endifenic->tx_coalesce_usecs=enic->config.intr_timer_usec;enic->rx_coalesce_usecs=enic->tx_coalesce_usecs;
From: Danny Kukawka <hidden> Date: 2012-02-17 15:43:53
Use eth_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.
v2: reworked to prevent using an extra variable
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/xilinx/ll_temac_main.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
@@ -327,7 +327,9 @@ static int temac_set_mac_address(struct net_device *ndev, void *address)memcpy(ndev->dev_addr,address,ETH_ALEN);if(!is_valid_ether_addr(ndev->dev_addr))-random_ether_addr(ndev->dev_addr);+eth_hw_addr_random(ndev);+else+dev->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-17 15:43:55
Set addr_assign_type correctly to NET_ADDR_RANDOM in case
a random MAC address was generated and assigned to the netdevice.
Fixed ethoc_set_mac_address() to check if the given mac
address is valid and set also dev_addr of the net_device.
Check also the return value of ethoc_set_mac_address() in
ethoc_probe().
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
v2: set net_device->dev_addr in ethoc_set_mac_address(),
check if given address is valid
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/ethoc.c | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
@@ -1050,10 +1057,19 @@ 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);+ret=ethoc_set_mac_address(netdev,netdev->dev_addr);+if(ret){+dev_err(&netdev->dev,"failed to set MAC address\n");+gotoerror;+}++if(random_mac)+netdev->addr_assign_type|=NET_ADDR_RANDOM;/* register MII bus */priv->mdio=mdiobus_alloc();
From: Danny Kukawka <hidden> Date: 2012-02-17 15:44:57
Use eth_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.
Remove one memcpy from emac_dev_setmac_addr() since this is a
duplicate: it's already done some lines above.
v2: use bitops, adapt to eth_hw_addr_random, remove a memcpy
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/ti/davinci_emac.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
@@ -1260,10 +1260,10 @@ 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);+ndev->addr_assign_type&=~NET_ADDR_RANDOM;/* MAC address is configured only after the interface is enabled. */if(netif_running(ndev)){-memcpy(priv->mac_addr,sa->sa_data,ndev->addr_len);emac_setmac(priv,EMAC_DEF_RX_CH,priv->mac_addr);}
@@ -1897,7 +1897,8 @@ 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);+eth_hw_addr_random(ndev);+memcpy(priv->mac_addr,ndev->dev_addr,ndev->addr_len);dev_warn(&pdev->dev,"using random MAC addr: %pM\n",priv->mac_addr);}
From: Danny Kukawka <hidden> Date: 2012-02-17 15:46:23
Use eth_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
v2: adapt to eth_hw_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 since no valid provided by platform_data*/+eth_hw_addr_random(dev);+}aup->phy_static_config=pd->phy_static_config;aup->phy_search_highest_addr=pd->phy_search_highest_addr;
From: Danny Kukawka <hidden> Date: 2012-02-17 15:46:25
Reset the state of addr_assign_type to NET_ADDR_PERM as soon as
the MAC get changed via .ndo_set_mac_address.
v2: use bitops to reset addr_assign_type
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/intel/igbvf/netdev.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
--
1.7.8.3
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
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-17 15:46:57
Use eth_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Remove dev_addr in interface_setup(), it's not needed anymore.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
v2: use bitops, adapt to eth_hw_addr_random()
Signed-off-by: Danny Kukawka <redacted>
---
net/batman-adv/soft-interface.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
From: Danny Kukawka <hidden> Date: 2012-02-17 15:47:19
Set addr_assign_type correctly to NET_ADDR_RANDOM in case
a random MAC address was generated and assigned to the netdevice.
Fix error handling in atl1c_probe(). If atl1c_read_mac_addr()
couldn't get the hw mac address, and a random mac address get
set return the error code. Don't go to err_eeprom in
atl1c_probe(), use the generated MAC address in this case.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
v2: use bitops
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/atheros/atl1c/atl1c_hw.c | 2 +-
drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 9 ++++-----
drivers/net/ethernet/atheros/atlx/atl1.c | 12 +++++++++---
drivers/net/ethernet/atheros/atlx/atlx.c | 1 +
4 files changed, 15 insertions(+), 9 deletions(-)
@@ -2746,10 +2747,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 +2774,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)){
From: David Miller <davem@davemloft.net> Date: 2012-02-17 20:59:42
From: Danny Kukawka <redacted>
Date: Fri, 17 Feb 2012 16:43:22 +0100
Use eth_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
v2: adapt to eth_hw_addr_random()
Signed-off-by: Danny Kukawka <redacted>
Please don't shit up the comments:
- /* set a random MAC now in case platform_data doesn't provide one */
...
+ /*set a random MAC since no valid provided by platform_data*/
You had to work to make that comment look worse than it originally
did in the code, spaces around the sentence and if you can be so
bothered capitalize sentences and put proper punctionation at the
end.
I took care of this, but I will not next time.
From: David Miller <davem@davemloft.net> Date: 2012-02-17 21:00:23
From: Danny Kukawka <redacted>
Date: Fri, 17 Feb 2012 16:43:23 +0100
Set addr_assign_type correctly to NET_ADDR_RANDOM in case
a random MAC address was generated and assigned to the netdevice.
v2: added comment, renamed bool variable to random_mac
Signed-off-by: Danny Kukawka <redacted>
More bad comment formatting.
+ /*set addr_assign_type here, ltq_etop_set_mac_address would reset it*/
From: David Miller <davem@davemloft.net> Date: 2012-02-17 21:01:23
From: Danny Kukawka <redacted>
Date: Fri, 17 Feb 2012 16:43:26 +0100
Reset the state of addr_assign_type to NET_ADDR_PERM as soon as
the MAC get changed via .ndo_set_mac_address.
v2: use bitops to reset addr_assign_type
Signed-off-by: Danny Kukawka <redacted>
From: David Miller <davem@davemloft.net> Date: 2012-02-17 21:01:58
From: Danny Kukawka <redacted>
Date: Fri, 17 Feb 2012 16:43:28 +0100
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Couldn't replace random_ether_addr() in enic_probe() since
enic_set_mac_addr() is used which would reset addr_assign_type.
Instead set addr_assign_type directly to NET_ADDR_RANDOM in
case of random mac after call enic_set_mac_addr().
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
v2: use bitops, adapt to eth_hw_addr_random(), add a comment
Signed-off-by: Danny Kukawka <redacted>
This patch doesn't apply at all to the current net-next tree,
please always validate that your patches actually apply to the
tree before submission.
From: David Miller <davem@davemloft.net> Date: 2012-02-17 21:02:28
From: Danny Kukawka <redacted>
Date: Fri, 17 Feb 2012 16:43:27 +0100
Use eth_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Remove dev_addr in interface_setup(), it's not needed anymore.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
v2: use bitops, adapt to eth_hw_addr_random()
Signed-off-by: Danny Kukawka <redacted>
From: David Miller <davem@davemloft.net> Date: 2012-02-17 21:03:04
From: Danny Kukawka <redacted>
Date: Fri, 17 Feb 2012 16:43:30 +0100
Set addr_assign_type correctly to NET_ADDR_RANDOM in case
a random MAC address was generated and assigned to the netdevice.
Fix error handling in atl1c_probe(). If atl1c_read_mac_addr()
couldn't get the hw mac address, and a random mac address get
set return the error code. Don't go to err_eeprom in
atl1c_probe(), use the generated MAC address in this case.
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
v2: use bitops
Signed-off-by: Danny Kukawka <redacted>
From: David Miller <davem@davemloft.net> Date: 2012-02-17 21:03:40
From: Danny Kukawka <redacted>
Date: Fri, 17 Feb 2012 16:43:25 +0100
Use eth_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.
v2: reworked to prevent using an extra variable
Signed-off-by: Danny Kukawka <redacted>
Applied, but:
+ else
Trailing whitespace. This isn't something you need to be a rocket
scientist to catch, the tools find it for you, as they did for me.
From: David Miller <davem@davemloft.net> Date: 2012-02-17 21:03:48
From: Danny Kukawka <redacted>
Date: Fri, 17 Feb 2012 16:43:24 +0100
Use eth_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.
Remove one memcpy from emac_dev_setmac_addr() since this is a
duplicate: it's already done some lines above.
v2: use bitops, adapt to eth_hw_addr_random, remove a memcpy
Signed-off-by: Danny Kukawka <redacted>
From: David Miller <davem@davemloft.net> Date: 2012-02-17 21:03:53
From: Danny Kukawka <redacted>
Date: Fri, 17 Feb 2012 16:43:29 +0100
Set addr_assign_type correctly to NET_ADDR_RANDOM in case
a random MAC address was generated and assigned to the netdevice.
Fixed ethoc_set_mac_address() to check if the given mac
address is valid and set also dev_addr of the net_device.
Check also the return value of ethoc_set_mac_address() in
ethoc_probe().
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
v2: set net_device->dev_addr in ethoc_set_mac_address(),
check if given address is valid
Signed-off-by: Danny Kukawka <redacted>
Applied, but more coding style problems:
+ if(!is_valid_ether_addr(mac))
Come on, "if[SPACE](..." always.
+
Trailing whitespace.
+ if (ret) {
+ dev_err(&netdev->dev, "failed to set MAC address\n");
+ goto error;
+ }
+
From: Danny Kukawka <hidden> Date: 2012-02-17 21:25:37
On Freitag, 17. Februar 2012, David Miller wrote:
From: Danny Kukawka <redacted>
Date: Fri, 17 Feb 2012 16:43:23 +0100
quoted
Set addr_assign_type correctly to NET_ADDR_RANDOM in case
a random MAC address was generated and assigned to the netdevice.
v2: added comment, renamed bool variable to random_mac
Signed-off-by: Danny Kukawka <redacted>
More bad comment formatting.
quoted
+ /*set addr_assign_type here, ltq_etop_set_mac_address would reset it*/
Again, I fixed it up but I will not next time.
Thanks. I fixed it but accidently send the unfixed version of the patches
without noticing. Sorry.
Danny
From: Danny Kukawka <hidden> Date: 2012-02-17 21:36:44
On Freitag, 17. Februar 2012, David Miller wrote:
From: Danny Kukawka <redacted>
Date: Fri, 17 Feb 2012 16:43:28 +0100
quoted
Use dev_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.
Couldn't replace random_ether_addr() in enic_probe() since
enic_set_mac_addr() is used which would reset addr_assign_type.
Instead set addr_assign_type directly to NET_ADDR_RANDOM in
case of random mac after call enic_set_mac_addr().
Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.
v2: use bitops, adapt to eth_hw_addr_random(), add a comment
Signed-off-by: Danny Kukawka <redacted>
This patch doesn't apply at all to the current net-next tree,
please always validate that your patches actually apply to the
tree before submission.
Okay ... forgot that ... I'll check and send a new version.
Danny