net/mlx4_en: Reduce memory consumption on kdump kernel
authorAmir Vadai <amirv@mellanox.com>
Tue, 22 Jul 2014 12:44:12 +0000 (15:44 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 23 Jul 2014 02:53:14 +0000 (19:53 -0700)
When memory is limited, reduce number of rx and tx rings.

Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx4/en_main.c
drivers/net/ethernet/mellanox/mlx4/en_rx.c
drivers/net/ethernet/mellanox/mlx4/mlx4_en.h

index f953c1d7eae6a700a4fb7aacfacbaaa822c141d1..3626fdf4cb5ddd491d82b3e3496bfd8994546b0e 100644 (file)
@@ -129,8 +129,10 @@ static int mlx4_en_get_profile(struct mlx4_en_dev *mdev)
        int i;
 
        params->udp_rss = udp_rss;
-       params->num_tx_rings_p_up = min_t(int, num_online_cpus(),
-                       MLX4_EN_MAX_TX_RING_P_UP);
+       params->num_tx_rings_p_up = mlx4_low_memory_profile() ?
+               MLX4_EN_MIN_TX_RING_P_UP :
+               min_t(int, num_online_cpus(), MLX4_EN_MAX_TX_RING_P_UP);
+
        if (params->udp_rss && !(mdev->dev->caps.flags
                                        & MLX4_DEV_CAP_FLAG_UDP_RSS)) {
                mlx4_warn(mdev, "UDP RSS is not supported on this device\n");
index 7765a08f9e841cd30587e404a1c7f58b94b88fdc..9c909d23f14c4eda34ce8f03215b76aa29639894 100644 (file)
@@ -335,8 +335,9 @@ void mlx4_en_set_num_rx_rings(struct mlx4_en_dev *mdev)
                                           dev->caps.comp_pool/
                                           dev->caps.num_ports) - 1;
 
-               num_rx_rings = min_t(int, num_of_eqs,
-                                    netif_get_num_default_rss_queues());
+               num_rx_rings = mlx4_low_memory_profile() ? MIN_RX_RINGS :
+                       min_t(int, num_of_eqs,
+                             netif_get_num_default_rss_queues());
                mdev->profile.prof[i].rx_ring_num =
                        rounddown_pow_of_two(num_rx_rings);
        }
index 54c277412e424cf7aefa818375b8b9cbbd4782e3..3de41be49425ce23c19477db2e0c19fca4f395ac 100644 (file)
@@ -121,6 +121,7 @@ enum {
 #define MLX4_EN_MIN_TX_SIZE    (4096 / TXBB_SIZE)
 
 #define MLX4_EN_SMALL_PKT_SIZE         64
+#define MLX4_EN_MIN_TX_RING_P_UP       1
 #define MLX4_EN_MAX_TX_RING_P_UP       32
 #define MLX4_EN_NUM_UP                 8
 #define MLX4_EN_DEF_TX_RING_SIZE       512