From patchwork Wed Dec 28 16:54:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Slava Ovsiienko X-Patchwork-Id: 121454 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 0F96FA04FD; Wed, 28 Dec 2022 17:54:58 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AA88E40A7F; Wed, 28 Dec 2022 17:54:57 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2077.outbound.protection.outlook.com [40.107.94.77]) by mails.dpdk.org (Postfix) with ESMTP id B80FE40698 for ; Wed, 28 Dec 2022 17:54:56 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lAZnoC37zamkS6A0OFnSNzR9Tl6qhS5VzAxtFIvZ8wHJp3suZfpYJnEC3wnGNwPF6KCvp9SceC0Y5lmMCJ0nU4XyJXTPellmfsVfKfHQJpEORm7k0JTFgQjwCaaJ5u3iY4bGD6ry6oERY6fAXR5OpNFlnZMb8yqz0oXPcyESrSsgH8l84/ejCboBuv7lr46GvpCGErTQnrxUOaYUThX4+CcszlaIZxDRAGRdfbPkkU76OA+zU3gPHXXZXu5hM8iekHHnlSIj8CSYnH9mFLKtdUKwmTX1g0720njrmAvLY8o66W/DL53NNDphBValmDFne1YZNs/3SjIDrHo4jr/45A== 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=LmdVfNRswiF1uNC0U3praAoj9C9oSawUZtjEnhiH4ic=; b=m1NLsOugDJ047M8X/bBSwU1tnSwkC2+emPfUgvAGMWDidfsab7mlKTz2JYsXlqsFitWuI0Xvy/EQl+RevTesQ5qSedvB1gQIPv92sSn/XGO7Tx5kel98/86rdB9DZ1l+zirHOIHg+R86Vf5NIIPRCEZZqMd6PPSRRpc1mqkEXmL5OdTU/yD6LEdU8ddRvVnoIiMDk/u6LZBsiBxyDJl/Y29Tzn9GRMCHJDIeMS/5lSXnc/C/GCmc/GCqLO50pRYl6a3NAgfPf02+qh15W/b5tjhZ+3RBYkf3vccCZ3YhdxQVSPEFmoW0N1AAIBp8p/Lupah1Jq0at+PnP5UPTSl35w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=LmdVfNRswiF1uNC0U3praAoj9C9oSawUZtjEnhiH4ic=; b=awVEZGYCKzWZRbN/me62xsUDWJc1vFHGpoEknzyVXsbx1aKCRIenV1p2pbN5GN2uZ6clvnyD70V8EeSu48cDxc+jNv2SPiFUjWJ/NYwmLwVLkeGMXjBv5S7/gkjv0Cf7NVOq3xHvl3VSEt9HKoCkA4SQwQlQF9Ir4ZRMG2Vtjtz12zGwCa5j5DVXLkVeHAPymkIyXo7cRQZsirCfnGKMR6aExyTrofJkFiirZPbRPRB/S9wobDfOftX3PJjwM1rhFWOiS2x0h9Cr7F8mx3hOFUbzEZj9NKeeKh8oLwcUk926oGSg682lg0Em1qv5SnEbRAo2Ah6ZrmlAvtEP0PZrCw== Received: from BN9PR03CA0606.namprd03.prod.outlook.com (2603:10b6:408:106::11) by SA1PR12MB7295.namprd12.prod.outlook.com (2603:10b6:806:2b6::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.16; Wed, 28 Dec 2022 16:54:54 +0000 Received: from BL02EPF0000EE3C.namprd05.prod.outlook.com (2603:10b6:408:106:cafe::1d) by BN9PR03CA0606.outlook.office365.com (2603:10b6:408:106::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.17 via Frontend Transport; Wed, 28 Dec 2022 16:54:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BL02EPF0000EE3C.mail.protection.outlook.com (10.167.241.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.10 via Frontend Transport; Wed, 28 Dec 2022 16:54:54 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Wed, 28 Dec 2022 08:54:50 -0800 Received: from nvidia.com (10.126.231.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; Wed, 28 Dec 2022 08:54:48 -0800 From: Viacheslav Ovsiienko To: CC: , , , Subject: [RFC] ethdev: sharing indirect actions between ports Date: Wed, 28 Dec 2022 18:54:33 +0200 Message-ID: <20221228165433.18185-1-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.18.1 MIME-Version: 1.0 X-Originating-IP: [10.126.231.37] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0000EE3C:EE_|SA1PR12MB7295:EE_ X-MS-Office365-Filtering-Correlation-Id: 0c2d4f5b-6caa-4387-b48c-08dae8f43e99 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; X-Microsoft-Antispam-Message-Info: hJRey8HWlW0aKISnJe5xsUpUGCXX8rEEY6ToRPUglgbItQTu3msQkB9knYR7DO7PuaY4uT+ygZB9xVs60WdBMU9GU5YPdszAVGRhaWPssnaxvbl6NC16+DPMHX30fDUmiYPl8zfRMkXnGq8gPssyNSRG4UllkQeImPFyVnptbCj7UPiElvEitVoEn4ibxr7Ny7WhsdN/v/B4zi9mtFIxhgub1WM68MJUVdGkFm/NXCo5Lb0eryhqbqoYnetKjO+DnfBZ6nm9GGrLl7uFWD1VbyzWxSynh6r1ZU3TKGPGbnXyTC66yUrcbN4Fdp7F9z7zsaN2EC5QSWWPI52MIjdMjushaoApXJtEsVfW0o69BK7BjUye2ao5fGUcB1GXIoD1/tGdYTNZ/SW+UqApR7fYBlMnLzwcMKVTmKA3tCVAL48lpXrLSud+4xwqxXLqcvt7+yUDn8EHQUubU1qFPuQVc1EcliWb4zJEDMpKHDOrg3BvvnrbFWIzdZn3rkqyeFhT9BmwFyE9FnoZi0pjQvANE1GekGSDtzdrTxiHzGs9F1L66IwYm6+4fIJYVGO+0XGGKUAZKysV1O9gzEb545pH+dvdWzsA5QaSl0V/TQIoMvkk/QP/nW7CGmuuOK82SCgSYXpO4fhC9aWQ2/5AUUz+nKLywVv+R/9ymYRba6XCkZUwAAyzaHLQyhMQXNckMwthydoSyqLxIyYmogcLCJpa+rp6r1kcSXiXizVK82eVAanKJ0/F37VhzbzOcyUFnhke X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(396003)(346002)(376002)(136003)(451199015)(40470700004)(36840700001)(46966006)(82310400005)(36756003)(55016003)(41300700001)(5660300002)(40480700001)(8936002)(70206006)(8676002)(4326008)(2906002)(86362001)(70586007)(6916009)(54906003)(7636003)(7696005)(82740400003)(316002)(356005)(336012)(36860700001)(478600001)(83380400001)(107886003)(6666004)(47076005)(426003)(40460700003)(186003)(2616005)(1076003)(26005)(16526019)(6286002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2022 16:54:54.4239 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0c2d4f5b-6caa-4387-b48c-08dae8f43e99 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.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0000EE3C.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7295 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 --- 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..c784f4ec30 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 beetween + * 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_*). */