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 BE10CA0C43; Mon, 18 Oct 2021 20:03:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5EEA1410F2; Mon, 18 Oct 2021 20:03:34 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2046.outbound.protection.outlook.com [40.107.237.46]) by mails.dpdk.org (Postfix) with ESMTP id 29F4C40683 for ; Mon, 18 Oct 2021 20:03:32 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mx1kadLBAf9o8/k/rfDFjjKRUNSJEMzikNFGeDH12ne9/dPBjdD/ugEoF7wzZcGfXfS6HVRExem1XADT7GPkNMUtIuSv83xpkrwJuap6BtK8tLqEJIJhvzGaVmxsmiFnZ6fUEFE2B0mritXGH5SVQT+FCFsNO+QMf/LZGd22vT1zuMw9+zfU3enWYAufZjZQZtu7IamqKcbm1Xsc5YEBtA1UoMPp9aqcEu1VJsyw64OQLYdsmVWq8m3EiciYyASGcwSrxUHWoqfsSKLqzv91sdlv/WVj6x9t7XR2cH0FJ0SLmmTwcthIls7oYKg7l37LvdZVk+SZjvXvLL20OkcJ3Q== 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=T15uVhXyV6GWpvRlqcA0wcYmA58VpwENa87oIgT9qt8=; b=G9hsLsH7OO4ed+a2SPyfDWWXAARmnxdX2B3K6aofGlpJPmeV6Wa18CTYsk9ko8bzXrWmm62e7D4UBSzlTNmLbLcnfMRvrvlcT5BCYzBtX/WmiRvWoBNmUJcWUzGzVWUJzHcPdRHAozukNvVk2HHD7XANC2P9PRZbjv3JlYAxmx7Pz5AIGILKz9QPXmViXvRfwJ9Qgj7K/QOOLGI7HEs0BK+uOX0Fp9jH9pNC/TpU2NIGE8uMuVhLGc1GZkBmS7MHFSnLYGOyWR3900niFog5lMB878mGNKSVbOuHa8Xnk3WzL+FO1lP2YGYVyFWN+Wo4dBQidRB8zsvjRzfJzIFJBA== 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=T15uVhXyV6GWpvRlqcA0wcYmA58VpwENa87oIgT9qt8=; b=NQF54EMixXjUn66oJIKGVLA3iYKMCu+cOmoITAjPguE8muA9EbqPH35ZlqN9xxxqEDM7yVAjy6bFNQ40I/Yf27zdr50OrR2S8RX6e3Oc85kecG7FEK77cOb04C3vaY+GZZzGmWK+bR7uz9Psx0kcEABjQxO4X82+IqtXusXabmEzGLyZ7A0fY0OGGUafgZYu5KYL9A44vcI9TKnXfdgNrB1/tkYPKJIhTcZr2U/kWlIR/umqSVWqpxR+aN2HZNl8uoH+XkBTstwDr9wFfveMTiR5RQ5SQpnuJMBuJwMxF3G5ViG3azq/r30lWAWxT/vb5+OWoBUUOF5f8Xnk2wlPOA== Received: from CO2PR04CA0104.namprd04.prod.outlook.com (2603:10b6:104:6::30) by MW2PR12MB4684.namprd12.prod.outlook.com (2603:10b6:302:13::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Mon, 18 Oct 2021 18:03:30 +0000 Received: from CO1NAM11FT030.eop-nam11.prod.protection.outlook.com (2603:10b6:104:6:cafe::66) by CO2PR04CA0104.outlook.office365.com (2603:10b6:104:6::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.14 via Frontend Transport; Mon, 18 Oct 2021 18:03:30 +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 CO1NAM11FT030.mail.protection.outlook.com (10.13.174.125) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4608.15 via Frontend Transport; Mon, 18 Oct 2021 18:03:29 +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; Mon, 18 Oct 2021 18:03:25 +0000 From: Viacheslav Ovsiienko To: CC: , , , , , Date: Mon, 18 Oct 2021 21:02:49 +0300 Message-ID: <20211018180252.14106-4-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20211018180252.14106-1-viacheslavo@nvidia.com> References: <20210922180418.20663-1-viacheslavo@nvidia.com> <20211018180252.14106-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: b2347458-3785-4079-4c4b-08d992619771 X-MS-TrafficTypeDiagnostic: MW2PR12MB4684: 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: WsgwdxeZKtukclzsPN88wipPB0L+bZ0TxkxpjU5sq1b0tUHSrLgvbZiN9f7Q0NkIXs7cQXzD0PZFdJ0LIZShwk5VE0/p5tfAwfJutr/pvE3FDPrS1pJqW9VuttDcd4XC4YgHyDi+kqbTZucehzhOzFNjOFfGnhlNtgdPjPwYPb2GEOrXgabE4sol+JMY9pqnD9GgeQl/l6jaLDyHlJVsTmgbTYQLRmi7pVl9DuiUM9mBgMpraTdNS/gmcIQPe+3+Xl7TpMnqQOGKUq2wWjqd9bP8V2+F2pcQ16sFtO0njSzD1oCpXj7cbiHJGXiIQbO2J8iD9dXFuqJGTGRqsPiLJ/9JVe+aQnbC2OsxZgnPV+UpFAYp0/VhQmMxlGdyqjKsJ2/VVYSoyf3/JwpoqG4RWdyoNlI6BW0a4t/MyjLLr+uMBr1aztgSx0EZXma+uZ8sdqWN5BXIUwaVay3Qf437/b6qXK5pqhnnJK5VjrqW+p8FgXTCVsROCBwAeQO7UuTrMjkloD5CVucPQYaG+LQUtrWYVFvmeW//ias9ugZSNewEWDTgqeUGtoRpBTyCLGfnCjYnYie3XN6LrGrYALT5st0SrFAsqEu868a3zfRWwVCL7yIWTYIn84bxcqIKCjxVZcSTAo6JQ6fEv/kNrMD5X8GIniGQnLxyYkqBarc9OsCgYQtBd4Wq6vlV53Q0pBCfFvMWIHjImgRdoSC4+8THbw== 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)(36860700001)(54906003)(186003)(26005)(2616005)(6286002)(36906005)(16526019)(47076005)(70586007)(7636003)(6666004)(356005)(8676002)(1076003)(70206006)(4326008)(6916009)(5660300002)(86362001)(8936002)(7696005)(82310400003)(55016002)(426003)(508600001)(2906002)(336012)(36756003)(316002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2021 18:03:29.8514 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b2347458-3785-4079-4c4b-08d992619771 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: CO1NAM11FT030.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR12MB4684 Subject: [dpdk-dev] [PATCH v6 3/6] 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 | 2 ++ 3 files changed, 50 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 29fb71f1af..6992e25046 100644 --- a/lib/ethdev/version.map +++ b/lib/ethdev/version.map @@ -248,6 +248,8 @@ EXPERIMENTAL { # added in 21.11 rte_eth_rx_metadata_negotiate; + rte_flow_flex_item_create; + rte_flow_flex_item_release; }; INTERNAL { -- 2.18.1