X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fhinic%2Fbase%2Fhinic_pmd_cfg.c;h=a0cc16d9e02a1c1640eedc24818e17e9f8534d02;hb=5723fbed4f969bb69b32927a138b272fb002fba1;hp=61537b12cbb36a4b34e161eece17ff3d21ed19fb;hpb=d9ce1917941c9405a1a9b6465714341c2893fe4b;p=dpdk.git diff --git a/drivers/net/hinic/base/hinic_pmd_cfg.c b/drivers/net/hinic/base/hinic_pmd_cfg.c index 61537b12cb..a0cc16d9e0 100644 --- a/drivers/net/hinic/base/hinic_pmd_cfg.c +++ b/drivers/net/hinic/base/hinic_pmd_cfg.c @@ -8,6 +8,7 @@ #include "hinic_pmd_mgmt.h" #include "hinic_pmd_eqs.h" #include "hinic_pmd_cfg.h" +#include "hinic_pmd_mbox.h" bool hinic_support_nic(struct hinic_hwdev *hwdev, struct nic_service_cap *cap) { @@ -122,9 +123,13 @@ static void hinic_parse_pub_res_cap(struct service_cap *cap, cap->vf_id_start = dev_cap->vf_id_start; cap->max_sqs = dev_cap->nic_max_sq + 1; cap->max_rqs = dev_cap->nic_max_rq + 1; + } else { + cap->max_vf = 0; + cap->max_sqs = dev_cap->nic_max_sq; + cap->max_rqs = dev_cap->nic_max_rq; } - cap->chip_svc_type = CFG_SVC_NIC_BIT0; + cap->chip_svc_type = dev_cap->svc_cap_en; cap->host_total_function = dev_cap->host_total_func; cap->host_oq_id_mask_val = dev_cap->host_oq_id_mask_val; @@ -135,6 +140,7 @@ static void hinic_parse_pub_res_cap(struct service_cap *cap, PMD_DRV_LOG(INFO, "host_total_function: 0x%x, host_oq_id_mask_val: 0x%x, max_vf: 0x%x", cap->host_total_function, cap->host_oq_id_mask_val, cap->max_vf); + PMD_DRV_LOG(INFO, "chip_svc_type: 0x%x", cap->chip_svc_type); PMD_DRV_LOG(INFO, "pf_num: 0x%x, pf_id_start: 0x%x, vf_num: 0x%x, vf_id_start: 0x%x", cap->pf_num, cap->pf_id_start, cap->vf_num, cap->vf_id_start); @@ -173,7 +179,29 @@ static int get_cap_from_fw(struct hinic_hwdev *dev, enum func_type type) if (err || dev_cap.mgmt_msg_head.status || !out_len) { PMD_DRV_LOG(ERR, "Get capability from FW failed, err: %d, status: %d, out_len: %d", err, dev_cap.mgmt_msg_head.status, out_len); - return -EFAULT; + return -EIO; + } + + parse_dev_cap(dev, &dev_cap, type); + return 0; +} + +static int get_cap_from_pf(struct hinic_hwdev *dev, enum func_type type) +{ + int err; + u16 in_len, out_len; + struct hinic_dev_cap dev_cap; + + memset(&dev_cap, 0, sizeof(dev_cap)); + in_len = sizeof(dev_cap); + out_len = in_len; + err = hinic_mbox_to_pf(dev, HINIC_MOD_CFGM, HINIC_CFG_MBOX_CAP, + &dev_cap, in_len, &dev_cap, &out_len, + CFG_MAX_CMD_TIMEOUT); + if (err || dev_cap.mgmt_msg_head.status || !out_len) { + PMD_DRV_LOG(ERR, "Get capability from PF failed, err: %d, status: %d, out_len: %d", + err, dev_cap.mgmt_msg_head.status, out_len); + return -EIO; } parse_dev_cap(dev, &dev_cap, type); @@ -194,6 +222,14 @@ static int get_dev_cap(struct hinic_hwdev *dev) return err; } break; + case TYPE_VF: + err = get_cap_from_pf(dev, type); + if (err) { + PMD_DRV_LOG(ERR, "Get VF capability failed, err: %d", + err); + return err; + } + break; default: PMD_DRV_LOG(ERR, "Unsupported PCI function type"); return -EINVAL;