Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 271614
b: refs/heads/master
c: e3a7ae2
h: refs/heads/master
v: v3
  • Loading branch information
Somnath Kotur authored and David S. Miller committed Oct 28, 2011
1 parent 6c2ee5f commit 983d8ca
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 106df1e3594c710c74348883a4942f65651781ff
refs/heads/master: e3a7ae2c1819aa210a38f80f6bf13322652c8211
4 changes: 4 additions & 0 deletions trunk/drivers/net/ethernet/emulex/benet/be_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,10 @@ int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr,

err:
spin_unlock_bh(&adapter->mcc_lock);

if (status == MCC_STATUS_UNAUTHORIZED_REQUEST)
status = -EPERM;

return status;
}

Expand Down
28 changes: 15 additions & 13 deletions trunk/drivers/net/ethernet/emulex/benet/be_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,27 +229,29 @@ static int be_mac_addr_set(struct net_device *netdev, void *p)
struct be_adapter *adapter = netdev_priv(netdev);
struct sockaddr *addr = p;
int status = 0;
u8 current_mac[ETH_ALEN];
u32 pmac_id = adapter->pmac_id;

if (!is_valid_ether_addr(addr->sa_data))
return -EADDRNOTAVAIL;

/* MAC addr configuration will be done in hardware for VFs
* by their corresponding PFs. Just copy to netdev addr here
*/
if (!be_physfn(adapter))
goto netdev_addr;

status = be_cmd_pmac_del(adapter, adapter->if_handle,
adapter->pmac_id, 0);
status = be_cmd_mac_addr_query(adapter, current_mac,
MAC_ADDRESS_TYPE_NETWORK, false, adapter->if_handle);
if (status)
return status;
goto err;

status = be_cmd_pmac_add(adapter, (u8 *)addr->sa_data,
if (memcmp(addr->sa_data, current_mac, ETH_ALEN)) {
status = be_cmd_pmac_add(adapter, (u8 *)addr->sa_data,
adapter->if_handle, &adapter->pmac_id, 0);
netdev_addr:
if (!status)
memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
if (status)
goto err;

be_cmd_pmac_del(adapter, adapter->if_handle, pmac_id, 0);
}
memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
return 0;
err:
dev_err(&adapter->pdev->dev, "MAC %pM set Failed\n", addr->sa_data);
return status;
}

Expand Down

0 comments on commit 983d8ca

Please sign in to comment.