Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c0348eb0 authored by Parav Pandit's avatar Parav Pandit Committed by Doug Ledford
Browse files

IB: Let ib_core resolve destination mac address



Since IB/core resolves the destination mac address for user and kernel
consumers, avoid resolving in multiple provider drivers.

Only ib_core resolves DMAC now, therefore resolve_eth_dmac is removed as
exported symbol.

Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 5cda6587
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -53,6 +53,9 @@

#include "core_priv.h"

static int ib_resolve_eth_dmac(struct ib_device *device,
			       struct rdma_ah_attr *ah_attr);

static const char * const ib_events[] = {
	[IB_EVENT_CQ_ERR]		= "CQ error",
	[IB_EVENT_QP_FATAL]		= "QP fatal error",
@@ -1257,7 +1260,7 @@ int ib_modify_qp_is_ok(enum ib_qp_state cur_state, enum ib_qp_state next_state,
}
EXPORT_SYMBOL(ib_modify_qp_is_ok);

int ib_resolve_eth_dmac(struct ib_device *device,
static int ib_resolve_eth_dmac(struct ib_device *device,
			       struct rdma_ah_attr *ah_attr)
{
	int           ret = 0;
@@ -1317,7 +1320,6 @@ int ib_resolve_eth_dmac(struct ib_device *device,
out:
	return ret;
}
EXPORT_SYMBOL(ib_resolve_eth_dmac);

/**
 * ib_modify_qp_with_udata - Modifies the attributes for the specified QP.
+0 −8
Original line number Diff line number Diff line
@@ -729,14 +729,6 @@ struct ib_ah *bnxt_re_create_ah(struct ib_pd *ib_pd,
			ah->qplib_ah.nw_type = CMDQ_CREATE_AH_TYPE_V1;
			break;
		}
		rc = rdma_addr_find_l2_eth_by_grh(&sgid, &grh->dgid,
						  ah_attr->roce.dmac, &vlan_tag,
						  &sgid_attr.ndev->ifindex,
						  NULL);
		if (rc) {
			dev_err(rdev_to_dev(rdev), "Failed to get dmac\n");
			goto fail;
		}
	}

	memcpy(ah->qplib_ah.dmac, ah_attr->roce.dmac, ETH_ALEN);
+1 −13
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@ struct ib_ah *hns_roce_create_ah(struct ib_pd *ibpd,
	struct ib_gid_attr gid_attr;
	struct hns_roce_ah *ah;
	u16 vlan_tag = 0xffff;
	struct in6_addr in6;
	const struct ib_global_route *grh = rdma_ah_read_grh(ah_attr);
	union ib_gid sgid;
	int ret;
@@ -58,18 +57,7 @@ struct ib_ah *hns_roce_create_ah(struct ib_pd *ibpd,
		return ERR_PTR(-ENOMEM);

	/* Get mac address */
	memcpy(&in6, grh->dgid.raw, sizeof(grh->dgid.raw));
	if (rdma_is_multicast_addr(&in6)) {
		rdma_get_mcast_mac(&in6, ah->av.mac);
	} else {
		u8 *dmac = rdma_ah_retrieve_dmac(ah_attr);

		if (!dmac) {
			kfree(ah);
			return ERR_PTR(-EINVAL);
		}
		memcpy(ah->av.mac, dmac, ETH_ALEN);
	}
	memcpy(ah->av.mac, ah_attr->roce.dmac, ETH_ALEN);

	/* Get source gid */
	ret = ib_get_cached_gid(ibpd->device, rdma_ah_get_port_num(ah_attr),
+3 −5
Original line number Diff line number Diff line
@@ -92,12 +92,10 @@ static struct ib_ah *create_iboe_ah(struct ib_pd *pd,
	int ret;

	memcpy(&in6, grh->dgid.raw, sizeof(in6));
	if (rdma_is_multicast_addr(&in6)) {
	if (rdma_is_multicast_addr(&in6))
		is_mcast = 1;
		rdma_get_mcast_mac(&in6, ah->av.eth.mac);
	} else {

	memcpy(ah->av.eth.mac, ah_attr->roce.dmac, ETH_ALEN);
	}
	ret = ib_get_cached_gid(pd->device, rdma_ah_get_port_num(ah_attr),
				grh->sgid_index, &sgid, &gid_attr);
	if (ret)
+0 −4
Original line number Diff line number Diff line
@@ -89,10 +89,6 @@ struct ib_ah *mlx5_ib_create_ah(struct ib_pd *pd, struct rdma_ah_attr *ah_attr,

		resp.response_length = min_resp_len;

		err = ib_resolve_eth_dmac(pd->device, ah_attr);
		if (err)
			return ERR_PTR(err);

		memcpy(resp.dmac, ah_attr->roce.dmac, ETH_ALEN);
		err = ib_copy_to_udata(udata, &resp, resp.response_length);
		if (err)
Loading