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 63F5C45B17; Fri, 11 Oct 2024 20:52:24 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1EBE540EE5; Fri, 11 Oct 2024 20:52:19 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2049.outbound.protection.outlook.com [40.107.244.49]) by mails.dpdk.org (Postfix) with ESMTP id 248F240EDD for ; Fri, 11 Oct 2024 20:52:16 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=u+S8LUXYVijBVdQ8NI+dco7oIVbGXIrVNpBc9JI7ktC5K6WQZ4bxya/pPor9wuZj9OV5Vu1bDMvZJcDjVzkc7KkQnq9hSvpQCnrDu96wwPqOo3DTYFZYuuaiddL0S1p59UltyIQGTZQW6m4SiPYlkTIJhcvzFC6DB+NpLKndY2IFcUbTPY2AaP2jH+c6zZBup2SwhmCtONRX1SRvhbnstpiwl+Exj+Z5NQ0qkSBHdjvJyfa4ALpi8ZS4mu6Tgw72mdxSD3SVDwzjxErYtPhHzTAVqAx1QCPdUlUQACpqxS/VexoYcj1nCVcBCqZUWTNpGSTTRGIjrIazcWZ1ajhWaQ== 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=kx8QoP6KL0d7PEH2Bu485M5w1268AkM6iO1Z3fIoimA=; b=quWLBumoPsr3QwacXF9po3Zdlch1vQ+T4Vk/cPg5X90wzZw+uu4YE5HTweoxcH2kYpHfR5uor7vJkFmxS++BPDnitDHdRFXz1D+x+Vj739uWNPQya9uM4yCwEELKETFibTOALiokQPWfHBjIbax0gUSYOuq9kISvkjHFg1FcAySvQ24jSxYPCFoKQW29eSk/J+KjaGqo67bP85vu2pthULvwZnlmhYIAAidBspfTQzCroCS272/d5GRNc4KodOtYntQaN/qxlddmdRhEGcDAydUiveo5BXS//+ugI0vQTW/fSWEHt0vLQKG0mcV14kHaRDWybRl0cc360DPKVK8qvA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=kx8QoP6KL0d7PEH2Bu485M5w1268AkM6iO1Z3fIoimA=; b=cK5lowBCt252CmRVkQ+ym0VSwXX8+xpzm/LOKs6jsICZNDjZgc7DUhgeF9AiFc6AAdGgCvpM8BD0tcg2JNppzNZ8pcEegPumKxr7uoC9/d6wxeKYcEetF9MbmiUzIUv8cTASp7C7Dx3s6SsWGr8abhg9PjC+UMz1J7AbKj29s2Cl7fq6D4rFHFghcm65iSA5PYhD+at2altBocv84sMTHhMLQsX+Ap14rECOLtLDzDe7wgAHKKxl59xUH4fJBh67ti6jMkoA3dOUOp9u0zL8tIjrUxoEfyp0gmct5TiV7n7DmrwFDb9bnH9iWQlx9Rs/+ffl7Jw46lemIW/BAzV7mw== Received: from SA1P222CA0016.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:22c::8) by SA3PR12MB7830.namprd12.prod.outlook.com (2603:10b6:806:315::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Fri, 11 Oct 2024 18:52:12 +0000 Received: from SN1PEPF000397B5.namprd05.prod.outlook.com (2603:10b6:806:22c:cafe::56) by SA1P222CA0016.outlook.office365.com (2603:10b6:806:22c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.20 via Frontend Transport; Fri, 11 Oct 2024 18:52:12 +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 SN1PEPF000397B5.mail.protection.outlook.com (10.167.248.59) 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 18:52:12 +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.1544.4; Fri, 11 Oct 2024 11:51:57 -0700 Received: from nvidia.com (10.126.231.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 11:51:56 -0700 From: Dariusz Sosnowski To: Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko CC: , Konstantin Ananyev Subject: [PATCH v3 2/4] ethdev: add get restore flags driver callback Date: Fri, 11 Oct 2024 20:51:35 +0200 Message-ID: <20241011185137.277874-3-dsosnowski@nvidia.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241011185137.277874-1-dsosnowski@nvidia.com> References: <20241011093351.187191-1-dsosnowski@nvidia.com> <20241011185137.277874-1-dsosnowski@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.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: SN1PEPF000397B5:EE_|SA3PR12MB7830:EE_ X-MS-Office365-Filtering-Correlation-Id: f6221ec4-18ae-408b-2c5b-08dcea25d136 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|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?2f/5TQf/bYDGYj0HKYhLxgxMgeFjVziWtRUN8t1VmmXw9w808MVqrHJRav5C?= =?us-ascii?Q?GTAfkhl2HxLtqplilP0yowUJ9EKBwhOLqcsBhcuTVmtT8Ju7UT6192VwYceF?= =?us-ascii?Q?hUQ6B103MwVoQ7MtInMmvOL7aQLCyFF+2JSpQ6e8Ms99MflsJAzSKjyORVb7?= =?us-ascii?Q?A0+JRo3fv2tLPX63YKr0mTWr+441cG6QG8Oksmok6WY6tL3H+y2Mz8vUPzai?= =?us-ascii?Q?Qff4xVaO2jXO8J1dgBXUVnELWPutY7NN3lwvRZbOgEFbPH6Vo6yGWyX3hcks?= =?us-ascii?Q?KUj9iioABb32Zb6g3a1HJNGUwRg6khERIjr/xs7u4r1hAbcuvTjHxnsC2BUV?= =?us-ascii?Q?4Fr/bqicGyQbGaEdbC16qdvM0LVjeIcU8M4aZNxuAl/u9bmKy30ow573pIyD?= =?us-ascii?Q?PuWs304PgwgwTe0hnz2nCPciAYZ8g7XzUaCeTwFiUzUoLZaAlKSywdcZc77r?= =?us-ascii?Q?zyYWmvhtR2W+d4aV48og0XFcPnteRHuKe+1BoSOEz8YGoTTPQ5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o0wsmKInY8Wkc?= 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:(13230040)(1800799024)(36860700013)(376014)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2024 18:52:12.3195 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f6221ec4-18ae-408b-2c5b-08dcea25d136 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: SN1PEPF000397B5.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7830 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 | 9 ++++++ lib/ethdev/ethdev_driver.h | 66 ++++++++++++++++++++++++++++++++++++++ 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..9afef06431 100644 --- a/lib/ethdev/ethdev_driver.c +++ b/lib/ethdev/ethdev_driver.c @@ -958,3 +958,12 @@ rte_eth_switch_domain_free(uint16_t domain_id) return 0; } + +uint64_t +rte_eth_get_restore_flags(struct rte_eth_dev *dev, enum rte_eth_dev_operation op) +{ + if (dev->dev_ops->get_restore_flags != NULL) + return dev->dev_ops->get_restore_flags(dev, op); + else + return RTE_ETH_RESTORE_ALL; +} diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h index ae00ead865..3974512a5c 100644 --- a/lib/ethdev/ethdev_driver.h +++ b/lib/ethdev/ethdev_driver.h @@ -1235,6 +1235,48 @@ 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_BIT64(0) +/** If set, ethdev layer will forcefully restore current promiscuous mode setting. */ +#define RTE_ETH_RESTORE_PROMISC RTE_BIT64(1) +/** If set, ethdev layer will forcefully restore current all multicast mode setting. */ +#define RTE_ETH_RESTORE_ALLMULTI RTE_BIT64(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. + * + * @return + * ORed restore flags indicating which configuration should be restored by ethdev. + * 0 if no restore is required by the driver. + */ +typedef uint64_t (*eth_get_restore_flags_t)(struct rte_eth_dev *dev, + enum rte_eth_dev_operation op); + /** * @internal A structure containing the functions exported by an Ethernet driver. */ @@ -1474,6 +1516,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 +2176,27 @@ 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. + * + * @return + * ORed restore flags indicating which configuration should be restored by ethdev. + * 0 if no restore is required by the driver. + */ +__rte_internal +uint64_t +rte_eth_get_restore_flags(struct rte_eth_dev *dev, + enum rte_eth_dev_operation op); + #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