[RFC,v2,4/5] buildtools/dpdk-cmdline-gen: add IP address support

Message ID 20230918130352.379478-5-bruce.richardson@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series use script to simplify use of cmdline lib |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Bruce Richardson Sept. 18, 2023, 1:03 p.m. UTC
  Add support for apps to have IP addresses as command parameters

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 buildtools/dpdk-cmdline-gen.py | 5 +++++
 1 file changed, 5 insertions(+)
  

Patch

diff --git a/buildtools/dpdk-cmdline-gen.py b/buildtools/dpdk-cmdline-gen.py
index 1ddd8b6bbb..c1f8a6f1da 100755
--- a/buildtools/dpdk-cmdline-gen.py
+++ b/buildtools/dpdk-cmdline-gen.py
@@ -49,6 +49,10 @@  def process_command(tokens, cfile):
             result_struct.append(f"\t{t_type.lower()}_t {t_name};")
             initializers.append(f"static cmdline_parse_token_num_t cmd_{name}_{t_name}_tok =\n"
                     + f"\tTOKEN_NUM_INITIALIZER(struct cmd_{name}_result, {t_name}, RTE_{t_type});")
+        elif t_type in ['IP', 'IP_ADDR', 'IPADDR']:
+            result_struct.append(f"\tcmdline_ipaddr_t {t_name};")
+            initializers.append(f"cmdline_parse_token_ipaddr_t cmd_{name}_{t_name}_tok =\n"
+                    + f"\tTOKEN_IPV4_INITIALIZER(struct cmd_{name}_result, {t_name});")
         else:
             print(f"Error: unknown token-type {t}", file=sys.stderr)
             sys.exit(1)
@@ -96,6 +100,7 @@  def process_commands(infile, hfile, cfile, ctxname):
     print("#include <cmdline.h>")
     print("#include <cmdline_parse_string.h>")
     print("#include <cmdline_parse_num.h>")
+    print("#include <cmdline_parse_ipaddr.h>")
     print("")
 
     for line in infile.readlines():