IB/cma: Use rdma_protocol_roce() and remove cma_protocol_roce_dev_port()
rdma_protocol_roce() API from the ib_core already provides a way to detect whether a given device+port is RoCE or not. Therefore, make use of it and avoid implementing it again in rdmacm module. Reviewed-by: Daniel Jurgens <danielj@mellanox.com> Signed-off-by: Parav Pandit <parav@mellanox.com> Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
Родитель
563c4ba3bd
Коммит
5ac08a3413
|
@ -1407,21 +1407,12 @@ static bool cma_match_private_data(struct rdma_id_private *id_priv,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool cma_protocol_roce_dev_port(struct ib_device *device, int port_num)
|
|
||||||
{
|
|
||||||
enum rdma_link_layer ll = rdma_port_get_link_layer(device, port_num);
|
|
||||||
enum rdma_transport_type transport =
|
|
||||||
rdma_node_get_transport(device->node_type);
|
|
||||||
|
|
||||||
return ll == IB_LINK_LAYER_ETHERNET && transport == RDMA_TRANSPORT_IB;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool cma_protocol_roce(const struct rdma_cm_id *id)
|
static bool cma_protocol_roce(const struct rdma_cm_id *id)
|
||||||
{
|
{
|
||||||
struct ib_device *device = id->device;
|
struct ib_device *device = id->device;
|
||||||
const int port_num = id->port_num ?: rdma_start_port(device);
|
const int port_num = id->port_num ?: rdma_start_port(device);
|
||||||
|
|
||||||
return cma_protocol_roce_dev_port(device, port_num);
|
return rdma_protocol_roce(device, port_num);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool cma_match_net_dev(const struct rdma_cm_id *id,
|
static bool cma_match_net_dev(const struct rdma_cm_id *id,
|
||||||
|
@ -1434,7 +1425,7 @@ static bool cma_match_net_dev(const struct rdma_cm_id *id,
|
||||||
/* This request is an AF_IB request or a RoCE request */
|
/* This request is an AF_IB request or a RoCE request */
|
||||||
return (!id->port_num || id->port_num == port_num) &&
|
return (!id->port_num || id->port_num == port_num) &&
|
||||||
(addr->src_addr.ss_family == AF_IB ||
|
(addr->src_addr.ss_family == AF_IB ||
|
||||||
cma_protocol_roce_dev_port(id->device, port_num));
|
rdma_protocol_roce(id->device, port_num));
|
||||||
|
|
||||||
return !addr->dev_addr.bound_dev_if ||
|
return !addr->dev_addr.bound_dev_if ||
|
||||||
(net_eq(dev_net(net_dev), addr->dev_addr.net) &&
|
(net_eq(dev_net(net_dev), addr->dev_addr.net) &&
|
||||||
|
@ -1489,7 +1480,7 @@ static struct rdma_id_private *cma_id_from_event(struct ib_cm_id *cm_id,
|
||||||
if (PTR_ERR(*net_dev) == -EAFNOSUPPORT) {
|
if (PTR_ERR(*net_dev) == -EAFNOSUPPORT) {
|
||||||
/* Assuming the protocol is AF_IB */
|
/* Assuming the protocol is AF_IB */
|
||||||
*net_dev = NULL;
|
*net_dev = NULL;
|
||||||
} else if (cma_protocol_roce_dev_port(req.device, req.port)) {
|
} else if (rdma_protocol_roce(req.device, req.port)) {
|
||||||
/* TODO find the net dev matching the request parameters
|
/* TODO find the net dev matching the request parameters
|
||||||
* through the RoCE GID table */
|
* through the RoCE GID table */
|
||||||
*net_dev = NULL;
|
*net_dev = NULL;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче