Commit d34d0bdb authored by Zhu Yanjun's avatar Zhu Yanjun Committed by Leon Romanovsky
Browse files

RDMA/rxe: Replace netdev dev addr with raw_gid



Because TUN device does not have dev_addr, but a gid in rdma is needed,
as such, a raw_gid is generated to act as the gid. The similar commit is
in SIW. This commit learns from the similar commit bad5b6e3
("RDMA/siw: Fabricate a GID on tun and loopback devices") in SIW.

Signed-off-by: default avatarZhu Yanjun <yanjun.zhu@linux.dev>
Link: https://patch.msgid.link/20250119172831.3123110-2-yanjun.zhu@linux.dev


Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
parent 2014c95a
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -78,8 +78,19 @@ static void rxe_init_device_param(struct rxe_dev *rxe)
	if (!ndev)
		return;

	if (ndev->addr_len) {
		memcpy(rxe->raw_gid, ndev->dev_addr,
			min_t(unsigned int, ndev->addr_len, ETH_ALEN));
	} else {
		/*
		 * This device does not have a HW address, but
		 * connection mangagement requires a unique gid.
		 */
		eth_random_addr(rxe->raw_gid);
	}

	addrconf_addr_eui48((unsigned char *)&rxe->attr.sys_image_guid,
			ndev->dev_addr);
			rxe->raw_gid);

	dev_put(ndev);

@@ -125,7 +136,7 @@ static void rxe_init_ports(struct rxe_dev *rxe)
	if (!ndev)
		return;
	addrconf_addr_eui48((unsigned char *)&port->port_guid,
			    ndev->dev_addr);
			    rxe->raw_gid);
	dev_put(ndev);
	spin_lock_init(&port->port_lock);
}
+1 −1
Original line number Diff line number Diff line
@@ -1523,7 +1523,7 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name,
	dev->num_comp_vectors = num_possible_cpus();
	dev->local_dma_lkey = 0;
	addrconf_addr_eui48((unsigned char *)&dev->node_guid,
			    ndev->dev_addr);
			    rxe->raw_gid);

	dev->uverbs_cmd_mask |= BIT_ULL(IB_USER_VERBS_CMD_POST_SEND) |
				BIT_ULL(IB_USER_VERBS_CMD_REQ_NOTIFY_CQ);
+3 −1
Original line number Diff line number Diff line
@@ -378,6 +378,8 @@ struct rxe_dev {
	int			max_inline_data;
	struct mutex		usdev_lock;

	char			raw_gid[ETH_ALEN];

	struct rxe_pool		uc_pool;
	struct rxe_pool		pd_pool;
	struct rxe_pool		ah_pool;