From patchwork Tue Feb 7 14:01:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Slava Ovsiienko X-Patchwork-Id: 123246 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 375A341C30; Tue, 7 Feb 2023 15:02:45 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EE24B40E6E; Tue, 7 Feb 2023 15:02:43 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2064.outbound.protection.outlook.com [40.107.223.64]) by mails.dpdk.org (Postfix) with ESMTP id 4BE4A4021F for ; Tue, 7 Feb 2023 15:02:43 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mJSDNJJ2YSFHNgPbdg1BMdX36F/O67izEVTeJ3lLxVYuazmp4G3GRivcEhGAbKnLkDdH8V2SHeALgFUhd9LbUyArkq1l0eYxrVutwIMhm3wQqcr580Fy+4VIMxVEiwUoPCaaDdLDFS6dgNwZBBWjkAt5MRJRD8tWoZsQeZBhpvLpInQ+bdqpO6NR0edli4FYTxV06Ewbe0Oe90sqJW1PX0IQrH95YuFGDvzYL7d3JHQbq4AvJfeUY8yz13F+M066YjCQE/ppgzaykmsENPCqnKkh0Dr4/V8d6p9/RnBxB6WdTQWLaXU72Vz2c0ccss8FGCJDEbv7I3mPfuJOHm0ZDQ== 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=XqQhr9/5fwv6FJNqdgyjJsBeM7AkQZfPQzgDUABUaUE=; b=I3nrh5XN3JPVx7mDRlF8RdYa8VxvCsoIWPrtH58up9LjqXkjR/Ir0nTC6dnziPMHdtlmF/z8tBnoJ93idno7pA9nENYzoSm7Yqy4fFm4JX/GtEFfDA0x1mMFMl8G6FhXr1kc6u3Ca+RQsI8KZmJtBiNWxCoAs+e4hyb6LEKjGkQcQrSTdNY/Q2+U6e5YXMw7YgYu6ShN0X5BAf9zVALPKLXouGxzI4xau0B9BzslYNkV/IGSwj0ClB45fIxz7irhOpctirc5k6AmJ/bTU3vI7njvzrzTXwX+vRfk7PBol9+xJgNM6KoDYIS0JMYFuQSyqHRAtWwbov93OhlC7l0GMg== 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 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=XqQhr9/5fwv6FJNqdgyjJsBeM7AkQZfPQzgDUABUaUE=; b=sZZzUeaLS4UvvjsGKdhxLTkPOgwViCe5UA4qOtmCr7ZGZYrDbQUTdTtL47K0DLglM/0uRayZ3Z6XU9IFJ5WKJ+7E7345QEVWUAVi8AnGDYJOgZbCjdC6YFf5ZoAzvr4KrCXyQ8mPsnJ1oFjFk+rV6mrbUy/yPnfkuwEfn24Nk4IM3i+bJS07DaoBOYCw7SvMeIXTydcob45PDT9XH6bJb6ecJmu/E2GUv3RvM4ebuB7a3kCpnhuc4YJ0NS1FWbtJUu0cPDvD9Z1QU7bs3aKpn0+2OhUgcXucx6NGfvbtukK1zPgzNnMEbo6cI5fHISSHSpamIfJjqNyoHRpw0HCq1w== Received: from MW4PR04CA0354.namprd04.prod.outlook.com (2603:10b6:303:8a::29) by SA1PR12MB6996.namprd12.prod.outlook.com (2603:10b6:806:24f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.36; Tue, 7 Feb 2023 14:02:36 +0000 Received: from CO1NAM11FT034.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8a:cafe::5f) by MW4PR04CA0354.outlook.office365.com (2603:10b6:303:8a::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.36 via Frontend Transport; Tue, 7 Feb 2023 14:02:35 +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 CO1NAM11FT034.mail.protection.outlook.com (10.13.174.248) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.16 via Frontend Transport; Tue, 7 Feb 2023 14:02:35 +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.986.36; Tue, 7 Feb 2023 06:02:26 -0800 Received: from nvidia.com (10.126.230.37) 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.986.36; Tue, 7 Feb 2023 06:02:23 -0800 From: Viacheslav Ovsiienko To: CC: , , , , Subject: [PATCH v2 1/9] ethdev: sharing indirect actions between ports Date: Tue, 7 Feb 2023 16:01:58 +0200 Message-ID: <20230207140206.29139-1-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20230206095229.23027-1-viacheslavo@nvidia.com> References: <20230206095229.23027-1-viacheslavo@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT034:EE_|SA1PR12MB6996:EE_ X-MS-Office365-Filtering-Correlation-Id: bc580336-6319-4339-7672-08db0913f705 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W1V4mExuW3/sNlCowizp8L1gopVXxgVx9+iG89w0nBIFWo1370K+iV5W243RzfBWEK+/3SZKNh1rCsa8zBRyjxPr28u/lsT4AcUYXz+bV62iUUtHe8LhGzlZZLdSu5inoVX4Esq7zuK8YJqZbzAYoOL05WtsxoMeVRWZqGraI42b8E4dYrp1jzUIKw428XCXDTWnVIlwbKwHNOF65xYPx2nFlQK+cy1bh6t4LapwXlW2mZ3wCeEqbvSWLBYAIXGdNFuYOzF9A5Z3CY4KBPRcz1LVCRPCcTFhQfP6sNga8lxN6esJCnTTtsFEy/ofIJ2aqAMwmSKp5V3xCb723LzLakIc1W8PnXmHd/jGLoplW8pO1jK2WgfdeIz27h70xyygMeNAmE+nr48NZYOtbemTMT0uvetwgzimk90GBtlO8NNYjbS/Ept82ATGnyGBKBOuKhVAvr994rjQEkAohMPN81E7yuZrVqGyA9emQbyiZ+Yv/qoXx9aBn4q63qpwoE0W4QWYDjplvjcNQ27Igu3w7G8LZTv6r5dHFGRRHJS6Bb9Whl3MQ9coFe2DynFbdS96Haejp13MdDSqq+Fzde6Zre9K/gSRFSVe44S2xLWwhrJQLOvQiyljyf0Xj2E0nqVis8ZtnSCQVWRBr35ZvYWSkUqkLPb6k6X0HgPVev9bYwUTq+iZbrg5ET8EkwKOtjEqO4DPvKhVoX3P+BO9wqMhLA== 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:(13230025)(4636009)(396003)(39860400002)(136003)(376002)(346002)(451199018)(40470700004)(46966006)(36840700001)(16526019)(40460700003)(82740400003)(7636003)(83380400001)(316002)(356005)(8936002)(70586007)(8676002)(41300700001)(6916009)(4326008)(70206006)(1076003)(2906002)(5660300002)(36860700001)(2616005)(6666004)(26005)(478600001)(186003)(6286002)(86362001)(82310400005)(54906003)(426003)(47076005)(336012)(7696005)(36756003)(55016003)(40480700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Feb 2023 14:02:35.5322 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bc580336-6319-4339-7672-08db0913f705 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: CO1NAM11FT034.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6996 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 The RTE Flow API implements the concept of shared objects, known as indirect actions (RTE_FLOW_ACTION_TYPE_INDIRECT). An application can create the indirect action of desired type and configuration with rte_flow_action_handle_create call and then specify the obtained action handle in multiple flows. The initial concept supposes the action handle has strict attachment to the port it was created on and to be used exclusively in the flows being installed on the port. Nowadays the multipath network topologies are quite common, packets belonging to the same connection might arrive and be sent over multiple ports, and there is the raising demand to handle these "spread" connections. To fulfil this demand it is proposed to extend indirect action sharing across the multiple ports. This kind of sharing would be extremely useful for the meters and counters, allowing to manage the single connection over the multiple ports. This cross-port object sharing is hard to implement in generic way merely with software on the upper layers, but can be provided by the driver over the single hardware instance, where multiple ports reside on the same physical NIC and share the same hardware context. To allow this action sharing application should specify the "host port" during flow configuring to claim the intention to share the indirect actions. All indirect actions reside within "host port" context and can be shared in flows being installed on the host port and on all the ports referencing this one. If sharing between host and port being configured is not supported the configuration should be rejected with error. There might be multiple independent (mutual exclusive) sharing domains with dedicated host and referencing ports. To manage the shared indirect action any port from sharing domain can be specified. To share or not the created action is up to application, no API change is needed. Signed-off-by: Viacheslav Ovsiienko Acked-by: Ori Kam --- lib/ethdev/rte_flow.c | 6 ++++++ lib/ethdev/rte_flow.h | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index 7d0c24366c..692d37925a 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -1476,6 +1476,12 @@ rte_flow_configure(uint16_t port_id, RTE_FLOW_LOG(ERR, "Port %"PRIu16" queue info is NULL.\n", port_id); return -EINVAL; } + if ((port_attr->flags & RTE_FLOW_PORT_FLAG_SHARE_INDIRECT) && + !rte_eth_dev_is_valid_port(port_attr->host_port_id)) { + return rte_flow_error_set(error, ENODEV, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, rte_strerror(ENODEV)); + } if (likely(!!ops->configure)) { ret = ops->configure(dev, port_attr, nb_queue, queue_attr, error); if (ret == 0) diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index b60987db4b..89d2394bd8 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -4903,6 +4903,13 @@ rte_flow_info_get(uint16_t port_id, struct rte_flow_queue_info *queue_info, struct rte_flow_error *error); +/** + * Indicate all steering objects should be created on contexts + * of the host port, providing indirect object sharing between + * ports. + */ +#define RTE_FLOW_PORT_FLAG_SHARE_INDIRECT RTE_BIT32(0) + /** * @warning * @b EXPERIMENTAL: this API may change without prior notice. @@ -4932,6 +4939,10 @@ struct rte_flow_port_attr { * @see RTE_FLOW_ACTION_TYPE_CONNTRACK */ uint32_t nb_conn_tracks; + /** + * Port to base shared objects on. + */ + uint16_t host_port_id; /** * Port flags (RTE_FLOW_PORT_FLAG_*). */