forked from Minki/linux
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: Parav Pandit <parav@mellanox.com> Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
5cda6587fe
commit
c0348eb069
@ -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.
|
||||
|
@ -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);
|
||||
|
@ -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),
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -201,21 +201,6 @@ struct ib_ah *ocrdma_create_ah(struct ib_pd *ibpd, struct rdma_ah_attr *attr,
|
||||
/* Get network header type for this GID */
|
||||
ah->hdr_type = ib_gid_to_network_type(sgid_attr.gid_type, &sgid);
|
||||
|
||||
if ((pd->uctx) &&
|
||||
(!rdma_is_multicast_addr((struct in6_addr *)grh->dgid.raw)) &&
|
||||
(!rdma_link_local_addr((struct in6_addr *)grh->dgid.raw))) {
|
||||
status = rdma_addr_find_l2_eth_by_grh(&sgid, &grh->dgid,
|
||||
attr->roce.dmac,
|
||||
&vlan_tag,
|
||||
&sgid_attr.ndev->ifindex,
|
||||
NULL);
|
||||
if (status) {
|
||||
pr_err("%s(): Failed to resolve dmac from gid."
|
||||
"status = %d\n", __func__, status);
|
||||
goto av_conf_err;
|
||||
}
|
||||
}
|
||||
|
||||
status = set_av_attr(dev, ah, attr, &sgid, pd->id, &isvlan, vlan_tag);
|
||||
if (status)
|
||||
goto av_conf_err;
|
||||
|
@ -3622,8 +3622,6 @@ void ib_drain_rq(struct ib_qp *qp);
|
||||
void ib_drain_sq(struct ib_qp *qp);
|
||||
void ib_drain_qp(struct ib_qp *qp);
|
||||
|
||||
int ib_resolve_eth_dmac(struct ib_device *device,
|
||||
struct rdma_ah_attr *ah_attr);
|
||||
int ib_get_eth_speed(struct ib_device *dev, u8 port_num, u8 *speed, u8 *width);
|
||||
|
||||
static inline u8 *rdma_ah_retrieve_dmac(struct rdma_ah_attr *attr)
|
||||
|
Loading…
Reference in New Issue
Block a user