ethernet: use eth_hw_addr_set() instead of ether_addr_copy()
Convert Ethernet from ether_addr_copy() to eth_hw_addr_set(): @@ expression dev, np; @@ - ether_addr_copy(dev->dev_addr, np) + eth_hw_addr_set(dev, np) Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
e35b8d7dbb
commit
f3956ebb3b
@@ -990,7 +990,7 @@ static int fm10k_set_mac(struct net_device *dev, void *p)
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
ether_addr_copy(dev->dev_addr, addr->sa_data);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
ether_addr_copy(hw->mac.addr, addr->sa_data);
|
||||
dev->addr_assign_type &= ~NET_ADDR_RANDOM;
|
||||
}
|
||||
|
||||
@@ -300,7 +300,7 @@ static int fm10k_handle_reset(struct fm10k_intfc *interface)
|
||||
if (is_valid_ether_addr(hw->mac.perm_addr)) {
|
||||
ether_addr_copy(hw->mac.addr, hw->mac.perm_addr);
|
||||
ether_addr_copy(netdev->perm_addr, hw->mac.perm_addr);
|
||||
ether_addr_copy(netdev->dev_addr, hw->mac.perm_addr);
|
||||
eth_hw_addr_set(netdev, hw->mac.perm_addr);
|
||||
netdev->addr_assign_type &= ~NET_ADDR_RANDOM;
|
||||
}
|
||||
|
||||
@@ -2045,7 +2045,7 @@ static int fm10k_sw_init(struct fm10k_intfc *interface,
|
||||
netdev->addr_assign_type |= NET_ADDR_RANDOM;
|
||||
}
|
||||
|
||||
ether_addr_copy(netdev->dev_addr, hw->mac.addr);
|
||||
eth_hw_addr_set(netdev, hw->mac.addr);
|
||||
ether_addr_copy(netdev->perm_addr, hw->mac.addr);
|
||||
|
||||
if (!is_valid_ether_addr(netdev->perm_addr)) {
|
||||
|
||||
@@ -1587,7 +1587,7 @@ static int i40e_set_mac(struct net_device *netdev, void *p)
|
||||
*/
|
||||
spin_lock_bh(&vsi->mac_filter_hash_lock);
|
||||
i40e_del_mac_filter(vsi, netdev->dev_addr);
|
||||
ether_addr_copy(netdev->dev_addr, addr->sa_data);
|
||||
eth_hw_addr_set(netdev, addr->sa_data);
|
||||
i40e_add_mac_filter(vsi, netdev->dev_addr);
|
||||
spin_unlock_bh(&vsi->mac_filter_hash_lock);
|
||||
|
||||
@@ -13424,7 +13424,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
|
||||
i40e_add_mac_filter(vsi, broadcast);
|
||||
spin_unlock_bh(&vsi->mac_filter_hash_lock);
|
||||
|
||||
ether_addr_copy(netdev->dev_addr, mac_addr);
|
||||
eth_hw_addr_set(netdev, mac_addr);
|
||||
ether_addr_copy(netdev->perm_addr, mac_addr);
|
||||
|
||||
/* i40iw_net_event() reads 16 bytes from neigh->primary_key */
|
||||
|
||||
@@ -1847,7 +1847,7 @@ static int iavf_init_get_resources(struct iavf_adapter *adapter)
|
||||
eth_hw_addr_random(netdev);
|
||||
ether_addr_copy(adapter->hw.mac.addr, netdev->dev_addr);
|
||||
} else {
|
||||
ether_addr_copy(netdev->dev_addr, adapter->hw.mac.addr);
|
||||
eth_hw_addr_set(netdev, adapter->hw.mac.addr);
|
||||
ether_addr_copy(netdev->perm_addr, adapter->hw.mac.addr);
|
||||
}
|
||||
|
||||
|
||||
@@ -1685,7 +1685,7 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter,
|
||||
if (!v_retval)
|
||||
iavf_mac_add_ok(adapter);
|
||||
if (!ether_addr_equal(netdev->dev_addr, adapter->hw.mac.addr))
|
||||
ether_addr_copy(netdev->dev_addr, adapter->hw.mac.addr);
|
||||
eth_hw_addr_set(netdev, adapter->hw.mac.addr);
|
||||
break;
|
||||
case VIRTCHNL_OP_GET_STATS: {
|
||||
struct iavf_eth_stats *stats =
|
||||
@@ -1716,7 +1716,7 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter,
|
||||
ether_addr_copy(adapter->hw.mac.addr, netdev->dev_addr);
|
||||
} else {
|
||||
/* refresh current mac address if changed */
|
||||
ether_addr_copy(netdev->dev_addr, adapter->hw.mac.addr);
|
||||
eth_hw_addr_set(netdev, adapter->hw.mac.addr);
|
||||
ether_addr_copy(netdev->perm_addr,
|
||||
adapter->hw.mac.addr);
|
||||
}
|
||||
|
||||
@@ -3143,7 +3143,7 @@ static int ice_cfg_netdev(struct ice_vsi *vsi)
|
||||
if (vsi->type == ICE_VSI_PF) {
|
||||
SET_NETDEV_DEV(netdev, ice_pf_to_dev(vsi->back));
|
||||
ether_addr_copy(mac_addr, vsi->port_info->mac.perm_addr);
|
||||
ether_addr_copy(netdev->dev_addr, mac_addr);
|
||||
eth_hw_addr_set(netdev, mac_addr);
|
||||
ether_addr_copy(netdev->perm_addr, mac_addr);
|
||||
}
|
||||
|
||||
@@ -5172,7 +5172,7 @@ err_update_filters:
|
||||
netdev_err(netdev, "can't set MAC %pM. filter update failed\n",
|
||||
mac);
|
||||
netif_addr_lock_bh(netdev);
|
||||
ether_addr_copy(netdev->dev_addr, old_mac);
|
||||
eth_hw_addr_set(netdev, old_mac);
|
||||
netif_addr_unlock_bh(netdev);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -2540,7 +2540,7 @@ void ixgbevf_reset(struct ixgbevf_adapter *adapter)
|
||||
}
|
||||
|
||||
if (is_valid_ether_addr(adapter->hw.mac.addr)) {
|
||||
ether_addr_copy(netdev->dev_addr, adapter->hw.mac.addr);
|
||||
eth_hw_addr_set(netdev, adapter->hw.mac.addr);
|
||||
ether_addr_copy(netdev->perm_addr, adapter->hw.mac.addr);
|
||||
}
|
||||
|
||||
@@ -3054,7 +3054,7 @@ static int ixgbevf_sw_init(struct ixgbevf_adapter *adapter)
|
||||
else if (is_zero_ether_addr(adapter->hw.mac.addr))
|
||||
dev_info(&pdev->dev,
|
||||
"MAC address not assigned by administrator.\n");
|
||||
ether_addr_copy(netdev->dev_addr, hw->mac.addr);
|
||||
eth_hw_addr_set(netdev, hw->mac.addr);
|
||||
}
|
||||
|
||||
if (!is_valid_ether_addr(netdev->dev_addr)) {
|
||||
@@ -4231,7 +4231,7 @@ static int ixgbevf_set_mac(struct net_device *netdev, void *p)
|
||||
|
||||
ether_addr_copy(hw->mac.addr, addr->sa_data);
|
||||
ether_addr_copy(hw->mac.perm_addr, addr->sa_data);
|
||||
ether_addr_copy(netdev->dev_addr, addr->sa_data);
|
||||
eth_hw_addr_set(netdev, addr->sa_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user