RDMA/core: Refactor get link layer wrapper
The return values from rdma_node_get_transport() are strict and IB_LINK_LAYER_UNSPECIFIED is unreachable in this flow. Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:

committed by
Doug Ledford

parent
cdc596d89e
commit
82901e3eb8
@@ -194,19 +194,15 @@ EXPORT_SYMBOL(rdma_node_get_transport);
|
|||||||
|
|
||||||
enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device, u8 port_num)
|
enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device, u8 port_num)
|
||||||
{
|
{
|
||||||
|
enum rdma_transport_type lt;
|
||||||
if (device->get_link_layer)
|
if (device->get_link_layer)
|
||||||
return device->get_link_layer(device, port_num);
|
return device->get_link_layer(device, port_num);
|
||||||
|
|
||||||
switch (rdma_node_get_transport(device->node_type)) {
|
lt = rdma_node_get_transport(device->node_type);
|
||||||
case RDMA_TRANSPORT_IB:
|
if (lt == RDMA_TRANSPORT_IB)
|
||||||
return IB_LINK_LAYER_INFINIBAND;
|
return IB_LINK_LAYER_INFINIBAND;
|
||||||
case RDMA_TRANSPORT_IWARP:
|
|
||||||
case RDMA_TRANSPORT_USNIC:
|
return IB_LINK_LAYER_ETHERNET;
|
||||||
case RDMA_TRANSPORT_USNIC_UDP:
|
|
||||||
return IB_LINK_LAYER_ETHERNET;
|
|
||||||
default:
|
|
||||||
return IB_LINK_LAYER_UNSPECIFIED;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(rdma_port_get_link_layer);
|
EXPORT_SYMBOL(rdma_port_get_link_layer);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user