cmdline: configure input buffer size
PATCH 1/1 cmdline: configure input buffer size
DPDK defines cmdline input buffer size to 512 characters. That buffer size can be too small for long application input. For example, the following flow template API testpmd command is 444 bytes long:
```
flow queue 0 create 0 template_table 1000 \
pattern_template 0 actions_template 0 postpone no \
pattern eth / ipv4 / udp / end \
actions modify_field op set dst_type tag dst_level 0 dst_offset 0 \
src_type value src_value 0x31 width 32 / \
modify_field op set dst_type ipv4_src src_type value \
src_value 10101010 width 32 / modify_field op add dst_type \
ipv4_ttl dst_level 0 dst_offset 0 src_type value \
src_value ff width 8 / count / jump group 100 / end
```The patch introduces conditional RDLINE_CUSTOM_BUF_SIZE definition. Application can set custom cmdline size during DPDK configuration:
meson setup ... -Dc_args='-DRDLINE_CUSTOM_BUF_SIZE=4096' ...
--- lib/cmdline/cmdline_private.h | 4 ++++ 1 file changed, 4 insertions(+)
lib/cmdline/cmdline_private.h +4 -0
@@ -17,7 +17,11 @@#include <cmdline.h> +#ifndef RDLINE_CUSTOM_BUF_SIZE #define RDLINE_BUF_SIZE 512 +#else +#define RDLINE_BUF_SIZE RDLINE_CUSTOM_BUF_SIZE +#endif #define RDLINE_PROMPT_SIZE 32#define RDLINE_VT100_BUF_SIZE 8#define RDLINE_HISTORY_BUF_SIZE BUFSIZ
Signature · 1 line
2.43.0
Quoted 16 lines · Gregory Etelson
DPDK defines cmdline input buffer size to 512 characters. That buffer size can be too small for long application input. For example, the following flow template API testpmd command is 444 bytes long:
``` flow queue 0 create 0 template_table 1000 \ pattern_template 0 actions_template 0 postpone no \ pattern eth / ipv4 / udp / end \ actions modify_field op set dst_type tag dst_level 0 dst_offset 0 \ src_type value src_value 0x31 width 32 / \ modify_field op set dst_type ipv4_src src_type value \ src_value 10101010 width 32 / modify_field op add dst_type \ ipv4_ttl dst_level 0 dst_offset 0 src_type value \ src_value ff width 8 / count / jump group 100 / end ```
Quoted 7 lines
The patch introduces conditional
RDLINE_CUSTOM_BUF_SIZEdefinition. Application can set custom cmdline size during DPDK configuration:
meson setup ... -Dc_args='-DRDLINE_CUSTOM_BUF_SIZE=4096' ...Signed-off-by Gregory Etelson <[email protected]>---
Basic question, what would be the impact of increasing the default from 512 to 1k or 2k? Do we get a large memory footprint increase, or is it just an extra 1 or 2k of memory used?
/Bruce
Hello Bruce,
Quoted 4 lines
Quoted 4 lines
Application can set custom cmdline size during DPDK configuration:
meson setup ... -Dc_args='-DRDLINE_CUSTOM_BUF_SIZE=4096' ...
Quoted 8 lines
Quoted 2 lines
Signed-off-by Gregory Etelson <[email protected]>---
Basic question, what would be the impact of increasing the default from 512 to 1k or 2k? Do we get a large memory footprint increase, or is it just an extra 1 or 2k of memory used?
/Bruce
Increasing the RDLINE_BUF_SIZE size will also increase application memory usage.
However, that memory increase was required, because application could not fit it's command line into the default buffer.
Applications that can run with the default RDLINE_BUF_SIZE are not affected by that patch.
Regards,
Gregory
Quoted 11 lines · Gregory
Quoted 6 lines
Basic question, what would be the impact of increasing the default from 512 to 1k or 2k? Do we get a large memory footprint increase, or is it just an extra 1 or 2k of memory used?
/Bruce
Increasing the
RDLINE_BUF_SIZEsize will also increase application memory usage. However, that memory increase was required, because application could not fit it's command line into the default buffer.
Quoted 5 lines
Applications that can run with the default
RDLINE_BUF_SIZEare not affected by that patch.Regards,
Gregory
The buffer is transient so should have little impact. Why not just use LINE_MAX from limits.h?
Hello Stephen,
Quoted 14 lines
Quoted 14 lines
Quoted 6 lines
Basic question, what would be the impact of increasing the default from 512 to 1k or 2k? Do we get a large memory footprint increase, or is it just an extra 1 or 2k of memory used?
/Bruce
Increasing the
RDLINE_BUF_SIZEsize will also increase application memory usage. However, that memory increase was required, because application could not fit it's command line into the default buffer.Applications that can run with the default
RDLINE_BUF_SIZEare not affected by that patch.
Quoted 7 lines
Quoted 2 lines
Regards,
GregoryThe buffer is transient so should have little impact. Why not just use
LINE_MAXfromlimits.h?
The LINE_MAX value will be enough even for the template API testpmd commands. If there will be no objections, I'll set LINE_MAX as the new RDLINE_BUF_SIZE.
Regards,
Gregory
Quoted 20 lines · Gregory
Hello Stephen,
Quoted 18 lines
Quoted 16 lines
Quoted 6 lines
Basic question, what would be the impact of increasing the default from 512 to 1k or 2k? Do we get a large memory footprint increase, or is it just an extra 1 or 2k of memory used?
/Bruce
Increasing the
RDLINE_BUF_SIZEsize will also increase application memory usage. However, that memory increase was required, because application could not fit it's command line into the default buffer.Applications that can run with the default
RDLINE_BUF_SIZEare not affected by that patch.Regards,
Gregory
Quoted 8 lines
Quoted 3 lines
The buffer is transient so should have little impact. Why not just use
LINE_MAXfromlimits.h?The
LINE_MAXvalue will be enough even for the template API testpmd commands. If there will be no objections, I'll setLINE_MAXas the newRDLINE_BUF_SIZE.
+1 for just upping the size.
Thanks.
PATCH v2 1/1 cmdline: increase input buffer size
In reply to Gregory EtelsonDPDK defines cmdline input buffer size to 512 characters. That buffer size can be too small for long application input. For example, the following flow template API testpmd command is 444 bytes long:
```
flow queue 0 create 0 template_table 1000 \
pattern_template 0 actions_template 0 postpone no \
pattern eth / ipv4 / udp / end \
actions modify_field op set dst_type tag dst_level 0 dst_offset 0 \
src_type value src_value 0x31 width 32 / \
modify_field op set dst_type ipv4_src src_type value \
src_value 10101010 width 32 / modify_field op add dst_type \
ipv4_ttl dst_level 0 dst_offset 0 src_type value \
src_value ff width 8 / count / jump group 100 / end
```The patch increases cmdline input buffer size to the LINE_MAX value.
---
v2: set RDLINE_BUF_SIZE to LINE_MAX
change the patch subject
--- lib/cmdline/cmdline_private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/cmdline/cmdline_private.h +1 -1
@@ -17,7 +17,7 @@#include <cmdline.h> -#define RDLINE_BUF_SIZE 512 +#define RDLINE_BUF_SIZE LINE_MAX#define RDLINE_PROMPT_SIZE 32#define RDLINE_VT100_BUF_SIZE 8#define RDLINE_HISTORY_BUF_SIZE BUFSIZ
--
2.43.0
RE: [PATCH v2] cmdline: increase input buffer size
+CC: Bruce, Stephen
Quoted 19 lines
From: Gregory Etelson [mailto:[email protected]]
Sent: Wednesday, 1 May 2024 19.18DPDK defines cmdline input buffer size to 512 characters. That buffer size can be too small for long application input. For example, the following flow template API testpmd command is 444 bytes long:
``` flow queue 0 create 0 template_table 1000 \ pattern_template 0 actions_template 0 postpone no \ pattern eth / ipv4 / udp / end \ actions modify_field op set dst_type tag dst_level 0 dst_offset 0 \ src_type value src_value 0x31 width 32 / \ modify_field op set dst_type ipv4_src src_type value \ src_value 10101010 width 32 / modify_field op add dst_type \ ipv4_ttl dst_level 0 dst_offset 0 src_type value \ src_value ff width 8 / count / jump group 100 / end ```
Quoted 1 line
The patch increases cmdline input buffer size to the
LINE_MAXvalue.
+ ... , which typically is 2048.
Quoted 3 lines
Signed-off-by Gregory Etelson <[email protected]>---
With or without suggested patch description change,
Bruce Richardson
Acked-byRe: [PATCH v2] cmdline: increase input buffer size
Quoted 23 lines · Morten Brørup
+CC: Bruce, Stephen
Quoted 19 lines
From: Gregory Etelson [mailto:[email protected]]
Sent: Wednesday, 1 May 2024 19.18DPDK defines cmdline input buffer size to 512 characters. That buffer size can be too small for long application input. For example, the following flow template API testpmd command is 444 bytes long:
``` flow queue 0 create 0 template_table 1000 \ pattern_template 0 actions_template 0 postpone no \ pattern eth / ipv4 / udp / end \ actions modify_field op set dst_type tag dst_level 0 dst_offset 0 \ src_type value src_value 0x31 width 32 / \ modify_field op set dst_type ipv4_src src_type value \ src_value 10101010 width 32 / modify_field op add dst_type \ ipv4_ttl dst_level 0 dst_offset 0 src_type value \ src_value ff width 8 / count / jump group 100 / end ```Quoted 1 line
The patch increases cmdline input buffer size to the
LINE_MAXvalue.
Quoted 9 lines
+ ... , which typically is 2048.
Quoted 3 lines
Signed-off-by Gregory Etelson <[email protected]>---
With or without suggested patch description change,
Reviewed-by Morten Brørup <[email protected]>
PATCH v3 1/1 cmdline: increase input buffer size
In reply to Gregory EtelsonDPDK defines cmdline input buffer size to 512 characters. That buffer size can be too small for long application input. For example, the following flow template API testpmd command is 444 bytes long:
```
flow queue 0 create 0 template_table 1000 \
pattern_template 0 actions_template 0 postpone no \
pattern eth / ipv4 / udp / end \
actions modify_field op set dst_type tag dst_level 0 dst_offset 0 \
src_type value src_value 0x31 width 32 / \
modify_field op set dst_type ipv4_src src_type value \
src_value 10101010 width 32 / modify_field op add dst_type \
ipv4_ttl dst_level 0 dst_offset 0 src_type value \
src_value ff width 8 / count / jump group 100 / end
```The patch increases cmdline input buffer size to the LINE_MAX value, which typically is 2048 bytes.
---
v2: set RDLINE_BUF_SIZE to LINE_MAX
change the patch subject.
v3: fix Windows compilation error.
--- lib/cmdline/cmdline_private.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
lib/cmdline/cmdline_private.h +8 -1
@@ -11,13 +11,20 @@#include <rte_os_shim.h> #ifdef RTE_EXEC_ENV_WINDOWS #include <rte_windows.h> +#ifndef LINE_MAX +/** +* The LINE_MAX value is derived from POSIX. +* Windows environment may not have POSIX definitions. +*/ +#define LINE_MAX 2048 +#endif #else #include <termios.h> #endif #include <cmdline.h> -#define RDLINE_BUF_SIZE 512 +#define RDLINE_BUF_SIZE LINE_MAX#define RDLINE_PROMPT_SIZE 32#define RDLINE_VT100_BUF_SIZE 8#define RDLINE_HISTORY_BUF_SIZE BUFSIZ
Signature · 1 line
2.43.0
Re: [PATCH v3] cmdline: increase input buffer size
Hello,
What is the status of that patch ?
Regards,
Gregory
________________________________
From: Gregory Etelson <[email protected]>
Sent: Friday, May 3, 2024 07:27
To: Gregory Etelson <[email protected]>
Cc: Ali Alnubani <[email protected]>; [email protected] <[email protected]>; Maayan Kashani <[email protected]>; Raslan Darawsheh <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
Subject: [PATCH v3] cmdline: increase input buffer size
DPDK defines cmdline input buffer size to 512 characters. That buffer size can be too small for long application input. For example, the following flow template API testpmd command is 444 bytes long:
```
flow queue 0 create 0 template_table 1000 \
pattern_template 0 actions_template 0 postpone no \
pattern eth / ipv4 / udp / end \
actions modify_field op set dst_type tag dst_level 0 dst_offset 0 \
src_type value src_value 0x31 width 32 / \
modify_field op set dst_type ipv4_src src_type value \
src_value 10101010 width 32 / modify_field op add dst_type \
ipv4_ttl dst_level 0 dst_offset 0 src_type value \
src_value ff width 8 / count / jump group 100 / end
```The patch increases cmdline input buffer size to the LINE_MAX value, which typically is 2048 bytes.
---
v2: set RDLINE_BUF_SIZE to LINE_MAX
change the patch subject.
v3: fix Windows compilation error.
--- lib/cmdline/cmdline_private.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
lib/cmdline/cmdline_private.h +8 -1
@@ -11,13 +11,20 @@#include <rte_os_shim.h> #ifdef RTE_EXEC_ENV_WINDOWS #include <rte_windows.h> +#ifndef LINE_MAX +/** +* The LINE_MAX value is derived from POSIX. +* Windows environment may not have POSIX definitions. +*/ +#define LINE_MAX 2048 +#endif #else #include <termios.h> #endif #include <cmdline.h> -#define RDLINE_BUF_SIZE 512 +#define RDLINE_BUF_SIZE LINE_MAX#define RDLINE_PROMPT_SIZE 32#define RDLINE_VT100_BUF_SIZE 8#define RDLINE_HISTORY_BUF_SIZE BUFSIZ
--
2.43.0
David Marchand
AppliedRe: [PATCH v3] cmdline: increase input buffer size
In reply to Gregory EtelsonQuoted 17 lines · Gregory Etelson
DPDK defines cmdline input buffer size to 512 characters. That buffer size can be too small for long application input. For example, the following flow template API testpmd command is 444 bytes long:
``` flow queue 0 create 0 template_table 1000 \ pattern_template 0 actions_template 0 postpone no \ pattern eth / ipv4 / udp / end \ actions modify_field op set dst_type tag dst_level 0 dst_offset 0 \ src_type value src_value 0x31 width 32 / \ modify_field op set dst_type ipv4_src src_type value \ src_value 10101010 width 32 / modify_field op add dst_type \ ipv4_ttl dst_level 0 dst_offset 0 src_type value \ src_value ff width 8 / count / jump group 100 / end ```
Quoted 6 lines
The patch increases cmdline input buffer size to the
LINE_MAXvalue, which typically is 2048 bytes.Signed-off-by Gregory Etelson <[email protected]>Acked-by Bruce Richardson <[email protected]>Reviewed-by Morten Brørup <[email protected]>
Applied, thanks.
Signature · 1 line
David Marchand