Unverified Commit b93f7156 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!2592 Add support for RDMA VF over UBL

Merge Pull Request from: @stinft 
 
Upload two patchs to support RDMA VF over UBLink.
For RDMA over UB Link mode, UB Link replaces the current Ethernet. Add a new ARP protocol HW ID 38 and enable CM link building and netdevice event for this mode.

Chengchang Tang (1):
   RDMA/hns: Add support for RDMA VF over UBL
 Yangyang Li (1):
   RDMA/core: Add support for the new ARPHRD_UB

https://gitee.com/openeuler/kernel/issues/I8AL44 
 
Link:https://gitee.com/openeuler/kernel/pulls/2592

 

Reviewed-by: default avatarChengchang Tang <tangchengchang@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents eafc34bb 67fc1055
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -582,7 +582,8 @@ cma_validate_port(struct ib_device *device, u8 port,
	if ((dev_type != ARPHRD_INFINIBAND) && rdma_protocol_ib(device, port))
		return ERR_PTR(-ENODEV);

	if (dev_type == ARPHRD_ETHER && rdma_protocol_roce(device, port)) {
	if ((dev_type == ARPHRD_ETHER || dev_type == ARPHRD_UB)
	    && rdma_protocol_roce(device, port)) {
		ndev = dev_get_by_index(dev_addr->net, bound_if_index);
		if (!ndev)
			return ERR_PTR(-ENODEV);
+2 −2
Original line number Diff line number Diff line
@@ -754,7 +754,7 @@ static int netdevice_event(struct notifier_block *this, unsigned long event,
	struct net_device *ndev = netdev_notifier_info_to_dev(ptr);
	struct netdev_event_work_cmd cmds[ROCE_NETDEV_CALLBACK_SZ] = { {NULL} };

	if (ndev->type != ARPHRD_ETHER)
	if (ndev->type != ARPHRD_ETHER && ndev->type != ARPHRD_UB)
		return NOTIFY_DONE;

	switch (event) {
@@ -820,7 +820,7 @@ static int addr_event(struct notifier_block *this, unsigned long event,
	struct update_gid_event_work *work;
	enum gid_op_type gid_op;

	if (ndev->type != ARPHRD_ETHER)
	if (ndev->type != ARPHRD_ETHER && ndev->type != ARPHRD_UB)
		return NOTIFY_DONE;

	switch (event) {
+28 −4
Original line number Diff line number Diff line
@@ -3406,7 +3406,9 @@ 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)
			if (hr_dev->mac_type == HNAE3_MAC_ROH ||
			    hr_dev->pci_dev->device ==
				HNAE3_DEV_ID_RDMA_OVER_UBL_VF)
				return -EPERM;
			sgid_type = GID_TYPE_FLAG_ROCE_V1;
		}
@@ -7191,6 +7193,27 @@ 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_roce_ubl_tbl[] = {
	{ PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_RDMA_OVER_UBL_VF),
	  HNAE3_DEV_SUPPORT_ROCE_DCB_BITS },

	/* required last entry */
	{0, }
};

MODULE_DEVICE_TABLE(pci, hns_roce_ubl_tbl);

static const struct pci_device_id *get_pci_device_id(struct pci_dev *pci_dev)
{
	const struct pci_device_id *id;

	id = pci_match_id(hns_roce_hw_v2_pci_tbl, pci_dev);
	if (id)
		return id;

	return pci_match_id(hns_roce_ubl_tbl, pci_dev);
}

static void hns_roce_hw_v2_get_cfg(struct hns_roce_dev *hr_dev,
				  struct hnae3_handle *handle)
{
@@ -7199,7 +7222,7 @@ static void hns_roce_hw_v2_get_cfg(struct hns_roce_dev *hr_dev,
	int i;

	hr_dev->pci_dev = handle->pdev;
	id = pci_match_id(hns_roce_hw_v2_pci_tbl, hr_dev->pci_dev);
	id = get_pci_device_id(hr_dev->pci_dev);
	hr_dev->is_vf = id->driver_data;
	hr_dev->dev = &handle->pdev->dev;
	hr_dev->hw = &hns_roce_hw_v2;
@@ -7246,8 +7269,9 @@ static bool check_vf_support(struct pci_dev *vf)
	handle = &hdev->vport[0].roce;
	hr_dev = handle->priv;

	/* In UB link vf can not find the pf device */
	if (!hr_dev)
		return false;
		return true;

	bond_grp = hns_roce_get_bond_grp(get_hr_netdev(hr_dev, 0),
					 pf->bus->number);
@@ -7344,7 +7368,7 @@ static int hns_roce_hw_v2_init_instance(struct hnae3_handle *handle)
		goto reset_chk_err;
	}

	id = pci_match_id(hns_roce_hw_v2_pci_tbl, handle->pdev);
	id = get_pci_device_id(handle->pdev);
	if (!id)
		return 0;

+2 −0
Original line number Diff line number Diff line
@@ -732,6 +732,8 @@ static int hns_roce_port_immutable(struct ib_device *ib_dev, u8 port_num,

	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)->pci_dev->device == HNAE3_DEV_ID_RDMA_OVER_UBL_VF)
		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;