Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/108110/?format=api
https://patches.dpdk.org/api/patches/108110/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20220223030240.2506513-9-akozyrev@nvidia.com/", "project": { "id": 1, "url": "https://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20220223030240.2506513-9-akozyrev@nvidia.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20220223030240.2506513-9-akozyrev@nvidia.com", "date": "2022-02-23T03:02:37", "name": "[v10,08/11] app/testpmd: add async flow create/destroy operations", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "db11aef61aaf7d9b59fcc51354031c230812a504", "submitter": { "id": 1873, "url": "https://patches.dpdk.org/api/people/1873/?format=api", "name": "Alexander Kozyrev", "email": "akozyrev@nvidia.com" }, "delegate": { "id": 319, "url": "https://patches.dpdk.org/api/users/319/?format=api", "username": "fyigit", "first_name": "Ferruh", "last_name": "Yigit", "email": "ferruh.yigit@amd.com" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20220223030240.2506513-9-akozyrev@nvidia.com/mbox/", "series": [ { "id": 21808, "url": "https://patches.dpdk.org/api/series/21808/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=21808", "date": "2022-02-23T03:02:29", "name": "ethdev: datapath-focused flow rules management", "version": 10, "mbox": "https://patches.dpdk.org/series/21808/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/108110/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/108110/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "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])\n\tby inbox.dpdk.org (Postfix) with ESMTP id CC557A034C;\n\tWed, 23 Feb 2022 04:03:55 +0100 (CET)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 8AD7C4117E;\n\tWed, 23 Feb 2022 04:03:28 +0100 (CET)", "from NAM10-BN7-obe.outbound.protection.outlook.com\n (mail-bn7nam10on2089.outbound.protection.outlook.com [40.107.92.89])\n by mails.dpdk.org (Postfix) with ESMTP id D9A594117A\n for <dev@dpdk.org>; Wed, 23 Feb 2022 04:03:24 +0100 (CET)", "from BN8PR12MB2884.namprd12.prod.outlook.com (2603:10b6:408:97::18)\n by MN2PR12MB4784.namprd12.prod.outlook.com (2603:10b6:208:39::19)\n with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.22; Wed, 23 Feb\n 2022 03:03:22 +0000", "from DM5PR12CA0072.namprd12.prod.outlook.com (2603:10b6:3:103::34)\n by BN8PR12MB2884.namprd12.prod.outlook.com (2603:10b6:408:97::18) with\n Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.16; Wed, 23 Feb\n 2022 03:03:22 +0000", "from DM6NAM11FT024.eop-nam11.prod.protection.outlook.com\n (2603:10b6:3:103:cafe::3b) by DM5PR12CA0072.outlook.office365.com\n (2603:10b6:3:103::34) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.21 via Frontend\n Transport; Wed, 23 Feb 2022 03:03:21 +0000", "from mail.nvidia.com (12.22.5.238) by\n DM6NAM11FT024.mail.protection.outlook.com (10.13.172.159) with Microsoft SMTP\n Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id\n 15.20.5017.22 via Frontend Transport; Wed, 23 Feb 2022 03:03:21 +0000", "from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL105.nvidia.com\n (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.18;\n Wed, 23 Feb 2022 03:03:20 +0000", "from pegasus01.mtr.labs.mlnx (10.126.231.35) by\n rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9;\n Tue, 22 Feb 2022 19:03:17 -0800" ], "ARC-Seal": "i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;\n b=WVEkuZGLWHzFsFQMTpXzlevgDkhXCFH3AI8hfGuC5bvsgF1Kv/lnJ9G3/kgykp6xvE2XKcqL2vN3Ikz1okFZkc6XTNSp4k99cOdEBnRnVDbkpyn7Eja5ZH09NH9mW41xLVpjsSERWCSSMRFM+ZmR4SmrBljF2FxCa2Hnl8e6wr6fpO6n1TwQl2L7re+BSxXpMqph4O+NntjhQ520HOxgpVVOF6YNrcqGX+QjaT0XIGnbAzAgdt9ZR+n6evAdL090etaqCHtwu6fye17BTsoIEvkKhqXtKl1kunOv/cCOwFkSfsGGlLpjh91v9WhHPcWjrO2BW5hfFwz+jNZZBAyMdg==", "ARC-Message-Signature": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n s=arcselector9901;\n 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;\n bh=Dzm3Q11sKnPvpyXOb7SqpN16gyVqtlAyAaJJWYnOOKk=;\n b=il01awvEiUmsNdGNSCd5IHdT9q3CH8BbKjFuyNK9aB53H9FB8Wk8zli+29rlelAkE+XBLfvwo37XA2WLZchezfa2eZLquaoZp3M1ZI3+Zi2HKPIowL+fPWiKU19l53MdCpzQSjNatgZX8/FB91kRjZ3CjnsaTtqlyRTXNsB1JAzqx/rU6lvYKhOY9j41If3pB4zbCXbCJlSJeqrZhyaA1zlZemc3oErsVvISTNdOk+6fRB+YMzPg+eRRDxLFx3R5XHTsirI4T2AQqHcz1D/dT8MbdJLkJ67mi1UPceNSxd5GNVbQe5pzD3Gfm1yUoCq1uPi3PP0I3OMqwPvqC37m9A==", "ARC-Authentication-Results": "i=1; mx.microsoft.com 1; spf=pass (sender ip is\n 12.22.5.238) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass\n (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none\n (message not signed); arc=none", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com;\n s=selector2;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n bh=Dzm3Q11sKnPvpyXOb7SqpN16gyVqtlAyAaJJWYnOOKk=;\n b=SaE6Jox2QWfN7uWVOC9Sapsu4CIShVIwAKUcbNujkdJ5v/6yMbBxIOVTnO8RsfqR/4LG0w+1CD5xr7hberl9iliq1mfRYfU7QUukH/89ePDy76UfeXatBewyDSqyLBB6QcJWedDqH3JlfCnhn9iOJ5KjwOesIEMgdn945o8Auc+CFgd0xumW3bz3yUcAdgEhIjWJ8bTFd0K+9OzR0zKO+/paZi1dWc++jL/kLBI9wJrxVdyic281vj35F5Lls6f5CsIpfJxZOGqMRWIvu814MpsPIYW4tfzZdKr3IVxGEZSVfcLV/aXJo9Hl+g+KCDpfjAP0fNm9oMG7LzIU1idjHg==", "X-MS-Exchange-Authentication-Results": "spf=pass (sender IP is 12.22.5.238)\n smtp.mailfrom=nvidia.com; dkim=none (message not signed)\n header.d=none;dmarc=pass action=none header.from=nvidia.com;", "Received-SPF": "Pass (protection.outlook.com: domain of nvidia.com designates\n 12.22.5.238 as permitted sender) receiver=protection.outlook.com;\n client-ip=12.22.5.238; helo=mail.nvidia.com;", "From": "Alexander Kozyrev <akozyrev@nvidia.com>", "To": "<dev@dpdk.org>", "CC": "<orika@nvidia.com>, <thomas@monjalon.net>, <ivan.malov@oktetlabs.ru>,\n <andrew.rybchenko@oktetlabs.ru>, <ferruh.yigit@intel.com>,\n <mohammad.abdul.awal@intel.com>, <qi.z.zhang@intel.com>,\n <jerinj@marvell.com>, <ajit.khaparde@broadcom.com>,\n <bruce.richardson@intel.com>", "Subject": "[PATCH v10 08/11] app/testpmd: add async flow create/destroy\n operations", "Date": "Wed, 23 Feb 2022 05:02:37 +0200", "Message-ID": "<20220223030240.2506513-9-akozyrev@nvidia.com>", "X-Mailer": "git-send-email 2.18.2", "In-Reply-To": "<20220223030240.2506513-1-akozyrev@nvidia.com>", "References": "<20220221230240.2409665-1-akozyrev@nvidia.com>\n <20220223030240.2506513-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\n rnnvmail201.nvidia.com (10.129.68.8)", "X-EOPAttributedMessage": "0", "X-MS-PublicTrafficType": "Email", "X-MS-Office365-Filtering-Correlation-Id": "12b51a9f-8893-4d3d-8044-08d9f6790cdd", "X-MS-TrafficTypeDiagnostic": "BN8PR12MB2884:EE_|MN2PR12MB4784:EE_", "X-LD-Processed": "43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr,ExtAddr", "X-Microsoft-Antispam-PRVS": "\n <BN8PR12MB2884B86359685FEF4DF14613AF3C9@BN8PR12MB2884.namprd12.prod.outlook.com>", "X-MS-Exchange-SenderADCheck": "1", "X-MS-Exchange-AntiSpam-Relay": "0", "X-Microsoft-Antispam": "BCL:0;", "X-Microsoft-Antispam-Message-Info": "\n 8SZvu5KTpJ2ogh1UclJv/2/6wDcwNxH1DLUorzqxIyI/Y1QXMDyfvHwFi+JzPsS6l4J6+P5Oz3lHVPh64y05OvlqXVilSb8thoa3bUAjmmJOLAJeiSciMQoUIA+BB9RgnM4Zuhf3x+eJG+8XuwLmZwdaLLVTk7dWxn18H5bn6q21fAjEDGpyD4DaITLUNKqUf9IiH7KvaEe+GiuDTr2R4ogmdj5efsIx/b/JLSc+LCNkXsxW9BVUeGcYYO9WvxaCMdT5tp0jyRKgsi4b9EUYqdp2Ei7Mg7M2fUpf+p0Rj+Usaw8RuTOr9RaBr/pFMu3Rb08SgiHUrrZ3zQjEeDIRt81ZLtueY8qER4DvYz6BwNnnNKWAu4XcRqXaDxC8pw5zCkowC4V43J59GSF5UOBaAXysbAm/s5KtBqyjz5fLlrWU4RCMdvm7/wKtBbsIm6aBLM843x6/oLrpe/QhCmazLRbf4ugH3cUqvqi8AShpDp/0DocURBXwLcrq2vTVlRvJqkBzecG4hl5YJUE5UVZ2/we3doe1Tl6uKzb84cIv+v4RBFOew8TEAgNDRAZuxPySd0xeabcSnw3UKaKuS3nGxEhbe8bJ/qu5xcXZ61CcRj9019L8kXfJqU6DI59Z5D3mm+hoOUYCp5o773/FwfC5VrE5c+FK81hBaHersSP8cQ1utnrFzL0BXh5vC+Fnw0BAXmaQTRcxh1rTXfCZr6A+8g==", "X-Forefront-Antispam-Report": "CIP:12.22.5.238; CTRY:US; LANG:en; SCL:1; SRV:;\n IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE;\n SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(4326008)(47076005)(30864003)(426003)(336012)(83380400001)(36756003)(7416002)(40460700003)(5660300002)(2906002)(8936002)(2616005)(82310400004)(36860700001)(16526019)(186003)(26005)(70206006)(70586007)(356005)(81166007)(54906003)(6666004)(86362001)(1076003)(8676002)(6916009)(508600001)(316002)(36900700001);\n DIR:OUT; SFP:1101;", "X-OriginatorOrg": "Nvidia.com", "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "23 Feb 2022 03:03:21.5392 (UTC)", "X-MS-Exchange-CrossTenant-Network-Message-Id": "\n 12b51a9f-8893-4d3d-8044-08d9f6790cdd", "X-MS-Exchange-CrossTenant-Id": "43083d15-7273-40c1-b7db-39efd9ccc17a", "X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp": "\n TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.238];\n Helo=[mail.nvidia.com]", "X-MS-Exchange-CrossTenant-FromEntityHeader": "HybridOnPrem", "X-MS-Exchange-CrossTenant-AuthSource": "\n DM6NAM11FT024.eop-nam11.prod.protection.outlook.com", "X-MS-Exchange-CrossTenant-AuthAs": "Anonymous", "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "MN2PR12MB4784", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org" }, "content": "Add testpmd support for the rte_flow_q_create/rte_flow_q_destroy API.\nProvide the command line interface for enqueueing flow\ncreation/destruction operations. Usage example:\n testpmd> flow queue 0 create 0 postpone no\n template_table 6 pattern_template 0 actions_template 0\n pattern eth dst is 00:16:3e:31:15:c3 / end actions drop / end\n testpmd> flow queue 0 destroy 0 postpone yes rule 0\n\nSigned-off-by: Alexander Kozyrev <akozyrev@nvidia.com>\nAcked-by: Ori Kam <orika@nvidia.com>\n---\n app/test-pmd/cmdline_flow.c | 267 +++++++++++++++++++-\n app/test-pmd/config.c | 166 ++++++++++++\n app/test-pmd/testpmd.h | 7 +\n doc/guides/testpmd_app_ug/testpmd_funcs.rst | 57 +++++\n 4 files changed, 496 insertions(+), 1 deletion(-)", "diff": "diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c\nindex 5715899c95..d359127df9 100644\n--- a/app/test-pmd/cmdline_flow.c\n+++ b/app/test-pmd/cmdline_flow.c\n@@ -59,6 +59,7 @@ enum index {\n \tCOMMON_PATTERN_TEMPLATE_ID,\n \tCOMMON_ACTIONS_TEMPLATE_ID,\n \tCOMMON_TABLE_ID,\n+\tCOMMON_QUEUE_ID,\n \n \t/* TOP-level command. */\n \tADD,\n@@ -92,6 +93,7 @@ enum index {\n \tISOLATE,\n \tTUNNEL,\n \tFLEX,\n+\tQUEUE,\n \n \t/* Flex arguments */\n \tFLEX_ITEM_INIT,\n@@ -120,6 +122,22 @@ enum index {\n \tACTIONS_TEMPLATE_SPEC,\n \tACTIONS_TEMPLATE_MASK,\n \n+\t/* Queue arguments. */\n+\tQUEUE_CREATE,\n+\tQUEUE_DESTROY,\n+\n+\t/* Queue create arguments. */\n+\tQUEUE_CREATE_ID,\n+\tQUEUE_CREATE_POSTPONE,\n+\tQUEUE_TEMPLATE_TABLE,\n+\tQUEUE_PATTERN_TEMPLATE,\n+\tQUEUE_ACTIONS_TEMPLATE,\n+\tQUEUE_SPEC,\n+\n+\t/* Queue destroy arguments. */\n+\tQUEUE_DESTROY_ID,\n+\tQUEUE_DESTROY_POSTPONE,\n+\n \t/* Table arguments. */\n \tTABLE_CREATE,\n \tTABLE_DESTROY,\n@@ -918,6 +936,8 @@ struct token {\n struct buffer {\n \tenum index command; /**< Flow command. */\n \tportid_t port; /**< Affected port ID. */\n+\tqueueid_t queue; /** Async queue ID. */\n+\tbool postpone; /** Postpone async operation */\n \tunion {\n \t\tstruct {\n \t\t\tstruct rte_flow_port_attr port_attr;\n@@ -948,6 +968,7 @@ struct buffer {\n \t\t\tuint32_t action_id;\n \t\t} ia; /* Indirect action query arguments */\n \t\tstruct {\n+\t\t\tuint32_t table_id;\n \t\t\tuint32_t pat_templ_id;\n \t\t\tuint32_t act_templ_id;\n \t\t\tstruct rte_flow_attr attr;\n@@ -1103,6 +1124,18 @@ static const enum index next_table_destroy_attr[] = {\n \tZERO,\n };\n \n+static const enum index next_queue_subcmd[] = {\n+\tQUEUE_CREATE,\n+\tQUEUE_DESTROY,\n+\tZERO,\n+};\n+\n+static const enum index next_queue_destroy_attr[] = {\n+\tQUEUE_DESTROY_ID,\n+\tEND,\n+\tZERO,\n+};\n+\n static const enum index next_ia_create_attr[] = {\n \tINDIRECT_ACTION_CREATE_ID,\n \tINDIRECT_ACTION_INGRESS,\n@@ -2213,6 +2246,12 @@ static int parse_table(struct context *, const struct token *,\n static int parse_table_destroy(struct context *, const struct token *,\n \t\t\t const char *, unsigned int,\n \t\t\t void *, unsigned int);\n+static int parse_qo(struct context *, const struct token *,\n+\t\t const char *, unsigned int,\n+\t\t void *, unsigned int);\n+static int parse_qo_destroy(struct context *, const struct token *,\n+\t\t\t const char *, unsigned int,\n+\t\t\t void *, unsigned int);\n static int parse_tunnel(struct context *, const struct token *,\n \t\t\tconst char *, unsigned int,\n \t\t\tvoid *, unsigned int);\n@@ -2288,6 +2327,8 @@ static int comp_actions_template_id(struct context *, const struct token *,\n \t\t\t\t unsigned int, char *, unsigned int);\n static int comp_table_id(struct context *, const struct token *,\n \t\t\t unsigned int, char *, unsigned int);\n+static int comp_queue_id(struct context *, const struct token *,\n+\t\t\t unsigned int, char *, unsigned int);\n \n /** Token definitions. */\n static const struct token token_list[] = {\n@@ -2459,6 +2500,13 @@ static const struct token token_list[] = {\n \t\t.call = parse_int,\n \t\t.comp = comp_table_id,\n \t},\n+\t[COMMON_QUEUE_ID] = {\n+\t\t.name = \"{queue_id}\",\n+\t\t.type = \"QUEUE_ID\",\n+\t\t.help = \"queue id\",\n+\t\t.call = parse_int,\n+\t\t.comp = comp_queue_id,\n+\t},\n \t/* Top-level command. */\n \t[FLOW] = {\n \t\t.name = \"flow\",\n@@ -2481,7 +2529,8 @@ static const struct token token_list[] = {\n \t\t\t QUERY,\n \t\t\t ISOLATE,\n \t\t\t TUNNEL,\n-\t\t\t FLEX)),\n+\t\t\t FLEX,\n+\t\t\t QUEUE)),\n \t\t.call = parse_init,\n \t},\n \t/* Top-level command. */\n@@ -2784,6 +2833,84 @@ static const struct token token_list[] = {\n \t\t.call = parse_table,\n \t},\n \t/* Top-level command. */\n+\t[QUEUE] = {\n+\t\t.name = \"queue\",\n+\t\t.help = \"queue a flow rule operation\",\n+\t\t.next = NEXT(next_queue_subcmd, NEXT_ENTRY(COMMON_PORT_ID)),\n+\t\t.args = ARGS(ARGS_ENTRY(struct buffer, port)),\n+\t\t.call = parse_qo,\n+\t},\n+\t/* Sub-level commands. */\n+\t[QUEUE_CREATE] = {\n+\t\t.name = \"create\",\n+\t\t.help = \"create a flow rule\",\n+\t\t.next = NEXT(NEXT_ENTRY(QUEUE_TEMPLATE_TABLE),\n+\t\t\t NEXT_ENTRY(COMMON_QUEUE_ID)),\n+\t\t.args = ARGS(ARGS_ENTRY(struct buffer, queue)),\n+\t\t.call = parse_qo,\n+\t},\n+\t[QUEUE_DESTROY] = {\n+\t\t.name = \"destroy\",\n+\t\t.help = \"destroy a flow rule\",\n+\t\t.next = NEXT(NEXT_ENTRY(QUEUE_DESTROY_ID),\n+\t\t\t NEXT_ENTRY(COMMON_QUEUE_ID)),\n+\t\t.args = ARGS(ARGS_ENTRY(struct buffer, queue)),\n+\t\t.call = parse_qo_destroy,\n+\t},\n+\t/* Queue arguments. */\n+\t[QUEUE_TEMPLATE_TABLE] = {\n+\t\t.name = \"template table\",\n+\t\t.help = \"specify table id\",\n+\t\t.next = NEXT(NEXT_ENTRY(QUEUE_PATTERN_TEMPLATE),\n+\t\t\t NEXT_ENTRY(COMMON_TABLE_ID)),\n+\t\t.args = ARGS(ARGS_ENTRY(struct buffer,\n+\t\t\t\t\targs.vc.table_id)),\n+\t\t.call = parse_qo,\n+\t},\n+\t[QUEUE_PATTERN_TEMPLATE] = {\n+\t\t.name = \"pattern_template\",\n+\t\t.help = \"specify pattern template index\",\n+\t\t.next = NEXT(NEXT_ENTRY(QUEUE_ACTIONS_TEMPLATE),\n+\t\t\t NEXT_ENTRY(COMMON_UNSIGNED)),\n+\t\t.args = ARGS(ARGS_ENTRY(struct buffer,\n+\t\t\t\t\targs.vc.pat_templ_id)),\n+\t\t.call = parse_qo,\n+\t},\n+\t[QUEUE_ACTIONS_TEMPLATE] = {\n+\t\t.name = \"actions_template\",\n+\t\t.help = \"specify actions template index\",\n+\t\t.next = NEXT(NEXT_ENTRY(QUEUE_CREATE_POSTPONE),\n+\t\t\t NEXT_ENTRY(COMMON_UNSIGNED)),\n+\t\t.args = ARGS(ARGS_ENTRY(struct buffer,\n+\t\t\t\t\targs.vc.act_templ_id)),\n+\t\t.call = parse_qo,\n+\t},\n+\t[QUEUE_CREATE_POSTPONE] = {\n+\t\t.name = \"postpone\",\n+\t\t.help = \"postpone create operation\",\n+\t\t.next = NEXT(NEXT_ENTRY(ITEM_PATTERN),\n+\t\t\t NEXT_ENTRY(COMMON_BOOLEAN)),\n+\t\t.args = ARGS(ARGS_ENTRY(struct buffer, postpone)),\n+\t\t.call = parse_qo,\n+\t},\n+\t[QUEUE_DESTROY_POSTPONE] = {\n+\t\t.name = \"postpone\",\n+\t\t.help = \"postpone destroy operation\",\n+\t\t.next = NEXT(NEXT_ENTRY(QUEUE_DESTROY_ID),\n+\t\t\t NEXT_ENTRY(COMMON_BOOLEAN)),\n+\t\t.args = ARGS(ARGS_ENTRY(struct buffer, postpone)),\n+\t\t.call = parse_qo_destroy,\n+\t},\n+\t[QUEUE_DESTROY_ID] = {\n+\t\t.name = \"rule\",\n+\t\t.help = \"specify rule id to destroy\",\n+\t\t.next = NEXT(next_queue_destroy_attr,\n+\t\t\tNEXT_ENTRY(COMMON_UNSIGNED)),\n+\t\t.args = ARGS(ARGS_ENTRY_PTR(struct buffer,\n+\t\t\t\t\t args.destroy.rule)),\n+\t\t.call = parse_qo_destroy,\n+\t},\n+\t/* Top-level command. */\n \t[INDIRECT_ACTION] = {\n \t\t.name = \"indirect_action\",\n \t\t.type = \"{command} {port_id} [{arg} [...]]\",\n@@ -8503,6 +8630,111 @@ parse_table_destroy(struct context *ctx, const struct token *token,\n \treturn len;\n }\n \n+/** Parse tokens for queue create commands. */\n+static int\n+parse_qo(struct context *ctx, const struct token *token,\n+\t const char *str, unsigned int len,\n+\t void *buf, unsigned int size)\n+{\n+\tstruct buffer *out = buf;\n+\n+\t/* Token name must match. */\n+\tif (parse_default(ctx, token, str, len, NULL, 0) < 0)\n+\t\treturn -1;\n+\t/* Nothing else to do if there is no buffer. */\n+\tif (!out)\n+\t\treturn len;\n+\tif (!out->command) {\n+\t\tif (ctx->curr != QUEUE)\n+\t\t\treturn -1;\n+\t\tif (sizeof(*out) > size)\n+\t\t\treturn -1;\n+\t\tout->command = ctx->curr;\n+\t\tctx->objdata = 0;\n+\t\tctx->object = out;\n+\t\tctx->objmask = NULL;\n+\t\tout->args.vc.data = (uint8_t *)out + size;\n+\t\treturn len;\n+\t}\n+\tswitch (ctx->curr) {\n+\tcase QUEUE_CREATE:\n+\t\tout->command = ctx->curr;\n+\t\tctx->objdata = 0;\n+\t\tctx->object = out;\n+\t\tctx->objmask = NULL;\n+\t\treturn len;\n+\tcase QUEUE_TEMPLATE_TABLE:\n+\tcase QUEUE_PATTERN_TEMPLATE:\n+\tcase QUEUE_ACTIONS_TEMPLATE:\n+\tcase QUEUE_CREATE_POSTPONE:\n+\t\treturn len;\n+\tcase ITEM_PATTERN:\n+\t\tout->args.vc.pattern =\n+\t\t\t(void *)RTE_ALIGN_CEIL((uintptr_t)(out + 1),\n+\t\t\t\t\t sizeof(double));\n+\t\tctx->object = out->args.vc.pattern;\n+\t\tctx->objmask = NULL;\n+\t\treturn len;\n+\tcase ACTIONS:\n+\t\tout->args.vc.actions =\n+\t\t\t(void *)RTE_ALIGN_CEIL((uintptr_t)\n+\t\t\t\t\t (out->args.vc.pattern +\n+\t\t\t\t\t\tout->args.vc.pattern_n),\n+\t\t\t\t\t sizeof(double));\n+\t\tctx->object = out->args.vc.actions;\n+\t\tctx->objmask = NULL;\n+\t\treturn len;\n+\tdefault:\n+\t\treturn -1;\n+\t}\n+}\n+\n+/** Parse tokens for queue destroy command. */\n+static int\n+parse_qo_destroy(struct context *ctx, const struct token *token,\n+\t\t const char *str, unsigned int len,\n+\t\t void *buf, unsigned int size)\n+{\n+\tstruct buffer *out = buf;\n+\tuint32_t *flow_id;\n+\n+\t/* Token name must match. */\n+\tif (parse_default(ctx, token, str, len, NULL, 0) < 0)\n+\t\treturn -1;\n+\t/* Nothing else to do if there is no buffer. */\n+\tif (!out)\n+\t\treturn len;\n+\tif (!out->command || out->command == QUEUE) {\n+\t\tif (ctx->curr != QUEUE_DESTROY)\n+\t\t\treturn -1;\n+\t\tif (sizeof(*out) > size)\n+\t\t\treturn -1;\n+\t\tout->command = ctx->curr;\n+\t\tctx->objdata = 0;\n+\t\tctx->object = out;\n+\t\tctx->objmask = NULL;\n+\t\tout->args.destroy.rule =\n+\t\t\t(void *)RTE_ALIGN_CEIL((uintptr_t)(out + 1),\n+\t\t\t\t\t sizeof(double));\n+\t\treturn len;\n+\t}\n+\tswitch (ctx->curr) {\n+\tcase QUEUE_DESTROY_ID:\n+\t\tflow_id = out->args.destroy.rule\n+\t\t\t\t+ out->args.destroy.rule_n++;\n+\t\tif ((uint8_t *)flow_id > (uint8_t *)out + size)\n+\t\t\treturn -1;\n+\t\tctx->objdata = 0;\n+\t\tctx->object = flow_id;\n+\t\tctx->objmask = NULL;\n+\t\treturn len;\n+\tcase QUEUE_DESTROY_POSTPONE:\n+\t\treturn len;\n+\tdefault:\n+\t\treturn -1;\n+\t}\n+}\n+\n static int\n parse_flex(struct context *ctx, const struct token *token,\n \t const char *str, unsigned int len,\n@@ -9544,6 +9776,28 @@ comp_table_id(struct context *ctx, const struct token *token,\n \treturn i;\n }\n \n+/** Complete available queue IDs. */\n+static int\n+comp_queue_id(struct context *ctx, const struct token *token,\n+\t unsigned int ent, char *buf, unsigned int size)\n+{\n+\tunsigned int i = 0;\n+\tstruct rte_port *port;\n+\n+\t(void)token;\n+\tif (port_id_is_invalid(ctx->port, DISABLED_WARN) ||\n+\t ctx->port == (portid_t)RTE_PORT_ALL)\n+\t\treturn -1;\n+\tport = &ports[ctx->port];\n+\tfor (i = 0; i < port->queue_nb; i++) {\n+\t\tif (buf && i == ent)\n+\t\t\treturn snprintf(buf, size, \"%u\", i);\n+\t}\n+\tif (buf)\n+\t\treturn -1;\n+\treturn i;\n+}\n+\n /** Internal context. */\n static struct context cmd_flow_context;\n \n@@ -9855,6 +10109,17 @@ cmd_flow_parsed(const struct buffer *in)\n \t\t\t\t\tin->args.table_destroy.table_id_n,\n \t\t\t\t\tin->args.table_destroy.table_id);\n \t\tbreak;\n+\tcase QUEUE_CREATE:\n+\t\tport_queue_flow_create(in->port, in->queue, in->postpone,\n+\t\t\t\t in->args.vc.table_id, in->args.vc.pat_templ_id,\n+\t\t\t\t in->args.vc.act_templ_id, in->args.vc.pattern,\n+\t\t\t\t in->args.vc.actions);\n+\t\tbreak;\n+\tcase QUEUE_DESTROY:\n+\t\tport_queue_flow_destroy(in->port, in->queue, in->postpone,\n+\t\t\t\t\tin->args.destroy.rule_n,\n+\t\t\t\t\tin->args.destroy.rule);\n+\t\tbreak;\n \tcase INDIRECT_ACTION_CREATE:\n \t\tport_action_handle_create(\n \t\t\t\tin->port, in->args.vc.attr.group,\ndiff --git a/app/test-pmd/config.c b/app/test-pmd/config.c\nindex cefbc64c0c..d7ab57b124 100644\n--- a/app/test-pmd/config.c\n+++ b/app/test-pmd/config.c\n@@ -2460,6 +2460,172 @@ port_flow_template_table_destroy(portid_t port_id,\n \treturn ret;\n }\n \n+/** Enqueue create flow rule operation. */\n+int\n+port_queue_flow_create(portid_t port_id, queueid_t queue_id,\n+\t\t bool postpone, uint32_t table_id,\n+\t\t uint32_t pattern_idx, uint32_t actions_idx,\n+\t\t const struct rte_flow_item *pattern,\n+\t\t const struct rte_flow_action *actions)\n+{\n+\tstruct rte_flow_op_attr op_attr = { .postpone = postpone };\n+\tstruct rte_flow_op_result comp = { 0 };\n+\tstruct rte_flow *flow;\n+\tstruct rte_port *port;\n+\tstruct port_flow *pf;\n+\tstruct port_table *pt;\n+\tuint32_t id = 0;\n+\tbool found;\n+\tint ret = 0;\n+\tstruct rte_flow_error error = { RTE_FLOW_ERROR_TYPE_NONE, NULL, NULL };\n+\tstruct rte_flow_action_age *age = age_action_get(actions);\n+\n+\tport = &ports[port_id];\n+\tif (port->flow_list) {\n+\t\tif (port->flow_list->id == UINT32_MAX) {\n+\t\t\tprintf(\"Highest rule ID is already assigned,\"\n+\t\t\t \" delete it first\");\n+\t\t\treturn -ENOMEM;\n+\t\t}\n+\t\tid = port->flow_list->id + 1;\n+\t}\n+\n+\tif (queue_id >= port->queue_nb) {\n+\t\tprintf(\"Queue #%u is invalid\\n\", queue_id);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tfound = false;\n+\tpt = port->table_list;\n+\twhile (pt) {\n+\t\tif (table_id == pt->id) {\n+\t\t\tfound = true;\n+\t\t\tbreak;\n+\t\t}\n+\t\tpt = pt->next;\n+\t}\n+\tif (!found) {\n+\t\tprintf(\"Table #%u is invalid\\n\", table_id);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (pattern_idx >= pt->nb_pattern_templates) {\n+\t\tprintf(\"Pattern template index #%u is invalid,\"\n+\t\t \" %u templates present in the table\\n\",\n+\t\t pattern_idx, pt->nb_pattern_templates);\n+\t\treturn -EINVAL;\n+\t}\n+\tif (actions_idx >= pt->nb_actions_templates) {\n+\t\tprintf(\"Actions template index #%u is invalid,\"\n+\t\t \" %u templates present in the table\\n\",\n+\t\t actions_idx, pt->nb_actions_templates);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tpf = port_flow_new(NULL, pattern, actions, &error);\n+\tif (!pf)\n+\t\treturn port_flow_complain(&error);\n+\tif (age) {\n+\t\tpf->age_type = ACTION_AGE_CONTEXT_TYPE_FLOW;\n+\t\tage->context = &pf->age_type;\n+\t}\n+\t/* Poisoning to make sure PMDs update it in case of error. */\n+\tmemset(&error, 0x11, sizeof(error));\n+\tflow = rte_flow_async_create(port_id, queue_id, &op_attr, pt->table,\n+\t\tpattern, pattern_idx, actions, actions_idx, NULL, &error);\n+\tif (!flow) {\n+\t\tuint32_t flow_id = pf->id;\n+\t\tport_queue_flow_destroy(port_id, queue_id, true, 1, &flow_id);\n+\t\treturn port_flow_complain(&error);\n+\t}\n+\n+\twhile (ret == 0) {\n+\t\t/* Poisoning to make sure PMDs update it in case of error. */\n+\t\tmemset(&error, 0x22, sizeof(error));\n+\t\tret = rte_flow_pull(port_id, queue_id, &comp, 1, &error);\n+\t\tif (ret < 0) {\n+\t\t\tprintf(\"Failed to pull queue\\n\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t}\n+\n+\tpf->next = port->flow_list;\n+\tpf->id = id;\n+\tpf->flow = flow;\n+\tport->flow_list = pf;\n+\tprintf(\"Flow rule #%u creation enqueued\\n\", pf->id);\n+\treturn 0;\n+}\n+\n+/** Enqueue number of destroy flow rules operations. */\n+int\n+port_queue_flow_destroy(portid_t port_id, queueid_t queue_id,\n+\t\t\tbool postpone, uint32_t n, const uint32_t *rule)\n+{\n+\tstruct rte_flow_op_attr op_attr = { .postpone = postpone };\n+\tstruct rte_flow_op_result comp = { 0 };\n+\tstruct rte_port *port;\n+\tstruct port_flow **tmp;\n+\tuint32_t c = 0;\n+\tint ret = 0;\n+\n+\tif (port_id_is_invalid(port_id, ENABLED_WARN) ||\n+\t port_id == (portid_t)RTE_PORT_ALL)\n+\t\treturn -EINVAL;\n+\tport = &ports[port_id];\n+\n+\tif (queue_id >= port->queue_nb) {\n+\t\tprintf(\"Queue #%u is invalid\\n\", queue_id);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\ttmp = &port->flow_list;\n+\twhile (*tmp) {\n+\t\tuint32_t i;\n+\n+\t\tfor (i = 0; i != n; ++i) {\n+\t\t\tstruct rte_flow_error error;\n+\t\t\tstruct port_flow *pf = *tmp;\n+\n+\t\t\tif (rule[i] != pf->id)\n+\t\t\t\tcontinue;\n+\t\t\t/*\n+\t\t\t * Poisoning to make sure PMD\n+\t\t\t * update it in case of error.\n+\t\t\t */\n+\t\t\tmemset(&error, 0x33, sizeof(error));\n+\t\t\tif (rte_flow_async_destroy(port_id, queue_id, &op_attr,\n+\t\t\t\t\t\t pf->flow, NULL, &error)) {\n+\t\t\t\tret = port_flow_complain(&error);\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\n+\t\t\twhile (ret == 0) {\n+\t\t\t\t/*\n+\t\t\t\t * Poisoning to make sure PMD\n+\t\t\t\t * update it in case of error.\n+\t\t\t\t */\n+\t\t\t\tmemset(&error, 0x44, sizeof(error));\n+\t\t\t\tret = rte_flow_pull(port_id, queue_id,\n+\t\t\t\t\t\t &comp, 1, &error);\n+\t\t\t\tif (ret < 0) {\n+\t\t\t\t\tprintf(\"Failed to pull queue\\n\");\n+\t\t\t\t\treturn -EINVAL;\n+\t\t\t\t}\n+\t\t\t}\n+\n+\t\t\tprintf(\"Flow rule #%u destruction enqueued\\n\", pf->id);\n+\t\t\t*tmp = pf->next;\n+\t\t\tfree(pf);\n+\t\t\tbreak;\n+\t\t}\n+\t\tif (i == n)\n+\t\t\ttmp = &(*tmp)->next;\n+\t\t++c;\n+\t}\n+\treturn ret;\n+}\n+\n /** Create flow rule. */\n int\n port_flow_create(portid_t port_id,\ndiff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h\nindex fd02498faf..62e874eaaf 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -933,6 +933,13 @@ int port_flow_template_table_create(portid_t port_id, uint32_t id,\n \t\t uint32_t nb_actions_templates, uint32_t *actions_templates);\n int port_flow_template_table_destroy(portid_t port_id,\n \t\t\t uint32_t n, const uint32_t *table);\n+int port_queue_flow_create(portid_t port_id, queueid_t queue_id,\n+\t\t\t bool postpone, uint32_t table_id,\n+\t\t\t uint32_t pattern_idx, uint32_t actions_idx,\n+\t\t\t const struct rte_flow_item *pattern,\n+\t\t\t const struct rte_flow_action *actions);\n+int port_queue_flow_destroy(portid_t port_id, queueid_t queue_id,\n+\t\t\t bool postpone, uint32_t n, const uint32_t *rule);\n int port_flow_validate(portid_t port_id,\n \t\t const struct rte_flow_attr *attr,\n \t\t const struct rte_flow_item *pattern,\ndiff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst\nindex f63eb76a3a..194b350932 100644\n--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst\n+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst\n@@ -3384,6 +3384,20 @@ following sections.\n pattern {item} [/ {item} [...]] / end\n actions {action} [/ {action} [...]] / end\n \n+- Enqueue creation of a flow rule::\n+\n+ flow queue {port_id} create {queue_id}\n+ [postpone {boolean}] template_table {table_id}\n+ pattern_template {pattern_template_index}\n+ actions_template {actions_template_index}\n+ pattern {item} [/ {item} [...]] / end\n+ actions {action} [/ {action} [...]] / end\n+\n+- Enqueue destruction of specific flow rules::\n+\n+ flow queue {port_id} destroy {queue_id}\n+ [postpone {boolean}] rule {rule_id} [...]\n+\n - Create a flow rule::\n \n flow create {port_id}\n@@ -3708,6 +3722,30 @@ one.\n \n **All unspecified object values are automatically initialized to 0.**\n \n+Enqueueing creation of flow rules\n+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n+\n+``flow queue create`` adds creation operation of a flow rule to a queue.\n+It is bound to ``rte_flow_async_create()``::\n+\n+ flow queue {port_id} create {queue_id}\n+ [postpone {boolean}] template_table {table_id}\n+ pattern_template {pattern_template_index}\n+ actions_template {actions_template_index}\n+ pattern {item} [/ {item} [...]] / end\n+ actions {action} [/ {action} [...]] / end\n+\n+If successful, it will return a flow rule ID usable with other commands::\n+\n+ Flow rule #[...] creaion enqueued\n+\n+Otherwise it will show an error message of the form::\n+\n+ Caught error type [...] ([...]): [...]\n+\n+This command uses the same pattern items and actions as ``flow create``,\n+their format is described in `Creating flow rules`_.\n+\n Attributes\n ^^^^^^^^^^\n \n@@ -4430,6 +4468,25 @@ Non-existent rule IDs are ignored::\n Flow rule #0 destroyed\n testpmd>\n \n+Enqueueing destruction of flow rules\n+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n+\n+``flow queue destroy`` adds destruction operations to destroy one or more rules\n+from their rule ID (as returned by ``flow queue create``) to a queue,\n+this command calls ``rte_flow_async_destroy()`` as many times as necessary::\n+\n+ flow queue {port_id} destroy {queue_id}\n+ [postpone {boolean}] rule {rule_id} [...]\n+\n+If successful, it will show::\n+\n+ Flow rule #[...] destruction enqueued\n+\n+It does not report anything for rule IDs that do not exist. The usual error\n+message is shown when a rule cannot be destroyed::\n+\n+ Caught error type [...] ([...]): [...]\n+\n Querying flow rules\n ~~~~~~~~~~~~~~~~~~~\n \n", "prefixes": [ "v10", "08/11" ] }{ "id": 108110, "url": "