Commit 631518bf authored by Fengyan Mu's avatar Fengyan Mu Committed by Fengyan
Browse files

UNIC: Support identify UBL device through device id

driver inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I850RQ


CVE: NA

----------------------------------------------------------

The hns3 driver add the ability that support identifying device
which is over UB Link through the new device id including physical
device and virtual device.

Signed-off-by: default avatarFengyan Mu <mufengyan@hisilicon.com>
Signed-off-by: default avatarJunxin Chen <chenjunxin1@huawei.com>
parent eb44201e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2757,6 +2757,7 @@ CONFIG_HNS3_HCLGE=m
CONFIG_HNS3_DCB=y
CONFIG_HNS3_HCLGEVF=m
CONFIG_HNS3_ENET=m
CONFIG_HNS3_UBL=y
CONFIG_NET_VENDOR_HUAWEI=y
CONFIG_HINIC=m
CONFIG_HINIC3=m
+10 −0
Original line number Diff line number Diff line
@@ -139,6 +139,16 @@ config HNS3_ENET
	  family of SoCs. This module depends upon HNAE3 driver to access the HNAE3
	  devices and their associated operations.

config HNS3_UBL
	bool "Hisilicon HNS3 UB Link Device Support"
	default n
	depends on UBL
	help
	  This selects the HNS UBL support which depends upon configuration UBL.
	  It is needed by Hisilicon Network Subsystem 3 to use the UB Link and
	  its associated operations.
	  Say N if using non-UB device and network.

endif #HNS3

endif # NET_VENDOR_HISILICON
+23 −0
Original line number Diff line number Diff line
@@ -58,6 +58,10 @@
#define HNAE3_DEV_ID_400G_ROH			0xA22D
#define HNAE3_DEV_ID_VF				0xA22E
#define HNAE3_DEV_ID_RDMA_DCB_PFC_VF		0xA22F
#define HNAE3_DEV_ID_UDMA_OVER_UBL		0xA260
#define HNAE3_DEV_ID_RDMA_OVER_UBL		0xA262
#define HNAE3_DEV_ID_UDMA_OVER_UBL_VF		0xA268
#define HNAE3_DEV_ID_RDMA_OVER_UBL_VF		0xA26A

#define HNAE3_CLASS_NAME_SIZE 16

@@ -68,10 +72,29 @@
#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_UDMA_B		0x8
#define HNAE3_DEV_SUPPORT_UBL_B			0x9

#define HNAE3_DEV_SUPPORT_ROCE_DCB_BITS (BIT(HNAE3_DEV_SUPPORT_DCB_B) | \
		BIT(HNAE3_DEV_SUPPORT_ROCE_B))

#define HNAE3_DEV_SUPPORT_UDMA_OVER_UBL_DCB_BITS \
		(BIT(HNAE3_DEV_SUPPORT_DCB_B) | BIT(HNAE3_DEV_SUPPORT_UDMA_B) | \
		 BIT(HNAE3_DEV_SUPPORT_UBL_B))

#define HNAE3_DEV_SUPPORT_ROCE_OVER_UBL_DCB_BITS \
		(BIT(HNAE3_DEV_SUPPORT_DCB_B) | BIT(HNAE3_DEV_SUPPORT_ROCE_B) | \
		 BIT(HNAE3_DEV_SUPPORT_UBL_B))

#define HNAE3_DEV_SUPPORT_UDMA_DCB_BITS \
		(BIT(HNAE3_DEV_SUPPORT_DCB_B) | BIT(HNAE3_DEV_SUPPORT_UDMA_B))

#define hnae3_dev_udma_supported(ae_dev) \
	hnae3_get_bit((ae_dev)->flag, HNAE3_DEV_SUPPORT_UDMA_B)

#define hnae3_dev_ubl_supported(ae_dev) \
	hnae3_get_bit((ae_dev)->flag, HNAE3_DEV_SUPPORT_UBL_B)

#define hnae3_dev_roh_supported(hdev) \
	hnae3_get_bit((hdev)->ae_dev->flag, HNAE3_ROH_CLIENT_INITED_B)

+18 −0
Original line number Diff line number Diff line
@@ -106,6 +106,16 @@ static const struct pci_device_id hns3_pci_tbl[] = {
	{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_VF), 0},
	{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_RDMA_DCB_PFC_VF),
	 HNAE3_DEV_SUPPORT_ROCE_DCB_BITS},
#ifdef CONFIG_HNS3_UBL
	{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_UDMA_OVER_UBL),
	 HNAE3_DEV_SUPPORT_UDMA_OVER_UBL_DCB_BITS},
	{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_RDMA_OVER_UBL),
	 HNAE3_DEV_SUPPORT_ROCE_OVER_UBL_DCB_BITS},
	{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_UDMA_OVER_UBL_VF),
	 HNAE3_DEV_SUPPORT_UDMA_OVER_UBL_DCB_BITS},
	{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_RDMA_OVER_UBL_VF),
	 HNAE3_DEV_SUPPORT_ROCE_OVER_UBL_DCB_BITS},
#endif
	/* required last entry */
	{0,}
};
@@ -3296,9 +3306,17 @@ bool hns3_is_phys_func(struct pci_dev *pdev)
	case HNAE3_DEV_ID_200G_RDMA:
	case HNAE3_DEV_ID_200G_ROH:
	case HNAE3_DEV_ID_400G_ROH:
#ifdef CONFIG_HNS3_UBL
	case HNAE3_DEV_ID_UDMA_OVER_UBL:
	case HNAE3_DEV_ID_RDMA_OVER_UBL:
#endif
		return true;
	case HNAE3_DEV_ID_VF:
	case HNAE3_DEV_ID_RDMA_DCB_PFC_VF:
#ifdef CONFIG_HNS3_UBL
	case HNAE3_DEV_ID_UDMA_OVER_UBL_VF:
	case HNAE3_DEV_ID_RDMA_OVER_UBL_VF:
#endif
		return false;
	default:
		dev_warn(&pdev->dev, "un-recognized pci device-id %u",
+3 −0
Original line number Diff line number Diff line
@@ -746,6 +746,9 @@ static inline unsigned int hns3_page_order(struct hns3_enet_ring *ring)
	return 0;
}

#define hns3_ubl_supported(handle) \
	hnae3_dev_ubl_supported((struct hnae3_ae_dev *)pci_get_drvdata((handle)->pdev))

#define hns3_page_size(_ring) (PAGE_SIZE << hns3_page_order(_ring))

/* iterator for handling rings in ring group */
Loading