Add Kconfig option, user can specify the location of g_iob_buffer

Signed-off-by: luojun1 <luojun1@xiaomi.com>
This commit is contained in:
luojun1 2022-08-12 16:59:18 +08:00 committed by Xiang Xiao
parent 4e62772be5
commit bee9dcc73a
2 changed files with 17 additions and 1 deletions

View File

@ -46,6 +46,14 @@ config IOB_ALIGNMENT
The member io_head of all I/O buffers is aligned to the value
specified by this configuration.
config IOB_SECTION
string "The section where iob buffer is located"
default ".bss"
depends on !ARCH_SIM
---help---
The section where iob buffer is located.
The section must be zero-initialized on system boot.
config IOB_NCHAINS
int "Number of pre-allocated I/O buffer chain heads"
default 0 if !NET_READAHEAD

View File

@ -42,6 +42,14 @@
#define IOB_BUFFER_SIZE (IOB_ALIGN_SIZE * CONFIG_IOB_NBUFFERS + \
CONFIG_IOB_ALIGNMENT - 1)
/* Improve Flexibility */
#ifdef CONFIG_IOB_SECTION
# define IOB_SECTION locate_data(CONFIG_IOB_SECTION)
#else
# define IOB_SECTION
#endif
/****************************************************************************
* Private Data
****************************************************************************/
@ -51,7 +59,7 @@
* to the CONFIG_IOB_ALIGNMENT memory boundary.
*/
static uint8_t g_iob_buffer[IOB_BUFFER_SIZE];
static uint8_t g_iob_buffer[IOB_BUFFER_SIZE] IOB_SECTION;
#if CONFIG_IOB_NCHAINS > 0
/* This is a pool of pre-allocated iob_qentry_s buffers */