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 B695AA0C47; Tue, 12 Oct 2021 14:55:21 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DAE7F411A9; Tue, 12 Oct 2021 14:55:06 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2058.outbound.protection.outlook.com [40.107.236.58]) by mails.dpdk.org (Postfix) with ESMTP id 7DB0641198 for ; Tue, 12 Oct 2021 14:55:04 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cAEzNBatVC1iBaPIwlE8YbCzFL76EojyDIKS0OVgzWR/JK02+wbkWPiD95PtzdWHg/V/MV4gfLHa2hbwQTYy/b0AE0FOxn2HPQvtiQ/runV2Kym0lnY+JhENfsotL2UBnxB0X54vFI/oMPmOMm2wGAj4F8vzdqRb8nrQN3agfUaGZYVz+x63kWacJbZs1ivvy+Q8FW1B1YeFGTErgzWQLTCYSO9Pdr/k+vTbW1tQRp1F8ji+UgJVScGDouA9hlaPuS9cdevjhGxO0dInODOTG7DkdwcKp8D1fUZY2JfdsbDSXNp6V+FzfE5qgizHQs+x/DQQlbDKHWc8er9n12FnRQ== 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=AHefz2P5zPgBoGYtb2+ONr8CzcdYu9IJBhcciP+f8sE=; b=EYuPqR7bUlTj7NGYFO5e+fWSWlERPvzBXGgTYLwccTOJY1b3VZ1La14pWYmodIt0QRRlj+ZymWlxLIXIgGThFXCAT1HC8Q/7+7WrylAx52OZ/V5EzOnq7TgjNXoD4JAFOYyvf2ker56xUF3B8xBzlOTBouYLHCSTvmDEpx1NwcKWo3cdBp2gbRDROjvZYEyrS2Mh7rHW+p+bQzXaGLSs8u83Dauj2Os8rSo1ijffFJz+ugKSr3YarllqAznq4z0sjcFKBa0Czw4WQcvckcfBkc32VT2mas7YSwR9OiUXLYzAq52ZOCXzyVT481Iy9c6DT7jCKj2lDGy2ottPaT/a2w== 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=AHefz2P5zPgBoGYtb2+ONr8CzcdYu9IJBhcciP+f8sE=; b=rG1hCrcVtaBs34BljIxfXJnyDL6y6PDD0+AA7VSdkBpSK+/Y4CHmVHjLJNh919nVnWPlO6iXfjVc3ZHUmHY4Q5iwmd7GSZk81GrMGlINTqoKFJrAZjGOmkWTKLQOa1JXW9EtmSgo5k4/EEtJKsdWtauO0QxvvrvaeTZ5YANqRHQpUcpbg3RWodcqka9/SI/cx6SCIaDbJPMOpzev/ouXuLx+DiOIr+FML0OyDpAJtX9SQvsO9Qabum1PoOjjWYeFV5Qdm9AsPp9IHcYL7zHL2CTmgVEaXaVMFsl7YzIDjzuu2/VO5d3zzc8x3S3KV/yvbAnPeaiXNBvMxhBKRcmrFQ== Received: from BN0PR04CA0138.namprd04.prod.outlook.com (2603:10b6:408:ed::23) by BN6PR1201MB2465.namprd12.prod.outlook.com (2603:10b6:404:a6::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.20; Tue, 12 Oct 2021 12:55:01 +0000 Received: from BN8NAM11FT035.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ed:cafe::22) by BN0PR04CA0138.outlook.office365.com (2603:10b6:408:ed::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.25 via Frontend Transport; Tue, 12 Oct 2021 12:55:01 +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 BN8NAM11FT035.mail.protection.outlook.com (10.13.177.116) 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 12:55:01 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 12 Oct 2021 12:54:58 +0000 From: Viacheslav Ovsiienko To: CC: , , , , , Date: Tue, 12 Oct 2021 15:54:31 +0300 Message-ID: <20211012125433.31647-4-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20211012125433.31647-1-viacheslavo@nvidia.com> References: <20210922180418.20663-1-viacheslavo@nvidia.com> <20211012125433.31647-1-viacheslavo@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 556857d8-f470-4f71-3bef-08d98d7f80ea X-MS-TrafficTypeDiagnostic: BN6PR1201MB2465: 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: paQYopwJywJoxCp2XcVN+BGs5ljHo4ATJ4GBRznISCz6colwcmy0j1TEV8TUETM5nMbuTLG61MSbNAw8Rx2wb68UUeNa2NZEdqRCO9WP8ZGTCJYg1emQRYfMzZHY3x9aa5KekeMolsmcUX1hQb5mVVlXQNFhU55Vb2AMw7Bavy4yYkUbPDHaON2YSrCkZKBwTnLWzMdH3jKSO31g9B/YmRo/YRM6oY90ub28Vzpvn/GhKterAA0mJ9+KdW84yHpsSDk7K1DUuXN3MgqWgn2m9wErZj+j4Lj3uxbhIeLjvSM/xS7fDZQupcKfh5H8uh6BqcKnJesqNEFo2pu4avLE9JKSD77JDqvKwPFF4tjE4vDeSMFNIdiE8wp09gXm7lNwPXr/5OYKhcuja3nmC/WFDj1OA6GS2gy0RJaa4Daz3lbhxzXCOFDG33fyU/x9c0g8PGPfj50utTmUHZCITPuWJyWVl8sYSZqZEisw3OlSc6uw9cCXGFRZvr8jd+smwThRqK+otlXckMbBdM0E+aGfA0eAsYdIY2bMBfCx6Prahmr4By8423Impwty2980xVFY1Xy+fqhe5Ss0cmTwzlFwbpzaVxGC0blEvLONx4rj54XkDuNyGG4R1lJhRNN98jrsC3iYk2xZuK7vf6LClihB5w585bNdAqDQ7I56vaTzGy7/M/iZkkpSsudlcoQ6a3qi6qORgHQPvrpz97OxvV1H4Q== 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)(86362001)(83380400001)(36860700001)(4326008)(2906002)(8936002)(26005)(1076003)(16526019)(6916009)(186003)(70586007)(7696005)(70206006)(8676002)(6286002)(5660300002)(82310400003)(356005)(7636003)(47076005)(316002)(55016002)(36756003)(36906005)(6666004)(54906003)(426003)(336012)(508600001)(2616005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2021 12:55:01.1074 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 556857d8-f470-4f71-3bef-08d98d7f80ea 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: BN8NAM11FT035.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1201MB2465 Subject: [dpdk-dev] [PATCH v5 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 051781b440..8257ed8c97 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -1321,3 +1321,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