Commit 58030c76 authored by Mark Zhang's avatar Mark Zhang Committed by Leon Romanovsky

RDMA/cma: Always set static rate to 0 for RoCE

Set static rate to 0 as it should be discovered by path query and
has no meaning for RoCE.
This also avoid of using the rtnl lock and ethtool API, which is
a bottleneck when try to setup many rdma-cm connections at the same
time, especially with multiple processes.

Fixes: 3c86aa70 ("RDMA/cm: Add RDMA CM support for IBoE devices")
Signed-off-by: default avatarMark Zhang <markzhang@nvidia.com>
Link: https://lore.kernel.org/r/f72a4f8b667b803aee9fa794069f61afb5839ce4.1685960567.git.leon@kernel.orgSigned-off-by: default avatarLeon Romanovsky <leon@kernel.org>
parent 2de43f5b
...@@ -3295,7 +3295,7 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv) ...@@ -3295,7 +3295,7 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
route->path_rec->traffic_class = tos; route->path_rec->traffic_class = tos;
route->path_rec->mtu = iboe_get_mtu(ndev->mtu); route->path_rec->mtu = iboe_get_mtu(ndev->mtu);
route->path_rec->rate_selector = IB_SA_EQ; route->path_rec->rate_selector = IB_SA_EQ;
route->path_rec->rate = iboe_get_rate(ndev); route->path_rec->rate = IB_RATE_PORT_CURRENT;
dev_put(ndev); dev_put(ndev);
route->path_rec->packet_life_time_selector = IB_SA_EQ; route->path_rec->packet_life_time_selector = IB_SA_EQ;
/* In case ACK timeout is set, use this value to calculate /* In case ACK timeout is set, use this value to calculate
...@@ -4964,7 +4964,7 @@ static int cma_iboe_join_multicast(struct rdma_id_private *id_priv, ...@@ -4964,7 +4964,7 @@ static int cma_iboe_join_multicast(struct rdma_id_private *id_priv,
if (!ndev) if (!ndev)
return -ENODEV; return -ENODEV;
ib.rec.rate = iboe_get_rate(ndev); ib.rec.rate = IB_RATE_PORT_CURRENT;
ib.rec.hop_limit = 1; ib.rec.hop_limit = 1;
ib.rec.mtu = iboe_get_mtu(ndev->mtu); ib.rec.mtu = iboe_get_mtu(ndev->mtu);
......
...@@ -194,29 +194,6 @@ static inline enum ib_mtu iboe_get_mtu(int mtu) ...@@ -194,29 +194,6 @@ static inline enum ib_mtu iboe_get_mtu(int mtu)
return 0; return 0;
} }
static inline int iboe_get_rate(struct net_device *dev)
{
struct ethtool_link_ksettings cmd;
int err;
rtnl_lock();
err = __ethtool_get_link_ksettings(dev, &cmd);
rtnl_unlock();
if (err)
return IB_RATE_PORT_CURRENT;
if (cmd.base.speed >= 40000)
return IB_RATE_40_GBPS;
else if (cmd.base.speed >= 30000)
return IB_RATE_30_GBPS;
else if (cmd.base.speed >= 20000)
return IB_RATE_20_GBPS;
else if (cmd.base.speed >= 10000)
return IB_RATE_10_GBPS;
else
return IB_RATE_PORT_CURRENT;
}
static inline int rdma_link_local_addr(struct in6_addr *addr) static inline int rdma_link_local_addr(struct in6_addr *addr)
{ {
if (addr->s6_addr32[0] == htonl(0xfe800000) && if (addr->s6_addr32[0] == htonl(0xfe800000) &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment