Skip to content

Commit 8aa5f17

Browse files
dtatuleaSaeed Mahameed
authored andcommitted
net/mlx5e: IPoIB, Show unknown speed instead of error
ethtool is returning an error for unknown speeds for the IPoIB interface: $ ethtool ib0 netlink error: failed to retrieve link settings netlink error: Invalid argument netlink error: failed to retrieve link settings netlink error: Invalid argument Settings for ib0: Link detected: no After this change, ethtool will return success and show "unknown speed": $ ethtool ib0 Settings for ib0: Supported ports: [ ] Supported link modes: Not reported Supported pause frame use: No Supports auto-negotiation: No Supported FEC modes: Not reported Advertised link modes: Not reported Advertised pause frame use: No Advertised auto-negotiation: No Advertised FEC modes: Not reported Speed: Unknown! Duplex: Full Auto-negotiation: off Port: Other PHYAD: 0 Transceiver: internal Link detected: no Fixes: eb234ee ("net/mlx5e: IPoIB, Add support for get_link_ksettings in ethtool") Signed-off-by: Dragos Tatulea <[email protected]> Reviewed-by: Gal Pressman <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 8974aa9 commit 8aa5f17

File tree

1 file changed

+5
-8
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/ipoib

1 file changed

+5
-8
lines changed

drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -189,16 +189,16 @@ static inline int mlx5_ptys_rate_enum_to_int(enum mlx5_ptys_rate rate)
189189
}
190190
}
191191

192-
static int mlx5i_get_speed_settings(u16 ib_link_width_oper, u16 ib_proto_oper)
192+
static u32 mlx5i_get_speed_settings(u16 ib_link_width_oper, u16 ib_proto_oper)
193193
{
194194
int rate, width;
195195

196196
rate = mlx5_ptys_rate_enum_to_int(ib_proto_oper);
197197
if (rate < 0)
198-
return -EINVAL;
198+
return SPEED_UNKNOWN;
199199
width = mlx5_ptys_width_enum_to_int(ib_link_width_oper);
200200
if (width < 0)
201-
return -EINVAL;
201+
return SPEED_UNKNOWN;
202202

203203
return rate * width;
204204
}
@@ -221,16 +221,13 @@ static int mlx5i_get_link_ksettings(struct net_device *netdev,
221221
ethtool_link_ksettings_zero_link_mode(link_ksettings, advertising);
222222

223223
speed = mlx5i_get_speed_settings(ib_link_width_oper, ib_proto_oper);
224-
if (speed < 0)
225-
return -EINVAL;
224+
link_ksettings->base.speed = speed;
225+
link_ksettings->base.duplex = speed == SPEED_UNKNOWN ? DUPLEX_UNKNOWN : DUPLEX_FULL;
226226

227-
link_ksettings->base.duplex = DUPLEX_FULL;
228227
link_ksettings->base.port = PORT_OTHER;
229228

230229
link_ksettings->base.autoneg = AUTONEG_DISABLE;
231230

232-
link_ksettings->base.speed = speed;
233-
234231
return 0;
235232
}
236233

0 commit comments

Comments
 (0)