From: Xiaoyun Wang Date: Sat, 9 May 2020 04:04:15 +0000 (+0800) Subject: net/hinic: fail initialization for not supported device X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=13850e88a40a984847329d37081d1d1bcc4c05af;p=dpdk.git net/hinic: fail initialization for not supported device If hardware mode for this card does not support nic, the network features for this card will not be supported and driver will be initialized failed. Signed-off-by: Xiaoyun Wang --- diff --git a/drivers/net/hinic/base/hinic_pmd_cfg.c b/drivers/net/hinic/base/hinic_pmd_cfg.c index aa883e0274..2d25dc9d5d 100644 --- a/drivers/net/hinic/base/hinic_pmd_cfg.c +++ b/drivers/net/hinic/base/hinic_pmd_cfg.c @@ -129,7 +129,7 @@ static void hinic_parse_pub_res_cap(struct service_cap *cap, 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; @@ -140,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); diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c index e8264feb15..073afa4fa9 100644 --- a/drivers/net/hinic/hinic_pmd_ethdev.c +++ b/drivers/net/hinic/hinic_pmd_ethdev.c @@ -2812,8 +2812,12 @@ static int hinic_nic_dev_create(struct rte_eth_dev *eth_dev) } /* get nic capability */ - if (!hinic_support_nic(nic_dev->hwdev, &nic_dev->nic_cap)) + if (!hinic_support_nic(nic_dev->hwdev, &nic_dev->nic_cap)) { + PMD_DRV_LOG(ERR, "Hw doesn't support nic, dev_name: %s", + eth_dev->data->name); + rc = -EINVAL; goto nic_check_fail; + } /* init root cla and function table */ rc = hinic_init_nicio(nic_dev->hwdev);