enic: Use random mac addr when associating port-profile
authorScott Feldman <scofeldm@cisco.com>
Sat, 22 May 2010 17:29:58 +0000 (17:29 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 24 May 2010 06:11:06 +0000 (23:11 -0700)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/enic/enic_main.c

index 7e973237bf984bad5c03c8905146e5125a516249..6586b5c7e4b617066bea1d652f175b51b5f9d6f4 100644 (file)
@@ -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]);