Skip to content

Commit 675b9d5

Browse files
gal-pressmanSaeed Mahameed
authored andcommitted
net/mlx5e: IPoIB, Improve ethtool rxnfc callback structure in IPoIB
Followup commit 79ce39b ("net/mlx5e: Improve ethtool rxnfc callback structure") and handle CONFIG_MLX5_EN_RXNFC enabled/disabled inside the fs layer so the ethtool callbacks are always available. The fs layer will provide stubs when CONFIG_MLX5_EN_RXNFC is compiled out. Signed-off-by: Gal Pressman <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 597c112 commit 675b9d5

File tree

1 file changed

+10
-4
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/ipoib

1 file changed

+10
-4
lines changed

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ static int mlx5i_get_link_ksettings(struct net_device *netdev,
221221
return 0;
222222
}
223223

224-
#ifdef CONFIG_MLX5_EN_RXNFC
225224
static u32 mlx5i_flow_type_mask(u32 flow_type)
226225
{
227226
return flow_type & ~(FLOW_EXT | FLOW_MAC_EXT | FLOW_RSS);
@@ -243,9 +242,18 @@ static int mlx5i_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
243242
{
244243
struct mlx5e_priv *priv = mlx5i_epriv(dev);
245244

245+
/* ETHTOOL_GRXRINGS is needed by ethtool -x which is not part
246+
* of rxnfc. We keep this logic out of mlx5e_ethtool_get_rxnfc,
247+
* to avoid breaking "ethtool -x" when mlx5e_ethtool_get_rxnfc
248+
* is compiled out via CONFIG_MLX5_EN_RXNFC=n.
249+
*/
250+
if (info->cmd == ETHTOOL_GRXRINGS) {
251+
info->data = priv->channels.params.num_channels;
252+
return 0;
253+
}
254+
246255
return mlx5e_ethtool_get_rxnfc(priv, info, rule_locs);
247256
}
248-
#endif
249257

250258
const struct ethtool_ops mlx5i_ethtool_ops = {
251259
.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
@@ -263,10 +271,8 @@ const struct ethtool_ops mlx5i_ethtool_ops = {
263271
.get_coalesce = mlx5i_get_coalesce,
264272
.set_coalesce = mlx5i_set_coalesce,
265273
.get_ts_info = mlx5i_get_ts_info,
266-
#ifdef CONFIG_MLX5_EN_RXNFC
267274
.get_rxnfc = mlx5i_get_rxnfc,
268275
.set_rxnfc = mlx5i_set_rxnfc,
269-
#endif
270276
.get_link_ksettings = mlx5i_get_link_ksettings,
271277
.get_link = ethtool_op_get_link,
272278
};

0 commit comments

Comments
 (0)