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 D6A5743FC9; Tue, 7 May 2024 14:45:08 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 50A1B433DA; Tue, 7 May 2024 14:44:12 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2052.outbound.protection.outlook.com [40.107.94.52]) by mails.dpdk.org (Postfix) with ESMTP id DDD77433C7 for ; Tue, 7 May 2024 14:44:08 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Meqd24kRIpoffm65x9p0o3kHs9OKHYb2Ic4QcjYT/rPnJqOJP7GKdQuzij0pl8DiCayHpBO/J33lu2STE/c7t/7GlgF8Ctp3XBkK8uSpMN7O3HR9y6/KnW4OE3J/fOOXn/207qhRCOw7D8bKCnnXzz3ZHU20F3CArKOipSFKLUPHIqsMgEkqTUTJ6sPaHShhCUCBidM/Ty/FSXMXccpiHxVgpMyFwdSXkuoHT4cSMV9uBCAqpP2meAPNvA3fp+npnFfHw5J66ABUBhb5yWjLUayAJAr41LZt+l7jSgKjuokCXetWVnq8xzgLRiivS3TZgzAOlRgBmTg+o9ecHdYHng== 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=aQ8fUqNXfPcZBcnJHAtnZMJ2TNQp+R0GhU3t0nyvfXA=; b=a6JlD+zfeO5QRjeysDLnpPK/X0D11Z26/C7GvPKyipgeNnTrDASjsgGDJDkVSK85dc5OIK9cMb2yHCvls21bkfDk7hN6Qqji+Ul0lrAaJ5Kp1VmoyqzUiXer7GHHcYux62GYHzmzbvmbTogFNFJJb3g2YO1uCuQzKkMd3NOveWMpIEjjAftWjE1SitUku2d6IpfvSTF3ZgzF2jpzXlTrIY+MsZnK7KrcmTgTqXnlmGuPOYoWRGZNm6logWis/awdWqgIimerDU+tXtqJFw8S8sjp+VXeJem7Nq+Z4hk59Xgo11L5zKUUtny+fsGdE50fN2RMuYuVcZIObdB0VTgF/g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=dpdk.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aQ8fUqNXfPcZBcnJHAtnZMJ2TNQp+R0GhU3t0nyvfXA=; b=3t8TVJHfldb7+acL5tpyee/nlAqouO61t1xffHN5pkxANiSozuNKRmz1NyKHMwWuOBIBVBTIFqxazHmtvITSDKM+vmT37yFdqCiJ+vZgV0AvHlE+1ZiOImUxh2pvu0AasT3WN46wvcFs9piob6/JcHR5JTwNIDV2dDOwpZzSLOA= Received: from PH7PR03CA0014.namprd03.prod.outlook.com (2603:10b6:510:339::10) by DM4PR12MB7576.namprd12.prod.outlook.com (2603:10b6:8:10c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41; Tue, 7 May 2024 12:44:06 +0000 Received: from SN1PEPF00036F3F.namprd05.prod.outlook.com (2603:10b6:510:339:cafe::f1) by PH7PR03CA0014.outlook.office365.com (2603:10b6:510:339::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.43 via Frontend Transport; Tue, 7 May 2024 12:44:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SN1PEPF00036F3F.mail.protection.outlook.com (10.167.248.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7544.18 via Frontend Transport; Tue, 7 May 2024 12:44:06 +0000 Received: from cae-Lilac-RMB.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 7 May 2024 07:44:04 -0500 From: Venkat Kumar Ande To: CC: , Venkat Kumar Ande Subject: [PATCH v2 13/25] net/axgbe: remove use of comm owned field Date: Tue, 7 May 2024 18:12:53 +0530 Message-ID: <20240507124305.2318-13-venkatkumar.ande@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240507124305.2318-1-venkatkumar.ande@amd.com> References: <20240412125013.10498-1-VenkatKumar.Ande@amd.com> <20240507124305.2318-1-venkatkumar.ande@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF00036F3F:EE_|DM4PR12MB7576:EE_ X-MS-Office365-Filtering-Correlation-Id: 92bc42ba-dcaa-47c6-8fa0-08dc6e9361fb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|376005|1800799015|36860700004|82310400017; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?wmll7CiDh7YCVdiwaaAuWHk7nzy9Krtw0z2QK4LE1exQGjqfLhs48TH6/WUy?= =?us-ascii?Q?pJEBDEP/gcB71hPGlQP/JiSwVmjSs0ZT9+vmx8+xL8YUzIdI4Qw7v8OKk0WF?= =?us-ascii?Q?DMW2/hMUDx9vSRohpCAjtYc4l2q4DJavef6ZSRwvSaSaWoNR6mgzveUEfR8o?= =?us-ascii?Q?nVohz2oZe38AeGKKFQIMjufN3jYf1y+FOlwmfglrLbb300J7Z2O0V9JO3lcz?= =?us-ascii?Q?AiQ2mSV0QBhtDLroqjSi02FAHxLMcw5oDA1OBG9ZZeGRRB3Yr5CPBQJfvg9d?= =?us-ascii?Q?2MAd/PcmmCkG3Hho+Yp2jjoFs+YQK0BYUpKsPQQq/X4vHdZ1Ok8gZriiZi8W?= =?us-ascii?Q?E/lyoJC2xIlBYiFAsiOjjDJI1ksobtrltzYd9zFbvOHFCAvYQ5ZWv8/zCSAS?= =?us-ascii?Q?YMxizHBcwZCjSaC6keZKrdzDu+xJBNTqcpiNixPh7oCi0l/vWyxmSNxYqJgh?= =?us-ascii?Q?UNEn9ZN3N100z6hLT017fvMpviUiQUMR9o9B1wMDsDnnjpgKMQ9pf0jBKYcv?= =?us-ascii?Q?/PqoZQ3+I3u0gPsqgb/D8pYYFp86VByW3u3Vs8DAxLMzS/jySh4Dzsht/VxL?= =?us-ascii?Q?SGJXr+mnjwZsPqpxLej9yMi9qandSlCVizESQziWbngqx5TN3b/I+YjTsb6Y?= =?us-ascii?Q?szMEs6qT1npX+bemhOACIM+zdLo4M3HIds/T7UgjxgFIO8KgX5+ZTZYyHIGd?= =?us-ascii?Q?sP7TkVSr9ejdoVeCi7LS0iZ3pe05lL4n3MGUuHo5e91+nkxuq+knUCwRbAz3?= =?us-ascii?Q?ZA3h39gX+EhpVG7sWrAGOaxtWkPH51pO3VJuJNMzpfKQy+bIsD4jpdIiUKmT?= =?us-ascii?Q?D8nj21D6REhAbQUcisMk07V5C8tRojpCb27pMkXScjJDFhdmK/WCABYZ2uFV?= =?us-ascii?Q?TgcQta3Vq4weCcZxqG4BtvTvT4zskn0DuIHoMQuz8n7kOYXD5dsSxESssAnO?= =?us-ascii?Q?zCZsXE5W5G/AXeZudC3qQaKPB60mAT8wR4gPL+ICkR4oSRCeiomN+Q7QEkqY?= =?us-ascii?Q?ySgfktcyNV+oiZR08rupjYnpBBJy/IRkzZG+jZJcGpMCf2U2PmvX1cCOiz/8?= =?us-ascii?Q?/JyXmHogOHu8HTBjS3AHQXj+R690VUOMb6dqmyI1cU/bxqrpmyymmOaoH2mc?= =?us-ascii?Q?6L4AMvXFmTDeCFS7h/QheiruFh4b7mY5xVYHjH5gHEKBW+szHyVO6rrAHPNT?= =?us-ascii?Q?joGL8bCGGYNrrZIiWGVI2r6p930w+3zT33TjIB263HH5S9At/l2jG3gXbzbR?= =?us-ascii?Q?bzKfTIJ3WR5Jl2GV1g4fgoWFkEuc/alFAT2PPULVRf/Ty1FDQsfZmgb22jnK?= =?us-ascii?Q?Tvo+DGb9YCzIn1MnIm5UnRnudeEDBl+N/B3hC5YGtIxzFoSYuO2R/7VCe9rh?= =?us-ascii?Q?KAMshhrSGKbL7ztWRMnh7Tb37F7d?= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(376005)(1800799015)(36860700004)(82310400017); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2024 12:44:06.2266 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 92bc42ba-dcaa-47c6-8fa0-08dc6e9361fb X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF00036F3F.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7576 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 comm_owned field can hide logic where double locking is attempted and prevent multiple threads for the same device from accessing the mutex properly. Remove the comm_owned field and use the mutex API exclusively for gaining ownership. Signed-off-by: Venkat Kumar Ande --- drivers/net/axgbe/axgbe_phy_impl.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/drivers/net/axgbe/axgbe_phy_impl.c b/drivers/net/axgbe/axgbe_phy_impl.c index 0ad5b4ba85..d2a2b124be 100644 --- a/drivers/net/axgbe/axgbe_phy_impl.c +++ b/drivers/net/axgbe/axgbe_phy_impl.c @@ -204,8 +204,6 @@ struct axgbe_phy_data { unsigned int mdio_addr; - unsigned int comm_owned; - /* SFP Support */ enum axgbe_sfp_comm sfp_comm; unsigned int sfp_mux_address; @@ -253,12 +251,6 @@ static enum axgbe_an_mode axgbe_phy_an_mode(struct axgbe_port *pdata); static int axgbe_phy_i2c_xfer(struct axgbe_port *pdata, struct axgbe_i2c_op *i2c_op) { - struct axgbe_phy_data *phy_data = pdata->phy_data; - - /* Be sure we own the bus */ - if (!phy_data->comm_owned) - return -EIO; - return pdata->i2c_if.i2c_xfer(pdata, i2c_op); } @@ -399,10 +391,6 @@ static int axgbe_phy_sfp_get_mux(struct axgbe_port *pdata) static void axgbe_phy_put_comm_ownership(struct axgbe_port *pdata) { - struct axgbe_phy_data *phy_data = pdata->phy_data; - - phy_data->comm_owned = 0; - pthread_mutex_unlock(&pdata->phy_mutex); } @@ -418,9 +406,6 @@ static int axgbe_phy_get_comm_ownership(struct axgbe_port *pdata) */ pthread_mutex_lock(&pdata->phy_mutex); - if (phy_data->comm_owned) - return 0; - /* Clear the mutexes */ XP_IOWRITE(pdata, XP_I2C_MUTEX, AXGBE_MUTEX_RELEASE); XP_IOWRITE(pdata, XP_MDIO_MUTEX, AXGBE_MUTEX_RELEASE); @@ -443,7 +428,6 @@ static int axgbe_phy_get_comm_ownership(struct axgbe_port *pdata) XP_IOWRITE(pdata, XP_I2C_MUTEX, mutex_id); XP_IOWRITE(pdata, XP_MDIO_MUTEX, mutex_id); - phy_data->comm_owned = 1; return 0; } -- 2.34.1