Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 38463e2c authored by Eugenia Emantayev's avatar Eugenia Emantayev Committed by David S. Miller
Browse files

net/mlx4_en: Check device state when setting coalescing



When the device is down, CQs are freed. We must check the device state
to avoid issuing firmware commands on non existing CQs.

CC: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarEugenia Emantayev <eugenia@mellanox.com>
Signed-off-by: default avatarAmir Vadai <amirv@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent be4f154d
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -53,10 +53,12 @@ static int mlx4_en_moderation_update(struct mlx4_en_priv *priv)
	for (i = 0; i < priv->tx_ring_num; i++) {
		priv->tx_cq[i].moder_cnt = priv->tx_frames;
		priv->tx_cq[i].moder_time = priv->tx_usecs;
		if (priv->port_up) {
			err = mlx4_en_set_cq_moder(priv, &priv->tx_cq[i]);
			if (err)
				return err;
		}
	}

	if (priv->adaptive_rx_coal)
		return 0;
@@ -65,10 +67,12 @@ static int mlx4_en_moderation_update(struct mlx4_en_priv *priv)
		priv->rx_cq[i].moder_cnt = priv->rx_frames;
		priv->rx_cq[i].moder_time = priv->rx_usecs;
		priv->last_moder_time[i] = MLX4_EN_AUTO_CONF;
		if (priv->port_up) {
			err = mlx4_en_set_cq_moder(priv, &priv->rx_cq[i]);
			if (err)
				return err;
		}
	}

	return err;
}