From patchwork Tue Dec 5 14:51:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 134883 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 594FF4367A; Tue, 5 Dec 2023 15:51:42 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0ABB542E66; Tue, 5 Dec 2023 15:51:32 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 69DE342E6C for ; Tue, 5 Dec 2023 15:51:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701787890; x=1733323890; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VzGkMUWknDCgMZALZwpoUeosfzY66DbU5lXtz7m+XKA=; b=RuX9/9oBSVp1+rSjB7M0YlkwUzXzPIgAWEvpJRGbYlNGXkqDdi3mxQo9 BeCdya+QaIRxsWqHOYzjfROea8QPeF9NziIY1g3o1qyCNNYBRFyYwiKut U0BJvt2nm/zYYsLklgdaMcWpwyHhhW76hptGC56QVernrKsCA7+fpeCvE IqrIp3krB46RF/ZGPPHQUA0hGTFPNMmSd6+OJRWXy6Yrp+mIENURFqQCg y/MaIjd+i9ty/H3c1vzRLU9qtVjrxQJW4cmsP/9wRuM5K9vb83eNAEm2y AL+/7izBg4gsMWGUsaG10D1WD9fX3lPGpDuaKh0ZexUOlzwS5ew9cnUWN g==; X-IronPort-AV: E=McAfee;i="6600,9927,10915"; a="374089987" X-IronPort-AV: E=Sophos;i="6.04,252,1695711600"; d="scan'208";a="374089987" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2023 06:51:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10915"; a="1018234180" X-IronPort-AV: E=Sophos;i="6.04,252,1695711600"; d="scan'208";a="1018234180" Received: from unknown (HELO silpixa00401385.ir.intel.com) ([10.237.214.152]) by fmsmga006.fm.intel.com with ESMTP; 05 Dec 2023 06:51:28 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: skori@marvell.com, david.marchand@redhat.com, Bruce Richardson Subject: [PATCH 3/3] buildtools/dpdk-cmdline-gen: add explicit IPv4 and v6 types Date: Tue, 5 Dec 2023 14:51:09 +0000 Message-Id: <20231205145109.1000464-4-bruce.richardson@intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231205145109.1000464-1-bruce.richardson@intel.com> References: <20231205145109.1000464-1-bruce.richardson@intel.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add support for generating cmdline lib code to just match IPv4 addresses or IPv6 addresses, rather than IP addresses in general. Signed-off-by: Bruce Richardson Acked-by: Sunil Kumar Kori --- buildtools/dpdk-cmdline-gen.py | 12 ++++++++++++ doc/guides/prog_guide/cmdline.rst | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/buildtools/dpdk-cmdline-gen.py b/buildtools/dpdk-cmdline-gen.py index 8b4f22ca24..7dadded783 100755 --- a/buildtools/dpdk-cmdline-gen.py +++ b/buildtools/dpdk-cmdline-gen.py @@ -81,6 +81,18 @@ def process_command(lineno, tokens, comment): f"static cmdline_parse_token_ipaddr_t cmd_{name}_{t_name}_tok =\n" f"\tTOKEN_IPADDR_INITIALIZER(struct cmd_{name}_result, {t_name});" ) + elif t_type in ["IPV4", "IPv4", "IPV4_ADDR"]: + result_struct.append(f"\tcmdline_ipaddr_t {t_name};") + initializers.append( + f"static cmdline_parse_token_ipaddr_t cmd_{name}_{t_name}_tok =\n" + f"\tTOKEN_IPV4_INITIALIZER(struct cmd_{name}_result, {t_name});" + ) + elif t_type in ["IPV6", "IPv6", "IPV6_ADDR"]: + result_struct.append(f"\tcmdline_ipaddr_t {t_name};") + initializers.append( + f"static cmdline_parse_token_ipaddr_t cmd_{name}_{t_name}_tok =\n" + f"\tTOKEN_IPV6_INITIALIZER(struct cmd_{name}_result, {t_name});" + ) elif t_type.startswith("(") and t_type.endswith(")"): result_struct.append(f"\tcmdline_fixed_string_t {t_name};") t_val = f'"{t_type[1:-1].replace(",","#")}"' diff --git a/doc/guides/prog_guide/cmdline.rst b/doc/guides/prog_guide/cmdline.rst index fc32d727dc..f62f17f1aa 100644 --- a/doc/guides/prog_guide/cmdline.rst +++ b/doc/guides/prog_guide/cmdline.rst @@ -70,6 +70,10 @@ The format of the list file must be: * ``src_ip`` + * ``dst_ip4`` + + * ``dst_ip6`` + * Variable fields, which take their values from a list of options, have the comma-separated option list placed in braces, rather than a the type name. For example,