mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-09 14:50:19 +00:00
Merge branch 'hw_addr_set'
Jakub Kicinski says: ==================== Use netdev->dev_addr write helpers (part 1) Commit 406f42fa0d3c ("net-next: When a bond have a massive amount of VLANs...") introduced a rbtree for faster Ethernet address look up. To maintain netdev->dev_addr in this tree we need to make all the writes to it got through appropriate helpers. This is the first installment of predictably tedious conversion. It tackles: memcpy(netdev->dev_addr, something, ETH_ADDR) and ether_addr_copy(netdev->dev_addr, something) replacing both with eth_hw_addr_set(). The first 7 patches are done entirely by sparse. Next 4 were semi-manual because the sparse conversion resulted in errors. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
e9637775c0
@ -200,7 +200,7 @@ static struct net_device * __init nfeth_probe(int unit)
|
||||
dev->irq = nfEtherIRQ;
|
||||
dev->netdev_ops = &nfeth_netdev_ops;
|
||||
|
||||
memcpy(dev->dev_addr, mac, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, mac);
|
||||
|
||||
priv = netdev_priv(dev);
|
||||
priv->ethX = unit;
|
||||
|
@ -467,7 +467,7 @@ static int iss_net_set_mac(struct net_device *dev, void *addr)
|
||||
if (!is_valid_ether_addr(hwaddr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
spin_lock_bh(&lp->lock);
|
||||
memcpy(dev->dev_addr, hwaddr->sa_data, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, hwaddr->sa_data);
|
||||
spin_unlock_bh(&lp->lock);
|
||||
return 0;
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ static void el3_dev_fill(struct net_device *dev, __be16 *phys_addr, int ioaddr,
|
||||
{
|
||||
struct el3_private *lp = netdev_priv(dev);
|
||||
|
||||
memcpy(dev->dev_addr, phys_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, (u8 *)phys_addr);
|
||||
dev->base_addr = ioaddr;
|
||||
dev->irq = irq;
|
||||
dev->if_port = if_port;
|
||||
|
@ -716,7 +716,7 @@ static int ax_init_dev(struct net_device *dev)
|
||||
for (i = 0; i < 16; i++)
|
||||
SA_prom[i] = SA_prom[i+i];
|
||||
|
||||
memcpy(dev->dev_addr, SA_prom, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, SA_prom);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_AX88796_93CX6
|
||||
@ -733,7 +733,7 @@ static int ax_init_dev(struct net_device *dev)
|
||||
(__le16 __force *)mac_addr,
|
||||
sizeof(mac_addr) >> 1);
|
||||
|
||||
memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, mac_addr);
|
||||
}
|
||||
#endif
|
||||
if (ax->plat->wordlength == 2) {
|
||||
@ -757,7 +757,7 @@ static int ax_init_dev(struct net_device *dev)
|
||||
|
||||
if ((ax->plat->flags & AXFLG_MAC_FROMPLATFORM) &&
|
||||
ax->plat->mac_addr)
|
||||
memcpy(dev->dev_addr, ax->plat->mac_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, ax->plat->mac_addr);
|
||||
|
||||
if (!is_valid_ether_addr(dev->dev_addr)) {
|
||||
eth_hw_addr_random(dev);
|
||||
|
@ -3863,7 +3863,7 @@ static int et131x_change_mtu(struct net_device *netdev, int new_mtu)
|
||||
|
||||
et131x_init_send(adapter);
|
||||
et131x_hwaddr_init(adapter);
|
||||
ether_addr_copy(netdev->dev_addr, adapter->addr);
|
||||
eth_hw_addr_set(netdev, adapter->addr);
|
||||
|
||||
/* Init the device with the new settings */
|
||||
et131x_adapter_setup(adapter);
|
||||
@ -3966,7 +3966,7 @@ static int et131x_pci_setup(struct pci_dev *pdev,
|
||||
|
||||
netif_napi_add(netdev, &adapter->napi, et131x_poll, 64);
|
||||
|
||||
ether_addr_copy(netdev->dev_addr, adapter->addr);
|
||||
eth_hw_addr_set(netdev, adapter->addr);
|
||||
|
||||
rc = -ENOMEM;
|
||||
|
||||
|
@ -1660,7 +1660,7 @@ static int slic_read_eeprom(struct slic_device *sdev)
|
||||
goto free_eeprom;
|
||||
}
|
||||
/* set mac address */
|
||||
ether_addr_copy(sdev->netdev->dev_addr, mac[devfn]);
|
||||
eth_hw_addr_set(sdev->netdev, mac[devfn]);
|
||||
free_eeprom:
|
||||
dma_free_coherent(&sdev->pdev->dev, SLIC_EEPROM_SIZE, eeprom, paddr);
|
||||
|
||||
|
@ -356,7 +356,7 @@ static int emac_set_mac_address(struct net_device *dev, void *p)
|
||||
if (netif_running(dev))
|
||||
return -EBUSY;
|
||||
|
||||
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
|
||||
writel(dev->dev_addr[0] << 16 | dev->dev_addr[1] << 8 | dev->
|
||||
dev_addr[2], db->membase + EMAC_MAC_A1_REG);
|
||||
|
@ -4073,7 +4073,7 @@ static void ena_set_conf_feat_params(struct ena_adapter *adapter,
|
||||
ether_addr_copy(adapter->mac_addr, netdev->dev_addr);
|
||||
} else {
|
||||
ether_addr_copy(adapter->mac_addr, feat->dev_attr.mac_addr);
|
||||
ether_addr_copy(netdev->dev_addr, adapter->mac_addr);
|
||||
eth_hw_addr_set(netdev, adapter->mac_addr);
|
||||
}
|
||||
|
||||
/* Set offload features */
|
||||
|
@ -582,7 +582,7 @@ static unsigned long __init lance_probe1( struct net_device *dev,
|
||||
switch( lp->cardtype ) {
|
||||
case OLD_RIEBL:
|
||||
/* No ethernet address! (Set some default address) */
|
||||
memcpy(dev->dev_addr, OldRieblDefHwaddr, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, OldRieblDefHwaddr);
|
||||
break;
|
||||
case NEW_RIEBL:
|
||||
lp->memcpy_f(dev->dev_addr, RIEBL_HWADDR_ADDR, ETH_ALEN);
|
||||
|
@ -1178,7 +1178,7 @@ static int au1000_probe(struct platform_device *pdev)
|
||||
aup->phy1_search_mac0 = 1;
|
||||
} else {
|
||||
if (is_valid_ether_addr(pd->mac)) {
|
||||
memcpy(dev->dev_addr, pd->mac, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, pd->mac);
|
||||
} else {
|
||||
/* Set a random MAC since no valid provided by platform_data. */
|
||||
eth_hw_addr_random(dev);
|
||||
|
@ -635,7 +635,7 @@ static int nmclan_config(struct pcmcia_device *link)
|
||||
kfree(buf);
|
||||
goto failed;
|
||||
}
|
||||
memcpy(dev->dev_addr, buf, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, buf);
|
||||
kfree(buf);
|
||||
|
||||
/* Verify configuration by reading the MACE ID. */
|
||||
|
@ -1775,7 +1775,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
|
||||
pr_cont(" warning: CSR address invalid,\n");
|
||||
pr_info(" using instead PROM address of");
|
||||
}
|
||||
memcpy(dev->dev_addr, promaddr, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, promaddr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -332,7 +332,7 @@ int aq_nic_ndev_register(struct aq_nic_s *self)
|
||||
{
|
||||
static u8 mac_addr_permanent[] = AQ_CFG_MAC_ADDR_PERMANENT;
|
||||
|
||||
ether_addr_copy(self->ndev->dev_addr, mac_addr_permanent);
|
||||
eth_hw_addr_set(self->ndev, mac_addr_permanent);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1832,7 +1832,7 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
}
|
||||
|
||||
memcpy(hw->mac_addr, hw->perm_addr, ETH_ALEN);
|
||||
memcpy(netdev->dev_addr, hw->mac_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(netdev, hw->mac_addr);
|
||||
memcpy(netdev->perm_addr, hw->perm_addr, ETH_ALEN);
|
||||
|
||||
hw->mdio.prtad = 0;
|
||||
|
@ -2171,7 +2171,7 @@ static int b44_get_invariants(struct b44 *bp)
|
||||
* valid PHY address. */
|
||||
bp->phy_addr &= 0x1F;
|
||||
|
||||
memcpy(bp->dev->dev_addr, addr, ETH_ALEN);
|
||||
eth_hw_addr_set(bp->dev, addr);
|
||||
|
||||
if (!is_valid_ether_addr(&bp->dev->dev_addr[0])){
|
||||
pr_err("Invalid MAC address found in EEPROM\n");
|
||||
|
@ -670,7 +670,7 @@ static int bcm_enet_set_mac_address(struct net_device *dev, void *p)
|
||||
u32 val;
|
||||
|
||||
priv = netdev_priv(dev);
|
||||
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
|
||||
/* use perfect match register 0 to store my mac address */
|
||||
val = (dev->dev_addr[2] << 24) | (dev->dev_addr[3] << 16) |
|
||||
@ -1762,7 +1762,7 @@ static int bcm_enet_probe(struct platform_device *pdev)
|
||||
|
||||
pd = dev_get_platdata(&pdev->dev);
|
||||
if (pd) {
|
||||
memcpy(dev->dev_addr, pd->mac_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, pd->mac_addr);
|
||||
priv->has_phy = pd->has_phy;
|
||||
priv->phy_id = pd->phy_id;
|
||||
priv->has_phy_interrupt = pd->has_phy_interrupt;
|
||||
@ -2665,7 +2665,7 @@ static int bcm_enetsw_probe(struct platform_device *pdev)
|
||||
|
||||
pd = dev_get_platdata(&pdev->dev);
|
||||
if (pd) {
|
||||
memcpy(dev->dev_addr, pd->mac_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, pd->mac_addr);
|
||||
memcpy(priv->used_ports, pd->used_ports,
|
||||
sizeof(pd->used_ports));
|
||||
priv->num_ports = pd->num_ports;
|
||||
|
@ -150,7 +150,7 @@ static int bgmac_probe(struct bcma_device *core)
|
||||
err = -ENOTSUPP;
|
||||
goto err;
|
||||
}
|
||||
ether_addr_copy(bgmac->net_dev->dev_addr, mac);
|
||||
eth_hw_addr_set(bgmac->net_dev, mac);
|
||||
}
|
||||
|
||||
/* On BCM4706 we need common core to access PHY */
|
||||
|
@ -1241,7 +1241,7 @@ static int bgmac_set_mac_address(struct net_device *net_dev, void *addr)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ether_addr_copy(net_dev->dev_addr, sa->sa_data);
|
||||
eth_hw_addr_set(net_dev, sa->sa_data);
|
||||
bgmac_write_mac_address(bgmac, net_dev->dev_addr);
|
||||
|
||||
eth_commit_mac_addr_change(net_dev, addr);
|
||||
|
@ -8574,7 +8574,7 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
if (is_kdump_kernel())
|
||||
bnx2_wait_dma_complete(bp);
|
||||
|
||||
memcpy(dev->dev_addr, bp->mac_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, bp->mac_addr);
|
||||
|
||||
dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG |
|
||||
NETIF_F_TSO | NETIF_F_TSO_ECN |
|
||||
|
@ -11790,7 +11790,7 @@ static void bnx2x_get_cnic_mac_hwinfo(struct bnx2x *bp)
|
||||
* as the SAN mac was copied from the primary MAC.
|
||||
*/
|
||||
if (IS_MF_FCOE_AFEX(bp))
|
||||
memcpy(bp->dev->dev_addr, fip_mac, ETH_ALEN);
|
||||
eth_hw_addr_set(bp->dev, fip_mac);
|
||||
} else {
|
||||
val2 = SHMEM_RD(bp, dev_info.port_hw_config[port].
|
||||
iscsi_mac_upper);
|
||||
|
@ -3058,7 +3058,7 @@ enum sample_bulletin_result bnx2x_sample_bulletin(struct bnx2x *bp)
|
||||
if (bulletin->valid_bitmap & 1 << MAC_ADDR_VALID &&
|
||||
!ether_addr_equal(bulletin->mac, bp->old_bulletin.mac)) {
|
||||
/* update new mac to net device */
|
||||
memcpy(bp->dev->dev_addr, bulletin->mac, ETH_ALEN);
|
||||
eth_hw_addr_set(bp->dev, bulletin->mac);
|
||||
}
|
||||
|
||||
if (bulletin->valid_bitmap & (1 << LINK_VALID)) {
|
||||
|
@ -384,9 +384,8 @@ int bnx2x_vfpf_acquire(struct bnx2x *bp, u8 tx_count, u8 rx_count)
|
||||
sizeof(bp->fw_ver));
|
||||
|
||||
if (is_valid_ether_addr(bp->acquire_resp.resc.current_mac_addr))
|
||||
memcpy(bp->dev->dev_addr,
|
||||
bp->acquire_resp.resc.current_mac_addr,
|
||||
ETH_ALEN);
|
||||
eth_hw_addr_set(bp->dev,
|
||||
bp->acquire_resp.resc.current_mac_addr);
|
||||
|
||||
out:
|
||||
bnx2x_vfpf_finalize(bp, &req->first_tlv);
|
||||
@ -767,7 +766,7 @@ int bnx2x_vfpf_config_mac(struct bnx2x *bp, u8 *addr, u8 vf_qid, bool set)
|
||||
"vfpf SET MAC failed. Check bulletin board for new posts\n");
|
||||
|
||||
/* copy mac from bulletin to device */
|
||||
memcpy(bp->dev->dev_addr, bulletin.mac, ETH_ALEN);
|
||||
eth_hw_addr_set(bp->dev, bulletin.mac);
|
||||
|
||||
/* check if bulletin board was updated */
|
||||
if (bnx2x_sample_bulletin(bp) == PFVF_BULLETIN_UPDATED) {
|
||||
|
@ -13103,7 +13103,7 @@ static int bnxt_init_mac_addr(struct bnxt *bp)
|
||||
int rc = 0;
|
||||
|
||||
if (BNXT_PF(bp)) {
|
||||
memcpy(bp->dev->dev_addr, bp->pf.mac_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(bp->dev, bp->pf.mac_addr);
|
||||
} else {
|
||||
#ifdef CONFIG_BNXT_SRIOV
|
||||
struct bnxt_vf_info *vf = &bp->vf;
|
||||
@ -13111,7 +13111,7 @@ static int bnxt_init_mac_addr(struct bnxt *bp)
|
||||
|
||||
if (is_valid_ether_addr(vf->mac_addr)) {
|
||||
/* overwrite netdev dev_addr with admin VF MAC */
|
||||
memcpy(bp->dev->dev_addr, vf->mac_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(bp->dev, vf->mac_addr);
|
||||
/* Older PF driver or firmware may not approve this
|
||||
* correctly.
|
||||
*/
|
||||
|
@ -1217,7 +1217,7 @@ void bnxt_update_vf_mac(struct bnxt *bp)
|
||||
|
||||
/* overwrite netdev dev_addr with admin VF MAC */
|
||||
if (is_valid_ether_addr(bp->vf.mac_addr))
|
||||
memcpy(bp->dev->dev_addr, bp->vf.mac_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(bp->dev, bp->vf.mac_addr);
|
||||
update_vf_mac_exit:
|
||||
hwrm_req_drop(bp, req);
|
||||
if (inform_pf)
|
||||
|
@ -475,7 +475,7 @@ static void bnxt_vf_rep_netdev_init(struct bnxt *bp, struct bnxt_vf_rep *vf_rep,
|
||||
dev->features |= pf_dev->features;
|
||||
bnxt_vf_rep_eth_addr_gen(bp->pf.mac_addr, vf_rep->vf_idx,
|
||||
dev->perm_addr);
|
||||
ether_addr_copy(dev->dev_addr, dev->perm_addr);
|
||||
eth_hw_addr_set(dev, dev->perm_addr);
|
||||
/* Set VF-Rep's max-mtu to the corresponding VF's max-mtu */
|
||||
if (!bnxt_hwrm_vfr_qcfg(bp, vf_rep, &max_mtu))
|
||||
dev->max_mtu = max_mtu;
|
||||
|
@ -3633,7 +3633,7 @@ static int bcmgenet_set_mac_addr(struct net_device *dev, void *p)
|
||||
if (netif_running(dev))
|
||||
return -EBUSY;
|
||||
|
||||
ether_addr_copy(dev->dev_addr, addr->sa_data);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -4082,7 +4082,7 @@ static int bcmgenet_probe(struct platform_device *pdev)
|
||||
bcmgenet_power_up(priv, GENET_POWER_PASSIVE);
|
||||
|
||||
if (pd && !IS_ERR_OR_NULL(pd->mac_address))
|
||||
ether_addr_copy(dev->dev_addr, pd->mac_address);
|
||||
eth_hw_addr_set(dev, pd->mac_address);
|
||||
else
|
||||
if (!device_get_mac_address(&pdev->dev, dev->dev_addr, ETH_ALEN))
|
||||
if (has_acpi_companion(&pdev->dev))
|
||||
|
@ -875,7 +875,7 @@ bnad_set_netdev_perm_addr(struct bnad *bnad)
|
||||
|
||||
ether_addr_copy(netdev->perm_addr, bnad->perm_addr);
|
||||
if (is_zero_ether_addr(netdev->dev_addr))
|
||||
ether_addr_copy(netdev->dev_addr, bnad->perm_addr);
|
||||
eth_hw_addr_set(netdev, bnad->perm_addr);
|
||||
}
|
||||
|
||||
/* Control Path Handlers */
|
||||
@ -3249,7 +3249,7 @@ bnad_set_mac_address(struct net_device *netdev, void *addr)
|
||||
|
||||
err = bnad_mac_addr_set_locked(bnad, sa->sa_data);
|
||||
if (!err)
|
||||
ether_addr_copy(netdev->dev_addr, sa->sa_data);
|
||||
eth_hw_addr_set(netdev, sa->sa_data);
|
||||
|
||||
spin_unlock_irqrestore(&bnad->bna_lock, flags);
|
||||
|
||||
|
@ -411,7 +411,7 @@ void octeon_pf_changed_vf_macaddr(struct octeon_device *oct, u8 *mac)
|
||||
|
||||
if (!ether_addr_equal(netdev->dev_addr, mac)) {
|
||||
macaddr_changed = true;
|
||||
ether_addr_copy(netdev->dev_addr, mac);
|
||||
eth_hw_addr_set(netdev, mac);
|
||||
ether_addr_copy(((u8 *)&lio->linfo.hw_addr) + 2, mac);
|
||||
call_netdevice_notifiers(NETDEV_CHANGEADDR, netdev);
|
||||
}
|
||||
|
@ -3634,7 +3634,7 @@ static int setup_nic_devices(struct octeon_device *octeon_dev)
|
||||
|
||||
/* Copy MAC Address to OS network device structure */
|
||||
|
||||
ether_addr_copy(netdev->dev_addr, mac);
|
||||
eth_hw_addr_set(netdev, mac);
|
||||
|
||||
/* By default all interfaces on a single Octeon uses the same
|
||||
* tx and rx queues
|
||||
|
@ -2148,7 +2148,7 @@ static int setup_nic_devices(struct octeon_device *octeon_dev)
|
||||
mac[j] = *((u8 *)(((u8 *)&lio->linfo.hw_addr) + 2 + j));
|
||||
|
||||
/* Copy MAC Address to OS network device structure */
|
||||
ether_addr_copy(netdev->dev_addr, mac);
|
||||
eth_hw_addr_set(netdev, mac);
|
||||
|
||||
if (liquidio_setup_io_queues(octeon_dev, i,
|
||||
lio->linfo.num_txpciq,
|
||||
|
@ -221,8 +221,7 @@ static void nicvf_handle_mbx_intr(struct nicvf *nic)
|
||||
nic->tns_mode = mbx.nic_cfg.tns_mode & 0x7F;
|
||||
nic->node = mbx.nic_cfg.node_id;
|
||||
if (!nic->set_mac_pending)
|
||||
ether_addr_copy(nic->netdev->dev_addr,
|
||||
mbx.nic_cfg.mac_addr);
|
||||
eth_hw_addr_set(nic->netdev, mbx.nic_cfg.mac_addr);
|
||||
nic->sqs_mode = mbx.nic_cfg.sqs_mode;
|
||||
nic->loopback_supported = mbx.nic_cfg.loopback_supported;
|
||||
nic->link_up = false;
|
||||
|
@ -1140,7 +1140,7 @@ int t1_init_sw_modules(adapter_t *adapter, const struct board_info *bi)
|
||||
adapter->port[i].dev->name);
|
||||
goto error;
|
||||
}
|
||||
memcpy(adapter->port[i].dev->dev_addr, hw_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(adapter->port[i].dev, hw_addr);
|
||||
init_link_config(&adapter->port[i].link_config, bi);
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
#include <linux/etherdevice.h>
|
||||
#include "common.h"
|
||||
#include "regs.h"
|
||||
#include "sge_defs.h"
|
||||
@ -3758,8 +3759,7 @@ int t3_prep_adapter(struct adapter *adapter, const struct adapter_info *ai,
|
||||
memcpy(hw_addr, adapter->params.vpd.eth_base, 5);
|
||||
hw_addr[5] = adapter->params.vpd.eth_base[5] + i;
|
||||
|
||||
memcpy(adapter->port[i]->dev_addr, hw_addr,
|
||||
ETH_ALEN);
|
||||
eth_hw_addr_set(adapter->port[i], hw_addr);
|
||||
init_link_config(&p->link_config, p->phy.caps);
|
||||
p->phy.ops->power_down(&p->phy, 1);
|
||||
|
||||
|
@ -1545,7 +1545,7 @@ static inline void t4_write_reg64(struct adapter *adap, u32 reg_addr, u64 val)
|
||||
static inline void t4_set_hw_addr(struct adapter *adapter, int port_idx,
|
||||
u8 hw_addr[])
|
||||
{
|
||||
ether_addr_copy(adapter->port[port_idx]->dev_addr, hw_addr);
|
||||
eth_hw_addr_set(adapter->port[port_idx], hw_addr);
|
||||
ether_addr_copy(adapter->port[port_idx]->perm_addr, hw_addr);
|
||||
}
|
||||
|
||||
|
@ -9706,7 +9706,7 @@ int t4_port_init(struct adapter *adap, int mbox, int pf, int vf)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
memcpy(adap->port[i]->dev_addr, addr, ETH_ALEN);
|
||||
eth_hw_addr_set(adap->port[i], addr);
|
||||
j++;
|
||||
}
|
||||
return 0;
|
||||
|
@ -40,6 +40,7 @@
|
||||
#ifndef __CXGB4VF_ADAPTER_H__
|
||||
#define __CXGB4VF_ADAPTER_H__
|
||||
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/spinlock.h>
|
||||
@ -507,7 +508,7 @@ static inline const char *port_name(struct adapter *adapter, int pidx)
|
||||
static inline void t4_os_set_hw_addr(struct adapter *adapter, int pidx,
|
||||
u8 hw_addr[])
|
||||
{
|
||||
memcpy(adapter->port[pidx]->dev_addr, hw_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(adapter->port[pidx], hw_addr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -746,7 +746,7 @@ static struct net_device *ep93xx_dev_alloc(struct ep93xx_eth_data *data)
|
||||
if (dev == NULL)
|
||||
return NULL;
|
||||
|
||||
memcpy(dev->dev_addr, data->dev_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, data->dev_addr);
|
||||
|
||||
dev->ethtool_ops = &ep93xx_ethtool_ops;
|
||||
dev->netdev_ops = &ep93xx_netdev_ops;
|
||||
|
@ -541,7 +541,7 @@ static int set_mac_address(struct net_device *dev, void *addr)
|
||||
if (!is_valid_ether_addr(saddr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
memcpy(dev->dev_addr, saddr->sa_data, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, saddr->sa_data);
|
||||
netdev_info(dev, "Setting MAC address to %pM\n", dev->dev_addr);
|
||||
|
||||
/* set the Ethernet address */
|
||||
|
@ -1889,7 +1889,7 @@ static int gmac_set_mac_address(struct net_device *netdev, void *addr)
|
||||
{
|
||||
struct sockaddr *sa = addr;
|
||||
|
||||
memcpy(netdev->dev_addr, sa->sa_data, ETH_ALEN);
|
||||
eth_hw_addr_set(netdev, sa->sa_data);
|
||||
gmac_write_mac_address(netdev);
|
||||
|
||||
return 0;
|
||||
@ -2467,7 +2467,7 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev)
|
||||
DEFAULT_NAPI_WEIGHT);
|
||||
|
||||
if (is_valid_ether_addr((void *)port->mac_addr)) {
|
||||
memcpy(netdev->dev_addr, port->mac_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(netdev, (u8 *)port->mac_addr);
|
||||
} else {
|
||||
dev_dbg(dev, "ethernet address 0x%08x%08x%08x invalid\n",
|
||||
port->mac_addr[0], port->mac_addr[1],
|
||||
|
@ -1670,7 +1670,7 @@ dm9000_probe(struct platform_device *pdev)
|
||||
|
||||
if (!is_valid_ether_addr(ndev->dev_addr) && pdata != NULL) {
|
||||
mac_src = "platform data";
|
||||
memcpy(ndev->dev_addr, pdata->dev_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(ndev, pdata->dev_addr);
|
||||
}
|
||||
|
||||
if (!is_valid_ether_addr(ndev->dev_addr)) {
|
||||
|
@ -1609,7 +1609,7 @@ static int tulip_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
#if defined(CONFIG_SPARC)
|
||||
addr = of_get_property(dp, "local-mac-address", &len);
|
||||
if (addr && len == ETH_ALEN)
|
||||
memcpy(dev->dev_addr, addr, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, addr);
|
||||
#endif
|
||||
#if defined(__i386__) || defined(__x86_64__) /* Patch up x86 BIOS bug. */
|
||||
if (last_irq)
|
||||
|
@ -1611,7 +1611,7 @@ static int sundance_set_mac_addr(struct net_device *dev, void *data)
|
||||
|
||||
if (!is_valid_ether_addr(addr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
__set_mac_addr(dev);
|
||||
|
||||
return 0;
|
||||
|
@ -369,7 +369,7 @@ static int be_mac_addr_set(struct net_device *netdev, void *p)
|
||||
/* Remember currently programmed MAC */
|
||||
ether_addr_copy(adapter->dev_mac, addr->sa_data);
|
||||
done:
|
||||
ether_addr_copy(netdev->dev_addr, addr->sa_data);
|
||||
eth_hw_addr_set(netdev, addr->sa_data);
|
||||
dev_info(dev, "MAC address changed to %pM\n", addr->sa_data);
|
||||
return 0;
|
||||
err:
|
||||
@ -4599,7 +4599,7 @@ static int be_mac_setup(struct be_adapter *adapter)
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
memcpy(adapter->netdev->dev_addr, mac, ETH_ALEN);
|
||||
eth_hw_addr_set(adapter->netdev, mac);
|
||||
memcpy(adapter->netdev->perm_addr, mac, ETH_ALEN);
|
||||
|
||||
/* Initial MAC for BE3 VFs is already programmed by PF */
|
||||
|
@ -816,7 +816,7 @@ static int ethoc_set_mac_address(struct net_device *dev, void *p)
|
||||
|
||||
if (!is_valid_ether_addr(addr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
ethoc_do_set_mac_address(dev);
|
||||
return 0;
|
||||
}
|
||||
@ -1144,7 +1144,7 @@ static int ethoc_probe(struct platform_device *pdev)
|
||||
|
||||
/* Allow the platform setup code to pass in a MAC address. */
|
||||
if (pdata) {
|
||||
ether_addr_copy(netdev->dev_addr, pdata->hwaddr);
|
||||
eth_hw_addr_set(netdev, pdata->hwaddr);
|
||||
priv->phy_id = pdata->phy_id;
|
||||
} else {
|
||||
of_get_mac_address(pdev->dev.of_node, netdev->dev_addr);
|
||||
|
@ -421,7 +421,7 @@ static s32 nps_enet_set_mac_address(struct net_device *ndev, void *p)
|
||||
|
||||
res = eth_mac_addr(ndev, p);
|
||||
if (!res) {
|
||||
ether_addr_copy(ndev->dev_addr, addr->sa_data);
|
||||
eth_hw_addr_set(ndev, addr->sa_data);
|
||||
nps_enet_set_hw_mac_address(ndev);
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ static void ftgmac100_initial_mac(struct ftgmac100 *priv)
|
||||
|
||||
addr = device_get_mac_address(priv->dev, mac, ETH_ALEN);
|
||||
if (addr) {
|
||||
ether_addr_copy(priv->netdev->dev_addr, mac);
|
||||
eth_hw_addr_set(priv->netdev, mac);
|
||||
dev_info(priv->dev, "Read MAC address %pM from device tree\n",
|
||||
mac);
|
||||
return;
|
||||
@ -203,7 +203,7 @@ static void ftgmac100_initial_mac(struct ftgmac100 *priv)
|
||||
mac[5] = l & 0xff;
|
||||
|
||||
if (is_valid_ether_addr(mac)) {
|
||||
ether_addr_copy(priv->netdev->dev_addr, mac);
|
||||
eth_hw_addr_set(priv->netdev, mac);
|
||||
dev_info(priv->dev, "Read MAC address %pM from chip\n", mac);
|
||||
} else {
|
||||
eth_hw_addr_random(priv->netdev);
|
||||
|
@ -1768,7 +1768,7 @@ static int fec_get_mac(struct net_device *ndev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
memcpy(ndev->dev_addr, iap, ETH_ALEN);
|
||||
eth_hw_addr_set(ndev, iap);
|
||||
|
||||
/* Adjust MAC if using macaddr */
|
||||
if (iap == macaddr)
|
||||
|
@ -733,7 +733,7 @@ int gve_adminq_describe_device(struct gve_priv *priv)
|
||||
}
|
||||
priv->dev->max_mtu = mtu;
|
||||
priv->num_event_counters = be16_to_cpu(descriptor->counters);
|
||||
ether_addr_copy(priv->dev->dev_addr, descriptor->mac);
|
||||
eth_hw_addr_set(priv->dev, descriptor->mac);
|
||||
mac = descriptor->mac;
|
||||
dev_info(&priv->pdev->dev, "MAC addr: %pM\n", mac);
|
||||
priv->tx_pages_per_qpl = be16_to_cpu(descriptor->tx_pages_per_qpl);
|
||||
|
@ -2287,7 +2287,7 @@ static int hns3_nic_net_set_mac_address(struct net_device *netdev, void *p)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ether_addr_copy(netdev->dev_addr, mac_addr->sa_data);
|
||||
eth_hw_addr_set(netdev, mac_addr->sa_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -4933,7 +4933,7 @@ static int hns3_init_mac_addr(struct net_device *netdev)
|
||||
dev_warn(priv->dev, "using random MAC address %pM\n",
|
||||
netdev->dev_addr);
|
||||
} else if (!ether_addr_equal(netdev->dev_addr, mac_addr_temp)) {
|
||||
ether_addr_copy(netdev->dev_addr, mac_addr_temp);
|
||||
eth_hw_addr_set(netdev, mac_addr_temp);
|
||||
ether_addr_copy(netdev->perm_addr, mac_addr_temp);
|
||||
} else {
|
||||
return 0;
|
||||
|
@ -656,7 +656,7 @@ static int hinic_set_mac_addr(struct net_device *netdev, void *addr)
|
||||
|
||||
err = change_mac_addr(netdev, new_mac);
|
||||
if (!err)
|
||||
memcpy(netdev->dev_addr, new_mac, ETH_ALEN);
|
||||
eth_hw_addr_set(netdev, new_mac);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
@ -2986,7 +2986,7 @@ static struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter,
|
||||
SET_NETDEV_DEV(dev, port_dev);
|
||||
|
||||
/* initialize net_device structure */
|
||||
memcpy(dev->dev_addr, &port->mac_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, &port->mac_addr);
|
||||
|
||||
dev->netdev_ops = &ehea_netdev_ops;
|
||||
ehea_set_ethtool_ops(dev);
|
||||
|
@ -1613,7 +1613,7 @@ static int ibmveth_set_mac_addr(struct net_device *dev, void *p)
|
||||
return rc;
|
||||
}
|
||||
|
||||
ether_addr_copy(dev->dev_addr, addr->sa_data);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1720,7 +1720,7 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
|
||||
netdev->min_mtu = IBMVETH_MIN_MTU;
|
||||
netdev->max_mtu = ETH_MAX_MTU - IBMVETH_BUFF_OH;
|
||||
|
||||
memcpy(netdev->dev_addr, mac_addr_p, ETH_ALEN);
|
||||
eth_hw_addr_set(netdev, mac_addr_p);
|
||||
|
||||
if (firmware_has_feature(FW_FEATURE_CMO))
|
||||
memcpy(pool_count, pool_count_cmo, sizeof(pool_count));
|
||||
|
@ -4766,8 +4766,7 @@ static int handle_change_mac_rsp(union ibmvnic_crq *crq,
|
||||
/* crq->change_mac_addr.mac_addr is the requested one
|
||||
* crq->change_mac_addr_rsp.mac_addr is the returned valid one.
|
||||
*/
|
||||
ether_addr_copy(netdev->dev_addr,
|
||||
&crq->change_mac_addr_rsp.mac_addr[0]);
|
||||
eth_hw_addr_set(netdev, &crq->change_mac_addr_rsp.mac_addr[0]);
|
||||
ether_addr_copy(adapter->mac_addr,
|
||||
&crq->change_mac_addr_rsp.mac_addr[0]);
|
||||
out:
|
||||
@ -5723,7 +5722,7 @@ static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id)
|
||||
bitmap_set(adapter->map_ids, 0, 1);
|
||||
|
||||
ether_addr_copy(adapter->mac_addr, mac_addr_p);
|
||||
ether_addr_copy(netdev->dev_addr, adapter->mac_addr);
|
||||
eth_hw_addr_set(netdev, adapter->mac_addr);
|
||||
netdev->irq = dev->irq;
|
||||
netdev->netdev_ops = &ibmvnic_netdev_ops;
|
||||
netdev->ethtool_ops = &ibmvnic_ethtool_ops;
|
||||
|
@ -2921,7 +2921,7 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
|
||||
e100_phy_init(nic);
|
||||
|
||||
memcpy(netdev->dev_addr, nic->eeprom, ETH_ALEN);
|
||||
eth_hw_addr_set(netdev, (u8 *)nic->eeprom);
|
||||
if (!is_valid_ether_addr(netdev->dev_addr)) {
|
||||
if (!eeprom_bad_csum_allow) {
|
||||
netif_err(nic, probe, nic->netdev, "Invalid MAC address from EEPROM, aborting\n");
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ jme_load_macaddr(struct net_device *netdev)
|
||||
val = jread32(jme, JME_RXUMA_HI);
|
||||
macaddr[4] = (val >> 0) & 0xFF;
|
||||
macaddr[5] = (val >> 8) & 0xFF;
|
||||
memcpy(netdev->dev_addr, macaddr, ETH_ALEN);
|
||||
eth_hw_addr_set(netdev, macaddr);
|
||||
spin_unlock_bh(&jme->macaddr_lock);
|
||||
}
|
||||
|
||||
|
@ -1297,7 +1297,7 @@ static int korina_probe(struct platform_device *pdev)
|
||||
lp = netdev_priv(dev);
|
||||
|
||||
if (mac_addr)
|
||||
ether_addr_copy(dev->dev_addr, mac_addr);
|
||||
eth_hw_addr_set(dev, mac_addr);
|
||||
else if (of_get_mac_address(pdev->dev.of_node, dev->dev_addr) < 0)
|
||||
eth_hw_addr_random(dev);
|
||||
|
||||
|
@ -1919,7 +1919,7 @@ static int mv643xx_eth_set_mac_address(struct net_device *dev, void *addr)
|
||||
if (!is_valid_ether_addr(sa->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
memcpy(dev->dev_addr, sa->sa_data, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, sa->sa_data);
|
||||
|
||||
netif_addr_lock_bh(dev);
|
||||
mv643xx_eth_program_unicast_filter(dev);
|
||||
@ -2926,7 +2926,7 @@ static void set_params(struct mv643xx_eth_private *mp,
|
||||
unsigned int tx_ring_size;
|
||||
|
||||
if (is_valid_ether_addr(pd->mac_addr))
|
||||
memcpy(dev->dev_addr, pd->mac_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, pd->mac_addr);
|
||||
else
|
||||
uc_addr_get(mp, dev->dev_addr);
|
||||
|
||||
|
@ -5249,7 +5249,7 @@ static int mvneta_probe(struct platform_device *pdev)
|
||||
mvneta_get_mac_addr(pp, hw_mac_addr);
|
||||
if (is_valid_ether_addr(hw_mac_addr)) {
|
||||
mac_from = "hardware";
|
||||
memcpy(dev->dev_addr, hw_mac_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, hw_mac_addr);
|
||||
} else {
|
||||
mac_from = "random";
|
||||
eth_hw_addr_random(dev);
|
||||
|
@ -6083,7 +6083,7 @@ static void mvpp2_port_copy_mac_addr(struct net_device *dev, struct mvpp2 *priv,
|
||||
|
||||
if (fwnode_get_mac_address(fwnode, fw_mac_addr, ETH_ALEN)) {
|
||||
*mac_from = "firmware node";
|
||||
ether_addr_copy(dev->dev_addr, fw_mac_addr);
|
||||
eth_hw_addr_set(dev, fw_mac_addr);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -6091,7 +6091,7 @@ static void mvpp2_port_copy_mac_addr(struct net_device *dev, struct mvpp2 *priv,
|
||||
mvpp21_get_mac_address(port, hw_mac_addr);
|
||||
if (is_valid_ether_addr(hw_mac_addr)) {
|
||||
*mac_from = "hardware";
|
||||
ether_addr_copy(dev->dev_addr, hw_mac_addr);
|
||||
eth_hw_addr_set(dev, hw_mac_addr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -2347,7 +2347,7 @@ int mvpp2_prs_update_mac_da(struct net_device *dev, const u8 *da)
|
||||
return err;
|
||||
|
||||
/* Set addr in the device */
|
||||
ether_addr_copy(dev->dev_addr, da);
|
||||
eth_hw_addr_set(dev, da);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ static int otx2_hw_get_mac_addr(struct otx2_nic *pfvf,
|
||||
return PTR_ERR(msghdr);
|
||||
}
|
||||
rsp = (struct nix_get_mac_addr_rsp *)msghdr;
|
||||
ether_addr_copy(netdev->dev_addr, rsp->mac_addr);
|
||||
eth_hw_addr_set(netdev, rsp->mac_addr);
|
||||
mutex_unlock(&pfvf->mbox.lock);
|
||||
|
||||
return 0;
|
||||
|
@ -137,7 +137,7 @@ static int prestera_port_set_mac_address(struct net_device *dev, void *p)
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
ether_addr_copy(dev->dev_addr, addr->sa_data);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -607,7 +607,7 @@ static int pxa168_eth_set_mac_address(struct net_device *dev, void *addr)
|
||||
if (!is_valid_ether_addr(sa->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
memcpy(oldMac, dev->dev_addr, ETH_ALEN);
|
||||
memcpy(dev->dev_addr, sa->sa_data, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, sa->sa_data);
|
||||
|
||||
mac_h = dev->dev_addr[0] << 24;
|
||||
mac_h |= dev->dev_addr[1] << 16;
|
||||
|
@ -3459,7 +3459,7 @@ static int skge_set_mac_address(struct net_device *dev, void *p)
|
||||
if (!is_valid_ether_addr(addr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
|
||||
if (!netif_running(dev)) {
|
||||
memcpy_toio(hw->regs + B2_MAC_1 + port*8, dev->dev_addr, ETH_ALEN);
|
||||
|
@ -3817,7 +3817,7 @@ static int sky2_set_mac_address(struct net_device *dev, void *p)
|
||||
if (!is_valid_ether_addr(addr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
memcpy_toio(hw->regs + B2_MAC_1 + port * 8,
|
||||
dev->dev_addr, ETH_ALEN);
|
||||
memcpy_toio(hw->regs + B2_MAC_2 + port * 8,
|
||||
|
@ -797,7 +797,7 @@ static int mlx4_en_set_mac(struct net_device *dev, void *addr)
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
memcpy(dev->dev_addr, saddr->sa_data, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, saddr->sa_data);
|
||||
mlx4_en_update_user_mac(priv, new_mac);
|
||||
out:
|
||||
mutex_unlock(&mdev->state_lock);
|
||||
|
@ -3228,7 +3228,7 @@ static int mlx5e_set_mac(struct net_device *netdev, void *addr)
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
netif_addr_lock_bh(netdev);
|
||||
ether_addr_copy(netdev->dev_addr, saddr->sa_data);
|
||||
eth_hw_addr_set(netdev, saddr->sa_data);
|
||||
netif_addr_unlock_bh(netdev);
|
||||
|
||||
mlx5e_nic_set_rx_mode(priv);
|
||||
|
@ -75,7 +75,7 @@ static void mlxbf_gige_initial_mac(struct mlxbf_gige *priv)
|
||||
u64_to_ether_addr(local_mac, mac);
|
||||
|
||||
if (is_valid_ether_addr(mac)) {
|
||||
ether_addr_copy(priv->netdev->dev_addr, mac);
|
||||
eth_hw_addr_set(priv->netdev, mac);
|
||||
} else {
|
||||
/* Provide a random MAC if for some reason the device has
|
||||
* not been configured with a valid MAC address already.
|
||||
|
@ -672,7 +672,7 @@ static int ks8851_set_mac_address(struct net_device *dev, void *addr)
|
||||
if (!is_valid_ether_addr(sa->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
memcpy(dev->dev_addr, sa->sa_data, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, sa->sa_data);
|
||||
return ks8851_write_mac_addr(dev);
|
||||
}
|
||||
|
||||
|
@ -5581,7 +5581,7 @@ static int netdev_set_mac_address(struct net_device *dev, void *addr)
|
||||
memcpy(hw->override_addr, mac->sa_data, ETH_ALEN);
|
||||
}
|
||||
|
||||
memcpy(dev->dev_addr, mac->sa_data, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, mac->sa_data);
|
||||
|
||||
interrupt = hw_block_intr(hw);
|
||||
|
||||
@ -7005,10 +7005,9 @@ static int pcidev_init(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
dev->mem_end = dev->mem_start + reg_len - 1;
|
||||
dev->irq = pdev->irq;
|
||||
if (MAIN_PORT == i)
|
||||
memcpy(dev->dev_addr, hw_priv->hw.override_addr,
|
||||
ETH_ALEN);
|
||||
eth_hw_addr_set(dev, hw_priv->hw.override_addr);
|
||||
else {
|
||||
memcpy(dev->dev_addr, sw->other_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, sw->other_addr);
|
||||
if (ether_addr_equal(sw->other_addr, hw->override_addr))
|
||||
dev->dev_addr[5] += port->first_port;
|
||||
}
|
||||
|
@ -517,7 +517,7 @@ static int enc28j60_set_mac_address(struct net_device *dev, void *addr)
|
||||
if (!is_valid_ether_addr(address->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
ether_addr_copy(dev->dev_addr, address->sa_data);
|
||||
eth_hw_addr_set(dev, address->sa_data);
|
||||
return enc28j60_set_hw_macaddr(dev);
|
||||
}
|
||||
|
||||
@ -1573,7 +1573,7 @@ static int enc28j60_probe(struct spi_device *spi)
|
||||
}
|
||||
|
||||
if (device_get_mac_address(&spi->dev, macaddr, sizeof(macaddr)))
|
||||
ether_addr_copy(dev->dev_addr, macaddr);
|
||||
eth_hw_addr_set(dev, macaddr);
|
||||
else
|
||||
eth_hw_addr_random(dev);
|
||||
enc28j60_set_hw_macaddr(dev);
|
||||
|
@ -816,7 +816,7 @@ static int lan743x_mac_init(struct lan743x_adapter *adapter)
|
||||
eth_random_addr(adapter->mac_address);
|
||||
}
|
||||
lan743x_mac_set_address(adapter, adapter->mac_address);
|
||||
ether_addr_copy(netdev->dev_addr, adapter->mac_address);
|
||||
eth_hw_addr_set(netdev, adapter->mac_address);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -2645,7 +2645,7 @@ static int lan743x_netdev_set_mac_address(struct net_device *netdev,
|
||||
ret = eth_prepare_mac_addr_change(netdev, sock_addr);
|
||||
if (ret)
|
||||
return ret;
|
||||
ether_addr_copy(netdev->dev_addr, sock_addr->sa_data);
|
||||
eth_hw_addr_set(netdev, sock_addr->sa_data);
|
||||
lan743x_mac_set_address(adapter, sock_addr->sa_data);
|
||||
lan743x_rfe_update_mac_address(adapter);
|
||||
return 0;
|
||||
|
@ -162,7 +162,7 @@ static int sparx5_set_mac_address(struct net_device *dev, void *p)
|
||||
sparx5_mact_learn(sparx5, PGID_CPU, addr->sa_data, port->pvid);
|
||||
|
||||
/* Record the address */
|
||||
ether_addr_copy(dev->dev_addr, addr->sa_data);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1608,7 +1608,7 @@ static int mana_init_port(struct net_device *ndev)
|
||||
if (apc->num_queues > apc->max_queues)
|
||||
apc->num_queues = apc->max_queues;
|
||||
|
||||
ether_addr_copy(ndev->dev_addr, apc->mac_addr);
|
||||
eth_hw_addr_set(ndev, apc->mac_addr);
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -605,7 +605,7 @@ static int ocelot_port_set_mac_address(struct net_device *dev, void *p)
|
||||
/* Then forget the previous one. */
|
||||
ocelot_mact_forget(ocelot, dev->dev_addr, ocelot_port->pvid_vlan.vid);
|
||||
|
||||
ether_addr_copy(dev->dev_addr, addr->sa_data);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1704,7 +1704,7 @@ int ocelot_probe_port(struct ocelot *ocelot, int port, struct regmap *target,
|
||||
NETIF_F_HW_TC;
|
||||
dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_TC;
|
||||
|
||||
memcpy(dev->dev_addr, ocelot->base_mac, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, ocelot->base_mac);
|
||||
dev->dev_addr[ETH_ALEN - 1] += port;
|
||||
ocelot_mact_learn(ocelot, PGID_CPU, dev->dev_addr,
|
||||
ocelot_port->pvid_vlan.vid, ENTRYTYPE_LOCKED);
|
||||
|
@ -3022,7 +3022,7 @@ static int myri10ge_set_mac_address(struct net_device *dev, void *addr)
|
||||
}
|
||||
|
||||
/* change the dev structure */
|
||||
memcpy(dev->dev_addr, sa->sa_data, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, sa->sa_data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -7954,7 +7954,7 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
|
||||
|
||||
/* Set the factory defined MAC address initially */
|
||||
dev->addr_len = ETH_ALEN;
|
||||
memcpy(dev->dev_addr, sp->def_mac_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, sp->def_mac_addr[0].mac_addr);
|
||||
|
||||
/* initialize number of multicast & unicast MAC entries variables */
|
||||
if (sp->device_type == XFRAME_I_DEVICE) {
|
||||
|
@ -4663,7 +4663,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
|
||||
|
||||
/* Store the fw version for ethttool option */
|
||||
strcpy(vdev->fw_version, ll_config->device_hw_info.fw_version.version);
|
||||
memcpy(vdev->ndev->dev_addr, (u8 *)vdev->vpaths[0].macaddr, ETH_ALEN);
|
||||
eth_hw_addr_set(vdev->ndev, (u8 *)vdev->vpaths[0].macaddr);
|
||||
|
||||
/* Copy the station mac address to the list */
|
||||
for (i = 0; i < vdev->no_of_vpath; i++) {
|
||||
|
@ -305,7 +305,7 @@ nfp_abm_vnic_set_mac(struct nfp_pf *pf, struct nfp_abm *abm, struct nfp_net *nn,
|
||||
return;
|
||||
}
|
||||
|
||||
ether_addr_copy(nn->dp.netdev->dev_addr, mac_addr);
|
||||
eth_hw_addr_set(nn->dp.netdev, mac_addr);
|
||||
ether_addr_copy(nn->dp.netdev->perm_addr, mac_addr);
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ nfp_net_get_mac_addr(struct nfp_pf *pf, struct net_device *netdev,
|
||||
return;
|
||||
}
|
||||
|
||||
ether_addr_copy(netdev->dev_addr, eth_port->mac_addr);
|
||||
eth_hw_addr_set(netdev, eth_port->mac_addr);
|
||||
ether_addr_copy(netdev->perm_addr, eth_port->mac_addr);
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ static void nfp_netvf_get_mac_addr(struct nfp_net *nn)
|
||||
return;
|
||||
}
|
||||
|
||||
ether_addr_copy(nn->dp.netdev->dev_addr, mac_addr);
|
||||
eth_hw_addr_set(nn->dp.netdev, mac_addr);
|
||||
ether_addr_copy(nn->dp.netdev->perm_addr, mac_addr);
|
||||
}
|
||||
|
||||
|
@ -1283,7 +1283,7 @@ static int nixge_probe(struct platform_device *pdev)
|
||||
|
||||
mac_addr = nixge_get_nvmem_address(&pdev->dev);
|
||||
if (mac_addr && is_valid_ether_addr(mac_addr)) {
|
||||
ether_addr_copy(ndev->dev_addr, mac_addr);
|
||||
eth_hw_addr_set(ndev, mac_addr);
|
||||
kfree(mac_addr);
|
||||
} else {
|
||||
eth_hw_addr_random(ndev);
|
||||
|
@ -3175,7 +3175,7 @@ static int nv_set_mac_address(struct net_device *dev, void *addr)
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
/* synchronized against open : rtnl_lock() held by caller */
|
||||
memcpy(dev->dev_addr, macaddr->sa_data, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, macaddr->sa_data);
|
||||
|
||||
if (netif_running(dev)) {
|
||||
netif_tx_lock_bh(dev);
|
||||
|
@ -1093,7 +1093,7 @@ static int lpc_set_mac_address(struct net_device *ndev, void *p)
|
||||
|
||||
if (!is_valid_ether_addr(addr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
memcpy(ndev->dev_addr, addr->sa_data, ETH_ALEN);
|
||||
eth_hw_addr_set(ndev, addr->sa_data);
|
||||
|
||||
spin_lock_irqsave(&pldat->lock, flags);
|
||||
|
||||
|
@ -557,7 +557,7 @@ void qede_force_mac(void *dev, u8 *mac, bool forced)
|
||||
return;
|
||||
}
|
||||
|
||||
ether_addr_copy(edev->ndev->dev_addr, mac);
|
||||
eth_hw_addr_set(edev->ndev, mac);
|
||||
__qede_unlock(edev);
|
||||
}
|
||||
|
||||
@ -1101,7 +1101,7 @@ int qede_set_mac_addr(struct net_device *ndev, void *p)
|
||||
goto out;
|
||||
}
|
||||
|
||||
ether_addr_copy(ndev->dev_addr, addr->sa_data);
|
||||
eth_hw_addr_set(ndev, addr->sa_data);
|
||||
DP_INFO(edev, "Setting device MAC to %pM\n", addr->sa_data);
|
||||
|
||||
if (edev->state != QEDE_STATE_OPEN) {
|
||||
|
@ -836,7 +836,7 @@ static void qede_init_ndev(struct qede_dev *edev)
|
||||
ndev->max_mtu = QEDE_MAX_JUMBO_PACKET_SIZE;
|
||||
|
||||
/* Set network device HW mac */
|
||||
ether_addr_copy(edev->ndev->dev_addr, edev->dev_info.common.hw_mac);
|
||||
eth_hw_addr_set(edev->ndev, edev->dev_info.common.hw_mac);
|
||||
|
||||
ndev->mtu = edev->dev_info.common.mtu;
|
||||
}
|
||||
|
@ -304,7 +304,7 @@ int qlcnic_read_mac_addr(struct qlcnic_adapter *adapter)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
memcpy(netdev->dev_addr, mac_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(netdev, mac_addr);
|
||||
memcpy(adapter->mac_addr, netdev->dev_addr, netdev->addr_len);
|
||||
|
||||
/* set station address */
|
||||
|
@ -550,7 +550,7 @@ static int emac_probe_resources(struct platform_device *pdev,
|
||||
|
||||
/* get mac address */
|
||||
if (device_get_mac_address(&pdev->dev, maddr, ETH_ALEN))
|
||||
ether_addr_copy(netdev->dev_addr, maddr);
|
||||
eth_hw_addr_set(netdev, maddr);
|
||||
else
|
||||
eth_hw_addr_random(netdev);
|
||||
|
||||
|
@ -1153,7 +1153,7 @@ static void update_mac_address(struct net_device *ndev)
|
||||
static void read_mac_address(struct net_device *ndev, unsigned char *mac)
|
||||
{
|
||||
if (mac[0] || mac[1] || mac[2] || mac[3] || mac[4] || mac[5]) {
|
||||
memcpy(ndev->dev_addr, mac, ETH_ALEN);
|
||||
eth_hw_addr_set(ndev, mac);
|
||||
} else {
|
||||
u32 mahr = sh_eth_read(ndev, MAHR);
|
||||
u32 malr = sh_eth_read(ndev, MALR);
|
||||
|
@ -764,7 +764,7 @@ static int sgiseeq_probe(struct platform_device *pdev)
|
||||
setup_rx_ring(dev, sp->rx_desc, SEEQ_RX_BUFFERS);
|
||||
setup_tx_ring(dev, sp->tx_desc, SEEQ_TX_BUFFERS);
|
||||
|
||||
memcpy(dev->dev_addr, pd->mac, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, pd->mac);
|
||||
|
||||
#ifdef DEBUG
|
||||
gpriv = sp;
|
||||
|
@ -1250,7 +1250,7 @@ int ef100_probe_pf(struct efx_nic *efx)
|
||||
if (rc)
|
||||
goto fail;
|
||||
/* Assign MAC address */
|
||||
memcpy(net_dev->dev_addr, net_dev->perm_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(net_dev, net_dev->perm_addr);
|
||||
memcpy(nic_data->port_id, net_dev->perm_addr, ETH_ALEN);
|
||||
|
||||
return 0;
|
||||
|
@ -523,7 +523,7 @@ int efx_ef10_sriov_set_vf_mac(struct efx_nic *efx, int vf_i, u8 *mac)
|
||||
goto fail;
|
||||
|
||||
if (vf->efx)
|
||||
ether_addr_copy(vf->efx->net_dev->dev_addr, mac);
|
||||
eth_hw_addr_set(vf->efx->net_dev, mac);
|
||||
}
|
||||
|
||||
ether_addr_copy(vf->mac, mac);
|
||||
|
@ -136,7 +136,7 @@ static int efx_probe_port(struct efx_nic *efx)
|
||||
return rc;
|
||||
|
||||
/* Initialise MAC address to permanent address */
|
||||
ether_addr_copy(efx->net_dev->dev_addr, efx->net_dev->perm_addr);
|
||||
eth_hw_addr_set(efx->net_dev, efx->net_dev->perm_addr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user