Skip to contentSkip to conversation

net/mlx4_en: allow setting number of rx rings for, RSS/TCP

PATCH In review Yevgeny Petrilin 3 participants 3 messages Nov 21, 2011

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

PATCH 6/8 net/mlx4_en: allow setting number of rx rings for, RSS/TCP

From: Amir Vadai <[email protected]>

Make RSS TCP divert packets only to part of the rx rings, other could be accessed by using flow steering or RFS acceleration

---
 drivers/net/ethernet/mellanox/mlx4/en_main.c |    7 ++++---
 drivers/net/ethernet/mellanox/mlx4/en_rx.c   |    9 ++++++++-
 2 files changed, 12 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx4/en_main.c +4 -3
index a06096f..f70bafb 100644
@@ -63,9 +63,10 @@ static const char mlx4_en_version[] =
  */
 
 
-/* Enable RSS TCP traffic */
-MLX4_EN_PARM_INT(tcp_rss, 1,
-		 "Enable RSS for incomming TCP traffic or disabled (0)");
+/* RSS TCP usage */
+MLX4_EN_PARM_INT(tcp_rss, -1,
+		 "0 to disable RSS TCP, if n > 0, use n rx rings by RSS TCP. -1 "
+		 "for all rx rings");
 /* Enable RSS UDP traffic */
 MLX4_EN_PARM_INT(udp_rss, 1,
 		 "Enable RSS for incomming UDP traffic or disabled (0)");
drivers/net/ethernet/mellanox/mlx4/en_rx.c +8 -1
index 3c24e16..044123a 100644
@@ -834,6 +834,7 @@ int mlx4_en_config_rss_steer(struct mlx4_en_priv *priv)
 	struct mlx4_en_rss_map *rss_map = &priv->rss_map;
 	struct mlx4_qp_context context;
 	struct mlx4_rss_context *rss_context;
+	int tcp_rss_table_size;
 	void *ptr;
 	u8 rss_mask = (MLX4_RSS_IPV4 | MLX4_RSS_TCP_IPV4 | MLX4_RSS_IPV6 |
 			MLX4_RSS_TCP_IPV6);
@@ -874,10 +875,16 @@ int mlx4_en_config_rss_steer(struct mlx4_en_priv *priv)
 	mlx4_en_fill_qp_context(priv, 0, 0, 0, 1, priv->base_qpn,
 				priv->rx_ring[0].cqn, &context);
 
+	if (priv->mdev->profile.tcp_rss == -1 ||
+	    priv->mdev->profile.tcp_rss > priv->rx_ring_num)
+		tcp_rss_table_size = priv->rx_ring_num;
+	else
+		tcp_rss_table_size = max(1, priv->mdev->profile.tcp_rss);
+
 	ptr = ((void *) &context) + offsetof(struct mlx4_qp_context, pri_path)
 					+ MLX4_RSS_OFFSET_IN_QPC_PRI_PATH;
 	rss_context = ptr;
-	rss_context->base_qpn = cpu_to_be32(ilog2(priv->rx_ring_num) << 24 |
+	rss_context->base_qpn = cpu_to_be32(ilog2(tcp_rss_table_size) << 24 |
 					    (rss_map->base_qpn));
 	if (priv->mdev->profile.udp_rss) {
 		rss_mask |=  MLX4_RSS_UDP_IPV4 | MLX4_RSS_UDP_IPV6;
Signature · 1 line
1.7.7
#1 lore raw
Quoted 4 lines · Yevgeny Petrilin

From: Amir Vadai <[email protected]>

Make RSS TCP divert packets only to part of the rx rings, other could be accessed by using flow steering or RFS acceleration

[...]

The ethtool {get,set}_rxfh_indir operations are a standard and more flexible interface for configuring this.

Ben.

Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
maintainer
#2 lore raw

From: Ben Hutchings <[email protected]>
Date: Mon, 21 Nov 2011 16:57:30 +0000

Quoted 9 lines · Yevgeny Petrilin
Quoted 4 lines

From: Amir Vadai <[email protected]>

Make RSS TCP divert packets only to part of the rx rings, other could be accessed by using flow steering or RFS acceleration

[...]

The ethtool {get,set}_rxfh_indir operations are a standard and more flexible interface for configuring this.

Agreed, you should _NEVER_ add module options or private driver extensions for such a common configuration setting.