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 845B3A0C47; Tue, 12 Oct 2021 13:33:16 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 97FF541162; Tue, 12 Oct 2021 13:33:03 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2051.outbound.protection.outlook.com [40.107.223.51]) by mails.dpdk.org (Postfix) with ESMTP id BB6304116C for ; Tue, 12 Oct 2021 13:33:01 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M2trZkCjNvyG/DZt9641XCXxKnqTQ5g4Vz61RqaIFBEp0YkPRdTm0iZWMv02DL2C8KBUufXV2SfDpVdRHXJ5O9uyx42WMVtbPi/Cco+ewu/o2MeGcFN0MdC0DPyMIcfcVs6Ge27N4Z1kXJROh0XhiLNG3iGB6KZ+7Vo5nlNLmUrhaGRTDy4gllnenF0UHNa1Lq2Nne5nMupqg7AdZX8sfefDuQ9q8Eeor+w6OuzbzjVN1D6qJYEL/61KgjEYIdt4peW5UD5db6KvEe6MYiWGpF+oMjqM23q287kPPgvX+T23K0o0y72mBUO8W5GUqvia/jrxdmHYp98fiAomfYRHnw== 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=FSUq5XLPKW1Z1TrcklGTiZjgsBVA/amVA3yqHYcXEDs=; b=Z+B6BUVbq5kvD+8Dwy8Z/j7C27EKirN3SwsxrONA+bfKZQFTjBagt8Pzt1Bw5yFug4LY0dsNbFxyl5AMTAv8iK1WpYYlwTMnTf0e+FXJN7pE0VUAyidhJkUhtPQ0Vm7M/0w4G5l0mbqVTqlgF3VcAcgGnw8wl5UL4rUlALMUpBdto3BxLTqT5BIoNr/g/f223/gIqkBLoJGVtDLpvtIHWhPSzLRkfpaX7AadvcVJmDRBr/kLoGqTcYKtlccR8P4BiIB+pUVJblbEZqqyXH/IPzQTq428+yPQFAs0/C7G2TF01QMgZ/FUQH4+KybAUv0UZZig0V7LXKQVzKWk+v6B2A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=monjalon.net smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine 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=FSUq5XLPKW1Z1TrcklGTiZjgsBVA/amVA3yqHYcXEDs=; b=HBf2GQWYLw/xn3gu0jlwdi5tInII+KfGnoxqFrQDUYG0fnZLHLLZDEDuCtgaQcXEzdVWhAh5sEslmvo2di9MgM1WJx28A8xQTfSvGtfl+fuY9llMsMWkJCMu//sgA9C4+GUZBzmPTptbOnPmmeubKG7pInLtZps9bmg03zLXOr/OKNvDYz5uFL+gbgvoE2jMyXfJBIGV0YMZ1BOsPU71JPNbnEPUUx+PkXvIGFtdbV5Qe9Nlt87z/DxLtutws1QmpbUycmxvOhfNoVikjQ0nv72Z941n5UXGe54ALhBAHBi8TjNFc65gQSSrpkswK0/tRcAbN3ZnGwcoWgCr55iLdQ== Received: from BN6PR22CA0062.namprd22.prod.outlook.com (2603:10b6:404:ca::24) by MWHPR12MB1215.namprd12.prod.outlook.com (2603:10b6:300:d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18; Tue, 12 Oct 2021 11:32:58 +0000 Received: from BN8NAM11FT022.eop-nam11.prod.protection.outlook.com (2603:10b6:404:ca:cafe::af) by BN6PR22CA0062.outlook.office365.com (2603:10b6:404:ca::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.24 via Frontend Transport; Tue, 12 Oct 2021 11:32:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT022.mail.protection.outlook.com (10.13.176.112) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4587.18 via Frontend Transport; Tue, 12 Oct 2021 11:32:58 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 12 Oct 2021 11:32:55 +0000 From: Viacheslav Ovsiienko To: CC: , , , , , Date: Tue, 12 Oct 2021 14:32:33 +0300 Message-ID: <20211012113235.24975-4-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20211012113235.24975-1-viacheslavo@nvidia.com> References: <20210922180418.20663-1-viacheslavo@nvidia.com> <20211012113235.24975-1-viacheslavo@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 77173a2f-bf3c-421b-33b7-08d98d740a94 X-MS-TrafficTypeDiagnostic: MWHPR12MB1215: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8/BQxDD66VVH22dZL8st9xfGShPczajhzEf+ScMlrJBYxV+sWWXdZHNpBtG0/vQUN4TO8UErorolvgCNMozb16lfA48SPPoxAwZ+KXlBFiKOz6wZjxB5W8KHbLY7vkUH6kWSgfCwu37qtjOuesU6hiA63b9Pz8MbZJoi7QAsmxFMXw3rvdF8Kx+qQoPXf5cQAIvTjAN7EFhA/RY58iD/wjdTCVQKWTDf3nmKvOFg5TRj0RyNYDZ18QYwV2BtD9mDPSOn9ShREjwmPaoe9C0ocliethFBT8PkgjL3Pg0K/wY8o62ngpPzXXz4Vc0WYVDjYBrmpWyT1uFuE+DW6x7ZEyggwu9f2vvKtHylnq7G3+xEYiDmAFZco/NFUPvkLybuZYWtCtgGpUU8g4KfyfKPPRh2yJcBb/Mr7vRXxoeatCg/Py09oxNrh6appIg/NmjieiUwLl5nEZ5gByQv+uiJMhIBzVGqNVfhsx0bp+AS+VcdcQLKAZGMNS9XggFxihqm5OlAxiq37u9jff1fImI+Ar2Uog5ICLyN5Dz2lqC2VMdDXz1Jkg+SXQ3GCBKqDqmdIXUTG0hWXjrhRWbuvJEdHUSIJrzceugLytySkWTOWaQ6pvz73BTTbIop4wpiVOT35koyo/KwgtS4NoM3cbTgz6jIEzwAEGriDzVPXnKDwr+tv9xtuYgRhgY0ERuFfLWiBe2EZcYFQhrk2H5pM0tFiA== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(7636003)(70586007)(5660300002)(47076005)(86362001)(4326008)(54906003)(2616005)(7696005)(336012)(426003)(356005)(316002)(70206006)(1076003)(36756003)(508600001)(6916009)(2906002)(26005)(55016002)(6666004)(82310400003)(6286002)(8676002)(16526019)(186003)(36860700001)(8936002)(83380400001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2021 11:32:58.0864 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 77173a2f-bf3c-421b-33b7-08d98d740a94 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT022.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1215 Subject: [dpdk-dev] [PATCH v4 3/5] ethdev: implement RTE flex item API 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 Sender: "dev" From: Gregory Etelson RTE flex item API was introduced in "ethdev: introduce configurable flexible item" patch. The API allows DPDK application to define parser for custom network header in port hardware and offload flows that will match the custom header elements. Signed-off-by: Gregory Etelson Reviewed-by: Viacheslav Ovsiienko --- lib/ethdev/rte_flow.c | 40 ++++++++++++++++++++++++++++++++++++ lib/ethdev/rte_flow_driver.h | 8 ++++++++ lib/ethdev/version.map | 4 ++++ 3 files changed, 52 insertions(+) diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index 100983ca59..a858dc31e3 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -1323,3 +1323,43 @@ rte_flow_tunnel_item_release(uint16_t port_id, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, rte_strerror(ENOTSUP)); } + +struct rte_flow_item_flex_handle * +rte_flow_flex_item_create(uint16_t port_id, + const struct rte_flow_item_flex_conf *conf, + struct rte_flow_error *error) +{ + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; + const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error); + struct rte_flow_item_flex_handle *handle; + + if (unlikely(!ops)) + return NULL; + if (unlikely(!ops->flex_item_create)) { + rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, rte_strerror(ENOTSUP)); + return NULL; + } + handle = ops->flex_item_create(dev, conf, error); + if (handle == NULL) + flow_err(port_id, -rte_errno, error); + return handle; +} + +int +rte_flow_flex_item_release(uint16_t port_id, + const struct rte_flow_item_flex_handle *handle, + struct rte_flow_error *error) +{ + int ret; + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; + const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error); + + if (unlikely(!ops || !ops->flex_item_release)) + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, rte_strerror(ENOTSUP)); + ret = ops->flex_item_release(dev, handle, error); + return flow_err(port_id, ret, error); +} diff --git a/lib/ethdev/rte_flow_driver.h b/lib/ethdev/rte_flow_driver.h index 46f62c2ec2..34a5a5bcd0 100644 --- a/lib/ethdev/rte_flow_driver.h +++ b/lib/ethdev/rte_flow_driver.h @@ -139,6 +139,14 @@ struct rte_flow_ops { struct rte_flow_item *pmd_items, uint32_t num_of_items, struct rte_flow_error *err); + struct rte_flow_item_flex_handle *(*flex_item_create) + (struct rte_eth_dev *dev, + const struct rte_flow_item_flex_conf *conf, + struct rte_flow_error *error); + int (*flex_item_release) + (struct rte_eth_dev *dev, + const struct rte_flow_item_flex_handle *handle, + struct rte_flow_error *error); }; /** diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map index 904bce6ea1..ec3b66d7a1 100644 --- a/lib/ethdev/version.map +++ b/lib/ethdev/version.map @@ -247,6 +247,10 @@ EXPERIMENTAL { rte_mtr_meter_policy_delete; rte_mtr_meter_policy_update; rte_mtr_meter_policy_validate; + + # added in 21.11 + rte_flow_flex_item_create; + rte_flow_flex_item_release; }; INTERNAL { -- 2.18.1