Blame SOURCES/0131-netdrv-net-mlx5-Increase-the-max-number-of-channels-.patch

d8f823
From 5f7d29b04eb5cc609b4cae6aabd0e77353452f62 Mon Sep 17 00:00:00 2001
d8f823
From: Alaa Hleihel <ahleihel@redhat.com>
d8f823
Date: Tue, 12 May 2020 10:53:37 -0400
d8f823
Subject: [PATCH 131/312] [netdrv] net/mlx5: Increase the max number of
d8f823
 channels to 128
d8f823
d8f823
Message-id: <20200512105530.4207-12-ahleihel@redhat.com>
d8f823
Patchwork-id: 306883
d8f823
Patchwork-instance: patchwork
d8f823
O-Subject: [RHEL8.3 BZ 1789382 011/124] net/mlx5: Increase the max number of channels to 128
d8f823
Bugzilla: 1789382
d8f823
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
d8f823
RH-Acked-by: Kamal Heib <kheib@redhat.com>
d8f823
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
d8f823
d8f823
Bugzilla: http://bugzilla.redhat.com/1789382
d8f823
Upstream: v5.6-rc1
d8f823
d8f823
commit 57c7fce14b1ad512a42abe33cb721a2ea3520d4b
d8f823
Author: Fan Li <fanl@mellanox.com>
d8f823
Date:   Mon Dec 16 14:46:15 2019 +0200
d8f823
d8f823
    net/mlx5: Increase the max number of channels to 128
d8f823
d8f823
    Currently the max number of channels is limited to 64, which is half of
d8f823
    the indirection table size to allow some flexibility. But on servers
d8f823
    with more than 64 cores, users may want to utilize more queues.
d8f823
d8f823
    This patch increases the advertised max number of channels to 128 by
d8f823
    changing the ratio between channels and indirection table slots to 1:1.
d8f823
    At the same time, the driver still enable no more than 64 channels at
d8f823
    loading. Users can change it by ethtool afterwards.
d8f823
d8f823
    Signed-off-by: Fan Li <fanl@mellanox.com>
d8f823
    Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
d8f823
    Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
d8f823
d8f823
Signed-off-by: Alaa Hleihel <ahleihel@redhat.com>
d8f823
Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
d8f823
---
d8f823
 drivers/net/ethernet/mellanox/mlx5/core/en.h          |  6 +++---
d8f823
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c     | 12 +++++++-----
d8f823
 drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c |  4 ++--
d8f823
 3 files changed, 12 insertions(+), 10 deletions(-)
d8f823
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
d8f823
index 319797f42105..bd34b1851162 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
d8f823
@@ -134,7 +134,7 @@ struct page_pool;
d8f823
 #define MLX5E_LOG_INDIR_RQT_SIZE       0x7
d8f823
 #define MLX5E_INDIR_RQT_SIZE           BIT(MLX5E_LOG_INDIR_RQT_SIZE)
d8f823
 #define MLX5E_MIN_NUM_CHANNELS         0x1
d8f823
-#define MLX5E_MAX_NUM_CHANNELS         (MLX5E_INDIR_RQT_SIZE >> 1)
d8f823
+#define MLX5E_MAX_NUM_CHANNELS         MLX5E_INDIR_RQT_SIZE
d8f823
 #define MLX5E_MAX_NUM_SQS              (MLX5E_MAX_NUM_CHANNELS * MLX5E_MAX_NUM_TC)
d8f823
 #define MLX5E_TX_CQ_POLL_BUDGET        128
d8f823
 #define MLX5E_TX_XSK_POLL_BUDGET       64
d8f823
@@ -1170,11 +1170,11 @@ int mlx5e_attach_netdev(struct mlx5e_priv *priv);
d8f823
 void mlx5e_detach_netdev(struct mlx5e_priv *priv);
d8f823
 void mlx5e_destroy_netdev(struct mlx5e_priv *priv);
d8f823
 void mlx5e_set_netdev_mtu_boundaries(struct mlx5e_priv *priv);
d8f823
-void mlx5e_build_nic_params(struct mlx5_core_dev *mdev,
d8f823
+void mlx5e_build_nic_params(struct mlx5e_priv *priv,
d8f823
 			    struct mlx5e_xsk *xsk,
d8f823
 			    struct mlx5e_rss_params *rss_params,
d8f823
 			    struct mlx5e_params *params,
d8f823
-			    u16 max_channels, u16 mtu);
d8f823
+			    u16 mtu);
d8f823
 void mlx5e_build_rq_params(struct mlx5_core_dev *mdev,
d8f823
 			   struct mlx5e_params *params);
d8f823
 void mlx5e_build_rss_params(struct mlx5e_rss_params *rss_params,
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
d8f823
index 2f337a70e157..7815cae1af54 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
d8f823
@@ -4737,17 +4737,19 @@ void mlx5e_build_rss_params(struct mlx5e_rss_params *rss_params,
d8f823
 			tirc_default_config[tt].rx_hash_fields;
d8f823
 }
d8f823
 
d8f823
-void mlx5e_build_nic_params(struct mlx5_core_dev *mdev,
d8f823
+void mlx5e_build_nic_params(struct mlx5e_priv *priv,
d8f823
 			    struct mlx5e_xsk *xsk,
d8f823
 			    struct mlx5e_rss_params *rss_params,
d8f823
 			    struct mlx5e_params *params,
d8f823
-			    u16 max_channels, u16 mtu)
d8f823
+			    u16 mtu)
d8f823
 {
d8f823
+	struct mlx5_core_dev *mdev = priv->mdev;
d8f823
 	u8 rx_cq_period_mode;
d8f823
 
d8f823
 	params->sw_mtu = mtu;
d8f823
 	params->hard_mtu = MLX5E_ETH_HARD_MTU;
d8f823
-	params->num_channels = max_channels;
d8f823
+	params->num_channels = min_t(unsigned int, MLX5E_MAX_NUM_CHANNELS / 2,
d8f823
+				     priv->max_nch);
d8f823
 	params->num_tc       = 1;
d8f823
 
d8f823
 	/* SQ */
d8f823
@@ -4986,8 +4988,8 @@ static int mlx5e_nic_init(struct mlx5_core_dev *mdev,
d8f823
 	if (err)
d8f823
 		return err;
d8f823
 
d8f823
-	mlx5e_build_nic_params(mdev, &priv->xsk, rss, &priv->channels.params,
d8f823
-			       priv->max_nch, netdev->mtu);
d8f823
+	mlx5e_build_nic_params(priv, &priv->xsk, rss, &priv->channels.params,
d8f823
+			       netdev->mtu);
d8f823
 
d8f823
 	mlx5e_timestamp_init(priv);
d8f823
 
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
d8f823
index c4323bd42132..56078b23f1a0 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
d8f823
@@ -87,8 +87,8 @@ int mlx5i_init(struct mlx5_core_dev *mdev,
d8f823
 	mlx5e_set_netdev_mtu_boundaries(priv);
d8f823
 	netdev->mtu = netdev->max_mtu;
d8f823
 
d8f823
-	mlx5e_build_nic_params(mdev, NULL, &priv->rss_params, &priv->channels.params,
d8f823
-			       priv->max_nch, netdev->mtu);
d8f823
+	mlx5e_build_nic_params(priv, NULL, &priv->rss_params, &priv->channels.params,
d8f823
+			       netdev->mtu);
d8f823
 	mlx5i_build_nic_params(mdev, &priv->channels.params);
d8f823
 
d8f823
 	mlx5e_timestamp_init(priv);
d8f823
-- 
d8f823
2.13.6
d8f823