diff options
author | Leon Romanovsky <leonro@mellanox.com> | 2017-08-17 15:50:39 +0300 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2017-08-24 16:27:10 -0400 |
commit | 82901e3eb8f72326b06ac8c7285462d90cd3a56c (patch) | |
tree | 628fbcec9e95ef13f882d9086cfa8560afe78678 /drivers/infiniband | |
parent | cdc596d89e39521cf412209a19b8baeb8d788cdc (diff) | |
download | talos-obmc-linux-82901e3eb8f72326b06ac8c7285462d90cd3a56c.tar.gz talos-obmc-linux-82901e3eb8f72326b06ac8c7285462d90cd3a56c.zip |
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>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/core/verbs.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index 4c1485e01c83..b29d0ff94463 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c @@ -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_transport_type lt; if (device->get_link_layer) return device->get_link_layer(device, port_num); - switch (rdma_node_get_transport(device->node_type)) { - case RDMA_TRANSPORT_IB: + lt = rdma_node_get_transport(device->node_type); + if (lt == RDMA_TRANSPORT_IB) return IB_LINK_LAYER_INFINIBAND; - case RDMA_TRANSPORT_IWARP: - case RDMA_TRANSPORT_USNIC: - case RDMA_TRANSPORT_USNIC_UDP: - return IB_LINK_LAYER_ETHERNET; - default: - return IB_LINK_LAYER_UNSPECIFIED; - } + + return IB_LINK_LAYER_ETHERNET; } EXPORT_SYMBOL(rdma_port_get_link_layer); |