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 BB052A034E; Sat, 19 Feb 2022 05:13:19 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9AA2241154; Sat, 19 Feb 2022 05:12:41 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2065.outbound.protection.outlook.com [40.107.93.65]) by mails.dpdk.org (Postfix) with ESMTP id D453A41182 for ; Sat, 19 Feb 2022 05:12:39 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FOmostROZ05WzOwSOn0qDFF3vQMGEfGrySh7Ys8dgMRgEiVQAR9og2ggIM5RARnkNjiJaxQeYyOqSHUkwc9lBHmlVbvOsLrhzSoCBcqXccvqkaZfaRNjAg+WrFBs0tz/oaEKwqfHo6Rc/D3Vl49pD3gwU2qvpXDlQCnkIdJuvqt6DwnVfq5l+TuY9ptulUjnwKY1vZjTrBs6HjBgBCVJK7XMYHW1t7ktB5eCvfUMPC5dZk2Ni0MhyHfIu+uscM0kZTFIloFxv7grwD34Cl30FvLPoeeWjDoOa/rdHonFVoo2RGPgLMXWZA6GYDcZQcE4hVOb+8vszWenSTXC9fYvww== 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=hYgvzeOWEQFoDap0ZaNPkkZPMIySpNz2qIjFzhzWwic=; b=RPN5QF1/QHWU6hiU0NzPus6gQxdsshBYKfWftCJIjubpZXChkPJoI7dSiOTivs5AMq+Q6chQdbA8zV3LRe9plrvxVH+s2WS8mm5e63Pz7RQCVMuwAmAZy2xj7wji1Qzn8MDP1tQ40fuJO4GvNUyhM9Te+woJhxZKPpGifmoeNnYvgvrlVPjZArfUL8M4ln0pHCrSES8bcVd4gIJef3f1ep35rwa97FSRYmohQ+aIbXsdaM7glvv8pvTmH29E915qKSUWxvjeKsf8gjLP81SI5m/4AWgx1sG5MWYmhzwArnWZbLbcYPF4zWBHkj59xR8GdUjWpNoFgG7+Ljgh+a+LgQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) smtp.rcpttodomain=intel.com 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=hYgvzeOWEQFoDap0ZaNPkkZPMIySpNz2qIjFzhzWwic=; b=QrBdacg9GHAgjrf5N/9oD7BlP/qENk6vs4K7ig2Ubkm37p2d4sWV8qyuYFtBkoYVzmxVv7ADvD6TapNCbzQSZ4YYiKOCPdCNVvPpwPXPIlZS07hE0CaI26espKqYv8wiNyNVSH9tip9BtCXlU3JqpodBph0TmpeimrdOMejdgJBfjdhpmRUYpJ6o5+aRMc20/xrHlQPlslPc6O6ftezo2k7OJiAijc15FV5xSiWKBydPqcdTnkg+VV28Ufidclzoldh7hzPW7MUb41G50eQCpC8ZLZe6iR8l7sn8vud58i/HnwK7kQoykk+PAwz9tCp5r6reu6CLgc3xnnBhmKG02Q== Received: from DM5PR12MB1660.namprd12.prod.outlook.com (2603:10b6:4:9::22) by CH2PR12MB4839.namprd12.prod.outlook.com (2603:10b6:610:b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.18; Sat, 19 Feb 2022 04:12:37 +0000 Received: from BN0PR07CA0019.namprd07.prod.outlook.com (2603:10b6:408:141::9) by DM5PR12MB1660.namprd12.prod.outlook.com (2603:10b6:4:9::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.16; Sat, 19 Feb 2022 04:12:36 +0000 Received: from BN8NAM11FT038.eop-nam11.prod.protection.outlook.com (2603:10b6:408:141:cafe::7d) by BN0PR07CA0019.outlook.office365.com (2603:10b6:408:141::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.14 via Frontend Transport; Sat, 19 Feb 2022 04:12:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) 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 12.22.5.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.234) by BN8NAM11FT038.mail.protection.outlook.com (10.13.176.246) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4995.15 via Frontend Transport; Sat, 19 Feb 2022 04:12:35 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sat, 19 Feb 2022 04:12:35 +0000 Received: from pegasus01.mtr.labs.mlnx (10.126.230.35) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9; Fri, 18 Feb 2022 20:12:31 -0800 From: Alexander Kozyrev To: CC: , , , , , , , , , Subject: [PATCH v7 09/11] app/testpmd: add flow queue push operation Date: Sat, 19 Feb 2022 06:11:42 +0200 Message-ID: <20220219041144.2145380-10-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20220219041144.2145380-1-akozyrev@nvidia.com> References: <20220212041930.1516767-1-akozyrev@nvidia.com> <20220219041144.2145380-1-akozyrev@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To drhqmail201.nvidia.com (10.126.190.180) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 63b1ba49-4cb4-447f-113d-08d9f35e0f45 X-MS-TrafficTypeDiagnostic: DM5PR12MB1660:EE_|CH2PR12MB4839:EE_ X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WDwhr+sDtjZbl2FxXKeIn0Dh6Ez4Nuk8NP8/tZGPIbSrrtcwlCU5d7IKef8HVnNDh/xRgnHheG50T8Wn4pn1KFa2vB5OywIFEj66MQQCEE60utOAy0dVVzALKkx5Rk6wGGnt4AUZII+pjNU9qe+iOaixOHFfsa5pRtkXvM/5DYlNDaiFzRuLBRRwaxVYwJsZOFLY6ia7qCRf1kWiIN0v0yvQUGqbndnLbzwi4lzIEdcRMt1CRHZUHHvVsHkQo5fqRHodR/7kh15b6RIkdMgy5A2WAAHFPfhKgnL9XHh6Ks3ZVIX0QSZwpKOTEQaFdkthN6h0bsMGvBxGw0nZxfVtH7mMJgrQZ1BtzHViZMx0vwBaWYO8gN7JAmpvrF3SOkVtBxrEB7LvZk0xvv+yYmTzeyOwCUOQfhAhwTBENWMNy1sq60XYJd071XHqzEJGcOjhk6d6hnSXWlUSvIf271OnVm6Oe6pBnUE6KobnqD6l37rNwwBFBUxmeph161a6cORuzxcVFDs2xtj4b7RbDG/W/nYXf7Z19KBPOxiifzN2YgCSrL0xTGsVb4G0he2C9o3EJRXetbI/IQopmBHU/O9VuEPSMRV6QzVgoMsuT/tljTeXdhnKCOTIY83p7rFHDlAoLfowgH8vqD23PB5ePQCHi+LMynqjlB5Tfoc6dYnZngmyigeAZigQ7HrhWLs0A8DDhDL6G8Iy8bjb2/JGhO3Mxg== X-Forefront-Antispam-Report: CIP:12.22.5.234; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(4326008)(54906003)(8676002)(6916009)(70206006)(70586007)(316002)(508600001)(86362001)(356005)(81166007)(36756003)(47076005)(36860700001)(186003)(26005)(1076003)(16526019)(6666004)(2616005)(7416002)(5660300002)(2906002)(40460700003)(82310400004)(336012)(426003)(83380400001)(8936002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2022 04:12:35.6577 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 63b1ba49-4cb4-447f-113d-08d9f35e0f45 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.234]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT038.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4839 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 testpmd support for the rte_flow_push API. Provide the command line interface for pushing operations. Usage example: flow queue 0 push 0 Signed-off-by: Alexander Kozyrev Acked-by: Ori Kam --- app/test-pmd/cmdline_flow.c | 56 ++++++++++++++++++++- app/test-pmd/config.c | 28 +++++++++++ app/test-pmd/testpmd.h | 1 + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 21 ++++++++ 4 files changed, 105 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index d359127df9..af36975cdf 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -94,6 +94,7 @@ enum index { TUNNEL, FLEX, QUEUE, + PUSH, /* Flex arguments */ FLEX_ITEM_INIT, @@ -138,6 +139,9 @@ enum index { QUEUE_DESTROY_ID, QUEUE_DESTROY_POSTPONE, + /* Push arguments. */ + PUSH_QUEUE, + /* Table arguments. */ TABLE_CREATE, TABLE_DESTROY, @@ -2252,6 +2256,9 @@ static int parse_qo(struct context *, const struct token *, static int parse_qo_destroy(struct context *, const struct token *, const char *, unsigned int, void *, unsigned int); +static int parse_push(struct context *, const struct token *, + const char *, unsigned int, + void *, unsigned int); static int parse_tunnel(struct context *, const struct token *, const char *, unsigned int, void *, unsigned int); @@ -2530,7 +2537,8 @@ static const struct token token_list[] = { ISOLATE, TUNNEL, FLEX, - QUEUE)), + QUEUE, + PUSH)), .call = parse_init, }, /* Top-level command. */ @@ -2911,6 +2919,21 @@ static const struct token token_list[] = { .call = parse_qo_destroy, }, /* Top-level command. */ + [PUSH] = { + .name = "push", + .help = "push enqueued operations", + .next = NEXT(NEXT_ENTRY(PUSH_QUEUE), NEXT_ENTRY(COMMON_PORT_ID)), + .args = ARGS(ARGS_ENTRY(struct buffer, port)), + .call = parse_push, + }, + /* Sub-level commands. */ + [PUSH_QUEUE] = { + .name = "queue", + .help = "specify queue id", + .next = NEXT(NEXT_ENTRY(END), NEXT_ENTRY(COMMON_QUEUE_ID)), + .args = ARGS(ARGS_ENTRY(struct buffer, queue)), + }, + /* Top-level command. */ [INDIRECT_ACTION] = { .name = "indirect_action", .type = "{command} {port_id} [{arg} [...]]", @@ -8735,6 +8758,34 @@ parse_qo_destroy(struct context *ctx, const struct token *token, } } +/** Parse tokens for push queue command. */ +static int +parse_push(struct context *ctx, const struct token *token, + const char *str, unsigned int len, + void *buf, unsigned int size) +{ + struct buffer *out = buf; + + /* Token name must match. */ + if (parse_default(ctx, token, str, len, NULL, 0) < 0) + return -1; + /* Nothing else to do if there is no buffer. */ + if (!out) + return len; + if (!out->command) { + if (ctx->curr != PUSH) + return -1; + if (sizeof(*out) > size) + return -1; + out->command = ctx->curr; + ctx->objdata = 0; + ctx->object = out; + ctx->objmask = NULL; + out->args.vc.data = (uint8_t *)out + size; + } + return len; +} + static int parse_flex(struct context *ctx, const struct token *token, const char *str, unsigned int len, @@ -10120,6 +10171,9 @@ cmd_flow_parsed(const struct buffer *in) in->args.destroy.rule_n, in->args.destroy.rule); break; + case PUSH: + port_queue_flow_push(in->port, in->queue); + break; case INDIRECT_ACTION_CREATE: port_action_handle_create( in->port, in->args.vc.attr.group, diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index d3b3e6ca5a..e3b5e348ab 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2626,6 +2626,34 @@ port_queue_flow_destroy(portid_t port_id, queueid_t queue_id, return ret; } +/** Push all the queue operations in the queue to the NIC. */ +int +port_queue_flow_push(portid_t port_id, queueid_t queue_id) +{ + struct rte_port *port; + struct rte_flow_error error; + int ret = 0; + + if (port_id_is_invalid(port_id, ENABLED_WARN) || + port_id == (portid_t)RTE_PORT_ALL) + return -EINVAL; + port = &ports[port_id]; + + if (queue_id >= port->queue_nb) { + printf("Queue #%u is invalid\n", queue_id); + return -EINVAL; + } + + memset(&error, 0x55, sizeof(error)); + ret = rte_flow_push(port_id, queue_id, &error); + if (ret < 0) { + printf("Failed to push operations in the queue\n"); + return -EINVAL; + } + printf("Queue #%u operations pushed\n", queue_id); + return ret; +} + /** Create flow rule. */ int port_flow_create(portid_t port_id, diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 62e874eaaf..24a43fd82c 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -940,6 +940,7 @@ int port_queue_flow_create(portid_t port_id, queueid_t queue_id, const struct rte_flow_action *actions); int port_queue_flow_destroy(portid_t port_id, queueid_t queue_id, bool postpone, uint32_t n, const uint32_t *rule); +int port_queue_flow_push(portid_t port_id, queueid_t queue_id); int port_flow_validate(portid_t port_id, const struct rte_flow_attr *attr, const struct rte_flow_item *pattern, diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 194b350932..4f1f908d4a 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3398,6 +3398,10 @@ following sections. flow queue {port_id} destroy {queue_id} [postpone {boolean}] rule {rule_id} [...] +- Push enqueued operations:: + + flow push {port_id} queue {queue_id} + - Create a flow rule:: flow create {port_id} @@ -3616,6 +3620,23 @@ The usual error message is shown when a table cannot be destroyed:: Caught error type [...] ([...]): [...] +Pushing enqueued operations +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +``flow push`` pushes all the outstanding enqueued operations +to the underlying device immediately. +It is bound to ``rte_flow_push()``:: + + flow push {port_id} queue {queue_id} + +If successful, it will show:: + + Queue #[...] operations pushed + +The usual error message is shown when operations cannot be pushed:: + + Caught error type [...] ([...]): [...] + Creating a tunnel stub for offload ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- 2.18.2