diff options
author | Amrani, Ram <Ram.Amrani@cavium.com> | 2016-12-26 07:40:57 +0100 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2017-01-24 21:34:22 +0100 |
commit | d3f4aadd614c4627244452ad64eaf351179f2c31 (patch) | |
tree | 05b887462f77741d410c5ee31caabb0489d4ba6c /drivers/infiniband/hw/cxgb4/provider.c | |
parent | IB/vmw_pvrdma: Fix incorrect cleanup on pvrdma_pci_probe error path (diff) | |
download | linux-d3f4aadd614c4627244452ad64eaf351179f2c31.tar.xz linux-d3f4aadd614c4627244452ad64eaf351179f2c31.zip |
RDMA/core: Add the function ib_mtu_int_to_enum
As the functionality to convert the MTU from a number to enum_ib_mtu
is ubiquitous, define a dedicated function and remove the duplicated
code.
Signed-off-by: Ram Amrani <Ram.Amrani@cavium.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/hw/cxgb4/provider.c')
-rw-r--r-- | drivers/infiniband/hw/cxgb4/provider.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/drivers/infiniband/hw/cxgb4/provider.c b/drivers/infiniband/hw/cxgb4/provider.c index fa64f5d93b11..3345e1c312f7 100644 --- a/drivers/infiniband/hw/cxgb4/provider.c +++ b/drivers/infiniband/hw/cxgb4/provider.c @@ -373,16 +373,7 @@ static int c4iw_query_port(struct ib_device *ibdev, u8 port, memset(props, 0, sizeof(struct ib_port_attr)); props->max_mtu = IB_MTU_4096; - if (netdev->mtu >= 4096) - props->active_mtu = IB_MTU_4096; - else if (netdev->mtu >= 2048) - props->active_mtu = IB_MTU_2048; - else if (netdev->mtu >= 1024) - props->active_mtu = IB_MTU_1024; - else if (netdev->mtu >= 512) - props->active_mtu = IB_MTU_512; - else - props->active_mtu = IB_MTU_256; + props->active_mtu = ib_mtu_int_to_enum(netdev->mtu); if (!netif_carrier_ok(netdev)) props->state = IB_PORT_DOWN; |