Commit 5f0368ca authored by Chengchang Tang's avatar Chengchang Tang Committed by Ke Chen
Browse files

RDMA/hns: Support for ROH

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



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

This patch add Support for ROH.

Signed-off-by: default avatarChengchang Tang <tangchengchang@huawei.com>
parent 77efec93
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1108,6 +1108,7 @@ struct hns_roce_dev {
	struct hns_roce_hem_table  gmv_table;

	int			cmd_mod;
	u8			mac_type;
	int			loop_idc;
	u32			sdb_offset;
	u32			odb_offset;
+16 −0
Original line number Diff line number Diff line
@@ -3377,6 +3377,8 @@ static int hns_roce_v2_set_gid(struct hns_roce_dev *hr_dev, int gid_index,
			else
				sgid_type = GID_TYPE_FLAG_ROCE_V2_IPV6;
		} else if (attr->gid_type == IB_GID_TYPE_ROCE) {
			if (hr_dev->mac_type == HNAE3_MAC_ROH)
				return -EPERM;
			sgid_type = GID_TYPE_FLAG_ROCE_V1;
		}
	}
@@ -7191,6 +7193,16 @@ static const struct pci_device_id hns_roce_hw_v2_pci_tbl[] = {

MODULE_DEVICE_TABLE(pci, hns_roce_hw_v2_pci_tbl);

static const struct pci_device_id hns_roh_pci_tbl[] = {
	{ PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_100G_ROH), 0 },
	{ PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_200G_ROH), 0 },
	{ PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_400G_ROH), 0 },

	/* required last entry */
	{0, }
};
MODULE_DEVICE_TABLE(pci, hns_roh_pci_tbl);

static void hns_roce_hw_v2_get_cfg(struct hns_roce_dev *hr_dev,
				  struct hnae3_handle *handle)
{
@@ -7220,6 +7232,10 @@ static void hns_roce_hw_v2_get_cfg(struct hns_roce_dev *hr_dev,
		hr_dev->irq[i] = pci_irq_vector(handle->pdev,
						i + handle->rinfo.base_vector);

	id = pci_match_id(hns_roh_pci_tbl, hr_dev->pci_dev);
	if (id)
		hr_dev->mac_type = HNAE3_MAC_ROH;

	/* cmd issue mode: 0 is poll, 1 is event */
	hr_dev->cmd_mod = 1;
	hr_dev->loop_idc = 0;
+8 −3
Original line number Diff line number Diff line
@@ -731,9 +731,14 @@ static int hns_roce_port_immutable(struct ib_device *ib_dev, u32 port_num,
	immutable->gid_tbl_len = attr.gid_tbl_len;

	immutable->max_mad_size = IB_MGMT_MAD_SIZE;

	if (to_hr_dev(ib_dev)->mac_type == HNAE3_MAC_ROH)
		immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE_UDP_ENCAP;
	else if (to_hr_dev(ib_dev)->caps.flags & HNS_ROCE_CAP_FLAG_ROCE_V1_V2)
		immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE |
					    RDMA_CORE_PORT_IBA_ROCE_UDP_ENCAP;
	else
		immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE;
	if (to_hr_dev(ib_dev)->caps.flags & HNS_ROCE_CAP_FLAG_ROCE_V1_V2)
		immutable->core_cap_flags |= RDMA_CORE_PORT_IBA_ROCE_UDP_ENCAP;

	return 0;
}