From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id E955B425D1;
	Mon, 18 Sep 2023 15:04:39 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 16B7740A8B;
	Mon, 18 Sep 2023 15:04:10 +0200 (CEST)
Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20])
 by mails.dpdk.org (Postfix) with ESMTP id 0676640A6E
 for <dev@dpdk.org>; Mon, 18 Sep 2023 15:04:07 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
 d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
 t=1695042248; x=1726578248;
 h=from:to:cc:subject:date:message-id:in-reply-to:
 references:mime-version:content-transfer-encoding;
 bh=/LgBJRJsTvjFbK/Eeym9+ozhJFSN56v/DJZLnFfiznQ=;
 b=LMr4kj85BaaygFf4XXt2iOsoMZYNb6tjrls5nOj451QwSpvCHc5lm2QA
 xTFQ/FnyjWy0w7DUh7yHM559TV7GEc6pMXB0kytdydOlfWrPwSMGSvCcT
 e/eaX3/spAP0oCTB8zJJaCtIPF3J1W1bXxHAisCxjyjsm0Tqhec/quTbX
 ijVMjuBi/5caARM2cGOIdSQ9VGlqLkP+kBwugBaUJtx5Vpfu8nm02j3+v
 p7CzugW74GJuMp/sBWCcXaARSAOiCnTsGSCRB7E3WOaORSEY1dHp0CBxE
 CoDLXfNmEIfMoT6kF9Mi5JMslCUCb5WuX1Uy/K+wdC8Z1Y0yirSTL1dlD g==;
X-IronPort-AV: E=McAfee;i="6600,9927,10837"; a="369969403"
X-IronPort-AV: E=Sophos;i="6.02,156,1688454000"; d="scan'208";a="369969403"
Received: from orsmga007.jf.intel.com ([10.7.209.58])
 by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 18 Sep 2023 06:04:07 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=McAfee;i="6600,9927,10837"; a="739130642"
X-IronPort-AV: E=Sophos;i="6.02,156,1688454000"; d="scan'208";a="739130642"
Received: from silpixa00401385.ir.intel.com ([10.237.214.14])
 by orsmga007.jf.intel.com with ESMTP; 18 Sep 2023 06:04:06 -0700
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Olivier Matz <olivier.matz@6wind.com>,
 Bruce Richardson <bruce.richardson@intel.com>
Subject: [RFC PATCH v2 4/5] buildtools/dpdk-cmdline-gen: add IP address support
Date: Mon, 18 Sep 2023 14:03:51 +0100
Message-Id: <20230918130352.379478-5-bruce.richardson@intel.com>
X-Mailer: git-send-email 2.39.2
In-Reply-To: <20230918130352.379478-1-bruce.richardson@intel.com>
References: <20230802170052.955323-1-bruce.richardson@intel.com>
 <20230918130352.379478-1-bruce.richardson@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

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

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