diff mbox

[net-next-2.6,2/2] enic: Use random mac addr when associating port-profile

Message ID 20100523032957.20200.59700.stgit@savbu-pc100.cisco.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Scott Feldman May 23, 2010, 3:29 a.m. UTC
From: Scott Feldman <scofeldm@cisco.com>

Use random mac addr for interface when associating port-profile to 
dynamic enic device, in the case no mac addr was previous assigned.

Signed-off-by: Scott Feldman <scofeldm@cisco.com>
---
 drivers/net/enic/enic_main.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller May 24, 2010, 6:11 a.m. UTC | #1
From: Scott Feldman <scofeldm@cisco.com>
Date: Sat, 22 May 2010 20:29:58 -0700

> From: Scott Feldman <scofeldm@cisco.com>
> 
> Use random mac addr for interface when associating port-profile to 
> dynamic enic device, in the case no mac addr was previous assigned.
> 
> Signed-off-by: Scott Feldman <scofeldm@cisco.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 7e97323..6586b5c 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -1132,6 +1132,14 @@  static int enic_set_vf_port(struct net_device *netdev, int vf,
 	switch (request) {
 	case PORT_REQUEST_ASSOCIATE:
 
+		/* If the interface mac addr hasn't been assigned,
+		 * assign a random mac addr before setting port-
+		 * profile.
+		 */
+
+		if (is_zero_ether_addr(netdev->dev_addr))
+			random_ether_addr(netdev->dev_addr);
+
 		if (port[IFLA_PORT_PROFILE])
 			name = nla_data(port[IFLA_PORT_PROFILE]);