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 13E1244153; Tue, 4 Jun 2024 14:14:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 09D16436E5; Tue, 4 Jun 2024 14:13:11 +0200 (CEST) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2081.outbound.protection.outlook.com [40.107.100.81]) by mails.dpdk.org (Postfix) with ESMTP id ACD10436E5 for ; Tue, 4 Jun 2024 14:13:09 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lGDWODeTIh5MPI6JKLTVABi4z7EjWGAcMSKLAlW7p33LaC5VHJy4c/DChbJ/4Kh8UiBugLjpx8qyn1ZSITWf2J4M/25ZGWv89p8oeO3F2GWIWGWi6fx6HRD4sGSbA0eZ1S04GefKYWjVnTggLgqnJUfrLd4YJ2VLLZfhJKodzgR1tPxDdgf72S5yoNvn/keJLa5eAzw+GQcmnfXRDzcIvNt/ld+QGlP26fyind8zy6eTcrDpepMOGtq/o1A4d3eYrxzB4UeSJ1CWk+70mRWTHEZfMyM/+P8no1UeXEMB65DQbioGApKFBidJAnqEEqExf4ENC5lHoM1CJXXQtM7CxQ== 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=ljAKB428Ead/O12U+woopW6rrtU2Xf53TqrFrzjXqcA=; b=f/MRVFovLV5lHOXmVShEZ7abjLhgmOH7QZyfhbfEZ6XaSnwRq9/oBg6L4kyhRTLpPRyHalnFSaf7tdbSKFxX5LN4vGGddFubaohvKH/80wAq8PsPTGiXFz/BsDe0xYl/K0hvsBWGUm+fM5pyogWC9FEpQmxlL2VWqbGlOGn7N0do0hyrco3s3bJp0er92idgIaEwoEfcjaPPSnbYd7/6J3MfUU3dNlpcBfjBcvJwXDGOqsrFndnAoPT8JdEHeZOt1OJVsQwZRuaB8LSXzFbCvvd0DyMfsK4guzLGdM8/DPQJYVtH2efH57WlExCAJZEnBMyEKPyCz2/wkf/Oba85XA== 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=ljAKB428Ead/O12U+woopW6rrtU2Xf53TqrFrzjXqcA=; b=GXKpLt6o0FN9IdnFQ6ssb6nMWeWUbo83Vm92tSBmOT+sfuMAlKtOWHT8IbfXfHQgh+zKLugjpF5eV0QfUBy/l388cTmhmFhq7ggoCHkdlhMRSlC+3x6DbXHwFs9v2Tws8YS2GngaAewVyvy/6txOJPSUMRuIWdaZ5t1Jm2YEKMY= Received: from MN2PR10CA0030.namprd10.prod.outlook.com (2603:10b6:208:120::43) by PH7PR12MB7020.namprd12.prod.outlook.com (2603:10b6:510:1ba::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.31; Tue, 4 Jun 2024 12:13:07 +0000 Received: from BN3PEPF0000B372.namprd21.prod.outlook.com (2603:10b6:208:120:cafe::11) by MN2PR10CA0030.outlook.office365.com (2603:10b6:208:120::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.30 via Frontend Transport; Tue, 4 Jun 2024 12:13: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 BN3PEPF0000B372.mail.protection.outlook.com (10.167.243.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.0 via Frontend Transport; Tue, 4 Jun 2024 12:13: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, 4 Jun 2024 07:13:03 -0500 From: Venkat Kumar Ande To: CC: , Venkat Kumar Ande , Selwin Sebastian Subject: [PATCH v3 14/25] net/axgbe: remove use of comm owned field Date: Tue, 4 Jun 2024 17:41:46 +0530 Message-ID: <20240604121157.3052-14-venkatkumar.ande@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240604121157.3052-1-venkatkumar.ande@amd.com> References: <20240507124305.2318-1-VenkatKumar.Ande@amd.com> <20240604121157.3052-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: BN3PEPF0000B372:EE_|PH7PR12MB7020:EE_ X-MS-Office365-Filtering-Correlation-Id: 1ed495b9-aab4-4e5b-d77b-08dc848fb137 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|36860700004|82310400017|1800799015|376005; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?1QOz3MAf9YqcpL7WJfO5fomDJLtatn58ub+8d8jPXkQhnoLzes96ffyha6bc?= =?us-ascii?Q?RLpFKOM4Ouob0C5XwE1XXVXfCClQplS0UrMGCB4i+lhlPfcRTdfP3d6yWnAx?= =?us-ascii?Q?q9LQS083uEeo6oCQyeSLhDpMbxvwqrE/+GhqpBnRhw04/8eVbRDygI6SttNe?= =?us-ascii?Q?cA+ZO651rt0NafZw0lTal91nqcd/t6jFqQEOdloPp8oxtPJSGCAVJLGaG4v5?= =?us-ascii?Q?u58DXrkylOLlfo5yVXcFdGnMJd3WDSKjTuq078zr8Ak8NitOxfS0WrCVIiOf?= =?us-ascii?Q?EqPGY7DtrRWMcfxM4OUr1vlCbb5CWTsr+qFLEGoQpQnyXl530Egt4PIZMNXw?= =?us-ascii?Q?4yIhPJ4cMFJgxBmZHWhc68L985/ShqZV6XtOTnje8flVcXnZN4E+jLrhv6qE?= =?us-ascii?Q?eHOFv8gi9N5HfYKfkTQPubk9fpBiSrD6VlTJMVEkBgSzxaeEnKW71+0R1l0Z?= =?us-ascii?Q?jMyJKpxjD4WTgDcqduIDIioiAUy3kh74ATjDrnkhxrtYiqVLPwLFW/BuKSFq?= =?us-ascii?Q?9QCutWdDkjNr3ihHXEiRNfGQa3YN4Y0ug7eZYDyEwGatnTw1HV+Laur+QVLB?= =?us-ascii?Q?E23R6oZKhc/hIv/NvUYaV258HJYtO+rQ+D7HZ3HYsIZX2iW9xcnteDC5IreE?= =?us-ascii?Q?T4M1sITl856vrGTlrREczthwUndY2KKYCUxETcS+baBq4bQehn9I9F4Xtbse?= =?us-ascii?Q?f5Gv7WlNz9Ach1HxZKdFQuYSRt0fxFBYrqkavldFVrcIyp6EU++jO7PVCUks?= =?us-ascii?Q?gmGfFJHTdj2UM58iaImi26ccUKji80mtO6dpEz3ULXf+Cs4fXxzzbng6dsog?= =?us-ascii?Q?gkTah5zozu5ehEa8HvuxL+jobwFZnXPoqmMl+KtEnUr4kzoNQz3BIAtXaE3m?= =?us-ascii?Q?7zs2dpuCRfWJ37XDrjvGt2kYCXGCRuC4zjROr+WUDt+KgswhYGhl5eptHo/5?= =?us-ascii?Q?lERLnAElHMaYEFg+CQS6+IGjM3jZPCusfOMfHRgQDud30zhIg3usu1CPkEa7?= =?us-ascii?Q?JLpQYmjh75J6sKCEh9AMhXGPxPYkhenE0+c8WcDTYqbVZkKyY58afeL4yUq0?= =?us-ascii?Q?aCrgsUqdCGBjAjHi5W6J3B07iAOpA3Mz6R5smfs3Ie+yCkabwHgATc+ITTqQ?= =?us-ascii?Q?V+Zrt3SxrLwOn8vXYR0EJ5SjtkKxB8tKvqYNC7v2nMWNmBjEocaDd5PxdS/Y?= =?us-ascii?Q?GqOYLG4senzolt4OJ6GqAn0qIQYRFNIkvv1TXMXQWa9qq2bUgCYtYUbxv12Q?= =?us-ascii?Q?hV7bPE7RFi1rmhHKTc2WJmeGOzi37ICR6nt+o3HN6ymJlzbhSpn9pb5tkS55?= =?us-ascii?Q?MjRVGC5eFxrPxygHKAPMa/mD2rmJV+lRS2IKw7r1DAfrKKO+42xD7Hp7RvBN?= =?us-ascii?Q?U1U+yuz/uspbC2nEH8J91iS8ATMOm7o0/FY7HOFlRKod07XIYg=3D=3D?= 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)(36860700004)(82310400017)(1800799015)(376005); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jun 2024 12:13:06.7715 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1ed495b9-aab4-4e5b-d77b-08dc848fb137 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: BN3PEPF0000B372.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7020 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 From: Venkat Kumar Ande 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 Acked-by: Selwin Sebastian --- 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 b6a2a084aa..30727ee5a4 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