Commit 5b03a422 authored by Wei Xu's avatar Wei Xu Committed by Jason Gunthorpe

RDMA/hns: Query the number of functions supported by the PF

Query how many functions are supported by the PF from the FW and store it
in the hns_roce_dev structure which will be used to support the
configuration of virtual functions.

Link: https://lore.kernel.org/r/1617715514-29039-3-git-send-email-liweihang@huawei.comSigned-off-by: default avatarWei Xu <xuwei5@hisilicon.com>
Signed-off-by: default avatarShengming Shu <shushengming1@huawei.com>
Signed-off-by: default avatarWeihang Li <liweihang@huawei.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 0fb46da0
...@@ -986,6 +986,7 @@ struct hns_roce_dev { ...@@ -986,6 +986,7 @@ struct hns_roce_dev {
void *priv; void *priv;
struct workqueue_struct *irq_workq; struct workqueue_struct *irq_workq;
const struct hns_roce_dfx_hw *dfx; const struct hns_roce_dfx_hw *dfx;
u32 func_num;
u32 cong_algo_tmpl_id; u32 cong_algo_tmpl_id;
}; };
......
...@@ -1612,15 +1612,20 @@ static int hns_roce_query_func_info(struct hns_roce_dev *hr_dev) ...@@ -1612,15 +1612,20 @@ static int hns_roce_query_func_info(struct hns_roce_dev *hr_dev)
struct hns_roce_cmq_desc desc; struct hns_roce_cmq_desc desc;
int ret; int ret;
if (hr_dev->pci_dev->revision < PCI_REVISION_ID_HIP09) if (hr_dev->pci_dev->revision < PCI_REVISION_ID_HIP09) {
hr_dev->func_num = 1;
return 0; return 0;
}
hns_roce_cmq_setup_basic_desc(&desc, HNS_ROCE_OPC_QUERY_FUNC_INFO, hns_roce_cmq_setup_basic_desc(&desc, HNS_ROCE_OPC_QUERY_FUNC_INFO,
true); true);
ret = hns_roce_cmq_send(hr_dev, &desc, 1); ret = hns_roce_cmq_send(hr_dev, &desc, 1);
if (ret) if (ret) {
hr_dev->func_num = 1;
return ret; return ret;
}
hr_dev->func_num = le32_to_cpu(desc.func_info.own_func_num);
hr_dev->cong_algo_tmpl_id = le32_to_cpu(desc.func_info.own_mac_id); hr_dev->cong_algo_tmpl_id = le32_to_cpu(desc.func_info.own_mac_id);
return 0; return 0;
......
...@@ -1710,9 +1710,9 @@ struct hns_roce_cmq_desc { ...@@ -1710,9 +1710,9 @@ struct hns_roce_cmq_desc {
union { union {
__le32 data[6]; __le32 data[6];
struct { struct {
__le32 rsv1; __le32 own_func_num;
__le32 own_mac_id; __le32 own_mac_id;
__le32 rsv2[4]; __le32 rsv[4];
} func_info; } func_info;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment