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 B52C243412; Thu, 30 Nov 2023 17:33:01 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 014BD42EFB; Thu, 30 Nov 2023 17:32:51 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2069.outbound.protection.outlook.com [40.107.244.69]) by mails.dpdk.org (Postfix) with ESMTP id C709242E8B for ; Thu, 30 Nov 2023 17:32:47 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WP2MGxGLj6/FMcUcSANS1riC/YsjWrkdFqZMWMSc6VCTm6U/+UfXjTxSG49sy3Y/xjdNFy3DGlXxXWzQ4sgco0cwQFmX1pJgJ9WoBASf+nvP1lpVyDDNYCH4xyaEqsL6m6nife7pFKOrYE0HvSUQk/eCO2gGK8E+kKOXz3r7DQIQDRrqbyhIooQUiOxm44NHVJSNE/G4Abv9o95xAIt9kEM601OBNM5htNh/zQ2hjbDzuZ7YbqDv+HTk2RmBu/S1U/it2ygRtERGtHm6V08/eh+CczxLGr2dRsVcuHpRtl9qwySqLTqUqYsbueDlZGkUcXfbUC3b/qB4aa99THhzJg== 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=H9CbEno+g4NpbDODojkrrMdvJUfTmEO4fA0LaGYy1pA=; b=QgR69QNLi50EvnQ1T5yvfCRIK/anbQD7oWEp7FIQ99eEwtcrKbMiw7AD31ltf3RV7l4cpxTJVJXVfGbx0M09K/1UW5lWHm1v0aDi8zRi7fQrqWGIwWJjMQ7LU2vkK1KqpNn17xztxAbhpgE3/CCzd4+vXQVw9PYU9rRB6/nEKgRGEdeKWpfjbtrhHRVNh0OyKmtwLLigUXFytTi45NJ/V5kqkvJCk8lDsYMhQdtY1IFDKF0HhuK/8LtQ2g0IM3KVq7r99UeFWqBjFZ2MekWbRcT28e6xIYNUqqlockppW4qqEFgLbEiq9rOo9+l2C2KNxj5+oW/+IreIeeMJsan2PA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) 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 (0) 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=H9CbEno+g4NpbDODojkrrMdvJUfTmEO4fA0LaGYy1pA=; b=arSpXLu3Xaa2r45hy1cvSFNRWM7QgH5evuiwmTiEo/x+BUur50kK5C/qtFbNPwhkzFuGdGxavqZzubI3/8jez1xh5n7nD+6C9GpRtxrW2Bo4SGKCjK1zhugBflREJXkFPp07BVativEdf8pyaIxdQJ8fj/l+nKW2vAkaYs4t471Ncw7cGru4RBoSc5LkBe1FkqnmHQu1Of0JXMsEUz7xa1AhAZAwnO9m0OYSGugaK9S4xlOqj7KXsydlCQYuo+A90TBT/2b2PwJkXdXQO2HAfcpTW+qVcTvtCc2mL8K8s0LsLkjKughykNhQwwzLDMBH1uJyaTNYJUKs+1y9VJDmFA== Received: from BL0PR02CA0117.namprd02.prod.outlook.com (2603:10b6:208:35::22) by DM6PR12MB4435.namprd12.prod.outlook.com (2603:10b6:5:2a6::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.24; Thu, 30 Nov 2023 16:32:44 +0000 Received: from BL6PEPF0001AB76.namprd02.prod.outlook.com (2603:10b6:208:35:cafe::e5) by BL0PR02CA0117.outlook.office365.com (2603:10b6:208:35::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.27 via Frontend Transport; Thu, 30 Nov 2023 16:32:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL6PEPF0001AB76.mail.protection.outlook.com (10.167.242.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.17 via Frontend Transport; Thu, 30 Nov 2023 16:32:44 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Thu, 30 Nov 2023 08:32:27 -0800 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Thu, 30 Nov 2023 08:32:26 -0800 Received: from nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41 via Frontend Transport; Thu, 30 Nov 2023 08:32:24 -0800 From: Michael Baum To: CC: Ori Kam , Aman Singh , "Yuying Zhang" , Ferruh Yigit , "Thomas Monjalon" Subject: [PATCH v3 2/2] app/testpmd: add random item support Date: Thu, 30 Nov 2023 18:32:15 +0200 Message-ID: <20231130163215.666239-3-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231130163215.666239-1-michaelba@nvidia.com> References: <20230911074149.697944-1-michaelba@nvidia.com> <20231130163215.666239-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: BL6PEPF0001AB76:EE_|DM6PR12MB4435:EE_ X-MS-Office365-Filtering-Correlation-Id: 884bf58c-6fd6-4a89-d84b-08dbf1c1fae9 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: BxM8xaqZ9aLr1i+GDL0PlvEgaUdAbt7BAVpfh+VNNoxjxZFaxGmqXXvQ8ANyQ1WQPb5cbdj9Nxmczj0P8bpWNDi//4uFW4jldUeRULah58+0EsIKAvav1XiEWLagW/XXZQK2bCgabsU2lbWLhKsJKxkYcHDKLYv8Fh0etgo3OR8gDtkm33HBCRPxTRG8aVc8aZBqIDpx8fEn13LkpGOaCFRu0rvkeNEzckth1wb+BgXFoYeBKC+6vSfCrGr1HuvNwAvtZwmXkw/lryzon955ElZ/6X5iAPYdDJLQaenPIp7eoucJmm3XWtTJF6osZ8XKuj7R13qozoc2C1xh4gyISpWTI7sHniUUpr61faBSWLmEgxFnL0eUZvCli94hbPnMQmLkf8+66zHbtehi5fCQzOqAtF24aJjrTTLEzYn3nREMk9QtSh8h4nomE45TOlDVzfg5ZKX82/DOJgsdmmbLZVMRU579NnSDrdtfDWSYn8nY+20aOoek4iRI3m85VKaziv+hizCXsD7Tpbyp5YwbeRJhNDQrjHBERM37yRz2lK99leyuyxYRzh19qs2mGVCJJcdc8fktiyCtDB11APSS+gv6UUR9IiwIqMmBuBIBlxMkiv5F642BXEafwFnp8GDzOThhy9fp2i1+wo8pt68pS65YARZmIim2u5D195QfWPmlJjjnGvz4LVzDAJ7jHfSdIvWIZ1iie2F9VSskL883S/zUexmGLQv+BZ9eSdoxaSCHqgic5nYPG1rSOCfUgxuT X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230031)(4636009)(376002)(396003)(136003)(346002)(39860400002)(230922051799003)(1800799012)(451199024)(82310400011)(64100799003)(186009)(46966006)(40470700004)(36840700001)(26005)(6286002)(356005)(55016003)(7636003)(41300700001)(82740400003)(336012)(426003)(36756003)(40480700001)(36860700001)(47076005)(1076003)(2616005)(478600001)(6666004)(40460700003)(7696005)(5660300002)(70586007)(316002)(70206006)(2906002)(6916009)(54906003)(86362001)(8936002)(8676002)(4326008); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2023 16:32:44.1637 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 884bf58c-6fd6-4a89-d84b-08dbf1c1fae9 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.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB76.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4435 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 | 28 +++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 4 +++ 2 files changed, 32 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index ce71818705..359c187b3c 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -433,6 +433,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, @@ -956,6 +958,7 @@ static const char *const modify_field_ids[] = { "hash_result", "geneve_opt_type", "geneve_opt_class", "geneve_opt_data", "mpls", "tcp_data_off", "ipv4_ihl", "ipv4_total_len", "ipv6_payload_len", + "random", NULL }; @@ -1562,6 +1565,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, @@ -1873,6 +1877,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, @@ -5195,6 +5205,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", @@ -12883,6 +12908,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 447e28e694..0cd1615d9e 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3756,6 +3756,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