| .. | .. |
|---|
| 130 | 130 | return mlx5e_ethtool_flash_device(priv, flash); |
|---|
| 131 | 131 | } |
|---|
| 132 | 132 | |
|---|
| 133 | | -enum mlx5_ptys_width { |
|---|
| 134 | | - MLX5_PTYS_WIDTH_1X = 1 << 0, |
|---|
| 135 | | - MLX5_PTYS_WIDTH_2X = 1 << 1, |
|---|
| 136 | | - MLX5_PTYS_WIDTH_4X = 1 << 2, |
|---|
| 137 | | - MLX5_PTYS_WIDTH_8X = 1 << 3, |
|---|
| 138 | | - MLX5_PTYS_WIDTH_12X = 1 << 4, |
|---|
| 139 | | -}; |
|---|
| 140 | | - |
|---|
| 141 | 133 | static inline int mlx5_ptys_width_enum_to_int(enum mlx5_ptys_width width) |
|---|
| 142 | 134 | { |
|---|
| 143 | 135 | switch (width) { |
|---|
| .. | .. |
|---|
| 174 | 166 | } |
|---|
| 175 | 167 | } |
|---|
| 176 | 168 | |
|---|
| 177 | | -static int mlx5i_get_port_settings(struct net_device *netdev, |
|---|
| 178 | | - u16 *ib_link_width_oper, u16 *ib_proto_oper) |
|---|
| 179 | | -{ |
|---|
| 180 | | - struct mlx5e_priv *priv = mlx5i_epriv(netdev); |
|---|
| 181 | | - struct mlx5_core_dev *mdev = priv->mdev; |
|---|
| 182 | | - u32 out[MLX5_ST_SZ_DW(ptys_reg)] = {0}; |
|---|
| 183 | | - int ret; |
|---|
| 184 | | - |
|---|
| 185 | | - ret = mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_IB, 1); |
|---|
| 186 | | - if (ret) |
|---|
| 187 | | - return ret; |
|---|
| 188 | | - |
|---|
| 189 | | - *ib_link_width_oper = MLX5_GET(ptys_reg, out, ib_link_width_oper); |
|---|
| 190 | | - *ib_proto_oper = MLX5_GET(ptys_reg, out, ib_proto_oper); |
|---|
| 191 | | - |
|---|
| 192 | | - return 0; |
|---|
| 193 | | -} |
|---|
| 194 | | - |
|---|
| 195 | | -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) |
|---|
| 196 | 170 | { |
|---|
| 197 | 171 | int rate, width; |
|---|
| 198 | 172 | |
|---|
| 199 | 173 | rate = mlx5_ptys_rate_enum_to_int(ib_proto_oper); |
|---|
| 200 | 174 | if (rate < 0) |
|---|
| 201 | | - return -EINVAL; |
|---|
| 175 | + return SPEED_UNKNOWN; |
|---|
| 202 | 176 | width = mlx5_ptys_width_enum_to_int(ib_link_width_oper); |
|---|
| 203 | 177 | if (width < 0) |
|---|
| 204 | | - return -EINVAL; |
|---|
| 178 | + return SPEED_UNKNOWN; |
|---|
| 205 | 179 | |
|---|
| 206 | 180 | return rate * width; |
|---|
| 207 | 181 | } |
|---|
| .. | .. |
|---|
| 209 | 183 | static int mlx5i_get_link_ksettings(struct net_device *netdev, |
|---|
| 210 | 184 | struct ethtool_link_ksettings *link_ksettings) |
|---|
| 211 | 185 | { |
|---|
| 186 | + struct mlx5e_priv *priv = mlx5i_epriv(netdev); |
|---|
| 187 | + struct mlx5_core_dev *mdev = priv->mdev; |
|---|
| 212 | 188 | u16 ib_link_width_oper; |
|---|
| 213 | 189 | u16 ib_proto_oper; |
|---|
| 214 | 190 | int speed, ret; |
|---|
| 215 | 191 | |
|---|
| 216 | | - ret = mlx5i_get_port_settings(netdev, &ib_link_width_oper, &ib_proto_oper); |
|---|
| 192 | + ret = mlx5_query_ib_port_oper(mdev, &ib_link_width_oper, &ib_proto_oper, |
|---|
| 193 | + 1); |
|---|
| 217 | 194 | if (ret) |
|---|
| 218 | 195 | return ret; |
|---|
| 219 | 196 | |
|---|
| .. | .. |
|---|
| 221 | 198 | ethtool_link_ksettings_zero_link_mode(link_ksettings, advertising); |
|---|
| 222 | 199 | |
|---|
| 223 | 200 | speed = mlx5i_get_speed_settings(ib_link_width_oper, ib_proto_oper); |
|---|
| 224 | | - if (speed < 0) |
|---|
| 225 | | - return -EINVAL; |
|---|
| 201 | + link_ksettings->base.speed = speed; |
|---|
| 202 | + link_ksettings->base.duplex = speed == SPEED_UNKNOWN ? DUPLEX_UNKNOWN : DUPLEX_FULL; |
|---|
| 226 | 203 | |
|---|
| 227 | | - link_ksettings->base.duplex = DUPLEX_FULL; |
|---|
| 228 | 204 | link_ksettings->base.port = PORT_OTHER; |
|---|
| 229 | 205 | |
|---|
| 230 | 206 | link_ksettings->base.autoneg = AUTONEG_DISABLE; |
|---|
| 231 | | - |
|---|
| 232 | | - link_ksettings->base.speed = speed; |
|---|
| 233 | 207 | |
|---|
| 234 | 208 | return 0; |
|---|
| 235 | 209 | } |
|---|
| 236 | 210 | |
|---|
| 237 | 211 | const struct ethtool_ops mlx5i_ethtool_ops = { |
|---|
| 212 | + .supported_coalesce_params = ETHTOOL_COALESCE_USECS | |
|---|
| 213 | + ETHTOOL_COALESCE_MAX_FRAMES | |
|---|
| 214 | + ETHTOOL_COALESCE_USE_ADAPTIVE, |
|---|
| 238 | 215 | .get_drvinfo = mlx5i_get_drvinfo, |
|---|
| 239 | 216 | .get_strings = mlx5i_get_strings, |
|---|
| 240 | 217 | .get_sset_count = mlx5i_get_sset_count, |
|---|