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 2A15A44078 for ; Mon, 20 May 2024 12:40:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1E351402EE; Mon, 20 May 2024 12:40:14 +0200 (CEST) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2060.outbound.protection.outlook.com [40.107.212.60]) by mails.dpdk.org (Postfix) with ESMTP id 139CF400EF; Mon, 20 May 2024 12:40:11 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hZGEWIkVmUrQoKDaF/HFLiuE+kc2BdgLVZIgfopFvGuyL0BSW7mjsqUTv3YC5boEAfFDWRAMInBFFRFS/qB9L697MGY7vrrLCYCSW7fdvBH2aqf7qLVh4bSySgkXohj9f67O3xI/OFpYxeMYVFQ29DJ1jLFlPfJz/M6lMcsxSTMw20mfhxAm0S+nRDwXPkSdKSB46zXNVCFAlxhCW2s6o3IkGJ9u1fXp2/cHGgDdxxCyjhurjnrn9HcWJbrWd/ARwojGK8kuHpxE+gvEJ0IE6DuC8VGfC4RWzUNa9LklEANrpUQKqGjXvPQG9JFg7AXFxdMzBzcCIunRM9iWAtuo6Q== 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=EkhxQ8/Dh0G1cXsg+GGSXT3aYLaHbius9Cz1TY4WnjE=; b=Tg49GsZAF4r6phVBylKF0IziaDzoRTmnXt/5oD8VkQlhcCZ09W+1HnnExoDEqHr692ICk+420kWtmzPvmpugyFkqyJiEUeCvapLbRR/XCqBYUsZhSkznQQeB9vyDn+StaA5Gz0hEHkoSjDpl3BFBbF+KWUjbLYjn7L0YuX1+hellaQ4B9OZpGlgtDAtI4jIV1jH+D40JLlSaWSjsWsHjBFHPEzdHsj2fERg7xR0NwIB9M2o9F7sIdr0SQMKH0L5dOcJGMh9zTH7u5PeWhbpxkkN0bP8SrNlRwtkxhDKIUvnqMWdE8GYB1mNyKDIbfu2zWsbAO63I1av6ekL8I3HIIg== 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=EkhxQ8/Dh0G1cXsg+GGSXT3aYLaHbius9Cz1TY4WnjE=; b=FJCrjR5WC13ASWpoiUmAXmySfpgCsvgnJtbo82gjYpnWWgCOWukgT5UJuUuwQVuETg+muy3zbAfTHAwikehYk2UVn8SyI4QNMyXcReu4kW8nx9mvZ64TlE3C+FT5hwnJEpVYJkgIiIWo9qjI+yUl5+0J4VbS2tuUultC18vrU3E= Received: from DM4PR12MB5055.namprd12.prod.outlook.com (2603:10b6:5:39a::20) by PH8PR12MB7447.namprd12.prod.outlook.com (2603:10b6:510:215::7) 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:40:07 +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:40:07 +0000 From: "Sebastian, Selwin" To: "Ande, Venkat Kumar" , "dev@dpdk.org" CC: "stable@dpdk.org" Subject: RE: [PATCH v2 01/25] net/axgbe: fix mdio access for non-zero ports and CL45 PHYs Thread-Topic: [PATCH v2 01/25] net/axgbe: fix mdio access for non-zero ports and CL45 PHYs Thread-Index: AQHaoHwsl08s06aDnEax+wNyaK/usLGgAwFA Date: Mon, 20 May 2024 10:40:07 +0000 Message-ID: References: <20240412125013.10498-1-VenkatKumar.Ande@amd.com> <20240507124305.2318-1-venkatkumar.ande@amd.com> In-Reply-To: <20240507124305.2318-1-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=da326d64-a519-40a1-8e8c-b95027aaedfe; 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:39:27Z; 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_|PH8PR12MB7447:EE_ x-ms-office365-filtering-correlation-id: 16496f61-b7a8-40a5-5e0b-08dc78b937a1 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?UA2PFWYZEU+ow43kv2u8ZJJOR8uNlH3r/RB/JhZTnZFJGBmdvr2p+gTQi/Hh?= =?us-ascii?Q?M/ltdHjPzDV6jfTGiBQNYeRE4ou+v2zy+EnVtPuIyn5+GeO8BgciMbLBjGYw?= =?us-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ksdLqb60nggpUlhq1EHhR0su8et4?= =?us-ascii?Q?3842J9inVRd+KuPXkQqsFNz0MyPD45raLHU08/VFqKZYUQNYbNbndxBy/oqx?= =?us-ascii?Q?aOCpiZ1aHwY8rE/Rq3d327MAOj5i5C6d9FutW3qppQ0p+nhn+7bhsCOEi/44?= =?us-ascii?Q?Hc/RfMXFiiYyTs/9RX/rUOkEPNfknybbTJf8qCz7H2qvfXBj/ZjBfWz3d8Dc?= =?us-ascii?Q?UOTu1P/kMIPGwWocj/RtOG4a29Iy2k4+sjHm8hPzblYrBDqxsrAQ7jzCxl9M?= =?us-ascii?Q?fM2tl+M5wX1EUB9VObA6NBKUL4ybymlyzj5zr6EhikGEFX2KJvs26ReCWYeS?= =?us-ascii?Q?bHjc3d3YACR7O9lfxaLT1ByAROMBEyoSt+aQqezM9/p1Cw=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?Phs/YLKsrr9my4DWBAlzk6bSKMn7KEsP26Nt/zYdxV2jeP/K5jbXRYdiRqLR?= =?us-ascii?Q?OeZ5fQyQEVmDF9IJpAlGxjoRtnhBMF3xGOgXqMocaP7IvTnPPl7LkNdtz4K9?= =?us-ascii?Q?eoqNBfV8ejIQenJYNKWW153t6JgCBTX5/j57mi/NRZW8IuDLQoRhveZEu2OZ?= =?us-ascii?Q?Cg/FSh6uRiwByga/MOGrnhBx5ju5SHfFWXh8CBjJq7etAXGpfCfBIQ4dr/49?= =?us-ascii?Q?6PB2uqe5V/u5nvkOHpYWQpU9RfUithDaVDCIFHA4zl0LdwxpVWKbDJwSWdam?= =?us-ascii?Q?w7WPG3N1CdueA084pJ7LxWdJV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-ascii?Q?bP90N/Esc9JGQR+PIYEihBFCAohdnDPXSL7A2oqKpVhk/mjdZKVp1/gonlgK?= =?us-ascii?Q?AwalFTE626i3lQfmhJS3s441iqUcNgMmtg0Wc2UKXmAgRY9q+BExHU31/rfc?= =?us-ascii?Q?VjP5F2z4QNrpsTHGyARs16yVxcqsXJ8P+WzSZSAJTjtHjT8eCzLIEdkYLjX+?= =?us-ascii?Q?mraCTGGwbtrNULX88LKh9UzNEOMNFVR8/ASnI9YmoPzqMNmcpOnQPF6BgNdg?= =?us-ascii?Q?M8SvKQF8QfckhQexnt1dYsggVfYmqgs07mo5AdnpaoXZJTFfVSqqNNkJidrb?= =?us-ascii?Q?biydSKY+Ari7j5YkMpiREKmfv6HygJj5+19lQU3i6qNMnSAqIJAwOriC2Tpp?= =?us-ascii?Q?qCBZFTN3ZvjvTqt5DZg=3D?= 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: 16496f61-b7a8-40a5-5e0b-08dc78b937a1 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 May 2024 10:40:07.6977 (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: F83f1LYWTwcYEMfRlNiuBAA/rFCT7dkZmKVW5cO2nbHjVGU46ryLpsuZHcrX8DzdPQOo3/CjlRGyqC7HgHckbg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7447 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-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 ; stable@dpdk.org Subject: [PATCH v2 01/25] net/axgbe: fix mdio access for non-zero ports and= CL45 PHYs The XGBE supports performing MDIO operations using an MDIO command request.= The driver mistakenly uses the mdio port address as the MDIO command reque= st device address instead of the MDIO command request port address. Additio= nally, the driver does not properly check for and create a clause 45 MDIO c= ommand Without the fix user will get a incorrect value from PHY device. Check the supplied MDIO register to determine if the request is a clause 45 operation (MII_ADDR_C45). For a clause 45 operation, extract device addr= ess and register number from the supplied MDIO register and use them to set= the MDIO command request device address and register number fields. For a clause 22 operation, the MDIO request device address is set to zero a= nd the MDIO command request register number is set to the supplied MDIO reg= ister. In either case, the supplied MDIO port address is used as the MDIO c= ommand request port address. Fixes: 4ac7516b8b39 ("net/axgbe: add phy init and related APIs") Cc: stable@dpdk.org Signed-off-by: Venkat Kumar Ande --- drivers/net/axgbe/axgbe_common.h | 2 -- drivers/net/axgbe/axgbe_dev.c | 22 ++++++++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/net/axgbe/axgbe_common.h b/drivers/net/axgbe/axgbe_com= mon.h index a5d11c5832..51532fb34a 100644 --- a/drivers/net/axgbe/axgbe_common.h +++ b/drivers/net/axgbe/axgbe_common.h @@ -407,8 +407,6 @@ #define MAC_MDIOSCAR_PA_WIDTH 5 #define MAC_MDIOSCAR_RA_INDEX 0 #define MAC_MDIOSCAR_RA_WIDTH 16 -#define MAC_MDIOSCAR_REG_INDEX 0 -#define MAC_MDIOSCAR_REG_WIDTH 21 #define MAC_MDIOSCCDR_BUSY_INDEX 22 #define MAC_MDIOSCCDR_BUSY_WIDTH 1 #define MAC_MDIOSCCDR_CMD_INDEX 16 diff --git a/drivers/net/axgbe/axgbe_dev.c b/drivers/net/axgbe/axgbe_dev.c = index 6a7fddffca..3389954aa6 100644 --- a/drivers/net/axgbe/axgbe_dev.c +++ b/drivers/net/axgbe/axgbe_dev.c @@ -63,15 +63,27 @@ static int mdio_complete(struct axgbe_port *pdata) return 0; } +static unsigned int axgbe_create_mdio_sca(int port, int reg) { + unsigned int mdio_sca, da; + + da =3D (reg & MII_ADDR_C45) ? reg >> 16 : 0; + + mdio_sca =3D 0; + AXGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, RA, reg); + AXGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, PA, port); + AXGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, DA, da); + + return mdio_sca; +} + static int axgbe_write_ext_mii_regs(struct axgbe_port *pdata, int addr, int reg, u16 val) { unsigned int mdio_sca, mdio_sccd; uint64_t timeout; - mdio_sca =3D 0; - AXGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, REG, reg); - AXGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, DA, addr); + mdio_sca =3D axgbe_create_mdio_sca(addr, reg); AXGMAC_IOWRITE(pdata, MAC_MDIOSCAR, mdio_sca); mdio_sccd =3D 0; @@ -97,9 +109,7 @@ static int axgbe_read_ext_mii_regs(struct axgbe_port *pd= ata, int addr, unsigned int mdio_sca, mdio_sccd; uint64_t timeout; - mdio_sca =3D 0; - AXGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, REG, reg); - AXGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, DA, addr); + mdio_sca =3D axgbe_create_mdio_sca(addr, reg); AXGMAC_IOWRITE(pdata, MAC_MDIOSCAR, mdio_sca); mdio_sccd =3D 0; -- 2.34.1