Re: [EXT] [PATCH 1/2] net: qed*: Reduce RX and TX default ring count when running inside kdump kernel

From: Igor Russkikh
Date: Wed May 06 2020 - 02:51:51 EST




> #include <linux/compiler.h>
> +#include <linux/crash_dump.h>
> #include <linux/version.h>
> #include <linux/workqueue.h>
> #include <linux/netdevice.h>
> @@ -574,13 +575,13 @@ int qede_add_tc_flower_fltr(struct qede_dev *edev,
> __be16 proto,
> #define RX_RING_SIZE ((u16)BIT(RX_RING_SIZE_POW))
> #define NUM_RX_BDS_MAX (RX_RING_SIZE - 1)
> #define NUM_RX_BDS_MIN 128
> -#define NUM_RX_BDS_DEF ((u16)BIT(10) - 1)
> +#define NUM_RX_BDS_DEF ((is_kdump_kernel()) ? ((u16)BIT(6) - 1) :
> ((u16)BIT(10) - 1))
>
> #define TX_RING_SIZE_POW 13
> #define TX_RING_SIZE ((u16)BIT(TX_RING_SIZE_POW))
> #define NUM_TX_BDS_MAX (TX_RING_SIZE - 1)
> #define NUM_TX_BDS_MIN 128
> -#define NUM_TX_BDS_DEF NUM_TX_BDS_MAX
> +#define NUM_TX_BDS_DEF ((is_kdump_kernel()) ? ((u16)BIT(6) - 1) :
> NUM_TX_BDS_MAX)
>

Hi Bhupesh,

Thanks for looking into this. We are also analyzing how to reduce qed* memory
usage even more.

Patch is good, but may I suggest not to introduce conditional logic into the
defines but instead just add two new defines like NUM_[RT]X_BDS_MIN and check
for is_kdump_kernel() in the code explicitly?

if (is_kdump_kernel()) {
edev->q_num_rx_buffers = NUM_RX_BDS_MIN;
edev->q_num_tx_buffers = NUM_TX_BDS_MIN;
} else {
edev->q_num_rx_buffers = NUM_RX_BDS_DEF;
edev->q_num_tx_buffers = NUM_TX_BDS_DEF;
}

This may make configuration logic more explicit. If future we may want adding
more specific configs under this `if`.

Regards
Igor