net/mlx4_en: Use minimal rx and tx ring sizes on kdump kernel
authorAlaa Hleihel <alaa@mellanox.com>
Tue, 9 Oct 2018 09:06:52 +0000 (12:06 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 9 Oct 2018 18:08:48 +0000 (11:08 -0700)
When memory is limited (on kdump kernel), reduce size of rx and tx rings.
Also reduce the number of rx rings.

Signed-off-by: Alaa Hleihel <alaa@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx4/en_main.c
drivers/net/ethernet/mellanox/mlx4/mlx4_en.h

index d25e16d2c3191ecff8ed758353203de5f7dc9c07..109472d6b61f1948ce257e9504cc2fa2d4f1146b 100644 (file)
@@ -167,8 +167,13 @@ static void mlx4_en_get_profile(struct mlx4_en_dev *mdev)
                params->prof[i].rx_ppp = pfcrx;
                params->prof[i].tx_pause = !(pfcrx || pfctx);
                params->prof[i].tx_ppp = pfctx;
-               params->prof[i].tx_ring_size = MLX4_EN_DEF_TX_RING_SIZE;
-               params->prof[i].rx_ring_size = MLX4_EN_DEF_RX_RING_SIZE;
+               if (mlx4_low_memory_profile()) {
+                       params->prof[i].tx_ring_size = MLX4_EN_MIN_TX_SIZE;
+                       params->prof[i].rx_ring_size = MLX4_EN_MIN_RX_SIZE;
+               } else {
+                       params->prof[i].tx_ring_size = MLX4_EN_DEF_TX_RING_SIZE;
+                       params->prof[i].rx_ring_size = MLX4_EN_DEF_RX_RING_SIZE;
+               }
                params->prof[i].num_up = MLX4_EN_NUM_UP_LOW;
                params->prof[i].num_tx_rings_p_up = params->max_num_tx_rings_p_up;
                params->prof[i].tx_ring_num[TX] = params->max_num_tx_rings_p_up *
index c3228b89df463597de1cb546754ea1b8aa4d876d..485d856546c6c3b83cacdcbe6376d73862dd0f8a 100644 (file)
@@ -72,7 +72,7 @@
 #define MLX4_EN_PAGE_SIZE      (1 << MLX4_EN_PAGE_SHIFT)
 #define DEF_RX_RINGS           16
 #define MAX_RX_RINGS           128
-#define MIN_RX_RINGS           4
+#define MIN_RX_RINGS           1
 #define LOG_TXBB_SIZE          6
 #define TXBB_SIZE              BIT(LOG_TXBB_SIZE)
 #define HEADROOM               (2048 / TXBB_SIZE + 1)