DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] cmdline: configure input buffer size
@ 2024-05-01  5:26 Gregory Etelson
  2024-05-01  9:08 ` Bruce Richardson
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Gregory Etelson @ 2024-05-01  5:26 UTC (permalink / raw)
  To: dev; +Cc: getelson,  , rasland, alialnu

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' ...`

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
---
 lib/cmdline/cmdline_private.h | 4 ++++
 1 file changed, 4 insertions(+)

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] cmdline: configure input buffer size
  2024-05-01  5:26 [PATCH] cmdline: configure input buffer size Gregory Etelson
@ 2024-05-01  9:08 ` Bruce Richardson
  2024-05-01 10:06   ` Etelson, Gregory
  2024-05-01 17:18 ` [PATCH v2] cmdline: increase " Gregory Etelson
  2024-05-03  4:27 ` [PATCH v3] " Gregory Etelson
  2 siblings, 1 reply; 11+ messages in thread
From: Bruce Richardson @ 2024-05-01  9:08 UTC (permalink / raw)
  To: Gregory Etelson; +Cc: dev,  , rasland, alialnu

On Wed, May 01, 2024 at 08:26:59AM +0300, Gregory Etelson wrote:
> 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' ...`
> 
> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> ---
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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] cmdline: configure input buffer size
  2024-05-01  9:08 ` Bruce Richardson
@ 2024-05-01 10:06   ` Etelson, Gregory
  2024-05-01 14:42     ` Stephen Hemminger
  0 siblings, 1 reply; 11+ messages in thread
From: Etelson, Gregory @ 2024-05-01 10:06 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev,  , rasland, alialnu

Hello Bruce,

>> Application can set custom cmdline size during DPDK configuration:
>>
>> `meson setup ... -Dc_args='-DRDLINE_CUSTOM_BUF_SIZE=4096' ...`
>>
>> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
>> ---
> 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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] cmdline: configure input buffer size
  2024-05-01 10:06   ` Etelson, Gregory
@ 2024-05-01 14:42     ` Stephen Hemminger
  2024-05-01 15:56       ` Etelson, Gregory
  0 siblings, 1 reply; 11+ messages in thread
From: Stephen Hemminger @ 2024-05-01 14:42 UTC (permalink / raw)
  To: Etelson, Gregory; +Cc: Bruce Richardson, dev,  , rasland, alialnu

On Wed, 1 May 2024 13:06:47 +0300 (IDT)
"Etelson, Gregory" <getelson@nvidia.com> wrote:

> > 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


The buffer is transient so should have little impact.
Why not just use LINE_MAX from limits.h?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] cmdline: configure input buffer size
  2024-05-01 14:42     ` Stephen Hemminger
@ 2024-05-01 15:56       ` Etelson, Gregory
  2024-05-01 16:30         ` Bruce Richardson
  0 siblings, 1 reply; 11+ messages in thread
From: Etelson, Gregory @ 2024-05-01 15:56 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Bruce Richardson, dev,  , rasland, alialnu

Hello Stephen,

>>> 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
>
>
> The buffer is transient so should have little impact.
> Why not just use LINE_MAX from limits.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



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] cmdline: configure input buffer size
  2024-05-01 15:56       ` Etelson, Gregory
@ 2024-05-01 16:30         ` Bruce Richardson
  0 siblings, 0 replies; 11+ messages in thread
From: Bruce Richardson @ 2024-05-01 16:30 UTC (permalink / raw)
  To: Etelson, Gregory; +Cc: Stephen Hemminger, dev,  , rasland, alialnu

On Wed, May 01, 2024 at 06:56:37PM +0300, Etelson, Gregory wrote:
> Hello Stephen,
> 
> > > > 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
> > 
> > 
> > The buffer is transient so should have little impact.
> > Why not just use LINE_MAX from limits.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.
> 
+1 for just upping the size.
Thanks.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2] cmdline: increase input buffer size
  2024-05-01  5:26 [PATCH] cmdline: configure input buffer size Gregory Etelson
  2024-05-01  9:08 ` Bruce Richardson
@ 2024-05-01 17:18 ` Gregory Etelson
  2024-05-01 18:26   ` Morten Brørup
  2024-05-03  4:27 ` [PATCH v3] " Gregory Etelson
  2 siblings, 1 reply; 11+ messages in thread
From: Gregory Etelson @ 2024-05-01 17:18 UTC (permalink / raw)
  To: getelson; +Cc: alialnu, dev, mkashani, rasland

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(-)

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
--
2.43.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATCH v2] cmdline: increase input buffer size
  2024-05-01 17:18 ` [PATCH v2] cmdline: increase " Gregory Etelson
@ 2024-05-01 18:26   ` Morten Brørup
  2024-05-02  7:27     ` Bruce Richardson
  0 siblings, 1 reply; 11+ messages in thread
From: Morten Brørup @ 2024-05-01 18:26 UTC (permalink / raw)
  To: Gregory Etelson
  Cc: alialnu, dev, mkashani, rasland, Bruce Richardson, Stephen Hemminger

+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>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2] cmdline: increase input buffer size
  2024-05-01 18:26   ` Morten Brørup
@ 2024-05-02  7:27     ` Bruce Richardson
  0 siblings, 0 replies; 11+ messages in thread
From: Bruce Richardson @ 2024-05-02  7:27 UTC (permalink / raw)
  To: Morten Brørup
  Cc: Gregory Etelson, alialnu, dev, mkashani, rasland, Stephen Hemminger

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>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v3] cmdline: increase input buffer size
  2024-05-01  5:26 [PATCH] cmdline: configure input buffer size Gregory Etelson
  2024-05-01  9:08 ` Bruce Richardson
  2024-05-01 17:18 ` [PATCH v2] cmdline: increase " Gregory Etelson
@ 2024-05-03  4:27 ` Gregory Etelson
  2024-05-15  8:41   ` Gregory Etelson
  2 siblings, 1 reply; 11+ messages in thread
From: Gregory Etelson @ 2024-05-03  4:27 UTC (permalink / raw)
  To: getelson; +Cc: alialnu, dev, mkashani, rasland, bruce.richardson, stephen, mb

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.

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
---
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(-)

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3] cmdline: increase input buffer size
  2024-05-03  4:27 ` [PATCH v3] " Gregory Etelson
@ 2024-05-15  8:41   ` Gregory Etelson
  0 siblings, 0 replies; 11+ messages in thread
From: Gregory Etelson @ 2024-05-15  8:41 UTC (permalink / raw)
  Cc: Ali Alnubani, dev, Maayan Kashani, Raslan Darawsheh,
	bruce.richardson, stephen, mb

[-- Attachment #1: Type: text/plain, Size: 2500 bytes --]

Hello,

What is the status of that patch ?

Regards,
Gregory
________________________________
From: Gregory Etelson <getelson@nvidia.com>
Sent: Friday, May 3, 2024 07:27
To: Gregory Etelson <getelson@nvidia.com>
Cc: Ali Alnubani <alialnu@nvidia.com>; dev@dpdk.org <dev@dpdk.org>; Maayan Kashani <mkashani@nvidia.com>; Raslan Darawsheh <rasland@nvidia.com>; bruce.richardson@intel.com <bruce.richardson@intel.com>; stephen@networkplumber.org <stephen@networkplumber.org>; mb@smartsharesystems.com <mb@smartsharesystems.com>
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.

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
---
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(-)

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


[-- Attachment #2: Type: text/html, Size: 4685 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-05-15  8:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-01  5:26 [PATCH] cmdline: configure input buffer size Gregory Etelson
2024-05-01  9:08 ` Bruce Richardson
2024-05-01 10:06   ` Etelson, Gregory
2024-05-01 14:42     ` Stephen Hemminger
2024-05-01 15:56       ` Etelson, Gregory
2024-05-01 16:30         ` Bruce Richardson
2024-05-01 17:18 ` [PATCH v2] cmdline: increase " Gregory Etelson
2024-05-01 18:26   ` Morten Brørup
2024-05-02  7:27     ` Bruce Richardson
2024-05-03  4:27 ` [PATCH v3] " Gregory Etelson
2024-05-15  8:41   ` Gregory Etelson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).