diff --git a/drivers/net/ethernet/huawei/hinic/hinic_cfg.c b/drivers/net/ethernet/huawei/hinic/hinic_cfg.c index 70fe14918e3ecff99b4636f720d6832f06a3a714..341637e0602d607cf317986446c2dbca238980ae 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_cfg.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_cfg.c @@ -264,12 +264,15 @@ static void parse_l2nic_res_cap(struct service_cap *cap, nic_cap->max_rqs = dev_cap->nic_max_rq + 1; nic_cap->vf_max_sqs = dev_cap->nic_vf_max_sq + 1; nic_cap->vf_max_rqs = dev_cap->nic_vf_max_rq + 1; + nic_cap->max_queue_allowed = 0; + nic_cap->dynamic_qp = 0; } else { nic_cap->max_sqs = dev_cap->nic_max_sq; nic_cap->max_rqs = dev_cap->nic_max_rq; nic_cap->vf_max_sqs = 0; nic_cap->vf_max_rqs = 0; nic_cap->max_queue_allowed = dev_cap->max_queue_allowed; + nic_cap->dynamic_qp = dev_cap->ovs_dq_en; } if (dev_cap->nic_lro_en) @@ -510,6 +513,9 @@ static void parse_ovs_res_cap(struct service_cap *cap, ovs_cap->dev_ovs_cap.max_pctxs = dev_cap->ovs_max_qpc; ovs_cap->dev_ovs_cap.max_cqs = 0; + if (type == TYPE_PF || type == TYPE_PPF) + ovs_cap->dev_ovs_cap.dynamic_qp_en = dev_cap->ovs_dq_en; + pr_info("Get ovs resource capbility, max_qpc: 0x%x\n", ovs_cap->dev_ovs_cap.max_pctxs); } @@ -1329,6 +1335,7 @@ static int cfg_mbx_pf_proc_vf_msg(void *hwdev, u16 vf_id, u8 cmd, void *buf_in, /* OVS VF resources */ dev_cap->ovs_max_qpc = ovs_cap->max_pctxs; + dev_cap->ovs_dq_en = ovs_cap->dynamic_qp_en; *out_size = sizeof(*dev_cap); @@ -1352,8 +1359,10 @@ static int cfg_mbx_pf_proc_vf_msg(void *hwdev, u16 vf_id, u8 cmd, void *buf_in, dev_cap->nic_max_sq = dev_cap_tmp.nic_max_sq + 1; dev_cap->nic_max_rq = dev_cap_tmp.nic_max_rq + 1; dev_cap->max_queue_allowed = dev_cap_tmp.max_queue_allowed; - sdk_info(dev->dev_hdl, "func_id(%u) fixed qnum %u max_queue_allowed %u\n", - func_id, dev_cap->nic_max_sq, dev_cap->max_queue_allowed); + + sdk_info(dev->dev_hdl, "func_id(%u) %s qnum %u max_queue_allowed %u\n", + func_id, (ovs_cap->dynamic_qp_en ? "dynamic" : "fixed"), + dev_cap->nic_max_sq, dev_cap->max_queue_allowed); return 0; } @@ -1751,6 +1760,16 @@ bool hinic_support_ft(void *hwdev) } EXPORT_SYMBOL(hinic_support_ft); +bool hinic_support_dynamic_q(void *hwdev) +{ + struct hinic_hwdev *dev = hwdev; + + if (!hwdev) + return false; + + return dev->cfg_mgmt->svc_cap.nic_cap.dynamic_qp ? true : false; +} + bool hinic_func_for_mgmt(void *hwdev) { struct hinic_hwdev *dev = hwdev; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_cfg.h b/drivers/net/ethernet/huawei/hinic/hinic_cfg.h index 50d11cc6996b5930092ef7a43259112aa0a4c0ee..f6596e93cda668589810d18d32107c8b47fbdab6 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_cfg.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_cfg.h @@ -442,7 +442,8 @@ struct hinic_dev_cap { /* OVS */ u32 ovs_max_qpc; - u32 rsvd6; + u8 ovs_dq_en; + u8 rsvd5[3]; /* ToE */ u32 toe_max_pctx; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw_mgmt.h b/drivers/net/ethernet/huawei/hinic/hinic_hw_mgmt.h index 563188ab7441b453a917cc72baee3cc8f6ceac9c..a2242cc852e9ba589c033c6d459e8aa5f4671c06 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_hw_mgmt.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_hw_mgmt.h @@ -73,6 +73,7 @@ struct nic_service_cap { u8 tso_sz; /* TSO context space: n*16B */ u16 max_queue_allowed; + u16 dynamic_qp; /* support dynamic queue */ }; struct dev_roce_svc_own_cap { @@ -358,6 +359,7 @@ struct dev_ovs_svc_cap { /* PF resources */ u32 max_pctxs; /* Parent Context: max specifications 1M */ u32 max_cqs; + u8 dynamic_qp_en; /* VF resources */ u32 vf_max_pctxs; /* Parent Context: max specifications 1M */ @@ -412,6 +414,7 @@ bool hinic_support_acl(void *hwdev, struct acl_service_cap *cap); bool hinic_support_rdma(void *hwdev, struct rdma_service_cap *cap); bool hinic_support_ft(void *hwdev); bool hinic_func_for_mgmt(void *hwdev); +bool hinic_support_dynamic_q(void *hwdev); int hinic_set_toe_enable(void *hwdev, bool enable); bool hinic_get_toe_enable(void *hwdev); diff --git a/drivers/net/ethernet/huawei/hinic/hinic_lld.c b/drivers/net/ethernet/huawei/hinic/hinic_lld.c index 1636bb4df859e482e9cfa122897ba93c64dd94cc..f851bb2e65ddb34e40962f5f74024a1e44bba69c 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_lld.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_lld.c @@ -1644,6 +1644,9 @@ static int __set_nic_func_state(struct hinic_pcidev *pci_adapter) } if (enable_nic) { + if (is_multi_bm_slave(pci_adapter->hwdev)) + hinic_set_vf_dev_cap(pci_adapter->hwdev); + err = attach_uld(pci_adapter, SERVICE_T_NIC, &g_uld_info[SERVICE_T_NIC]); if (err) { @@ -2060,6 +2063,10 @@ static void hinic_set_vf_load_state(struct hinic_pcidev *pci_adapter, if (hinic_func_type(pci_adapter->hwdev) == TYPE_VF) return; + /* The VF on the BM slave side must be probed */ + if (is_multi_bm_slave(pci_adapter->hwdev)) + vf_load_state = false; + func_id = hinic_global_func_id_hw(pci_adapter->hwdev); chip_node = pci_adapter->chip_node; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_nic_io.c b/drivers/net/ethernet/huawei/hinic/hinic_nic_io.c index e00ae11d197b381eb808ed9bfb6953b6ed2edfc3..bd5c8698ca7ceb5f844901cadd88cb3109677043 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_nic_io.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_nic_io.c @@ -30,6 +30,8 @@ #include "hinic_nic_io.h" #include "hinic_nic.h" #include "hinic_ctx_def.h" +#include "hinic_wq.h" +#include "hinic_cmdq.h" #define HINIC_DEAULT_TX_CI_PENDING_LIMIT 0 #define HINIC_DEAULT_TX_CI_COALESCING_TIME 0 @@ -778,6 +780,14 @@ int hinic_init_nic_hwdev(void *hwdev, u16 rx_buff_len) if (!hwdev) return -EINVAL; + if (is_multi_bm_slave(hwdev) && hinic_support_dynamic_q(hwdev)) { + err = hinic_reinit_cmdq_ctxts(dev); + if (err) { + nic_err(dev->dev_hdl, "Failed to reinit cmdq\n"); + return err; + } + } + nic_io = dev->nic_io; err = hinic_get_base_qpn(hwdev, &global_qpn);