Commit 7524a5d8 authored by Gal Pressman's avatar Gal Pressman Committed by David S. Miller

net/mlx5e: Don't try to modify CQ moderation if it is not supported

If CQ moderation is not supported by the device, print a warning on
netdevice load, and return error when trying to modify/query cq
moderation via ethtool.

Fixes: f62b8bb8 ('net/mlx5: Extend mlx5_core to support ConnectX-4
Ethernet functionality')
Signed-off-by: default avatarGal Pressman <galp@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 556dd1b9
...@@ -400,6 +400,9 @@ static int mlx5e_get_coalesce(struct net_device *netdev, ...@@ -400,6 +400,9 @@ static int mlx5e_get_coalesce(struct net_device *netdev,
{ {
struct mlx5e_priv *priv = netdev_priv(netdev); struct mlx5e_priv *priv = netdev_priv(netdev);
if (!MLX5_CAP_GEN(priv->mdev, cq_moderation))
return -ENOTSUPP;
coal->rx_coalesce_usecs = priv->params.rx_cq_moderation_usec; coal->rx_coalesce_usecs = priv->params.rx_cq_moderation_usec;
coal->rx_max_coalesced_frames = priv->params.rx_cq_moderation_pkts; coal->rx_max_coalesced_frames = priv->params.rx_cq_moderation_pkts;
coal->tx_coalesce_usecs = priv->params.tx_cq_moderation_usec; coal->tx_coalesce_usecs = priv->params.tx_cq_moderation_usec;
...@@ -417,6 +420,9 @@ static int mlx5e_set_coalesce(struct net_device *netdev, ...@@ -417,6 +420,9 @@ static int mlx5e_set_coalesce(struct net_device *netdev,
int tc; int tc;
int i; int i;
if (!MLX5_CAP_GEN(mdev, cq_moderation))
return -ENOTSUPP;
priv->params.tx_cq_moderation_usec = coal->tx_coalesce_usecs; priv->params.tx_cq_moderation_usec = coal->tx_coalesce_usecs;
priv->params.tx_cq_moderation_pkts = coal->tx_max_coalesced_frames; priv->params.tx_cq_moderation_pkts = coal->tx_max_coalesced_frames;
priv->params.rx_cq_moderation_usec = coal->rx_coalesce_usecs; priv->params.rx_cq_moderation_usec = coal->rx_coalesce_usecs;
......
...@@ -870,12 +870,10 @@ static int mlx5e_open_cq(struct mlx5e_channel *c, ...@@ -870,12 +870,10 @@ static int mlx5e_open_cq(struct mlx5e_channel *c,
if (err) if (err)
goto err_destroy_cq; goto err_destroy_cq;
err = mlx5_core_modify_cq_moderation(mdev, &cq->mcq, if (MLX5_CAP_GEN(mdev, cq_moderation))
moderation_usecs, mlx5_core_modify_cq_moderation(mdev, &cq->mcq,
moderation_frames); moderation_usecs,
if (err) moderation_frames);
goto err_destroy_cq;
return 0; return 0;
err_destroy_cq: err_destroy_cq:
...@@ -2218,6 +2216,8 @@ static int mlx5e_check_required_hca_cap(struct mlx5_core_dev *mdev) ...@@ -2218,6 +2216,8 @@ static int mlx5e_check_required_hca_cap(struct mlx5_core_dev *mdev)
} }
if (!MLX5_CAP_ETH(mdev, self_lb_en_modifiable)) if (!MLX5_CAP_ETH(mdev, self_lb_en_modifiable))
mlx5_core_warn(mdev, "Self loop back prevention is not supported\n"); mlx5_core_warn(mdev, "Self loop back prevention is not supported\n");
if (!MLX5_CAP_GEN(mdev, cq_moderation))
mlx5_core_warn(mdev, "CQ modiration is not supported\n");
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment