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 7C16845A68; Fri, 11 Oct 2024 11:34:42 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 42017402F2; Fri, 11 Oct 2024 11:34:36 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2046.outbound.protection.outlook.com [40.107.236.46]) by mails.dpdk.org (Postfix) with ESMTP id D8DFF4060B for ; Fri, 11 Oct 2024 11:34:34 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=zCkmeibXJzFHV8M02jfVlHR7WAk7quAY4FYVnlsiK+TxegtHWp/n19bbVRlMoUyn7U0H+NeSJNXti9WcwfdK0yo2e3udKLZFGs8F1j6uqisF1ThzY6Zs6l0dhLDbBgQj8TPcqGLUjAPtur4eX27h0sb+0g1pI4Rm8CvMfzipQnyE5+rjUVoH5p/8nOE5uRbCCCrvTAJNj2XbHhSWR28pg5HnDwDPKfppgBcHGmS6l6CalR/Et55x16DO4tAfEpXuvC+jnXbQmeaTdsd5fPRHTsoPEgZyoghVlCF+ETFMCeRwsT2sKT6jXCzrZBmaEaYV0OsuG2VigBR8b/Q6XNeK7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=L/11hE5Svdgcy2E1+K/OZbYYQoE0zPeMfO+TkCL7ZtY=; b=cTiqsaLAxovd83OW6aZw6GU6CUl83M8hTSNqFM7l4JJ9b8E1c6IcKJncjzQ+FZdr74nDeOO+dFCzge7H1xmOeD0Szy+0bvz1lkRSCMihrTGkzh9rQBR9bY8N4l7mVrPHV9tY8O7l7yoh7yWEusbSvAqV8fgH9Jkb+vLeDE4jTWDlUK4c38BjE+AqEKIdmESonqXB/2PoIltNGzYxkdtdWCTkdWZ4ZwySzXsZ2KAw/uts43k8YJ+N+XHfKQxwIKGz10j2RYx+hcbdG9mizxOIo7WNjN0Rgr2RTAccVNMaLrRtKk2awrdNOTqtZJDKgxBCgZAYFX/1ceyaJDoDaLnzwg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=monjalon.net 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 (0) 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=L/11hE5Svdgcy2E1+K/OZbYYQoE0zPeMfO+TkCL7ZtY=; b=mbE0LYHnDYoBiMGluxp5S6vGzLUqNCuWkJRk3+oW2OyrxMhvJWzH8Cfa2lcpCzRYY/33DtDt6U086qJduY/3KVyKSj6DQ2UUi4f4YIuf/pkYbM83VlPmmkm4B2tQFSgE3Vdrgv+hZVvQbgDJY7NhtXaaxPG0CNMIIXO95PFRDgIrjk/DxNjlAKh/KOVWurVNx8hm6ccrgPWtrO8fzFFSr287Ms18iHCQ1OZGLrvxRCffYhzM24GC9HXlg2gImjBQy5yQ90UOvyxDUESj6F6ajDl+iRNE5gN8O+ugamZ7HL4qeR86dtJuW+BsYO5TQjZStUhqhosZEBTZxK9DacLoxQ== Received: from SJ0PR13CA0083.namprd13.prod.outlook.com (2603:10b6:a03:2c4::28) by SN7PR12MB6814.namprd12.prod.outlook.com (2603:10b6:806:266::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.16; Fri, 11 Oct 2024 09:34:31 +0000 Received: from SJ5PEPF000001D4.namprd05.prod.outlook.com (2603:10b6:a03:2c4:cafe::a) by SJ0PR13CA0083.outlook.office365.com (2603:10b6:a03:2c4::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.9 via Frontend Transport; Fri, 11 Oct 2024 09:34:30 +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 SJ5PEPF000001D4.mail.protection.outlook.com (10.167.242.56) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.13 via Frontend Transport; Fri, 11 Oct 2024 09:34:30 +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.1544.4; Fri, 11 Oct 2024 02:34:23 -0700 Received: from nvidia.com (10.126.230.35) 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.1544.4; Fri, 11 Oct 2024 02:34:21 -0700 From: Dariusz Sosnowski To: Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko CC: , Konstantin Ananyev Subject: [PATCH v2 2/4] ethdev: add get restore flags driver callback Date: Fri, 11 Oct 2024 11:33:49 +0200 Message-ID: <20241011093351.187191-3-dsosnowski@nvidia.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241011093351.187191-1-dsosnowski@nvidia.com> References: <20241011092103.181145-1-dsosnowski@nvidia.com> <20241011093351.187191-1-dsosnowski@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D4:EE_|SN7PR12MB6814:EE_ X-MS-Office365-Filtering-Correlation-Id: 7461a998-b240-4bf5-7e03-08dce9d7e874 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; ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?0L8e7ipqp5gmSzLbTrobALtYiBNCfDbgOA7pET+RjHXXAYeNunsMT5wOm662?= =?us-ascii?Q?FavJbPtxDZveOSu3tEP4xR/AsUKY98AqCg7HMGo6C98HV1ptAvrgPvq9VYey?= =?us-ascii?Q?eaFempDrKtvnWO7/UZSXJfLQEvUtCDa/c+Jcyy3zjeulqr3AdIRjOpVbKGuj?= =?us-ascii?Q?Bw3yeKXYvTDG7Nql1dAxKLcZbCoLW0r8Tufq1uLTcryvwyRnoIneT9mZ1zXC?= =?us-ascii?Q?robaFuZUb20APGjZ9XDqcFgRjOAMCIXIbUlbr6jrbZ08o/jw/zAVGMaoxThQ?= =?us-ascii?Q?Wkjsvgd10vAmsdrx1YKoivdioeaDmz6o4nHn3RvIm4aKDgSiVrdPozv/LzkX?= =?us-ascii?Q?fmppFlKrx7QWfzHdnNUmjuGBvc0GXxBOijAdztIwE+vVN+9xlxEVRvr2q46a?= =?us-ascii?Q?CS0kk1jycJx4wtecRRk23ww8BfQ0u03heDcO6QhwsWCn3h7Hpaa9uvQim1uG?= =?us-ascii?Q?aUyedhRrU1o4yEK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56NI20jH19+6?= =?us-ascii?Q?VjVC/CR3g3zBVv5Utgd1L7Y7z7tr?= 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:(13230040)(376014)(1800799024)(36860700013)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2024 09:34:30.6644 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7461a998-b240-4bf5-7e03-08dce9d7e874 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: SJ5PEPF000001D4.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6814 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 Before this patch, ethdev layer assumed that all drivers require that it has to forcefully restore: - MAC addresses - promiscuous mode setting - all multicast mode setting upon rte_eth_dev_start(). This patch introduces a new callback to eth_dev_ops - get_restore_flags(). Drivers implementing this callback can explicitly enable/disable certain parts of config restore procedure. In order to minimize the changes to all the drivers and preserve the current behavior, it is assumed that if this callback is not defined, all configuration should be restored. Signed-off-by: Dariusz Sosnowski --- lib/ethdev/ethdev_driver.c | 11 +++++++ lib/ethdev/ethdev_driver.h | 64 ++++++++++++++++++++++++++++++++++++++ lib/ethdev/version.map | 1 + 3 files changed, 76 insertions(+) diff --git a/lib/ethdev/ethdev_driver.c b/lib/ethdev/ethdev_driver.c index c335a25a82..f78f9fb5c1 100644 --- a/lib/ethdev/ethdev_driver.c +++ b/lib/ethdev/ethdev_driver.c @@ -958,3 +958,14 @@ rte_eth_switch_domain_free(uint16_t domain_id) return 0; } + +void +rte_eth_get_restore_flags(struct rte_eth_dev *dev, + enum rte_eth_dev_operation op, + uint32_t *flags) +{ + if (dev->dev_ops->get_restore_flags != NULL) + dev->dev_ops->get_restore_flags(dev, op, flags); + else + *flags = RTE_ETH_RESTORE_ALL; +} diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h index ae00ead865..8ac5328521 100644 --- a/lib/ethdev/ethdev_driver.h +++ b/lib/ethdev/ethdev_driver.h @@ -1235,6 +1235,47 @@ typedef int (*eth_count_aggr_ports_t)(struct rte_eth_dev *dev); typedef int (*eth_map_aggr_tx_affinity_t)(struct rte_eth_dev *dev, uint16_t tx_queue_id, uint8_t affinity); +/** + * @internal + * Defines types of operations which can be executed by the application. + */ +enum rte_eth_dev_operation { + RTE_ETH_START, +}; + +/**@{@name Restore flags + * Flags returned by get_restore_flags() callback. + * They indicate to ethdev layer which configuration is required to be restored. + */ +/** If set, ethdev layer will forcefully restore default and any other added MAC addresses. */ +#define RTE_ETH_RESTORE_MAC_ADDR RTE_BIT32(0) +/** If set, ethdev layer will forcefully restore current promiscuous mode setting. */ +#define RTE_ETH_RESTORE_PROMISC RTE_BIT32(1) +/** If set, ethdev layer will forcefully restore current all multicast mode setting. */ +#define RTE_ETH_RESTORE_ALLMULTI RTE_BIT32(2) +/**@}*/ + +/** All configuration which can be restored by ethdev layer. */ +#define RTE_ETH_RESTORE_ALL (RTE_ETH_RESTORE_MAC_ADDR | \ + RTE_ETH_RESTORE_PROMISC | \ + RTE_ETH_RESTORE_ALLMULTI) + +/** + * @internal + * Fetch from the driver what kind of configuration must be restored by ethdev layer, + * after certain operations are performed by the application (such as rte_eth_dev_start()). + * + * @param dev + * Port (ethdev) handle. + * @param op + * Type of operation executed by the application. + * @param flags + * Flags indicating what configuration must be restored by ethdev layer. + */ +typedef void (*eth_get_restore_flags_t)(struct rte_eth_dev *dev, + enum rte_eth_dev_operation op, + uint32_t *flags); + /** * @internal A structure containing the functions exported by an Ethernet driver. */ @@ -1474,6 +1515,9 @@ struct eth_dev_ops { eth_count_aggr_ports_t count_aggr_ports; /** Map a Tx queue with an aggregated port of the DPDK port */ eth_map_aggr_tx_affinity_t map_aggr_tx_affinity; + + /** Get configuration which ethdev should restore */ + eth_get_restore_flags_t get_restore_flags; }; /** @@ -2131,6 +2175,26 @@ struct rte_eth_fdir_conf { struct rte_eth_fdir_flex_conf flex_conf; }; +/** + * @internal + * Fetch from the driver what kind of configuration must be restored by ethdev layer, + * using get_restore_flags() callback. + * + * If callback is not defined, it is assumed that all supported configuration must be restored. + * + * @param dev + * Port (ethdev) handle. + * @param op + * Type of operation executed by the application. + * @param flags + * Flags indicating what configuration must be restored by ethdev layer. + */ +__rte_internal +void +rte_eth_get_restore_flags(struct rte_eth_dev *dev, + enum rte_eth_dev_operation op, + uint32_t *flags); + #ifdef __cplusplus } #endif diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map index 1669055ca5..fa0469e602 100644 --- a/lib/ethdev/version.map +++ b/lib/ethdev/version.map @@ -358,4 +358,5 @@ INTERNAL { rte_eth_switch_domain_alloc; rte_eth_switch_domain_free; rte_flow_fp_default_ops; + rte_eth_get_restore_flags; }; -- 2.39.5