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 80CFEA00BE; Fri, 11 Feb 2022 03:28:17 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1FF6D42706; Fri, 11 Feb 2022 03:27:49 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2048.outbound.protection.outlook.com [40.107.220.48]) by mails.dpdk.org (Postfix) with ESMTP id E8039426F8 for ; Fri, 11 Feb 2022 03:27:46 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ezmnoya7zGsy8+gT042bP+I5vqtxzZZqLNCcZIHos810e9btzjWmOrXlUfVZKcAc5opVK77xnHI0je3iWfdbSKrBG5IdsDSta04PvMJuYzp/AOs0dHhWQjtqXDD3gQad/o2O8JSMg0C/8hVnQvkV3PZ3HarAm7+i0EQgknHXc890+CWJegh8N0Afy+EdfNB4gGHS+I1qOSuA0nic70vLGOSK9a7cI57Rz0ZbhRGAnHud9qU5UXt3GQMqPpj8d4x/KYmTcrLCrLIvx8tKc2QI+EdDxRxW9oZoRrQ37aCr3DVe/Qblr0Xr4IXFlj0xY+R4/hHv4gy+X0mU0UoXMykf2g== 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=ZDdrbUC/eyif76RrMf/5pKHH2xAmq8Z/7+Kv4abKqA8=; b=RSPuHsbGxuhktaX7FdJNadtfcxBjB2M8WqcnPLO6ISzhzBBJ0OIlgVItONYl+lhJfcUUlzfUinYjn0YoZnBh3/onT7KEaDnodHkHhnhukTWiA1hYlhSUmtToV+eCDu3HrTwhJtxNWnIDioB3s086B82GaRYJ3ybLm19Rn0heBI3E78DuEocyd96QCMdzUoKNNCGMYpZJ/rxBnrB2MKa7zn7og/ZCv0Jb+DWeqSx5dtJipWiP4jrmN1kVozC8Nn0NecI3CfCRA9OqxqClK5K/vGKe7TN5Rhb/HdO58kPUXtv4ZNPz41WXmhm5GjCPf70scyA2cLrNCSTRrhr1ogfBtg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) 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=ZDdrbUC/eyif76RrMf/5pKHH2xAmq8Z/7+Kv4abKqA8=; b=WH+gTU3dbLrGjG2qTqviLxS6mFKjFBjxoe32xNNUJ426hmDSBtO+UlPGta5sY6BWS3DMs+lAuGFhPnZeTscYFOwerCWNPoQQ1LuINJ+cZfNEfbcNxB6qJk60fstgse3kb6yYe4ut5Ms/xX7gshyJDmNKuBaSw2l7DBr0TYB6IapGn80Xgk2bCS7v7oFCWTTjj45ER9VXGqcTrCDtD47Dc4OqCmw4e+3dJgkVpD2QTCQsmG8M368Z9CkC7DQM30TWaT/8WczKarJesDoHAXOZOsdca/ydMwhVtTAfOosJH0DhbIi+W2fweOcueuEZngULuZX1IlpsAugqM3Ypsr6scg== Received: from SA1PR12MB5672.namprd12.prod.outlook.com (2603:10b6:806:23c::5) by DM4PR12MB5357.namprd12.prod.outlook.com (2603:10b6:5:39b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.12; Fri, 11 Feb 2022 02:27:45 +0000 Received: from DM6PR17CA0023.namprd17.prod.outlook.com (2603:10b6:5:1b3::36) by SA1PR12MB5672.namprd12.prod.outlook.com (2603:10b6:806:23c::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.12; Fri, 11 Feb 2022 02:27:44 +0000 Received: from DM6NAM11FT037.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1b3:cafe::48) by DM6PR17CA0023.outlook.office365.com (2603:10b6:5:1b3::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11 via Frontend Transport; Fri, 11 Feb 2022 02:27:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) 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.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.238) by DM6NAM11FT037.mail.protection.outlook.com (10.13.172.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4975.11 via Frontend Transport; Fri, 11 Feb 2022 02:27:43 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Fri, 11 Feb 2022 02:27:43 +0000 Received: from pegasus01.mtr.labs.mlnx (10.126.231.35) by rnnvmail201.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.9; Thu, 10 Feb 2022 18:27:39 -0800 From: Alexander Kozyrev To: CC: , , , , , , , , , Subject: [PATCH v5 08/10] app/testpmd: add flow queue push operation Date: Fri, 11 Feb 2022 04:26:51 +0200 Message-ID: <20220211022653.1372318-9-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20220211022653.1372318-1-akozyrev@nvidia.com> References: <20220209213809.1208269-1-akozyrev@nvidia.com> <20220211022653.1372318-1-akozyrev@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b2a64d96-8fd0-477d-a1d4-08d9ed061599 X-MS-TrafficTypeDiagnostic: SA1PR12MB5672:EE_|DM4PR12MB5357:EE_ X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zGbt0Lh96kjq+aWyl5G5dVGaEjReQA0e7rc/dAG8x8bxQBmnMfppKGnLzO+SeLf1outWJjtLjWjpQWST350I37RW6rTQMrdTZmEr8HC5jy+c6QG/fuUwJKF7uG+T+YANPLu0EVaCIcaXNE2/Yo5+wDdV7QRl2TvwkUf3+2ECVqmCwzEEQBJMurtLE77mJLFxboQ/lkVRu/VClaT7z4+cK9jNDwhTfHM0w+f8OiJOUITAsf+eB0bDAdjuaiScTATnpbsSq//G+aSatZ9Qa1X//fu0C4gBVb9TByV7Tt4dT5bE1D4lnhP9MRBMrBwC/+mbAJ7BBLTDVBBhRbacCOR99d4KS7Li0WXNRvAzDapFz0352p9DvWdPUOgGfv0YflKHcrpF7+6RJssgyNS0KS7NPVgG7+L1AD0hPrS1KyCuYfAqWND/M0QlPVfW5PBSvTuFm5XYZO9fle6qiIcr3TGeXM4Eqnp0LMtaaUkzpxCLNN5GsX3H1/y0wuyLUGEVvP1KnH2Zf0v0sv1pqpC5kTUlGZC8eAdyp+VHzVhqVHD01XA81+AEN6n4dLgp6Ta8NTgEQiCyFympnVqh4Ic4tPxnjCjIvdLgs+qMQacm1tuLQAWIFt5EJnVeOUSqY+/cuX/8LCQQvc+jYwtoHYYyosLYlPxmRiEjDtphDnN+5Z10yc4SEZS5LMNjNJgBkz5MrW55KRGiFLxl7xY1LMLGFHepPg== X-Forefront-Antispam-Report: CIP:12.22.5.238; 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)(36756003)(86362001)(40460700003)(36860700001)(47076005)(54906003)(82310400004)(508600001)(6916009)(426003)(8676002)(5660300002)(70206006)(83380400001)(336012)(2906002)(81166007)(356005)(6666004)(8936002)(2616005)(70586007)(1076003)(4326008)(16526019)(26005)(186003)(7416002)(316002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2022 02:27:43.6206 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b2a64d96-8fd0-477d-a1d4-08d9ed061599 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.238]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT037.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5357 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_q_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 f794a83a07..11240d6f04 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, @@ -132,6 +133,9 @@ enum index { QUEUE_DESTROY_ID, QUEUE_DESTROY_POSTPONE, + /* Push arguments. */ + PUSH_QUEUE, + /* Table arguments. */ TABLE_CREATE, TABLE_DESTROY, @@ -2159,6 +2163,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); @@ -2437,7 +2444,8 @@ static const struct token token_list[] = { ISOLATE, TUNNEL, FLEX, - QUEUE)), + QUEUE, + PUSH)), .call = parse_init, }, /* Top-level command. */ @@ -2782,6 +2790,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} [...]]", @@ -8413,6 +8436,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, @@ -9784,6 +9835,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 50781b2b84..52ecc4d773 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2619,6 +2619,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_q_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 d0e1e3eeec..03f135ff46 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -939,6 +939,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 b802288c66..01e5e3c19f 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3396,6 +3396,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} @@ -3611,6 +3615,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_q_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