From patchwork Wed Sep 25 18:05:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kozyrev X-Patchwork-Id: 144435 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: 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]) by inbox.dpdk.org (Postfix) with ESMTP id 1A0C945A2C; Wed, 25 Sep 2024 20:06:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 25E3D4060F; Wed, 25 Sep 2024 20:06:25 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2067.outbound.protection.outlook.com [40.107.92.67]) by mails.dpdk.org (Postfix) with ESMTP id 97ADF402D8 for ; Wed, 25 Sep 2024 20:06:20 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=T0h5ENwjYwsC4gMPnKthP7OoLKm1frmGX1D1nMbpeJJbNvQDEdA3cVZyxnImQkmXvDqXuXg/F1mMdTjqKM16p/mo3fZXvB9MPcC9DOl0ILcIYjANbvAq0VH1kmc/C24s1e3WkzACGP+GI8VdluGOBM/AY8t++UDwbCcb+bpkkZryDDLO0p35k3pHpfUps/bKwk6o/Swmn3rAX0ckDydUsUWgrktENJBux32Y5tDNKKGVWR3bXECNsU3Uy0hrN85G7HldSFwaOZyVBeshd253tM9AJNqPUh7fMT0o+lXei2jbl4ueMa1vgvXaCc8Hlkulrn93ubi5twPlS/aciGD0Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=8ykIRkPCQZynXdU0U1+pMQT4Ypdtt2oMvMkCLoGWZbc=; b=UK9pHhACia2PVgUAagA9Rq+852ukzsLUfCjnjEOGO4btwMRqZzT4AuInOv+y7yiGnbZNN2VRlCJptjA6cuQhAdL3A3oh0FTrXacEt+a+kA6McDs6126leUKQHR+7kz3UBdc59ZRXqMkgOb1NE/pRYgAuKUe4HNGozc6aS9c7YnkDOIzPHeswTpNAZN5WS3ECBxZoDBWs0+8If6UN4wqOuH+W0mNG82nODit5TaPDmNNFe3q1CUt6N2xcRlbYM5ZggN1Uw87o1GyPpREgX+0AJRgvEUblseVPd4+FThZGOXvB4SIOxHEnhbkoNo1ZsuVtGgqhaNUPSw5HTiUHu4J3Kg== 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=8ykIRkPCQZynXdU0U1+pMQT4Ypdtt2oMvMkCLoGWZbc=; b=g74aquHTcL6cFnOIpcXg2wlx16/tHHLCOyc/hw7hNTss6jVJRlE0MteVjw2RdDcHQij4YaYODiHPuw3I5wAQp0V6uhlaGyrunrfwLelfa+WXRFQftzF9U2oQCfAPEt6IVpAWvHp6zhPcXRdODonzZYgET9NdsXpBXyTxQlcPLP4IkduLYW+HgDZGEBomHE1yHrgc4Q0YcoYd6rxdzy4zJIZAQsiU1MHKIqmSz6R+qpdZmcW5HIkVv/PTtVaTUycmYEDfJbzKErTish0ferESbsYDc6D4+BcqAsOQhoozq0Azmp0kO1a521ZYUPGakKmAns3Ptj1lImg4WLunf5MxVQ== Received: from BYAPR02CA0044.namprd02.prod.outlook.com (2603:10b6:a03:54::21) by SA1PR12MB8697.namprd12.prod.outlook.com (2603:10b6:806:385::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.28; Wed, 25 Sep 2024 18:06:17 +0000 Received: from CO1PEPF000075F4.namprd03.prod.outlook.com (2603:10b6:a03:54:cafe::fd) by BYAPR02CA0044.outlook.office365.com (2603:10b6:a03:54::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.17 via Frontend Transport; Wed, 25 Sep 2024 18:06:17 +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 CO1PEPF000075F4.mail.protection.outlook.com (10.167.249.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.15 via Frontend Transport; Wed, 25 Sep 2024 18:06:16 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) 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.1544.4; Wed, 25 Sep 2024 11:06:00 -0700 Received: from pegasus01.mtr.labs.mlnx (10.126.230.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.1544.4; Wed, 25 Sep 2024 11:05:58 -0700 From: Alexander Kozyrev To: CC: , , , , , Subject: [PATCH v2 4/7] app/testpmd: add insertion by index with pattern option Date: Wed, 25 Sep 2024 21:05:29 +0300 Message-ID: <20240925180532.3958656-5-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20240925180532.3958656-1-akozyrev@nvidia.com> References: <20240919004813.3158356-1-akozyrev@nvidia.com> <20240925180532.3958656-1-akozyrev@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.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-TrafficTypeDiagnostic: CO1PEPF000075F4:EE_|SA1PR12MB8697:EE_ X-MS-Office365-Filtering-Correlation-Id: 26755a83-e1f8-4b13-e30d-08dcdd8cc010 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; ARA:13230040|1800799024|36860700013|82310400026|376014; X-Microsoft-Antispam-Message-Info: 5PrhzKad37xoT9NCizGexmOzfCcCOTCuq4skuuwykAJfTfG1umP+GRTVLhBW9x8KzQOuL9/HvCs8EVaQiMUwTE4hRbCxVvTrkk1FzpXyvqV9BmRN49aBLj+W+s7VMh6HIIZ4Hq0tSXlJE9jewnSQ67qKPmNZrr34crJQ9mbqKbFWgC1UPkWEn5yOHBELtXwqt6kIG5w6zoq31FtXv4PXrDQBLz/JnT34OdVvaDnhOnC+zWNW2mg3dy4Kuli9ImPpiNtWZZV9Eq1+26vNNAcmkeHRFhN826FGFsgxyi9O/NKnHNCpSYGq7d4xtGOZf1mykKvonl2IeanNkA9UOe9mflv1JUXFAuuGw02gLqzNqaTH5gMGi+Ual99rJRB0ptT8UIEdH9Sv2yqztnncUyX5xlRJBXRg/c4rlH6yUQlYKjwPrxOuoJrEc+fDy1ymIMPS/EoiQtfZl9vO76xVMTsQ6LhwI6DUD/VTMZHaeDtVLZ2rLBCrk8VxEmzKM6IDJ8F63bMgtXOGlmWgo2poxvULEGl/45OhBhqBJKr/FrmKBMv4BcKVQqXkfjMtkaIcwuWQZk4aGZG+fTEAUWeJZ3AlY445GhLVrdCd7+pkz55Hwr5wB6qFDFnc+8GfxJevXjf9rJZqFTpPdurBzOmshCwau30Pe4+2hzHmslUYjvQNm2Zz57u6aLCIVbMXl1evvD3FQF8EuVgrChcUrkLJojgjifwQGsffwjrmSzxWf1NF3ACD/tp4mVl+emXIa4dVokxHDWSPdCLM/Eq0fvvWxJvOB//wu69Tlu67svFvhQmZN2qPsC0gdJEoy9zIAGsEfcfCGGacJW1r2v+ZiTNnct+HJbUcP45k/jQPJ9eJgvW7Xf4J46pEaSosV602bJNa8M8X/7tO0r7Tfy92qlIqZ3UVHoOYgjjKJ6o4tb36M9Rfu/uJenGAPxr0nXjWof7wuo0nMGi2ErDY8igkkXuiKyjQmuH0/KeSDXxatAJYlGhAeTM1zcAc9GbSYGBa8ljmtIhJpurd2Eago3EmkRXGLiOQgpQqZgz51afoWNxLfkUBDmDrYdehuhgrxq4iw0bSUp22GYtLY/haJIb9LmR3YBx9bcC3UIksOVuDV4ceZ6ws5ko/vAN+jdtEoizO1XwAUG2R8/xgImCEz1F0v/Sts0dYcrlOtmDfSFgPB374cltWVcC4J6FkiaWyPOU9mZw1AliuKtyB3MPO8KY3B9FaBCmRFXMxwgS+mbyzzATspf9Czn/Xt83+2HH0uQXtz7r7bOHYfXvbJt+sd/nr5fdKTAiulDil4ktlZ50uMi5XaAHBv9GeEgVpAvD4xO5bFvpmGvak1LMeIUQK+hCnR20nhEsfe9XT6VLS0tVRkGDjcZagTRm3JXOXOyOECSIQuwRyxPzh 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:(13230040)(1800799024)(36860700013)(82310400026)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2024 18:06:16.6478 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 26755a83-e1f8-4b13-e30d-08dcdd8cc010 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: CO1PEPF000075F4.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8697 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 Allow to specify both the rule index and the pattern in the flow rule creation command line parameters. Both are needed for rte_flow_async_create_by_index_with_pattern(). flow queue 0 create 0 template_table 2 rule_index 5 pattern_template 0 actions_template 0 postpone no pattern eth / end actions count / queue index 1 / end Signed-off-by: Alexander Kozyrev Acked-by: Ori Kam --- app/test-pmd/cmdline_flow.c | 8 +++++++- app/test-pmd/config.c | 22 ++++++++++++++++------ app/test-pmd/testpmd.h | 2 +- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index b048821e85..65030936d2 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -1583,6 +1583,12 @@ static const enum index next_async_insert_subcmd[] = { ZERO, }; +static const enum index next_async_pattern_subcmd[] = { + QUEUE_PATTERN_TEMPLATE, + QUEUE_ACTIONS_TEMPLATE, + ZERO, +}; + static const enum index item_param[] = { ITEM_PARAM_IS, ITEM_PARAM_SPEC, @@ -3786,7 +3792,7 @@ static const struct token token_list[] = { [QUEUE_RULE_ID] = { .name = "rule_index", .help = "specify flow rule index", - .next = NEXT(NEXT_ENTRY(QUEUE_ACTIONS_TEMPLATE), + .next = NEXT(next_async_pattern_subcmd, NEXT_ENTRY(COMMON_UNSIGNED)), .args = ARGS(ARGS_ENTRY(struct buffer, args.vc.rule_id)), diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 6f0beafa27..39924d8da9 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2636,8 +2636,8 @@ port_flow_template_table_create(portid_t port_id, uint32_t id, } pt->nb_pattern_templates = nb_pattern_templates; pt->nb_actions_templates = nb_actions_templates; - rte_memcpy(&pt->flow_attr, &table_attr->flow_attr, - sizeof(struct rte_flow_attr)); + rte_memcpy(&pt->attr, table_attr, + sizeof(struct rte_flow_template_table_attr)); printf("Template table #%u created\n", pt->id); return 0; } @@ -2835,7 +2835,7 @@ port_queue_flow_create(portid_t port_id, queueid_t queue_id, } job->type = QUEUE_JOB_TYPE_FLOW_CREATE; - pf = port_flow_new(&pt->flow_attr, pattern, actions, &error); + pf = port_flow_new(&pt->attr.flow_attr, pattern, actions, &error); if (!pf) { free(job); return port_flow_complain(&error); @@ -2846,12 +2846,22 @@ port_queue_flow_create(portid_t port_id, queueid_t queue_id, } /* Poisoning to make sure PMDs update it in case of error. */ memset(&error, 0x11, sizeof(error)); - if (rule_idx == UINT32_MAX) + if (pt->attr.insertion_type == RTE_FLOW_TABLE_INSERTION_TYPE_PATTERN) flow = rte_flow_async_create(port_id, queue_id, &op_attr, pt->table, pattern, pattern_idx, actions, actions_idx, job, &error); - else + else if (pt->attr.insertion_type == RTE_FLOW_TABLE_INSERTION_TYPE_INDEX) flow = rte_flow_async_create_by_index(port_id, queue_id, &op_attr, pt->table, rule_idx, actions, actions_idx, job, &error); + else if (pt->attr.insertion_type == RTE_FLOW_TABLE_INSERTION_TYPE_INDEX_WITH_PATTERN) + flow = rte_flow_async_create_by_index_with_pattern(port_id, queue_id, &op_attr, + pt->table, rule_idx, pattern, pattern_idx, actions, actions_idx, job, + &error); + else { + free(pf); + free(job); + printf("Insertion type %d is invalid\n", pt->attr.insertion_type); + return -EINVAL; + } if (!flow) { free(pf); free(job); @@ -3060,7 +3070,7 @@ port_queue_flow_update(portid_t port_id, queueid_t queue_id, } job->type = QUEUE_JOB_TYPE_FLOW_UPDATE; - uf = port_flow_new(&pt->flow_attr, pf->rule.pattern_ro, actions, &error); + uf = port_flow_new(&pt->attr.flow_attr, pf->rule.pattern_ro, actions, &error); if (!uf) { free(job); return port_flow_complain(&error); diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 9facd7f281..f9ab88d667 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -220,7 +220,7 @@ struct port_table { uint32_t id; /**< Table ID. */ uint32_t nb_pattern_templates; /**< Number of pattern templates. */ uint32_t nb_actions_templates; /**< Number of actions templates. */ - struct rte_flow_attr flow_attr; /**< Flow attributes. */ + struct rte_flow_template_table_attr attr; /**< Table attributes. */ struct rte_flow_template_table *table; /**< PMD opaque template object */ };