Commit e3a7ae2c authored by Somnath Kotur's avatar Somnath Kotur Committed by David S. Miller

be2net: Changing MAC Address of a VF was broken.

Allow for MAC Address change of VF(SR-IOV case) on the fly- First add and then
delete MAC Address to allow for 'out of pool' errors.
When MAC Addr configured from a VM, the MAC on the NIC will aleady have
the supplied MAC,so just copy the supplied MAC to the netdev structure
before returning success to the stack
Signed-off-by: default avatarSomnath Kotur <somnath.kotur@emulex.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 106df1e3
...@@ -688,6 +688,10 @@ int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr, ...@@ -688,6 +688,10 @@ int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr,
err: err:
spin_unlock_bh(&adapter->mcc_lock); spin_unlock_bh(&adapter->mcc_lock);
if (status == MCC_STATUS_UNAUTHORIZED_REQUEST)
status = -EPERM;
return status; return status;
} }
......
...@@ -229,27 +229,29 @@ static int be_mac_addr_set(struct net_device *netdev, void *p) ...@@ -229,27 +229,29 @@ static int be_mac_addr_set(struct net_device *netdev, void *p)
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
struct sockaddr *addr = p; struct sockaddr *addr = p;
int status = 0; int status = 0;
u8 current_mac[ETH_ALEN];
u32 pmac_id = adapter->pmac_id;
if (!is_valid_ether_addr(addr->sa_data)) if (!is_valid_ether_addr(addr->sa_data))
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
/* MAC addr configuration will be done in hardware for VFs status = be_cmd_mac_addr_query(adapter, current_mac,
* by their corresponding PFs. Just copy to netdev addr here MAC_ADDRESS_TYPE_NETWORK, false, adapter->if_handle);
*/
if (!be_physfn(adapter))
goto netdev_addr;
status = be_cmd_pmac_del(adapter, adapter->if_handle,
adapter->pmac_id, 0);
if (status) 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); adapter->if_handle, &adapter->pmac_id, 0);
netdev_addr: if (status)
if (!status) goto err;
memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
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; return status;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment