hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c
....@@ -166,16 +166,16 @@
166166 }
167167 }
168168
169
-static int mlx5i_get_speed_settings(u16 ib_link_width_oper, u16 ib_proto_oper)
169
+static u32 mlx5i_get_speed_settings(u16 ib_link_width_oper, u16 ib_proto_oper)
170170 {
171171 int rate, width;
172172
173173 rate = mlx5_ptys_rate_enum_to_int(ib_proto_oper);
174174 if (rate < 0)
175
- return -EINVAL;
175
+ return SPEED_UNKNOWN;
176176 width = mlx5_ptys_width_enum_to_int(ib_link_width_oper);
177177 if (width < 0)
178
- return -EINVAL;
178
+ return SPEED_UNKNOWN;
179179
180180 return rate * width;
181181 }
....@@ -198,15 +198,12 @@
198198 ethtool_link_ksettings_zero_link_mode(link_ksettings, advertising);
199199
200200 speed = mlx5i_get_speed_settings(ib_link_width_oper, ib_proto_oper);
201
- if (speed < 0)
202
- return -EINVAL;
201
+ link_ksettings->base.speed = speed;
202
+ link_ksettings->base.duplex = speed == SPEED_UNKNOWN ? DUPLEX_UNKNOWN : DUPLEX_FULL;
203203
204
- link_ksettings->base.duplex = DUPLEX_FULL;
205204 link_ksettings->base.port = PORT_OTHER;
206205
207206 link_ksettings->base.autoneg = AUTONEG_DISABLE;
208
-
209
- link_ksettings->base.speed = speed;
210207
211208 return 0;
212209 }