svn commit: r338553 - stable/10/sys/dev/mlx5/mlx5_en

Hans Petter Selasky hselasky at FreeBSD.org
Mon Sep 10 08:10:53 UTC 2018


Author: hselasky
Date: Mon Sep 10 08:10:52 2018
New Revision: 338553
URL: https://svnweb.freebsd.org/changeset/base/338553

Log:
  MFC r338492:
  Add support for receive side scaling stride, RSSS, in mlx5en(4).
  
  The receive side scaling stride parameter is a value which define the interval
  between active receive side queues. The traffic for the inactive queues is
  redirected to the nearest active queue by use of modulus. The default value
  of this parameter is one, which means all receive side queues are used.
  
  The point of this feature is to redirect more traffic to fewer receive side
  queues in order to take more advantage of sorted large receive offload,
  sorted LRO. The sorted LRO works better when more packets are accumulated
  per service interval.
  
  Sponsored by:		Mellanox Technologies

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/en.h
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/mlx5_en/en.h
==============================================================================
--- stable/10/sys/dev/mlx5/mlx5_en/en.h	Mon Sep 10 08:09:42 2018	(r338552)
+++ stable/10/sys/dev/mlx5/mlx5_en/en.h	Mon Sep 10 08:10:52 2018	(r338553)
@@ -407,6 +407,7 @@ struct mlx5e_params {
 	u32	rx_pauseframe_control;
 	u16	tx_max_inline;
 	u8	tx_min_inline_mode;
+	u8	channels_rsss;
 };
 
 #define	MLX5E_PARAMS(m)							\
@@ -415,6 +416,7 @@ struct mlx5e_params {
   m(+1, u64 tx_queue_size, "tx_queue_size", "Default send queue size")	\
   m(+1, u64 rx_queue_size, "rx_queue_size", "Default receive queue size") \
   m(+1, u64 channels, "channels", "Default number of channels")		\
+  m(+1, u64 channels_rsss, "channels_rsss", "Default channels receive side scaling stride") \
   m(+1, u64 coalesce_usecs_max, "coalesce_usecs_max", "Maximum usecs for joining packets") \
   m(+1, u64 coalesce_pkts_max, "coalesce_pkts_max", "Maximum packets to join") \
   m(+1, u64 rx_coalesce_usecs, "rx_coalesce_usecs", "Limit in usec for joining rx packets") \

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
==============================================================================
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c	Mon Sep 10 08:09:42 2018	(r338552)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c	Mon Sep 10 08:10:52 2018	(r338553)
@@ -246,6 +246,24 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS)
 			mlx5e_open_locked(priv->ifp);
 		break;
 
+	case MLX5_PARAM_OFFSET(channels_rsss):
+		/* network interface must be down */
+		if (was_opened)
+			mlx5e_close_locked(priv->ifp);
+
+		/* import number of channels */
+		if (priv->params_ethtool.channels_rsss < 1)
+			priv->params_ethtool.channels_rsss = 1;
+		else if (priv->params_ethtool.channels_rsss > 128)
+			priv->params_ethtool.channels_rsss = 128;
+
+		priv->params.channels_rsss = priv->params_ethtool.channels_rsss;
+
+		/* restart network interface, if any */
+		if (was_opened)
+			mlx5e_open_locked(priv->ifp);
+		break;
+
 	case MLX5_PARAM_OFFSET(channels):
 		/* network interface must be down */
 		if (was_opened)
@@ -694,6 +712,7 @@ mlx5e_create_ethtool(struct mlx5e_priv *priv)
 	priv->params_ethtool.tx_queue_size = 1 << priv->params.log_sq_size;
 	priv->params_ethtool.rx_queue_size = 1 << priv->params.log_rq_size;
 	priv->params_ethtool.channels = priv->params.num_channels;
+	priv->params_ethtool.channels_rsss = priv->params.channels_rsss;
 	priv->params_ethtool.coalesce_pkts_max = MLX5E_FLD_MAX(cqc, cq_max_count);
 	priv->params_ethtool.coalesce_usecs_max = MLX5E_FLD_MAX(cqc, cq_period);
 	priv->params_ethtool.rx_coalesce_mode = priv->params.rx_cq_moderation_mode;

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==============================================================================
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Mon Sep 10 08:09:42 2018	(r338552)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Mon Sep 10 08:10:52 2018	(r338553)
@@ -2055,14 +2055,16 @@ mlx5e_open_rqt(struct mlx5e_priv *priv)
 	MLX5_SET(rqtc, rqtc, rqt_max_size, sz);
 
 	for (i = 0; i < sz; i++) {
-		int ix;
+		int ix = i;
 #ifdef RSS
-		ix = rss_get_indirection_to_bucket(i);
-#else
-		ix = i;
+		ix = rss_get_indirection_to_bucket(ix);
 #endif
 		/* ensure we don't overflow */
 		ix %= priv->params.num_channels;
+
+		/* apply receive side scaling stride, if any */
+		ix -= ix % (int)priv->params.channels_rsss;
+
 		MLX5_SET(rqtc, rqtc, rq_num[i], priv->channel[ix]->rq.rqn);
 	}
 
@@ -2926,6 +2928,7 @@ mlx5e_build_ifp_priv(struct mlx5_core_dev *mdev,
 
 	priv->mdev = mdev;
 	priv->params.num_channels = num_comp_vectors;
+	priv->params.channels_rsss = 1;
 	priv->order_base_2_num_channels = order_base_2(num_comp_vectors);
 	priv->queue_mapping_channel_mask =
 	    roundup_pow_of_two(num_comp_vectors) - 1;


More information about the svn-src-all mailing list