| .. | .. |
|---|
| 166 | 166 | } |
|---|
| 167 | 167 | } |
|---|
| 168 | 168 | |
|---|
| 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) |
|---|
| 170 | 170 | { |
|---|
| 171 | 171 | int rate, width; |
|---|
| 172 | 172 | |
|---|
| 173 | 173 | rate = mlx5_ptys_rate_enum_to_int(ib_proto_oper); |
|---|
| 174 | 174 | if (rate < 0) |
|---|
| 175 | | - return -EINVAL; |
|---|
| 175 | + return SPEED_UNKNOWN; |
|---|
| 176 | 176 | width = mlx5_ptys_width_enum_to_int(ib_link_width_oper); |
|---|
| 177 | 177 | if (width < 0) |
|---|
| 178 | | - return -EINVAL; |
|---|
| 178 | + return SPEED_UNKNOWN; |
|---|
| 179 | 179 | |
|---|
| 180 | 180 | return rate * width; |
|---|
| 181 | 181 | } |
|---|
| .. | .. |
|---|
| 198 | 198 | ethtool_link_ksettings_zero_link_mode(link_ksettings, advertising); |
|---|
| 199 | 199 | |
|---|
| 200 | 200 | 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; |
|---|
| 203 | 203 | |
|---|
| 204 | | - link_ksettings->base.duplex = DUPLEX_FULL; |
|---|
| 205 | 204 | link_ksettings->base.port = PORT_OTHER; |
|---|
| 206 | 205 | |
|---|
| 207 | 206 | link_ksettings->base.autoneg = AUTONEG_DISABLE; |
|---|
| 208 | | - |
|---|
| 209 | | - link_ksettings->base.speed = speed; |
|---|
| 210 | 207 | |
|---|
| 211 | 208 | return 0; |
|---|
| 212 | 209 | } |
|---|