[v2] cmdline: increase input buffer size

Message ID 20240501171806.307533-1-getelson@nvidia.com (mailing list archive)
State Superseded
Delegated to: Thomas Monjalon
Headers
Series [v2] cmdline: increase input buffer size |

Checks

Context Check Description
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build fail github build: failed
ci/intel-Functional success Functional PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-compile-amd64-testing fail Testing issues
ci/iol-abi-testing success Testing PASS
ci/iol-unit-amd64-testing fail Testing issues
ci/iol-sample-apps-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

Gregory Etelson May 1, 2024, 5:18 p.m. UTC
  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.

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
---
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(-)

--
2.43.0
  

Comments

Morten Brørup May 1, 2024, 6:26 p.m. UTC | #1
+CC: Bruce, Stephen

> From: Gregory Etelson [mailto:getelson@nvidia.com]
> Sent: Wednesday, 1 May 2024 19.18
> 
> 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.

> 
> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> ---

With or without suggested patch description change,
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
  
Bruce Richardson May 2, 2024, 7:27 a.m. UTC | #2
On Wed, May 01, 2024 at 08:26:54PM +0200, Morten Brørup wrote:
> +CC: Bruce, Stephen
> 
> > From: Gregory Etelson [mailto:getelson@nvidia.com]
> > Sent: Wednesday, 1 May 2024 19.18
> > 
> > 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.
> 
> > 
> > Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> > ---
> 
> With or without suggested patch description change,
> Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
> 
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
  

Patch

diff --git a/lib/cmdline/cmdline_private.h b/lib/cmdline/cmdline_private.h
index b64f363903..3d0168ce03 100644
--- a/lib/cmdline/cmdline_private.h
+++ b/lib/cmdline/cmdline_private.h
@@ -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