提交 7efd26d0 编写于 作者: J Joe Perches 提交者: David S. Miller

ethernet: Use eth_random_addr

Convert the existing uses of random_ether_addr to
the new eth_random_addr.
Signed-off-by: NJoe Perches <joe@perches.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 0a4dd594
...@@ -199,7 +199,7 @@ int atl1c_read_mac_addr(struct atl1c_hw *hw) ...@@ -199,7 +199,7 @@ int atl1c_read_mac_addr(struct atl1c_hw *hw)
err = atl1c_get_permanent_address(hw); err = atl1c_get_permanent_address(hw);
if (err) if (err)
random_ether_addr(hw->perm_mac_addr); eth_random_addr(hw->perm_mac_addr);
memcpy(hw->mac_addr, hw->perm_mac_addr, sizeof(hw->perm_mac_addr)); memcpy(hw->mac_addr, hw->perm_mac_addr, sizeof(hw->perm_mac_addr));
return err; return err;
......
...@@ -538,7 +538,7 @@ static s32 atl1_read_mac_addr(struct atl1_hw *hw) ...@@ -538,7 +538,7 @@ static s32 atl1_read_mac_addr(struct atl1_hw *hw)
u16 i; u16 i;
if (atl1_get_permanent_address(hw)) { if (atl1_get_permanent_address(hw)) {
random_ether_addr(hw->perm_mac_addr); eth_random_addr(hw->perm_mac_addr);
ret = 1; ret = 1;
} }
......
...@@ -2346,7 +2346,7 @@ static s32 atl2_read_mac_addr(struct atl2_hw *hw) ...@@ -2346,7 +2346,7 @@ static s32 atl2_read_mac_addr(struct atl2_hw *hw)
{ {
if (get_permanent_address(hw)) { if (get_permanent_address(hw)) {
/* for test */ /* for test */
/* FIXME: shouldn't we use random_ether_addr() here? */ /* FIXME: shouldn't we use eth_random_addr() here? */
hw->perm_mac_addr[0] = 0x00; hw->perm_mac_addr[0] = 0x00;
hw->perm_mac_addr[1] = 0x13; hw->perm_mac_addr[1] = 0x13;
hw->perm_mac_addr[2] = 0x74; hw->perm_mac_addr[2] = 0x74;
......
...@@ -1057,7 +1057,7 @@ static int __devinit ethoc_probe(struct platform_device *pdev) ...@@ -1057,7 +1057,7 @@ static int __devinit ethoc_probe(struct platform_device *pdev)
/* Check the MAC again for validity, if it still isn't choose and /* Check the MAC again for validity, if it still isn't choose and
* program a random one. */ * program a random one. */
if (!is_valid_ether_addr(netdev->dev_addr)) { if (!is_valid_ether_addr(netdev->dev_addr)) {
random_ether_addr(netdev->dev_addr); eth_random_addr(netdev->dev_addr);
random_mac = true; random_mac = true;
} }
......
...@@ -5008,7 +5008,7 @@ static int igb_vf_configure(struct igb_adapter *adapter, int vf) ...@@ -5008,7 +5008,7 @@ static int igb_vf_configure(struct igb_adapter *adapter, int vf)
unsigned int device_id; unsigned int device_id;
u16 thisvf_devfn; u16 thisvf_devfn;
random_ether_addr(mac_addr); eth_random_addr(mac_addr);
igb_set_vf_mac(adapter, vf, mac_addr); igb_set_vf_mac(adapter, vf, mac_addr);
switch (adapter->hw.mac.type) { switch (adapter->hw.mac.type) {
...@@ -5417,7 +5417,7 @@ static void igb_vf_reset_event(struct igb_adapter *adapter, u32 vf) ...@@ -5417,7 +5417,7 @@ static void igb_vf_reset_event(struct igb_adapter *adapter, u32 vf)
/* generate a new mac address as we were hotplug removed/added */ /* generate a new mac address as we were hotplug removed/added */
if (!(adapter->vf_data[vf].flags & IGB_VF_FLAG_PF_SET_MAC)) if (!(adapter->vf_data[vf].flags & IGB_VF_FLAG_PF_SET_MAC))
random_ether_addr(vf_mac); eth_random_addr(vf_mac);
/* process remaining reset events */ /* process remaining reset events */
igb_vf_reset(adapter, vf); igb_vf_reset(adapter, vf);
......
...@@ -467,7 +467,7 @@ int ixgbe_vf_configuration(struct pci_dev *pdev, unsigned int event_mask) ...@@ -467,7 +467,7 @@ int ixgbe_vf_configuration(struct pci_dev *pdev, unsigned int event_mask)
bool enable = ((event_mask & 0x10000000U) != 0); bool enable = ((event_mask & 0x10000000U) != 0);
if (enable) { if (enable) {
random_ether_addr(vf_mac_addr); eth_random_addr(vf_mac_addr);
e_info(probe, "IOV: VF %d is enabled MAC %pM\n", e_info(probe, "IOV: VF %d is enabled MAC %pM\n",
vfn, vf_mac_addr); vfn, vf_mac_addr);
/* /*
......
...@@ -645,7 +645,7 @@ ltq_etop_init(struct net_device *dev) ...@@ -645,7 +645,7 @@ ltq_etop_init(struct net_device *dev)
memcpy(&mac, &priv->pldata->mac, sizeof(struct sockaddr)); memcpy(&mac, &priv->pldata->mac, sizeof(struct sockaddr));
if (!is_valid_ether_addr(mac.sa_data)) { if (!is_valid_ether_addr(mac.sa_data)) {
pr_warn("etop: invalid MAC, using random\n"); pr_warn("etop: invalid MAC, using random\n");
random_ether_addr(mac.sa_data); eth_random_addr(mac.sa_data);
random_mac = true; random_mac = true;
} }
......
...@@ -422,7 +422,7 @@ static void ks8851_read_mac_addr(struct net_device *dev) ...@@ -422,7 +422,7 @@ static void ks8851_read_mac_addr(struct net_device *dev)
* *
* Get or create the initial mac address for the device and then set that * Get or create the initial mac address for the device and then set that
* into the station address register. If there is an EEPROM present, then * into the station address register. If there is an EEPROM present, then
* we try that. If no valid mac address is found we use random_ether_addr() * we try that. If no valid mac address is found we use eth_random_addr()
* to create a new one. * to create a new one.
*/ */
static void ks8851_init_mac(struct ks8851_net *ks) static void ks8851_init_mac(struct ks8851_net *ks)
......
...@@ -1609,7 +1609,7 @@ static int __devinit ks8851_probe(struct platform_device *pdev) ...@@ -1609,7 +1609,7 @@ static int __devinit ks8851_probe(struct platform_device *pdev)
memcpy(ks->mac_addr, pdata->mac_addr, 6); memcpy(ks->mac_addr, pdata->mac_addr, 6);
if (!is_valid_ether_addr(ks->mac_addr)) { if (!is_valid_ether_addr(ks->mac_addr)) {
/* Use random MAC address if none passed */ /* Use random MAC address if none passed */
random_ether_addr(ks->mac_addr); eth_random_addr(ks->mac_addr);
netdev_info(netdev, "Using random mac address\n"); netdev_info(netdev, "Using random mac address\n");
} }
netdev_info(netdev, "Mac address is: %pM\n", ks->mac_addr); netdev_info(netdev, "Mac address is: %pM\n", ks->mac_addr);
......
...@@ -2488,7 +2488,7 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev) ...@@ -2488,7 +2488,7 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
eth_hw_addr_random(dev); eth_hw_addr_random(dev);
smsc911x_set_hw_mac_address(pdata, dev->dev_addr); smsc911x_set_hw_mac_address(pdata, dev->dev_addr);
SMSC_TRACE(pdata, probe, SMSC_TRACE(pdata, probe,
"MAC Address is set to random_ether_addr"); "MAC Address is set to eth_random_addr");
} }
} }
......
...@@ -748,7 +748,7 @@ static int __devinit cpsw_probe(struct platform_device *pdev) ...@@ -748,7 +748,7 @@ static int __devinit cpsw_probe(struct platform_device *pdev)
memcpy(priv->mac_addr, data->slave_data[0].mac_addr, ETH_ALEN); memcpy(priv->mac_addr, data->slave_data[0].mac_addr, ETH_ALEN);
pr_info("Detected MACID = %pM", priv->mac_addr); pr_info("Detected MACID = %pM", priv->mac_addr);
} else { } else {
random_ether_addr(priv->mac_addr); eth_random_addr(priv->mac_addr);
pr_info("Random MACID = %pM", priv->mac_addr); pr_info("Random MACID = %pM", priv->mac_addr);
} }
......
...@@ -1844,7 +1844,7 @@ static void tile_net_dev_init(const char *name, const uint8_t *mac) ...@@ -1844,7 +1844,7 @@ static void tile_net_dev_init(const char *name, const uint8_t *mac)
memcpy(dev->dev_addr, mac, 6); memcpy(dev->dev_addr, mac, 6);
dev->addr_len = 6; dev->addr_len = 6;
} else { } else {
random_ether_addr(dev->dev_addr); eth_random_addr(dev->dev_addr);
} }
/* Register the network device. */ /* Register the network device. */
......
...@@ -637,7 +637,7 @@ static int __devinit w5100_hw_probe(struct platform_device *pdev) ...@@ -637,7 +637,7 @@ static int __devinit w5100_hw_probe(struct platform_device *pdev)
if (data && is_valid_ether_addr(data->mac_addr)) { if (data && is_valid_ether_addr(data->mac_addr)) {
memcpy(ndev->dev_addr, data->mac_addr, ETH_ALEN); memcpy(ndev->dev_addr, data->mac_addr, ETH_ALEN);
} else { } else {
random_ether_addr(ndev->dev_addr); eth_random_addr(ndev->dev_addr);
ndev->addr_assign_type |= NET_ADDR_RANDOM; ndev->addr_assign_type |= NET_ADDR_RANDOM;
} }
......
...@@ -557,7 +557,7 @@ static int __devinit w5300_hw_probe(struct platform_device *pdev) ...@@ -557,7 +557,7 @@ static int __devinit w5300_hw_probe(struct platform_device *pdev)
if (data && is_valid_ether_addr(data->mac_addr)) { if (data && is_valid_ether_addr(data->mac_addr)) {
memcpy(ndev->dev_addr, data->mac_addr, ETH_ALEN); memcpy(ndev->dev_addr, data->mac_addr, ETH_ALEN);
} else { } else {
random_ether_addr(ndev->dev_addr); eth_random_addr(ndev->dev_addr);
ndev->addr_assign_type |= NET_ADDR_RANDOM; ndev->addr_assign_type |= NET_ADDR_RANDOM;
} }
......
...@@ -312,7 +312,7 @@ static void axienet_set_mac_address(struct net_device *ndev, void *address) ...@@ -312,7 +312,7 @@ static void axienet_set_mac_address(struct net_device *ndev, void *address)
if (address) if (address)
memcpy(ndev->dev_addr, address, ETH_ALEN); memcpy(ndev->dev_addr, address, ETH_ALEN);
if (!is_valid_ether_addr(ndev->dev_addr)) if (!is_valid_ether_addr(ndev->dev_addr))
random_ether_addr(ndev->dev_addr); eth_random_addr(ndev->dev_addr);
/* Set up unicast MAC address filter set its mac address */ /* Set up unicast MAC address filter set its mac address */
axienet_iow(lp, XAE_UAW0_OFFSET, axienet_iow(lp, XAE_UAW0_OFFSET,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册