mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-24 17:23:25 -05:00
net: rdma: use __ethtool_get_ksettings
Signed-off-by: David Decotigny <decot@googlers.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
008eb73693
commit
17605b961f
1 changed files with 6 additions and 8 deletions
|
@ -262,24 +262,22 @@ static inline enum ib_mtu iboe_get_mtu(int mtu)
|
|||
|
||||
static inline int iboe_get_rate(struct net_device *dev)
|
||||
{
|
||||
struct ethtool_cmd cmd;
|
||||
u32 speed;
|
||||
struct ethtool_link_ksettings cmd;
|
||||
int err;
|
||||
|
||||
rtnl_lock();
|
||||
err = __ethtool_get_settings(dev, &cmd);
|
||||
err = __ethtool_get_link_ksettings(dev, &cmd);
|
||||
rtnl_unlock();
|
||||
if (err)
|
||||
return IB_RATE_PORT_CURRENT;
|
||||
|
||||
speed = ethtool_cmd_speed(&cmd);
|
||||
if (speed >= 40000)
|
||||
if (cmd.base.speed >= 40000)
|
||||
return IB_RATE_40_GBPS;
|
||||
else if (speed >= 30000)
|
||||
else if (cmd.base.speed >= 30000)
|
||||
return IB_RATE_30_GBPS;
|
||||
else if (speed >= 20000)
|
||||
else if (cmd.base.speed >= 20000)
|
||||
return IB_RATE_20_GBPS;
|
||||
else if (speed >= 10000)
|
||||
else if (cmd.base.speed >= 10000)
|
||||
return IB_RATE_10_GBPS;
|
||||
else
|
||||
return IB_RATE_PORT_CURRENT;
|
||||
|
|
Loading…
Add table
Reference in a new issue