All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Part 1: handle addr_assign_type for random addresses
@ 2012-02-09 19:48 ` Danny Kukawka
  0 siblings, 0 replies; 13+ messages in thread
From: Danny Kukawka @ 2012-02-09 19:48 UTC (permalink / raw)
  To: David S. Miller
  Cc: Danny Kukawka, netdev, linux-kernel, Jeff Kirsher,
	Jesse Brandeburg, Bruce Allan, Carolyn Wyborny, Don Skidmore,
	Greg Rose, Peter P Waskiewicz Jr, Alex Duyck, John Ronciak,
	Mitch Williams, Jiri Pirko, Eric Dumazet, e1000-devel,
	Neil Horman, Randy Dunlap, Stephen Hemminger

This is an updated and split up version of my patch series to
fix the handling of addr_assign_type for random MAC addresses.

The first part contains the basic changes in etherdevice.h
and eth.c incl. needed adaptations in the existing code

Danny Kukawka (2):
  eth: reset addr_assign_type if eth_mac_addr() called
  rename dev_hw_addr_random and remove redundant second

 drivers/net/ethernet/intel/igbvf/netdev.c         |   11 +++++---
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |   28 ++++++++++++--------
 include/linux/etherdevice.h                       |   13 +++++----
 net/ethernet/eth.c                                |    2 +
 4 files changed, 33 insertions(+), 21 deletions(-)

-- 
1.7.7.3


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 0/2] Part 1: handle addr_assign_type for random addresses
@ 2012-02-09 19:48 ` Danny Kukawka
  0 siblings, 0 replies; 13+ messages in thread
From: Danny Kukawka @ 2012-02-09 19:48 UTC (permalink / raw)
  To: David S. Miller
  Cc: Neil Horman, Jiri Pirko, e1000-devel, netdev, Bruce Allan,
	Jesse Brandeburg, linux-kernel, Randy Dunlap, John Ronciak,
	Danny Kukawka

This is an updated and split up version of my patch series to
fix the handling of addr_assign_type for random MAC addresses.

The first part contains the basic changes in etherdevice.h
and eth.c incl. needed adaptations in the existing code

Danny Kukawka (2):
  eth: reset addr_assign_type if eth_mac_addr() called
  rename dev_hw_addr_random and remove redundant second

 drivers/net/ethernet/intel/igbvf/netdev.c         |   11 +++++---
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |   28 ++++++++++++--------
 include/linux/etherdevice.h                       |   13 +++++----
 net/ethernet/eth.c                                |    2 +
 4 files changed, 33 insertions(+), 21 deletions(-)

-- 
1.7.7.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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 1/2] eth: reset addr_assign_type if eth_mac_addr() called
  2012-02-09 19:48 ` Danny Kukawka
  (?)
@ 2012-02-09 19:48 ` Danny Kukawka
  2012-02-13  5:50   ` David Miller
  -1 siblings, 1 reply; 13+ messages in thread
From: Danny Kukawka @ 2012-02-09 19:48 UTC (permalink / raw)
  To: David S. Miller
  Cc: Danny Kukawka, netdev, linux-kernel, Neil Horman, Eric Dumazet,
	Randy Dunlap

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.

v2: changed to bitops, removed if()

Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de>
---
 net/ethernet/eth.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index a246836..a93af86 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -288,6 +288,8 @@ 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 */
+	dev->addr_assign_type &= ~NET_ADDR_RANDOM;
 	return 0;
 }
 EXPORT_SYMBOL(eth_mac_addr);
-- 
1.7.7.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/2] rename dev_hw_addr_random and remove redundant second
  2012-02-09 19:48 ` Danny Kukawka
@ 2012-02-09 19:48   ` Danny Kukawka
  -1 siblings, 0 replies; 13+ messages in thread
From: Danny Kukawka @ 2012-02-09 19:48 UTC (permalink / raw)
  To: David S. Miller
  Cc: Danny Kukawka, netdev, linux-kernel, Jeff Kirsher,
	Jesse Brandeburg, Bruce Allan, Carolyn Wyborny, Don Skidmore,
	Greg Rose, Peter P Waskiewicz Jr, Alex Duyck, John Ronciak,
	Mitch Williams, Jiri Pirko, Eric Dumazet, e1000-devel,
	Stephen Hemminger

Renamed dev_hw_addr_random to eth_hw_addr_random() to reflect that
this function only assign a random ethernet address (MAC). Removed
the second parameter (u8 *hwaddr), it's redundant since the also
given net_device already contains net_device->dev_addr.
Set it directly.

Adapt igbvf and ixgbevf to the changed function.

Small fix for ixgbevf_probe(): if ixgbevf_sw_init() fails
(which means the device got no dev_addr) handle the error and
jump to err_sw_init as already done by igbvf in similar case.

Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de>
---
 drivers/net/ethernet/intel/igbvf/netdev.c         |   11 +++++---
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |   28 ++++++++++++--------
 include/linux/etherdevice.h                       |   13 +++++----
 3 files changed, 31 insertions(+), 21 deletions(-)

diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c
index a4b20c8..14d42f9 100644
--- a/drivers/net/ethernet/intel/igbvf/netdev.c
+++ b/drivers/net/ethernet/intel/igbvf/netdev.c
@@ -2695,18 +2695,19 @@ static int __devinit igbvf_probe(struct pci_dev *pdev,
 		dev_info(&pdev->dev,
 			 "PF still in reset state, assigning new address."
 			 " Is the PF interface up?\n");
-		dev_hw_addr_random(adapter->netdev, hw->mac.addr);
+		eth_hw_addr_random(netdev);
+		memcpy(adapter->hw.mac.addr, netdev->dev_addr,
+			netdev->addr_len);
 	} else {
 		err = hw->mac.ops.read_mac_addr(hw);
 		if (err) {
 			dev_err(&pdev->dev, "Error reading MAC address\n");
 			goto err_hw_init;
 		}
+		memcpy(netdev->dev_addr, adapter->hw.mac.addr,
+			netdev->addr_len);
 	}
 
-	memcpy(netdev->dev_addr, adapter->hw.mac.addr, netdev->addr_len);
-	memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len);
-
 	if (!is_valid_ether_addr(netdev->perm_addr)) {
 		dev_err(&pdev->dev, "Invalid MAC Address: %pM\n",
 		        netdev->dev_addr);
@@ -2714,6 +2715,8 @@ static int __devinit igbvf_probe(struct pci_dev *pdev,
 		goto err_hw_init;
 	}
 
+	memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len);
+
 	setup_timer(&adapter->watchdog_timer, &igbvf_watchdog,
 	            (unsigned long) adapter);
 
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index bed411b..0daf7fd 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -2195,13 +2195,17 @@ static int __devinit ixgbevf_sw_init(struct ixgbevf_adapter *adapter)
 	if (err) {
 		dev_info(&pdev->dev,
 		         "PF still in reset state, assigning new address\n");
-		dev_hw_addr_random(adapter->netdev, hw->mac.addr);
+		eth_hw_addr_random(adapter->netdev);
+		memcpy(adapter->hw.mac.addr, adapter->netdev->dev_addr,
+			adapter->netdev->addr_len);
 	} else {
 		err = hw->mac.ops.init_hw(hw);
 		if (err) {
 			pr_err("init_shared_code failed: %d\n", err);
 			goto out;
 		}
+		memcpy(adapter->netdev->dev_addr, adapter->hw.mac.addr,
+			adapter->netdev->addr_len);
 	}
 
 	/* Enable dynamic interrupt throttling rates */
@@ -2220,6 +2224,7 @@ static int __devinit ixgbevf_sw_init(struct ixgbevf_adapter *adapter)
 	adapter->flags |= IXGBE_FLAG_RX_CSUM_ENABLED;
 
 	set_bit(__IXGBEVF_DOWN, &adapter->state);
+	return 0;
 
 out:
 	return err;
@@ -3394,6 +3399,17 @@ static int __devinit ixgbevf_probe(struct pci_dev *pdev,
 
 	/* setup the private structure */
 	err = ixgbevf_sw_init(adapter);
+	if (err)
+		goto err_sw_init;
+
+	/* The HW MAC address was set and/or determined in sw_init */
+	memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len);
+
+	if (!is_valid_ether_addr(netdev->dev_addr)) {
+		pr_err("invalid MAC address\n");
+		err = -EIO;
+		goto err_sw_init;
+	}
 
 	netdev->hw_features = NETIF_F_SG |
 			   NETIF_F_IP_CSUM |
@@ -3418,16 +3434,6 @@ static int __devinit ixgbevf_probe(struct pci_dev *pdev,
 
 	netdev->priv_flags |= IFF_UNICAST_FLT;
 
-	/* The HW MAC address was set and/or determined in sw_init */
-	memcpy(netdev->dev_addr, adapter->hw.mac.addr, netdev->addr_len);
-	memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len);
-
-	if (!is_valid_ether_addr(netdev->dev_addr)) {
-		pr_err("invalid MAC address\n");
-		err = -EIO;
-		goto err_sw_init;
-	}
-
 	init_timer(&adapter->watchdog_timer);
 	adapter->watchdog_timer.function = ixgbevf_watchdog;
 	adapter->watchdog_timer.data = (unsigned long)adapter;
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 05955cf..8a18358 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -140,17 +140,18 @@ static inline void random_ether_addr(u8 *addr)
 }
 
 /**
- * dev_hw_addr_random - Create random MAC and set device flag
+ * eth_hw_addr_random - Generate software assigned random Ethernet and
+ * set device flag
  * @dev: pointer to net_device structure
- * @hwaddr: Pointer to a six-byte array containing the Ethernet address
  *
- * Generate random MAC to be used by a device and set addr_assign_type
- * so the state can be read by sysfs and be used by udev.
+ * Generate a random Ethernet address (MAC) to be used by a net device
+ * and set addr_assign_type so the state can be read by sysfs and be
+ * used by userspace.
  */
-static inline void dev_hw_addr_random(struct net_device *dev, u8 *hwaddr)
+static inline void eth_hw_addr_random(struct net_device *dev)
 {
 	dev->addr_assign_type |= NET_ADDR_RANDOM;
-	random_ether_addr(hwaddr);
+	random_ether_addr(dev->dev_addr);
 }
 
 /**
-- 
1.7.7.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/2] rename dev_hw_addr_random and remove redundant second
@ 2012-02-09 19:48   ` Danny Kukawka
  0 siblings, 0 replies; 13+ messages in thread
From: Danny Kukawka @ 2012-02-09 19:48 UTC (permalink / raw)
  To: David S. Miller
  Cc: Jiri Pirko, e1000-devel, netdev, Bruce Allan, Jesse Brandeburg,
	linux-kernel, John Ronciak, Danny Kukawka

Renamed dev_hw_addr_random to eth_hw_addr_random() to reflect that
this function only assign a random ethernet address (MAC). Removed
the second parameter (u8 *hwaddr), it's redundant since the also
given net_device already contains net_device->dev_addr.
Set it directly.

Adapt igbvf and ixgbevf to the changed function.

Small fix for ixgbevf_probe(): if ixgbevf_sw_init() fails
(which means the device got no dev_addr) handle the error and
jump to err_sw_init as already done by igbvf in similar case.

Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de>
---
 drivers/net/ethernet/intel/igbvf/netdev.c         |   11 +++++---
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |   28 ++++++++++++--------
 include/linux/etherdevice.h                       |   13 +++++----
 3 files changed, 31 insertions(+), 21 deletions(-)

diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c
index a4b20c8..14d42f9 100644
--- a/drivers/net/ethernet/intel/igbvf/netdev.c
+++ b/drivers/net/ethernet/intel/igbvf/netdev.c
@@ -2695,18 +2695,19 @@ static int __devinit igbvf_probe(struct pci_dev *pdev,
 		dev_info(&pdev->dev,
 			 "PF still in reset state, assigning new address."
 			 " Is the PF interface up?\n");
-		dev_hw_addr_random(adapter->netdev, hw->mac.addr);
+		eth_hw_addr_random(netdev);
+		memcpy(adapter->hw.mac.addr, netdev->dev_addr,
+			netdev->addr_len);
 	} else {
 		err = hw->mac.ops.read_mac_addr(hw);
 		if (err) {
 			dev_err(&pdev->dev, "Error reading MAC address\n");
 			goto err_hw_init;
 		}
+		memcpy(netdev->dev_addr, adapter->hw.mac.addr,
+			netdev->addr_len);
 	}
 
-	memcpy(netdev->dev_addr, adapter->hw.mac.addr, netdev->addr_len);
-	memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len);
-
 	if (!is_valid_ether_addr(netdev->perm_addr)) {
 		dev_err(&pdev->dev, "Invalid MAC Address: %pM\n",
 		        netdev->dev_addr);
@@ -2714,6 +2715,8 @@ static int __devinit igbvf_probe(struct pci_dev *pdev,
 		goto err_hw_init;
 	}
 
+	memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len);
+
 	setup_timer(&adapter->watchdog_timer, &igbvf_watchdog,
 	            (unsigned long) adapter);
 
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index bed411b..0daf7fd 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -2195,13 +2195,17 @@ static int __devinit ixgbevf_sw_init(struct ixgbevf_adapter *adapter)
 	if (err) {
 		dev_info(&pdev->dev,
 		         "PF still in reset state, assigning new address\n");
-		dev_hw_addr_random(adapter->netdev, hw->mac.addr);
+		eth_hw_addr_random(adapter->netdev);
+		memcpy(adapter->hw.mac.addr, adapter->netdev->dev_addr,
+			adapter->netdev->addr_len);
 	} else {
 		err = hw->mac.ops.init_hw(hw);
 		if (err) {
 			pr_err("init_shared_code failed: %d\n", err);
 			goto out;
 		}
+		memcpy(adapter->netdev->dev_addr, adapter->hw.mac.addr,
+			adapter->netdev->addr_len);
 	}
 
 	/* Enable dynamic interrupt throttling rates */
@@ -2220,6 +2224,7 @@ static int __devinit ixgbevf_sw_init(struct ixgbevf_adapter *adapter)
 	adapter->flags |= IXGBE_FLAG_RX_CSUM_ENABLED;
 
 	set_bit(__IXGBEVF_DOWN, &adapter->state);
+	return 0;
 
 out:
 	return err;
@@ -3394,6 +3399,17 @@ static int __devinit ixgbevf_probe(struct pci_dev *pdev,
 
 	/* setup the private structure */
 	err = ixgbevf_sw_init(adapter);
+	if (err)
+		goto err_sw_init;
+
+	/* The HW MAC address was set and/or determined in sw_init */
+	memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len);
+
+	if (!is_valid_ether_addr(netdev->dev_addr)) {
+		pr_err("invalid MAC address\n");
+		err = -EIO;
+		goto err_sw_init;
+	}
 
 	netdev->hw_features = NETIF_F_SG |
 			   NETIF_F_IP_CSUM |
@@ -3418,16 +3434,6 @@ static int __devinit ixgbevf_probe(struct pci_dev *pdev,
 
 	netdev->priv_flags |= IFF_UNICAST_FLT;
 
-	/* The HW MAC address was set and/or determined in sw_init */
-	memcpy(netdev->dev_addr, adapter->hw.mac.addr, netdev->addr_len);
-	memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len);
-
-	if (!is_valid_ether_addr(netdev->dev_addr)) {
-		pr_err("invalid MAC address\n");
-		err = -EIO;
-		goto err_sw_init;
-	}
-
 	init_timer(&adapter->watchdog_timer);
 	adapter->watchdog_timer.function = ixgbevf_watchdog;
 	adapter->watchdog_timer.data = (unsigned long)adapter;
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 05955cf..8a18358 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -140,17 +140,18 @@ static inline void random_ether_addr(u8 *addr)
 }
 
 /**
- * dev_hw_addr_random - Create random MAC and set device flag
+ * eth_hw_addr_random - Generate software assigned random Ethernet and
+ * set device flag
  * @dev: pointer to net_device structure
- * @hwaddr: Pointer to a six-byte array containing the Ethernet address
  *
- * Generate random MAC to be used by a device and set addr_assign_type
- * so the state can be read by sysfs and be used by udev.
+ * Generate a random Ethernet address (MAC) to be used by a net device
+ * and set addr_assign_type so the state can be read by sysfs and be
+ * used by userspace.
  */
-static inline void dev_hw_addr_random(struct net_device *dev, u8 *hwaddr)
+static inline void eth_hw_addr_random(struct net_device *dev)
 {
 	dev->addr_assign_type |= NET_ADDR_RANDOM;
-	random_ether_addr(hwaddr);
+	random_ether_addr(dev->dev_addr);
 }
 
 /**
-- 
1.7.7.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&#174; Ethernet, visit http://communities.intel.com/community/wired

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 0/2] Part 1: handle addr_assign_type for random addresses
  2012-02-09 19:48 ` Danny Kukawka
                   ` (2 preceding siblings ...)
  (?)
@ 2012-02-09 20:09 ` Jeff Kirsher
  2012-07-02 18:55   ` Shuah Khan
  -1 siblings, 1 reply; 13+ messages in thread
From: Jeff Kirsher @ 2012-02-09 20:09 UTC (permalink / raw)
  To: Danny Kukawka
  Cc: David S. Miller, Danny Kukawka, netdev, linux-kernel,
	Jesse Brandeburg, Bruce Allan, Carolyn Wyborny, Don Skidmore,
	Greg Rose, Peter P Waskiewicz Jr, Alex Duyck, John Ronciak,
	Mitch Williams, Jiri Pirko, Eric Dumazet, e1000-devel,
	Neil Horman, Randy Dunlap, Stephen Hemminger

[-- Attachment #1: Type: text/plain, Size: 918 bytes --]

On Thu, 2012-02-09 at 20:48 +0100, Danny Kukawka wrote:
> This is an updated and split up version of my patch series to
> fix the handling of addr_assign_type for random MAC addresses.
> 
> The first part contains the basic changes in etherdevice.h
> and eth.c incl. needed adaptations in the existing code
> 
> Danny Kukawka (2):
>   eth: reset addr_assign_type if eth_mac_addr() called
>   rename dev_hw_addr_random and remove redundant second
> 
>  drivers/net/ethernet/intel/igbvf/netdev.c         |   11 +++++---
>  drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |   28 ++++++++++++--------
>  include/linux/etherdevice.h                       |   13 +++++----
>  net/ethernet/eth.c                                |    2 +
>  4 files changed, 33 insertions(+), 21 deletions(-)
> 

Thanks Danny, I will add both patches to my queue so that we can
validate the changes for ixgbevf and igbvf.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/2] rename dev_hw_addr_random and remove redundant second
  2012-02-09 19:48   ` Danny Kukawka
  (?)
@ 2012-02-09 20:11   ` Ben Hutchings
  -1 siblings, 0 replies; 13+ messages in thread
From: Ben Hutchings @ 2012-02-09 20:11 UTC (permalink / raw)
  To: Danny Kukawka
  Cc: David S. Miller, Danny Kukawka, netdev, linux-kernel,
	Jeff Kirsher, Jesse Brandeburg, Bruce Allan, Carolyn Wyborny,
	Don Skidmore, Greg Rose, Peter P Waskiewicz Jr, Alex Duyck,
	John Ronciak, Mitch Williams, Jiri Pirko, Eric Dumazet,
	e1000-devel, Stephen Hemminger

On Thu, 2012-02-09 at 20:48 +0100, Danny Kukawka wrote:
> Renamed dev_hw_addr_random to eth_hw_addr_random() to reflect that
> this function only assign a random ethernet address (MAC). Removed
> the second parameter (u8 *hwaddr), it's redundant since the also
> given net_device already contains net_device->dev_addr.
> Set it directly.
> 
> Adapt igbvf and ixgbevf to the changed function.
[...]
> --- a/drivers/net/ethernet/intel/igbvf/netdev.c
> +++ b/drivers/net/ethernet/intel/igbvf/netdev.c
> @@ -2695,18 +2695,19 @@ static int __devinit igbvf_probe(struct pci_dev *pdev,
>  		dev_info(&pdev->dev,
>  			 "PF still in reset state, assigning new address."
>  			 " Is the PF interface up?\n");
> -		dev_hw_addr_random(adapter->netdev, hw->mac.addr);
> +		eth_hw_addr_random(netdev);
> +		memcpy(adapter->hw.mac.addr, netdev->dev_addr,
> +			netdev->addr_len);
>  	} else {
>  		err = hw->mac.ops.read_mac_addr(hw);
>  		if (err) {
>  			dev_err(&pdev->dev, "Error reading MAC address\n");
>  			goto err_hw_init;
>  		}
> +		memcpy(netdev->dev_addr, adapter->hw.mac.addr,
> +			netdev->addr_len);
>  	}
>  
> -	memcpy(netdev->dev_addr, adapter->hw.mac.addr, netdev->addr_len);
> -	memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len);
> -
>  	if (!is_valid_ether_addr(netdev->perm_addr)) {
>  		dev_err(&pdev->dev, "Invalid MAC Address: %pM\n",
>  		        netdev->dev_addr);
> @@ -2714,6 +2715,8 @@ static int __devinit igbvf_probe(struct pci_dev *pdev,
>  		goto err_hw_init;
>  	}
>  
> +	memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len);
[...]

I wonder whether VF drivers should claim to have a permanent address at
all, let alone setting the 'permanent' address to a randomly generated
address.

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.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 1/2] eth: reset addr_assign_type if eth_mac_addr() called
  2012-02-09 19:48 ` [PATCH v2 1/2] eth: reset addr_assign_type if eth_mac_addr() called Danny Kukawka
@ 2012-02-13  5:50   ` David Miller
  0 siblings, 0 replies; 13+ messages in thread
From: David Miller @ 2012-02-13  5:50 UTC (permalink / raw)
  To: danny.kukawka
  Cc: dkukawka, netdev, linux-kernel, nhorman, eric.dumazet, rdunlap

From: Danny Kukawka <danny.kukawka@bisect.de>
Date: Thu,  9 Feb 2012 20:48:53 +0100

> 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.
> 
> v2: changed to bitops, removed if()
> 
> Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de>

Applied.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/2] rename dev_hw_addr_random and remove redundant second
  2012-02-09 19:48   ` Danny Kukawka
@ 2012-02-13  5:50     ` David Miller
  -1 siblings, 0 replies; 13+ messages in thread
From: David Miller @ 2012-02-13  5:50 UTC (permalink / raw)
  To: danny.kukawka
  Cc: dkukawka, netdev, linux-kernel, jeffrey.t.kirsher,
	jesse.brandeburg, bruce.w.allan, carolyn.wyborny,
	donald.c.skidmore, gregory.v.rose, peter.p.waskiewicz.jr,
	alexander.h.duyck, john.ronciak, mitch.a.williams, jpirko,
	eric.dumazet, e1000-devel, shemminger

From: Danny Kukawka <danny.kukawka@bisect.de>
Date: Thu,  9 Feb 2012 20:48:54 +0100

> Renamed dev_hw_addr_random to eth_hw_addr_random() to reflect that
> this function only assign a random ethernet address (MAC). Removed
> the second parameter (u8 *hwaddr), it's redundant since the also
> given net_device already contains net_device->dev_addr.
> Set it directly.
> 
> Adapt igbvf and ixgbevf to the changed function.
> 
> Small fix for ixgbevf_probe(): if ixgbevf_sw_init() fails
> (which means the device got no dev_addr) handle the error and
> jump to err_sw_init as already done by igbvf in similar case.
> 
> Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de>

Applied.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/2] rename dev_hw_addr_random and remove redundant second
@ 2012-02-13  5:50     ` David Miller
  0 siblings, 0 replies; 13+ messages in thread
From: David Miller @ 2012-02-13  5:50 UTC (permalink / raw)
  To: danny.kukawka
  Cc: jpirko, e1000-devel, netdev, bruce.w.allan, jesse.brandeburg,
	linux-kernel, john.ronciak, dkukawka

From: Danny Kukawka <danny.kukawka@bisect.de>
Date: Thu,  9 Feb 2012 20:48:54 +0100

> Renamed dev_hw_addr_random to eth_hw_addr_random() to reflect that
> this function only assign a random ethernet address (MAC). Removed
> the second parameter (u8 *hwaddr), it's redundant since the also
> given net_device already contains net_device->dev_addr.
> Set it directly.
> 
> Adapt igbvf and ixgbevf to the changed function.
> 
> Small fix for ixgbevf_probe(): if ixgbevf_sw_init() fails
> (which means the device got no dev_addr) handle the error and
> jump to err_sw_init as already done by igbvf in similar case.
> 
> Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de>

Applied.

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
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-dev2
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 0/2] Part 1: handle addr_assign_type for random addresses
  2012-02-09 20:09 ` [PATCH v2 0/2] Part 1: handle addr_assign_type for random addresses Jeff Kirsher
@ 2012-07-02 18:55   ` Shuah Khan
  2012-07-02 19:23     ` Jeff Kirsher
  0 siblings, 1 reply; 13+ messages in thread
From: Shuah Khan @ 2012-07-02 18:55 UTC (permalink / raw)
  To: jeffrey.t.kirsher
  Cc: Danny Kukawka, David S. Miller, Danny Kukawka, netdev, linux-kernel

On Thu, 2012-02-09 at 12:09 -0800, Jeff Kirsher wrote:

> 
> Thanks Danny, I will add both patches to my queue so that we can
> validate the changes for ixgbevf and igbvf.

Jeff,

Which upstream kernel did this patch end up in? Also did it make it into
any of the stable releases?

Thanks,
-- Shuah


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 0/2] Part 1: handle addr_assign_type for random addresses
  2012-07-02 18:55   ` Shuah Khan
@ 2012-07-02 19:23     ` Jeff Kirsher
  2012-07-02 19:41       ` Shuah Khan
  0 siblings, 1 reply; 13+ messages in thread
From: Jeff Kirsher @ 2012-07-02 19:23 UTC (permalink / raw)
  To: shuah.khan
  Cc: Danny Kukawka, David S. Miller, Danny Kukawka, netdev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 528 bytes --]

On Mon, 2012-07-02 at 12:55 -0600, Shuah Khan wrote:
> On Thu, 2012-02-09 at 12:09 -0800, Jeff Kirsher wrote:
> 
> > 
> > Thanks Danny, I will add both patches to my queue so that we can
> > validate the changes for ixgbevf and igbvf.
> 
> Jeff,
> 
> Which upstream kernel did this patch end up in? Also did it make it into
> any of the stable releases?
> 
> Thanks,
> -- Shuah
> 

It looks like it was accepted into kernel 3.3.  I am not aware of any
stable kernels earlier than 3.3 that picked up the patch.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 0/2] Part 1: handle addr_assign_type for random addresses
  2012-07-02 19:23     ` Jeff Kirsher
@ 2012-07-02 19:41       ` Shuah Khan
  0 siblings, 0 replies; 13+ messages in thread
From: Shuah Khan @ 2012-07-02 19:41 UTC (permalink / raw)
  To: jeffrey.t.kirsher
  Cc: Danny Kukawka, David S. Miller, Danny Kukawka, netdev, linux-kernel

On Mon, 2012-07-02 at 12:23 -0700, Jeff Kirsher wrote:

> 
> It looks like it was accepted into kernel 3.3.  I am not aware of any
> stable kernels earlier than 3.3 that picked up the patch.

Checked the 3.3 source didn't find it, it is in 3.4.

-- Shuah



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-07-02 19:41 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-09 19:48 [PATCH v2 0/2] Part 1: handle addr_assign_type for random addresses Danny Kukawka
2012-02-09 19:48 ` Danny Kukawka
2012-02-09 19:48 ` [PATCH v2 1/2] eth: reset addr_assign_type if eth_mac_addr() called Danny Kukawka
2012-02-13  5:50   ` David Miller
2012-02-09 19:48 ` [PATCH 2/2] rename dev_hw_addr_random and remove redundant second Danny Kukawka
2012-02-09 19:48   ` Danny Kukawka
2012-02-09 20:11   ` Ben Hutchings
2012-02-13  5:50   ` David Miller
2012-02-13  5:50     ` David Miller
2012-02-09 20:09 ` [PATCH v2 0/2] Part 1: handle addr_assign_type for random addresses Jeff Kirsher
2012-07-02 18:55   ` Shuah Khan
2012-07-02 19:23     ` Jeff Kirsher
2012-07-02 19:41       ` Shuah Khan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.