be2net: Provide an alternate way to read pf_num for BEx chips
[cascardo/linux.git] / drivers / net / ethernet / emulex / benet / be_cmds.c
index 15d02da..45d1742 100644 (file)
@@ -3527,6 +3527,11 @@ int be_cmd_get_cntl_attributes(struct be_adapter *adapter)
                for (i = 0; i < CNTL_SERIAL_NUM_WORDS; i++)
                        adapter->serial_num[i] = le32_to_cpu(serial_num[i]) &
                                (BIT_MASK(16) - 1);
+               /* For BEx, since GET_FUNC_CONFIG command is not
+                * supported, we read funcnum here as a workaround.
+                */
+               if (BEx_chip(adapter))
+                       adapter->pf_num = attribs->hba_attribs.pci_funcnum;
        }
 
 err:
@@ -4382,7 +4387,7 @@ err:
 }
 
 /* This routine returns a list of all the NIC PF_nums in the adapter */
-u16 be_get_nic_pf_num_list(u8 *buf, u32 desc_count, u16 *nic_pf_nums)
+static u16 be_get_nic_pf_num_list(u8 *buf, u32 desc_count, u16 *nic_pf_nums)
 {
        struct be_res_desc_hdr *hdr = (struct be_res_desc_hdr *)buf;
        struct be_pcie_res_desc *pcie = NULL;
@@ -4534,7 +4539,7 @@ static int be_cmd_set_profile_config(struct be_adapter *adapter, void *desc,
 }
 
 /* Mark all fields invalid */
-void be_reset_nic_desc(struct be_nic_res_desc *nic)
+static void be_reset_nic_desc(struct be_nic_res_desc *nic)
 {
        memset(nic, 0, sizeof(*nic));
        nic->unicast_mac_count = 0xFFFF;
@@ -4907,8 +4912,9 @@ err:
        return status;
 }
 
-int __be_cmd_set_logical_link_config(struct be_adapter *adapter,
-                                    int link_state, int version, u8 domain)
+static int
+__be_cmd_set_logical_link_config(struct be_adapter *adapter,
+                                int link_state, int version, u8 domain)
 {
        struct be_mcc_wrb *wrb;
        struct be_cmd_req_set_ll_link *req;