From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 31C6E4256B; Mon, 11 Sep 2023 09:42:29 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C5F8D402F1; Mon, 11 Sep 2023 09:42:14 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by mails.dpdk.org (Postfix) with ESMTP id C5E79402E1 for ; Mon, 11 Sep 2023 09:42:12 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N9K1DVU/PBjaqGrYOWad4a4FknFnW71PAwdX5HOGpjBUXAYb3wgV1tsSIcnJTDUv38ZFoqqVVrwLEWDaOJPrtFPIZqMib7wuNb7Z8NWkEp12CP2DPWLXTLkkzbi4ZEl1QcV5AOMO1+GU3dBp0xOHzHmpy/X88sE68Cv0WJwimtY6KJ9xZtrjgSMbDNMN9FH5w46FBLluiingWAFjeR+wDs/bGokDkvzc+wT0LJj5kOTXanVv/4EyvBOeQkxFoLD4L1CVyywI/RQiAyxa42gqDTZo8r7E1utxnVMwkNAzXvFFNv1BBVKwWEf2EUwrfp/vDhkI4IF2XwngO1Weo5ortg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4Qh7CrLu6Uh/HjelxuIhI7/jne8K3mP6M2BrTG2z21Q=; b=GnYlwj1Prv/2mhreAl9xFjYrtaxjwWAKh/NQW3f+5PEKuD9+P6KYQS/xW1mt1zsJEM0oDMkbiSVx6IiZedEzxhrUdbbx7FpApQhLXbpaPYbmKXTgcOTxm/8r1aVD7QobPRtT+ybzmINyltg/8g0X0xRDYzN38MMlsW+9NxsQy/xDgfJqE5OKyiudssbQbO5aVIaOuy6R9Y/eiiy63Y8OHCbL1FP1C/l8uzKN3zUn7THZKNzg4xoxJeATTCdUjJVsT/6LsTHAM3KwikgvFfGlgRRos3uoEdfwqai9odviYwNtF3hwqwFrXIautA+2g89fXYCDytdHt0dcw0UStyXcGw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4Qh7CrLu6Uh/HjelxuIhI7/jne8K3mP6M2BrTG2z21Q=; b=FWeV0EoYT8bY5mXsMJ0OgD9ooCNRF1xiOeTOi8ugQh0w/EoLte+qv4OEUoqeFACQEa2CB64LHOJc32U9lurnwPqBgrViqvHoYMwO2Ml59k0Z9d/x0kFU/xFhQh43/ldaKZ0qrJ/d8PoAnGzQwqNWkCh0PItaQf7LoRuDmIjwU1iEm0QZUBS131FCEvXZ6YXihV4l0I5WwRbyETDpWx7xgdGEYljez1nvUTBrjxoXU+xO43vFJS/k7vFNfQGueAvoitFW5m2jXDf2f9Z+l37y/EPJWlc/K2R8boFOUxKs+VGA1M0Eg7h3MyU9dy4kx7cqbUk991JPcgbdKBMBSs9oXA== Received: from SA9PR13CA0056.namprd13.prod.outlook.com (2603:10b6:806:22::31) by LV8PR12MB9156.namprd12.prod.outlook.com (2603:10b6:408:181::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.31; Mon, 11 Sep 2023 07:42:10 +0000 Received: from SN1PEPF000252A3.namprd05.prod.outlook.com (2603:10b6:806:22:cafe::e1) by SA9PR13CA0056.outlook.office365.com (2603:10b6:806:22::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.16 via Frontend Transport; Mon, 11 Sep 2023 07:42:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SN1PEPF000252A3.mail.protection.outlook.com (10.167.242.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.16 via Frontend Transport; Mon, 11 Sep 2023 07:42:10 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 11 Sep 2023 00:42:01 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 11 Sep 2023 00:42:00 -0700 Received: from nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37 via Frontend Transport; Mon, 11 Sep 2023 00:41:58 -0700 From: Michael Baum To: CC: Ori Kam , Aman Singh , "Yuying Zhang" , Ferruh Yigit , "Thomas Monjalon" Subject: [PATCH v2 2/2] app/testpmd: add random item support Date: Mon, 11 Sep 2023 10:41:49 +0300 Message-ID: <20230911074149.697944-3-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230911074149.697944-1-michaelba@nvidia.com> References: <20230822090505.3242455-1-michaelba@nvidia.com> <20230911074149.697944-1-michaelba@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000252A3:EE_|LV8PR12MB9156:EE_ X-MS-Office365-Filtering-Correlation-Id: 0914780f-0642-4d52-73c2-08dbb29a9b81 X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UiZl55sGHrfo9ieZyGtgRtJWKi2j6Uf+4PzMXU7pz7OQqQ4CIPSPgQuJXQ27N6fbGHCZ7mRv2tKL6/tSXFyfO/M/rmkC8jvGW/SL6P6nSlmus0CV6C/zFKVCmFeMm/1y5SOKZVG7aKM9cSa45yN4rM89p0J5+wINYUUr5xDcYsKqmLIaJAxYkUME8SuBCqrH+VGekg+zdDuQxeNg2X57u8avro5CYqlsiZ7aHSRYYlEOirvmbM8coq9S3U4t5mF21450BgEZi4Cda8ngFfWV30o9HEVgHaCK23MBrTxXrDMbh1Cnr8j7+Mq6KlvlzK8MaNWGE9XU+z/18/nqyVaTKmMiZ7N0eoDAl5u2Zk4l8Exl3HdadsVavIT7eqWJJ/PGMNqK0qfU2wLX2IEGLK+xYPcb9UAso5g3Lcl+AlWHghUpkkNVg0XeqPJUMhcNvuWWdV5dReHuO0xyuHHeaB+SyngoTEuyWIYLyS+Jk6/XFgdL8XXGwtn2LgfvUu/3ujpeQT1c2nJmEAlEJrzMMUZ8Gq5yUeiYlzPe08bxcg0c0v5oIuub297h/lBVM26wAwCZjEz4gwlX8MN5Rwhl5Yuu83f28WzYiz0T55zjhp1GrcPBaiMAMV4RveTteSDFp0Zvhmv6b3tTiyhrbMdpotFYU4Ewff8htMtelZP0hjUG4ETu1VT96n+erMRJJYVQeHE2YNdnPmHjL11sPDxKHgpr09p+DHg6ugmQp5DqPOBMO/qDrypo9WILQ9P/+1JlfXte X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230031)(4636009)(376002)(396003)(346002)(136003)(39860400002)(1800799009)(186009)(82310400011)(451199024)(40470700004)(46966006)(36840700001)(40460700003)(7696005)(41300700001)(70586007)(316002)(36756003)(7636003)(82740400003)(86362001)(2906002)(356005)(478600001)(6916009)(54906003)(70206006)(6666004)(55016003)(83380400001)(26005)(8676002)(8936002)(6286002)(4326008)(1076003)(40480700001)(47076005)(336012)(36860700001)(426003)(2616005)(5660300002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2023 07:42:10.5310 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0914780f-0642-4d52-73c2-08dbb29a9b81 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF000252A3.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9156 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 random item, usage example: pattern random spec value 0x1 mask value 0x3 / eth / end Flow rule with above pattern matching 25% of the traffic, it hits only when random value suffix is "01" and miss the others ("00", "10", "11"). Signed-off-by: Michael Baum --- app/test-pmd/cmdline_flow.c | 30 ++++++++++++++++++++- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 4 +++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 94827bcc4a..55fb07ec91 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -417,6 +417,8 @@ enum index { ITEM_ICMP6_ND_OPT_TLA_ETH_TLA, ITEM_META, ITEM_META_DATA, + ITEM_RANDOM, + ITEM_RANDOM_VALUE, ITEM_GRE_KEY, ITEM_GRE_KEY_VALUE, ITEM_GRE_OPTION, @@ -936,7 +938,8 @@ static const char *const modify_field_ids[] = { "ipv6_proto", "flex_item", "hash_result", - "geneve_opt_type", "geneve_opt_class", "geneve_opt_data", "mpls", + "geneve_opt_type", "geneve_opt_class", "geneve_opt_data", + "mpls", "random", NULL }; @@ -1535,6 +1538,7 @@ static const enum index next_item[] = { ITEM_ICMP6_ND_OPT_SLA_ETH, ITEM_ICMP6_ND_OPT_TLA_ETH, ITEM_META, + ITEM_RANDOM, ITEM_GRE_KEY, ITEM_GRE_OPTION, ITEM_GTP_PSC, @@ -1842,6 +1846,12 @@ static const enum index item_meta[] = { ZERO, }; +static const enum index item_random[] = { + ITEM_RANDOM_VALUE, + ITEM_NEXT, + ZERO, +}; + static const enum index item_gtp_psc[] = { ITEM_GTP_PSC_QFI, ITEM_GTP_PSC_PDU_T, @@ -5063,6 +5073,21 @@ static const struct token token_list[] = { .args = ARGS(ARGS_ENTRY_MASK(struct rte_flow_item_meta, data, "\xff\xff\xff\xff")), }, + [ITEM_RANDOM] = { + .name = "random", + .help = "match random value", + .priv = PRIV_ITEM(RANDOM, sizeof(struct rte_flow_item_random)), + .next = NEXT(item_random), + .call = parse_vc, + }, + [ITEM_RANDOM_VALUE] = { + .name = "value", + .help = "random value", + .next = NEXT(item_random, NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_MASK(struct rte_flow_item_random, + value, "\xff\xff")), + }, [ITEM_GRE_KEY] = { .name = "gre_key", .help = "match GRE key", @@ -12634,6 +12659,9 @@ flow_item_default_mask(const struct rte_flow_item *item) case RTE_FLOW_ITEM_TYPE_META: mask = &rte_flow_item_meta_mask; break; + case RTE_FLOW_ITEM_TYPE_RANDOM: + mask = &rte_flow_item_random_mask; + break; case RTE_FLOW_ITEM_TYPE_FUZZY: mask = &rte_flow_item_fuzzy_mask; break; diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index a182479ab2..0b27a6fd97 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3724,6 +3724,10 @@ This section lists supported pattern items and their attributes, if any. - ``data {unsigned}``: metadata value. +- ``random``: match application specific random value. + + - ``value {unsigned}``: random value. + - ``gtp_psc``: match GTP PDU extension header with type 0x85. - ``pdu_type {unsigned}``: PDU type. -- 2.25.1