[PATCH 23/50] efx: use dev_hw_addr_random() instead of random_ether_addr()

From: Danny Kukawka
Date: Wed Feb 08 2012 - 16:21:09 EST


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 <danny.kukawka@xxxxxxxxx>
---
drivers/net/ethernet/sfc/efx.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
index e43702f..cce339a 100644
--- a/drivers/net/ethernet/sfc/efx.c
+++ b/drivers/net/ethernet/sfc/efx.c
@@ -940,7 +940,7 @@ static int efx_probe_port(struct efx_nic *efx)
rc = -EINVAL;
goto err;
}
- 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);
--
1.7.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/