be2net: use GET_MAC_LIST cmd to query mac-address from a pmac-id
authorSuresh Reddy <suresh.reddy@emulex.com>
Wed, 15 Jan 2014 07:53:39 +0000 (13:23 +0530)
committerDavid S. Miller <davem@davemloft.net>
Wed, 15 Jan 2014 23:52:03 +0000 (15:52 -0800)
The use of NTKW_MAC_QUERY cmd has been deprecated for Skyhawk-R.
Replace the last remaining usage in be_vfs_mac_query() routine.

Signed-off-by: Suresh Reddy <suresh.reddy@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/emulex/benet/be_cmds.c
drivers/net/ethernet/emulex/benet/be_cmds.h
drivers/net/ethernet/emulex/benet/be_main.c

index cf5b8b0c59254b35b0c58734d72848b15c623d83..5635f1ec24e016e17e61f8e69403156c694d9966 100644 (file)
@@ -2742,7 +2742,8 @@ err:
  *               If pmac_id is returned, pmac_id_valid is returned as true
  */
 int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac,
-                            bool *pmac_id_valid, u32 *pmac_id, u8 domain)
+                            bool *pmac_id_valid, u32 *pmac_id, u32 if_handle,
+                            u8 domain)
 {
        struct be_mcc_wrb *wrb;
        struct be_cmd_req_get_mac_list *req;
@@ -2780,7 +2781,7 @@ int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac,
        req->mac_type = MAC_ADDRESS_TYPE_NETWORK;
        if (*pmac_id_valid) {
                req->mac_id = cpu_to_le32(*pmac_id);
-               req->iface_id = cpu_to_le16(adapter->if_handle);
+               req->iface_id = cpu_to_le16(if_handle);
                req->perm_override = 0;
        } else {
                req->perm_override = 1;
@@ -2833,17 +2834,21 @@ out:
        return status;
 }
 
-int be_cmd_get_active_mac(struct be_adapter *adapter, u32 curr_pmac_id, u8 *mac)
+int be_cmd_get_active_mac(struct be_adapter *adapter, u32 curr_pmac_id, u8 *mac,
+                         u32 if_handle, bool active, u32 domain)
 {
-       bool active = true;
 
+       if (!active)
+               be_cmd_get_mac_from_list(adapter, mac, &active, &curr_pmac_id,
+                                        if_handle, domain);
        if (BEx_chip(adapter))
                return be_cmd_mac_addr_query(adapter, mac, false,
-                                            adapter->if_handle, curr_pmac_id);
+                                            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);
+                                               &curr_pmac_id,
+                                               if_handle, domain);
 }
 
 int be_cmd_get_perm_mac(struct be_adapter *adapter, u8 *mac)
@@ -2862,7 +2867,7 @@ int be_cmd_get_perm_mac(struct be_adapter *adapter, u8 *mac)
                                                       adapter->if_handle, 0);
        } else {
                status = be_cmd_get_mac_from_list(adapter, mac, &pmac_valid,
-                                                 NULL, 0);
+                                                 NULL, adapter->if_handle, 0);
        }
 
        return status;
@@ -2923,7 +2928,8 @@ int be_cmd_set_mac(struct be_adapter *adapter, u8 *mac, int if_id, u32 dom)
        int status;
 
        status = be_cmd_get_mac_from_list(adapter, old_mac, &active_mac,
-                                         &pmac_id, dom);
+                                         &pmac_id, if_id, dom);
+
        if (!status && active_mac)
                be_cmd_pmac_del(adapter, if_id, pmac_id, dom);
 
index da182c0583f115a9d97476098d0cb19692b6bdbe..fc4e076dc202624721c7d505a482ca64d6c984d4 100644 (file)
@@ -2057,8 +2057,10 @@ int be_cmd_get_fn_privileges(struct be_adapter *adapter, u32 *privilege,
 int be_cmd_set_fn_privileges(struct be_adapter *adapter, u32 privileges,
                             u32 vf_num);
 int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac,
-                            bool *pmac_id_active, u32 *pmac_id, u8 domain);
-int be_cmd_get_active_mac(struct be_adapter *adapter, u32 pmac_id, u8 *mac);
+                            bool *pmac_id_active, u32 *pmac_id,
+                            u32 if_handle, u8 domain);
+int be_cmd_get_active_mac(struct be_adapter *adapter, u32 pmac_id, u8 *mac,
+                         u32 if_handle, bool active, u32 domain);
 int be_cmd_get_perm_mac(struct be_adapter *adapter, u8 *mac);
 int be_cmd_set_mac_list(struct be_adapter *adapter, u8 *mac_array, u8 mac_count,
                        u32 domain);
index 9704a1b23cef0ce07d6e5eaa77da7bf390573171..43cb4588b6c8054325dfa8c3e2e6c21647357eb6 100644 (file)
@@ -280,7 +280,8 @@ static int be_mac_addr_set(struct net_device *netdev, void *p)
        /* Decide if the new MAC is successfully activated only after
         * querying the FW
         */
-       status = be_cmd_get_active_mac(adapter, curr_pmac_id, mac);
+       status = be_cmd_get_active_mac(adapter, curr_pmac_id, mac,
+                                      adapter->if_handle, true, 0);
        if (status)
                goto err;
 
@@ -2872,14 +2873,11 @@ static int be_vfs_mac_query(struct be_adapter *adapter)
        int status, vf;
        u8 mac[ETH_ALEN];
        struct be_vf_cfg *vf_cfg;
-       bool active = false;
 
        for_all_vfs(adapter, vf_cfg, vf) {
-               be_cmd_get_mac_from_list(adapter, mac, &active,
-                                        &vf_cfg->pmac_id, 0);
-
-               status = be_cmd_mac_addr_query(adapter, mac, false,
-                                              vf_cfg->if_handle, 0);
+               status = be_cmd_get_active_mac(adapter, vf_cfg->pmac_id,
+                                              mac, vf_cfg->if_handle,
+                                              false, vf+1);
                if (status)
                        return status;
                memcpy(vf_cfg->mac_addr, mac, ETH_ALEN);