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 11BC544077; Mon, 20 May 2024 12:42:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C398340A84; Mon, 20 May 2024 12:42:27 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2056.outbound.protection.outlook.com [40.107.94.56]) by mails.dpdk.org (Postfix) with ESMTP id 1246440A75 for ; Mon, 20 May 2024 12:42:27 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MAWqFca8rKF2syvE+H8miLBbzk1tEv3QT5Ddr8hhb63MvUdfztDehUc62qBxATSv6H3AvN+MvHKjhv01atW7NAHRHsAHp7vT5r2Uj5ySTPKQAyQFxajBkvyqJVL1Jra39smbBo70B4xsGygR2ZdphTsG2lIZqqTS7OyPY7Za+58ApOCMlZmBYM5AFQYvN+789MU0lNH8VIdVMWJxZqJECxhf0prTXwRmBaK6Hktwn09zaAl5pWUm116nkHrIzME2RSPWPRnlGDu5GcHMw1H/fy8cSZ9qQtQ5L9rK/UjAMg046n4dBTI6dm59R0pyBOcieEZ0SvyjrxLm6f3EqO3FQA== 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=IFXYSKdOiOzruKWbKR2BJvEU7aoEdZRbCE1vQ6qWTQo=; b=oSJt8qEenFJqq/r71uA/BPzgSDjiF/qand2fQxcvwPmiSUeOAet+YTipxH18OIJoiw+MGLpSq8ZAQxdDi4o8E2zew53x7pdmzBBoXahJ0ZCGq7HNGV1wHkQD29ubozVyyCQfE3ZMXj6HdlYQioEce37/kun9LQUh8d5GcWL1k344licSdyr20WSLBEIroC7rIyT5rHT4wyPSkux2xDaKplflBsXvCPdlGI9Rox6iFWi8oYXXLnHAttBZjsvaeEGVqEF8O2JmpnxwBsLFE0OJT/lw8AqmGqrPghp6p1ODfl6AHci2+laqURqJQ1suECH8fy9+MXfQhA0Fs0lE3jYVnQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none 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=IFXYSKdOiOzruKWbKR2BJvEU7aoEdZRbCE1vQ6qWTQo=; b=tRRQTt1By/RS//9MIRbxf+joj8s3+HI03LDFFs3vL5r4jWyLyZeKndOefZ5gqsT+1bq9zVwO38YjUyaRJ/na5L4ElvVy985dCFRbcyI/prm8W+Z6wzjU4U8pZsw+lO2hr8ZMJKEQf0A1923kjU64Oz8mEfUUojD/ThZMrIgkn8E= Received: from DM4PR12MB5055.namprd12.prod.outlook.com (2603:10b6:5:39a::20) by CY8PR12MB7123.namprd12.prod.outlook.com (2603:10b6:930:60::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.35; Mon, 20 May 2024 10:42:24 +0000 Received: from DM4PR12MB5055.namprd12.prod.outlook.com ([fe80::acbd:ea93:4496:51a5]) by DM4PR12MB5055.namprd12.prod.outlook.com ([fe80::acbd:ea93:4496:51a5%7]) with mapi id 15.20.7587.035; Mon, 20 May 2024 10:42:24 +0000 From: "Sebastian, Selwin" To: "Ande, Venkat Kumar" , "dev@dpdk.org" Subject: RE: [PATCH v2 13/25] net/axgbe: remove use of comm owned field Thread-Topic: [PATCH v2 13/25] net/axgbe: remove use of comm owned field Thread-Index: AQHaoHxCv0E8jOvuCE2KV/owGttF67GgA9DA Date: Mon, 20 May 2024 10:42:24 +0000 Message-ID: References: <20240412125013.10498-1-VenkatKumar.Ande@amd.com> <20240507124305.2318-1-venkatkumar.ande@amd.com> <20240507124305.2318-13-venkatkumar.ande@amd.com> In-Reply-To: <20240507124305.2318-13-venkatkumar.ande@amd.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_ActionId=38926916-8386-41f8-acef-df522b95ba6e; MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_ContentBits=0; MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_Enabled=true; MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_Method=Standard; MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_Name=AMD Internal Distribution Only; MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_SetDate=2024-05-20T10:42:20Z; MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM4PR12MB5055:EE_|CY8PR12MB7123:EE_ x-ms-office365-filtering-correlation-id: f61927be-7ec7-4b45-d723-08dc78b98923 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|1800799015|366007|376005|38070700009; x-microsoft-antispam-message-info: =?us-ascii?Q?ib1oZovDMSwnGn4qvMdpi2zpcdE+cnGicpHMmXqcn1LXMblZAuhi6vnE+OYy?= =?us-ascii?Q?TlGEOMp2sDqb5LBjFG+b70pr12mgBD5TJ+YN3R8JxlTXKNLuR0rS9DA4ppqr?= =?us-ascii?Q?URPrSKJ+tkglLOmJiKCeT9pzsU4V7/2kv3uCzTt+A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WM+4mAnsCMtxKdPIfSvyo/0UAWtLpsh4Nk?= =?us-ascii?Q?GIvwqdy3avpvJ2W9JO960yRo4+iTJu3V6NVkjS//7aMWewbE1SA43zQ8+8zl?= =?us-ascii?Q?pjvZH45zENzVPhAe4V23+ICUtck0mvRQkN3g0NXdMwmqutYi0eZ8PpalTK99?= =?us-ascii?Q?zW9+myt3062GVUisF5Wg8s1hxA8rXtmlHnSuf29Yx9/VMzVxH53lvSJiZ5R6?= =?us-ascii?Q?CGNQRVWaE1soEgzj7ApUySetV4VlDFNnTNzEPtBWye3ModVjY9coaqFP9oW6?= =?us-ascii?Q?Q6AZbJdDo2+dOqr51ic9RhUDSM5y0m/72IlWGma5ZmNQrw=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR12MB5055.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(1800799015)(366007)(376005)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?HQy/35x7bqhdwi1ksC42RP1iQUIoEsEkNa4CoJ++dccUc4HLl3afXUXK/DNY?= =?us-ascii?Q?jM+b9biuHoCcOMcShT28B5vu9e/axvNLRBKwFhGTq9m2ATyP0VgUnNwasUgk?= =?us-ascii?Q?ywqSxdOv2ZvCqIn+hEpvH/9HJ6FAEIQuRK+1Hl/qbbAiN0SIn1jQK1Wjgi+j?= =?us-ascii?Q?GnRO835e06RJrbwIkfx18NoFHnuHcZUJFDw7sDqMVrPWqKi9qI7WTLSdTuwp?= =?us-ascii?Q?UyoWkL1sp7V751gFCOGsuw3qOrKY0+krTvDfV9mXFDxrvfklXexxKXeRlPD3?= =?us-ascii?Q?K4SS6sLvJQh/5uGBHJrOqsnUwgBL8DEuB49ejFwZJYiRhwOiKY9brNYxnYyb?= =?us-ascii?Q?901RXk/b0ug23HT/Jwa+G0zH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ii?Q?6CjLZilzQkqHbzFQBbewtsFUWP9cooiCj35zl5z7lYMKwqi40dvi2qAxvcrR?= =?us-ascii?Q?kOLf08FofsPsIpECFI7fNMpzp3ZDqgZSvoQyP0x9s4/PW2Mrd7+92rUwCMUT?= =?us-ascii?Q?knFnezfbl3OPfhx65XMb6x9bYndw9//zKaotsCbow6CQqBGZxvNpM7SrSTso?= =?us-ascii?Q?Dz/w1iBzVk/u+kLQG/vt6Gps4S0t5kZqSoGZ0O+efcEEjSVzLK43URIVyIBa?= =?us-ascii?Q?z1irDf4VqXpY+wFZQ8uj434O/bZYa8Ogh0HrTycLcOTl56TgNVMvQIBZKS/7?= =?us-ascii?Q?meRldeQfxO9VVS1f2oP8PDJoDhseUNWvWl4DE96T?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5055.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f61927be-7ec7-4b45-d723-08dc78b98923 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 May 2024 10:42:24.4304 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: bM2jw++iluE51qza1XHFZhixkw9t7MFG37TBOt7oTtiUx8ssoQkTS0VOXsj+MMj34EJo7uKa7NVCR6zZ4qGKkg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7123 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 [AMD Official Use Only - AMD Internal Distribution Only] Acked-by: Selwin Sebastian -----Original Message----- From: Ande, Venkat Kumar Sent: Tuesday, May 7, 2024 6:13 PM To: dev@dpdk.org Cc: Sebastian, Selwin ; Ande, Venkat Kumar Subject: [PATCH v2 13/25] net/axgbe: remove use of comm owned field The comm_owned field can hide logic where double locking is attempted and p= revent multiple threads for the same device from accessing the mutex proper= ly. Remove the comm_owned field and use the mutex API exclusively for gain= ing 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_p= hy_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 axg= be_port *pdata); static int axgbe_phy_i2c_xfer(struct axgbe_port *pdata, struct axgbe_i2c_op *i2c_op) { - struct axgbe_phy_data *phy_data =3D 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 *pd= ata) static void axgbe_phy_put_comm_ownership(struct axgbe_port *pdata) { - struct axgbe_phy_data *phy_data =3D pdata->phy_data; - - phy_data->comm_owned =3D 0; - pthread_mutex_unlock(&pdata->phy_mutex); } @@ -418,9 +406,6 @@ static int axgbe_phy_get_comm_ownership(struct axgbe_po= rt *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 +4= 28,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 =3D 1; return 0; } -- 2.34.1