Skip to content

Commit

Permalink
sfc: Store MAC address from NVRAM in net_device::perm_addr
Browse files Browse the repository at this point in the history
For some reason we failed to make this change when perm_addr was
introduced.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ben Hutchings authored and David S. Miller committed Dec 3, 2010
1 parent 02ebc26 commit 7e300bc
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
8 changes: 5 additions & 3 deletions drivers/net/sfc/efx.c
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,7 @@ static void efx_mac_work(struct work_struct *data)

static int efx_probe_port(struct efx_nic *efx)
{
unsigned char *perm_addr;
int rc;

netif_dbg(efx, probe, efx->net_dev, "create port\n");
Expand All @@ -922,11 +923,12 @@ static int efx_probe_port(struct efx_nic *efx)
return rc;

/* Sanity check MAC address */
if (is_valid_ether_addr(efx->mac_address)) {
memcpy(efx->net_dev->dev_addr, efx->mac_address, ETH_ALEN);
perm_addr = efx->net_dev->perm_addr;
if (is_valid_ether_addr(perm_addr)) {
memcpy(efx->net_dev->dev_addr, perm_addr, ETH_ALEN);
} else {
netif_err(efx, probe, efx->net_dev, "invalid MAC address %pM\n",
efx->mac_address);
perm_addr);
if (!allow_bad_hwaddr) {
rc = -EINVAL;
goto err;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/sfc/falcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -1297,7 +1297,7 @@ static int falcon_probe_nvconfig(struct efx_nic *efx)
}

/* Read the MAC addresses */
memcpy(efx->mac_address, nvconfig->mac_address[0], ETH_ALEN);
memcpy(efx->net_dev->perm_addr, nvconfig->mac_address[0], ETH_ALEN);

netif_dbg(efx, probe, efx->net_dev, "PHY is %d phy_id %d\n",
efx->phy_type, efx->mdio.prtad);
Expand Down
2 changes: 0 additions & 2 deletions drivers/net/sfc/net_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,6 @@ struct efx_filter_state;
* @stats_buffer: DMA buffer for statistics
* @stats_lock: Statistics update lock. Serialises statistics fetches
* @mac_op: MAC interface
* @mac_address: Permanent MAC address
* @phy_type: PHY type
* @phy_op: PHY interface
* @phy_data: PHY private data (including PHY-specific stats)
Expand Down Expand Up @@ -762,7 +761,6 @@ struct efx_nic {
spinlock_t stats_lock;

struct efx_mac_operations *mac_op;
unsigned char mac_address[ETH_ALEN];

unsigned int phy_type;
struct efx_phy_operations *phy_op;
Expand Down
8 changes: 1 addition & 7 deletions drivers/net/sfc/siena.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,7 @@ static int siena_reset_hw(struct efx_nic *efx, enum reset_type method)

static int siena_probe_nvconfig(struct efx_nic *efx)
{
int rc;

rc = efx_mcdi_get_board_cfg(efx, efx->mac_address, NULL);
if (rc)
return rc;

return 0;
return efx_mcdi_get_board_cfg(efx, efx->net_dev->perm_addr, NULL);
}

static int siena_probe_nic(struct efx_nic *efx)
Expand Down

0 comments on commit 7e300bc

Please sign in to comment.