aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/emulex/benet/be_cmds.c
diff options
context:
space:
mode:
authorVasundhara Volam <vasundhara.volam@emulex.com>2014-06-30 03:31:31 -0400
committerDavid S. Miller <davem@davemloft.net>2014-07-02 21:40:56 -0400
commit10cccf60fbd3dcf8045aac1a77508b90e18c94bd (patch)
treee03e655d22b10aed2499275c214f62f80211f6d8 /drivers/net/ethernet/emulex/benet/be_cmds.c
parentba48c0c92704c68065ffb07661e4f99c800aeca2 (diff)
be2net: read VF's capabilities from GET_PROFILE_CONFIG cmd
The PF driver must query the FW for VF's interface capabilities to know if the VF is RSS capable or not. This patch is in preparation for enabling RSS on VFs on Skyhawk-R. Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com> 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.c37
1 files changed, 32 insertions, 5 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 0e2f6e1930ba..68d200667aac 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -3313,15 +3313,28 @@ err:
3313 return status; 3313 return status;
3314} 3314}
3315 3315
3316static struct be_nic_res_desc *be_get_nic_desc(u8 *buf, u32 desc_count) 3316/* Descriptor type */
3317enum {
3318 FUNC_DESC = 1,
3319 VFT_DESC = 2
3320};
3321
3322static struct be_nic_res_desc *be_get_nic_desc(u8 *buf, u32 desc_count,
3323 int desc_type)
3317{ 3324{
3318 struct be_res_desc_hdr *hdr = (struct be_res_desc_hdr *)buf; 3325 struct be_res_desc_hdr *hdr = (struct be_res_desc_hdr *)buf;
3326 struct be_nic_res_desc *nic;
3319 int i; 3327 int i;
3320 3328
3321 for (i = 0; i < desc_count; i++) { 3329 for (i = 0; i < desc_count; i++) {
3322 if (hdr->desc_type == NIC_RESOURCE_DESC_TYPE_V0 || 3330 if (hdr->desc_type == NIC_RESOURCE_DESC_TYPE_V0 ||
3323 hdr->desc_type == NIC_RESOURCE_DESC_TYPE_V1) 3331 hdr->desc_type == NIC_RESOURCE_DESC_TYPE_V1) {
3324 return (struct be_nic_res_desc *)hdr; 3332 nic = (struct be_nic_res_desc *)hdr;
3333 if (desc_type == FUNC_DESC ||
3334 (desc_type == VFT_DESC &&
3335 nic->flags & (1 << VFT_SHIFT)))
3336 return nic;
3337 }
3325 3338
3326 hdr->desc_len = hdr->desc_len ? : RESOURCE_DESC_SIZE_V0; 3339 hdr->desc_len = hdr->desc_len ? : RESOURCE_DESC_SIZE_V0;
3327 hdr = (void *)hdr + hdr->desc_len; 3340 hdr = (void *)hdr + hdr->desc_len;
@@ -3329,6 +3342,16 @@ static struct be_nic_res_desc *be_get_nic_desc(u8 *buf, u32 desc_count)
3329 return NULL; 3342 return NULL;
3330} 3343}
3331 3344
3345static struct be_nic_res_desc *be_get_vft_desc(u8 *buf, u32 desc_count)
3346{
3347 return be_get_nic_desc(buf, desc_count, VFT_DESC);
3348}
3349
3350static struct be_nic_res_desc *be_get_func_nic_desc(u8 *buf, u32 desc_count)
3351{
3352 return be_get_nic_desc(buf, desc_count, FUNC_DESC);
3353}
3354
3332static struct be_pcie_res_desc *be_get_pcie_desc(u8 devfn, u8 *buf, 3355static struct be_pcie_res_desc *be_get_pcie_desc(u8 devfn, u8 *buf,
3333 u32 desc_count) 3356 u32 desc_count)
3334{ 3357{
@@ -3424,7 +3447,7 @@ int be_cmd_get_func_config(struct be_adapter *adapter, struct be_resources *res)
3424 u32 desc_count = le32_to_cpu(resp->desc_count); 3447 u32 desc_count = le32_to_cpu(resp->desc_count);
3425 struct be_nic_res_desc *desc; 3448 struct be_nic_res_desc *desc;
3426 3449
3427 desc = be_get_nic_desc(resp->func_param, desc_count); 3450 desc = be_get_func_nic_desc(resp->func_param, desc_count);
3428 if (!desc) { 3451 if (!desc) {
3429 status = -EINVAL; 3452 status = -EINVAL;
3430 goto err; 3453 goto err;
@@ -3446,6 +3469,7 @@ int be_cmd_get_profile_config(struct be_adapter *adapter,
3446{ 3469{
3447 struct be_cmd_resp_get_profile_config *resp; 3470 struct be_cmd_resp_get_profile_config *resp;
3448 struct be_cmd_req_get_profile_config *req; 3471 struct be_cmd_req_get_profile_config *req;
3472 struct be_nic_res_desc *vf_res;
3449 struct be_pcie_res_desc *pcie; 3473 struct be_pcie_res_desc *pcie;
3450 struct be_port_res_desc *port; 3474 struct be_port_res_desc *port;
3451 struct be_nic_res_desc *nic; 3475 struct be_nic_res_desc *nic;
@@ -3486,10 +3510,13 @@ int be_cmd_get_profile_config(struct be_adapter *adapter,
3486 if (port) 3510 if (port)
3487 adapter->mc_type = port->mc_type; 3511 adapter->mc_type = port->mc_type;
3488 3512
3489 nic = be_get_nic_desc(resp->func_param, desc_count); 3513 nic = be_get_func_nic_desc(resp->func_param, desc_count);
3490 if (nic) 3514 if (nic)
3491 be_copy_nic_desc(res, nic); 3515 be_copy_nic_desc(res, nic);
3492 3516
3517 vf_res = be_get_vft_desc(resp->func_param, desc_count);
3518 if (vf_res)
3519 res->vf_if_cap_flags = vf_res->cap_flags;
3493err: 3520err:
3494 if (cmd.va) 3521 if (cmd.va)
3495 pci_free_consistent(adapter->pdev, cmd.size, cmd.va, cmd.dma); 3522 pci_free_consistent(adapter->pdev, cmd.size, cmd.va, cmd.dma);