From: Ke Chen chenke54@huawei.com
driver inclusion category:feature bugzilla: https://gitee.com/openeuler/kernel/issues/I9A3QT CVE: NA
----------------------------------------------------------------------
add support for the roh capability in hnae3_dev flag.
Signed-off-by: Ke Chen chenke54@huawei.com Signed-off-by: Jiantao Xiao xiaojiantao1@h-partners.com --- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 7 ++++++- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 6 +++--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 6 ++++-- 3 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h index 2055df16dec4..d98e951574de 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h @@ -71,12 +71,17 @@ #define HNAE3_UNIC_CLIENT_INITED_B 0x4 #define HNAE3_ROCE_CLIENT_INITED_B 0x5 #define HNAE3_ROH_CLIENT_INITED_B 0x6 +#define HNAE3_DEV_SUPPORT_ROH_B 0xA
#define HNAE3_DEV_SUPPORT_ROCE_DCB_BITS (BIT(HNAE3_DEV_SUPPORT_DCB_B) | \ BIT(HNAE3_DEV_SUPPORT_ROCE_B))
+#define HNAE3_DEV_SUPPORT_ROCE_ROH_DCB_BITS \ + (BIT(HNAE3_DEV_SUPPORT_DCB_B) | BIT(HNAE3_DEV_SUPPORT_ROCE_B) | \ + BIT(HNAE3_DEV_SUPPORT_ROH_B)) + #define hnae3_dev_roh_supported(hdev) \ - hnae3_get_bit((hdev)->ae_dev->flag, HNAE3_ROH_CLIENT_INITED_B) + hnae3_get_bit((hdev)->ae_dev->flag, HNAE3_DEV_SUPPORT_ROH_B)
#define hnae3_dev_roce_supported(hdev) \ hnae3_get_bit((hdev)->ae_dev->flag, HNAE3_DEV_SUPPORT_ROCE_B) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 0df74d71bec8..dae17c3b72bc 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -99,13 +99,13 @@ static const struct pci_device_id hns3_pci_tbl[] = { {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_100G_RDMA_MACSEC), HNAE3_DEV_SUPPORT_ROCE_DCB_BITS}, {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_100G_ROH), - HNAE3_DEV_SUPPORT_ROCE_DCB_BITS}, + HNAE3_DEV_SUPPORT_ROCE_ROH_DCB_BITS}, {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_200G_RDMA), HNAE3_DEV_SUPPORT_ROCE_DCB_BITS}, {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_200G_ROH), - HNAE3_DEV_SUPPORT_ROCE_DCB_BITS}, + HNAE3_DEV_SUPPORT_ROCE_ROH_DCB_BITS}, {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_400G_ROH), - HNAE3_DEV_SUPPORT_ROCE_DCB_BITS}, + HNAE3_DEV_SUPPORT_ROCE_ROH_DCB_BITS}, {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_VF), 0}, {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_RDMA_DCB_PFC_VF), HNAE3_DEV_SUPPORT_ROCE_DCB_BITS}, diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index fc372b326a29..23769f075c56 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -11614,8 +11614,10 @@ static int hclge_init_client_instance(struct hnae3_client *client,
break; case HNAE3_CLIENT_ROH: - hdev->roh_client = client; - vport->roh.client = client; + if (hnae3_dev_roh_supported(hdev)) { + hdev->roh_client = client; + vport->roh.client = client; + }
ret = hclge_init_roh_client_instance(ae_dev, vport); if (ret)