Skip to contentSkip to conversation

mlx4_en: Adjusting moderation per each ring

PATCH Applied Alexander Guller 1 participant 1 message Oct 9, 2011

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 3/7 mlx4_en: Adjusting moderation per each ring

Moderation is now done per ring and coalescing is enabled by set_ring_param in ethtool.

---
 drivers/net/ethernet/mellanox/mlx4/en_ethtool.c |   12 +++-
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c  |   88 ++++++++---------------
 drivers/net/ethernet/mellanox/mlx4/mlx4_en.h    |    6 +-
 3 files changed, 45 insertions(+), 61 deletions(-)
drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +11 -1
index e247bd7..74e2a2a 100644
@@ -342,13 +342,13 @@ static int mlx4_en_set_coalesce(struct net_device *dev,
 	priv->rx_usecs_high = coal->rx_coalesce_usecs_high;
 	priv->sample_interval = coal->rate_sample_interval;
 	priv->adaptive_rx_coal = coal->use_adaptive_rx_coalesce;
-	priv->last_moder_time = MLX4_EN_AUTO_CONF;
 	if (priv->adaptive_rx_coal)
 		return 0;
 
 	for (i = 0; i < priv->rx_ring_num; i++) {
 		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;
 		err = mlx4_en_set_cq_moder(priv, &priv->rx_cq[i]);
 		if (err)
 			return err;
@@ -394,6 +394,7 @@ static int mlx4_en_set_ringparam(struct net_device *dev,
 	u32 rx_size, tx_size;
 	int port_up = 0;
 	int err = 0;
+	int i;
 
 	if (param->rx_jumbo_pending || param->rx_mini_pending)
 		return -EINVAL;
@@ -432,6 +433,15 @@ static int mlx4_en_set_ringparam(struct net_device *dev,
 			en_err(priv, "Failed starting port\n");
 	}
 
+	for (i = 0; i < priv->rx_ring_num; i++) {
+		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;
+		err = mlx4_en_set_cq_moder(priv, &priv->rx_cq[i]);
+		if (err)
+			goto out;
+	}
+
 out:
 	mutex_unlock(&mdev->state_lock);
 	return err;
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +31 -57

127 lines not on this page · raw message

drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +3 -3
index fe8146d..3b753f7 100644
@@ -426,11 +426,11 @@ struct mlx4_en_priv {
 	struct mlx4_en_port_state port_state;
 	spinlock_t stats_lock;
 
-	unsigned long last_moder_packets;
+	unsigned long last_moder_packets[MAX_RX_RINGS];
 	unsigned long last_moder_tx_packets;
-	unsigned long last_moder_bytes;
+	unsigned long last_moder_bytes[MAX_RX_RINGS];
 	unsigned long last_moder_jiffies;
-	int last_moder_time;
+	int last_moder_time[MAX_RX_RINGS];
 	u16 rx_usecs;
 	u16 rx_frames;
 	u16 tx_usecs;
Signature · 1 line
1.7.5.4