summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/emulex/benet/be_cmds.c
diff options
context:
space:
mode:
authorSathya Perla <sathya.perla@emulex.com>2013-07-23 15:25:03 +0530
committerDavid S. Miller <davem@davemloft.net>2013-07-24 15:41:52 -0700
commit3175d8c2d05f4c87ba616d4c11037a4ad3f77378 (patch)
tree0bc33bbcb84487e7263af90636c36473ffa82367 /drivers/net/ethernet/emulex/benet/be_cmds.c
parent95046b927a54f461766f83a212c6a93bc5fd2e67 (diff)
downloadlwn-3175d8c2d05f4c87ba616d4c11037a4ad3f77378.tar.gz
lwn-3175d8c2d05f4c87ba616d4c11037a4ad3f77378.zip
be2net: use SET/GET_MAC_LIST for SH-R
On SH-R and Lancer-R, GET_MAC_LIST cmd is better supported (instead of NTWK_MAC_QUERY cmd) to query provisioned MAC addresses. Similiarly, (on SH-R and Lancer-R) SET_MAC_LIST must be used by the PF to provision a permanent MAC addresses to the VF. Signed-off-by: Sathya Perla <sathya.perla@emulex.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/emulex/benet/be_cmds.c')
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.c49
1 files changed, 34 insertions, 15 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index f4ee94eb0c19..613d8879b345 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -2740,19 +2740,15 @@ out:
int be_cmd_get_active_mac(struct be_adapter *adapter, u32 curr_pmac_id, u8 *mac)
{
- int status;
bool active = true;
- /* When SH FW is ready, SH should use Lancer path too */
- if (lancer_chip(adapter)) {
- /* Fetch the MAC address using pmac_id */
- status = be_cmd_get_mac_from_list(adapter, mac, &active,
- &curr_pmac_id, 0);
- return status;
- } else {
+ if (BEx_chip(adapter))
return be_cmd_mac_addr_query(adapter, mac, false,
adapter->if_handle, curr_pmac_id);
- }
+ else
+ /* Fetch the MAC address using pmac_id */
+ return be_cmd_get_mac_from_list(adapter, mac, &active,
+ &curr_pmac_id, 0);
}
int be_cmd_get_perm_mac(struct be_adapter *adapter, u8 *mac)
@@ -2762,14 +2758,18 @@ int be_cmd_get_perm_mac(struct be_adapter *adapter, u8 *mac)
memset(mac, 0, ETH_ALEN);
- if (lancer_chip(adapter))
+ if (BEx_chip(adapter)) {
+ if (be_physfn(adapter))
+ status = be_cmd_mac_addr_query(adapter, mac, true, 0,
+ 0);
+ else
+ status = be_cmd_mac_addr_query(adapter, mac, false,
+ adapter->if_handle, 0);
+ } else {
status = be_cmd_get_mac_from_list(adapter, mac, &pmac_valid,
NULL, 0);
- else if (be_physfn(adapter))
- status = be_cmd_mac_addr_query(adapter, mac, true, 0, 0);
- else
- status = be_cmd_mac_addr_query(adapter, mac, false,
- adapter->if_handle, 0);
+ }
+
return status;
}
@@ -2816,6 +2816,25 @@ err:
return status;
}
+/* Wrapper to delete any active MACs and provision the new mac.
+ * Changes to MAC_LIST are allowed iff none of the MAC addresses in the
+ * current list are active.
+ */
+int be_cmd_set_mac(struct be_adapter *adapter, u8 *mac, int if_id, u32 dom)
+{
+ bool active_mac = false;
+ u8 old_mac[ETH_ALEN];
+ u32 pmac_id;
+ int status;
+
+ status = be_cmd_get_mac_from_list(adapter, old_mac, &active_mac,
+ &pmac_id, dom);
+ if (!status && active_mac)
+ be_cmd_pmac_del(adapter, if_id, pmac_id, dom);
+
+ return be_cmd_set_mac_list(adapter, mac, mac ? 1 : 0, dom);
+}
+
int be_cmd_set_hsw_config(struct be_adapter *adapter, u16 pvid,
u32 domain, u16 intf_id)
{