aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2018-09-06 12:28:06 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2018-09-06 12:28:06 +0000
commit16ae32f927d9c8946c9dc3b277a7a3640e270b67 (patch)
tree0a120a8385ace24f8258c5d0e7fa0940b236e783 /sys/dev
parentb4df6efb4e2bdcf0d827e50807fbbc9ac5323282 (diff)
downloadsrc-16ae32f927d9c8946c9dc3b277a7a3640e270b67.tar.gz
src-16ae32f927d9c8946c9dc3b277a7a3640e270b67.zip
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. MFC after: 3 days Approved by: re (marius) Sponsored by: Mellanox Technologies
Notes
Notes: svn path=/head/; revision=338492
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/mlx5/mlx5_en/en.h2
-rw-r--r--sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c19
-rw-r--r--sys/dev/mlx5/mlx5_en/mlx5_en_main.c11
3 files changed, 28 insertions, 4 deletions
diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h
index eff172b55cdc..73f0268ca270 100644
--- a/sys/dev/mlx5/mlx5_en/en.h
+++ b/sys/dev/mlx5/mlx5_en/en.h
@@ -454,6 +454,7 @@ struct mlx5e_params {
u32 rx_priority_flow_control __aligned(4);
u16 tx_max_inline;
u8 tx_min_inline_mode;
+ u8 channels_rsss;
};
#define MLX5E_PARAMS(m) \
@@ -462,6 +463,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") \
diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c b/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
index d85afb570872..85b1fe85617f 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
@@ -493,6 +493,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)
@@ -1041,6 +1059,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;
diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
index 08a0e98fa0fb..916ebe72c46c 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
@@ -2204,14 +2204,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);
}
@@ -3083,6 +3085,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;