Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1769110pxb; Thu, 4 Nov 2021 08:08:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxP8Ghu0qfUa8QKw2vIdvKdza/LwiDVjIws2Nb8/bj4gTTnDatoOPpSqA9fyaD9YrcmQ920 X-Received: by 2002:a05:6e02:102f:: with SMTP id o15mr9482254ilj.272.1636038509136; Thu, 04 Nov 2021 08:08:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1636038509; cv=pass; d=google.com; s=arc-20160816; b=grv6i4kGzBiihOkCAQDAP8RjkWlAS6mcK4sjveqmGJPJ3iHO+s7ygBhIFWUczsBvB/ iWs0gsfDiqUooeClKQUG5cjrwLPQE6ODoz0J0A+75gFrhjNOa+iZq4uCYXo4HB704auK epF0AFh2BavrgKuOTAxCkv+btN2G/PU1ADsQsFXvo5k9//XHZ5mGYnVVsW6yUZ7v+pPE DzlQD5OuEor+LA/iSPp1xJ0B33tIUo1KQU+b28mx7+0M+ejXHsx3dQcaj8w2AUWNohQn NMfQbqqSCkNWQI+ry+g6Ag6RWW3z2ASn+lChA/unWiGSigpCPwVGuk2cuBJ/hH2nYRZd sPog== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:in-reply-to:user-agent:date:message-id:references :cc:to:subject:from:dkim-signature; bh=6AdRzp5z1BwBqY96xcLAr3PzQWh0CDpGpfhTPs7UHWE=; b=g6lGkRKwiOU0m5he3wq5zsrJQNYDXYKw2PsVc7QeFkfYIBDlFjN8ISKR8hENL03QRu 6p3EAJ5nA8/Cu951RzHBgs205ph7q3NguLYvdbFEVyBdafDpkFruM5jZjh+IU6qOLMfB QjZqt5FJs6KkGXZSNAMxVksCrQ6YrNlwvRGgfOkdN4q66wS8AU395sObJMCCYvI/3fus AePz0NqP5nsoAupE/dNtnhcmNptQrfmR4mOS4szXoG0vACV0OCrR0zC/9Xua5cMQQRVb DGM9iKaJIa5NRbyU0y577CpscZOmod4Ozy4vlpsDvOmNafU+PN5ubGlQtS3RbmHPBfvI 0Pzg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@secospa.onmicrosoft.com header.s=selector2-secospa-onmicrosoft-com header.b=kkr8Im62; arc=pass (i=1 spf=pass spfdomain=seco.com dkim=pass dkdomain=seco.com dmarc=pass fromdomain=seco.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=seco.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a4si7869995ilt.68.2021.11.04.08.08.13; Thu, 04 Nov 2021 08:08:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@secospa.onmicrosoft.com header.s=selector2-secospa-onmicrosoft-com header.b=kkr8Im62; arc=pass (i=1 spf=pass spfdomain=seco.com dkim=pass dkdomain=seco.com dmarc=pass fromdomain=seco.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=seco.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231371AbhKDPI3 (ORCPT + 99 others); Thu, 4 Nov 2021 11:08:29 -0400 Received: from mail-eopbgr80083.outbound.protection.outlook.com ([40.107.8.83]:24577 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231248AbhKDPI2 (ORCPT ); Thu, 4 Nov 2021 11:08:28 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jJiFvLlK5YO7Ubz4vs9AcSgxNaqyK84u3toivVkjgJW3zgjLKXgazogc8+TWc4lKWVZ7ITy0sNsabW4LMNeoi+YcYqIFAkg59YfBbW06+++fTGMn0PqGS+VAVNLcmtiY6arN2tju3fgT9oDR2WPPFmceSBk5zNAAswJdaBX71j8PgJ31WRBjNDMUU8gD5JGROaLSH0b42T5ZvBNRfLu+E9ClE1f2Kt8iiy6lhuOTyBbWDQ5/gW8orscU3rzbUhZjyujDxctATgq4siHlxLwHmCj0HUt8i7jRgW+xKTw1CWrX1dPGbfppjQG3NkFyc7uYPmNQNFMLCfhLc6hGB4a2Lg== 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=6AdRzp5z1BwBqY96xcLAr3PzQWh0CDpGpfhTPs7UHWE=; b=NWoB+2Zsf0IzSJOGC8Gt5JA2lrCqd27JRP27DYxTGuribDOQtG5EoU3/VlghLb/6B6r52Ouvhe6m1RL8mYYgIV5TX1o4IftHgH+qKW9GFKR0Rm1olRGn0Zeu8auuVZ9JxrrAUHNVfdfkxjjQsn5vIi/qbvb76oO3whz1M9C7SIttOyyxWlSTzMPrdleuvGQXDYQwK4DAcfnMnOjf0tfpf88OU6IQzyXb7b1X1SPPzneUFE8eZi8jp0eBUGe9j7jkUwFVgAJovfu6CVPNAeFbMdm7WACUY569YjOcacn5CVkPo6Gp2/hrSwPsrFE2WzVr43PvyRDPjY9OLEDq4C8/oQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secospa.onmicrosoft.com; s=selector2-secospa-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6AdRzp5z1BwBqY96xcLAr3PzQWh0CDpGpfhTPs7UHWE=; b=kkr8Im62PBjXF2Q2ebLJh5vozui6r3u+shqfUIghQt7RiOhPnZ5oTL6gGOcM7qGeO/VqcpqmLk5cOStVTLFrv75+EB6ePApE3ISgg34POEcd/5PJ/b7+J9NjwGisLDQyCjBj3/kEq3TzZNFxg6TGEqm9LigsxyV6DLfDynmPGrc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4523.eurprd03.prod.outlook.com (2603:10a6:10:19::27) by DBAPR03MB6549.eurprd03.prod.outlook.com (2603:10a6:10:19b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.15; Thu, 4 Nov 2021 15:05:46 +0000 Received: from DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::a9aa:f363:66e:fadf]) by DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::a9aa:f363:66e:fadf%6]) with mapi id 15.20.4649.021; Thu, 4 Nov 2021 15:05:46 +0000 From: Sean Anderson Subject: Re: [RFC PATCH] net: phy/mdio: enable mmd indirect access through phy_mii_ioctl() To: "Russell King (Oracle)" Cc: Andrew Lunn , Grygorii Strashko , "David S. Miller" , netdev@vger.kernel.org, Jakub Kicinski , Heiner Kallweit , Florian Fainelli , linux-kernel@vger.kernel.org, Vignesh Raghavendra References: <20211101182859.24073-1-grygorii.strashko@ti.com> Message-ID: <53f4af3b-442a-14dd-76cd-d2784a71d709@seco.com> Date: Thu, 4 Nov 2021 11:05:37 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: MN2PR07CA0003.namprd07.prod.outlook.com (2603:10b6:208:1a0::13) To DB7PR03MB4523.eurprd03.prod.outlook.com (2603:10a6:10:19::27) MIME-Version: 1.0 Received: from [172.27.1.65] (50.195.82.171) by MN2PR07CA0003.namprd07.prod.outlook.com (2603:10b6:208:1a0::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.13 via Frontend Transport; Thu, 4 Nov 2021 15:05:44 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: db46dfdc-b4ac-4993-4691-08d99fa4940e X-MS-TrafficTypeDiagnostic: DBAPR03MB6549: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F6+dkp3ngcSQfUTnKVPeL3BzzO8jNOdidYxEo69z0MD/Xi7+exUt8eZFMPlRtTdvIaoRL6+U9BRzs4372jLEolx1zJf25KDyc08T69FGr5kEkm/WMRbLVWKFLaLNg0aQ2POrhO77XlkW2bafU5kAtDkV+ypEKWf52KQLiKDs07IHZsG8qbEY1KpnopqZ2w7YZAL1sLeftwF2afLq6v/bYbyWPXRAquClyaekP5smrmoj1r4tRj/arQlojZ43QX8GxBkAAzlzdPgH8B9HalylM9clw/jeJrJR9gNHsSLxMVK/7IWM4uyZ6WtfeQhxl35sActGOVzN15yrSYiYyFQOmoR+lGkN+rHgBwMn0H1JFqmq8NwR4Jzn+4zXSD5E2gEh642RpsiZbvzikceMz5xcXd6DVxYDuER5RdLYrIRMzT3KV63IE5CluLVaAJXgXPxVtgre6Qr8PzlY4Vdxvlp7N/SnfGEJCIQSgO3rkz0eKZbAOHXrcqtkCtjtXRf3Yypn+PNzovE7ZP4hl9Xg27MXZXXT3lhpNjVIiyKdWi+4ezxrWty474CVlzrUWNZkYkWT4fZ4o/L95I/L2Sfe8SIfoAEaPf/A61NdHsAjxSFqpv+zSURL9dsXbvCSMaEmFktpwlhWXej3tNexLXn9/hui0mnMFliRyoABPe7XuLGgwWmN/TYr27yFjeveC5JEy5C+wx7ey7NTCGsAzJ7m1xSe7oR3oYb1ZAjDZpgiJwk98PwO9LVTOfT1jiN3Q9wmBuRMcmNr0BSpTsweCzzLUkggQQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4523.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(36756003)(66946007)(66556008)(26005)(66476007)(186003)(6486002)(8936002)(5660300002)(4326008)(31686004)(6666004)(52116002)(53546011)(38100700002)(31696002)(8676002)(86362001)(316002)(16576012)(44832011)(83380400001)(956004)(2906002)(38350700002)(508600001)(54906003)(2616005)(6916009)(7416002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?T0krRFFzeWtrR29WdzZWZDlJYnE5eWkwTzF6M2IyK2t6Z2Jzb2FsTllraFly?= =?utf-8?B?NEZJMzBuMlVobmludEVPVHJVeGg5YUVWaGlIY2tFOW9iSWdZNjlLa01QZ1ly?= =?utf-8?B?THJoODRXNTZlLzBneThZZEFkY0xnMS9mbTBUeVhWVDhub2VOOC9EalFHamFD?= =?utf-8?B?cFdKaVRZSlJqTXR1alpqRmJGS0NMTHA4WkdVRmM2YVFMbUZJTTNXWkI5aG80?= =?utf-8?B?Z3MrTDZyNE1PWUpldWNOblRQZzNUMkVtaEY5dXlUd296VGN5Z3JIM3R0TzE5?= =?utf-8?B?VW83VUE5L29Cdng2bnNFN1lzOG9KYkhYYUozN2VKZmI5dnlpTVhiN2dobXAx?= =?utf-8?B?TlozUUtTdkpJUVk2V2FGNXViOEwvTGVEaWJFcnJzVXg5S2tqM0pQeU9oUmJX?= =?utf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-Exchange-CrossTenant-Network-Message-Id: db46dfdc-b4ac-4993-4691-08d99fa4940e X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4523.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2021 15:05:46.0310 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7XD6OluIhICQdrvab1UxaHuCB0Dx1//v+uoRZLj/RgBYIFMN0Yt867vCX/XauHOGWdGz0oCo1RHYeYPCga2yPA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR03MB6549 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/2/21 7:38 PM, Russell King (Oracle) wrote: > On Tue, Nov 02, 2021 at 03:46:13PM -0400, Sean Anderson wrote: >> I have not found this to be the case. As soon as you need to access >> something using phylink, the emulated registers make the ioctls useless >> (especially because there may be multiple phy-like devices for one >> interface). > > I think you're fundamentally misunderstanding something there. > > If there is a PHY present, phylink presents no different an interface > from phylib - it does no emulation what so ever, and you can access any > address. I use this on Macchiatobin when researching the 88x3310 PHY. I > have a tool that allows me to view part of the register set in any MMD > in almost real-time - and I can access either of the two PHYs on the > xmdio bus from either of their network interfaces. Same for the clause > 22 mdio bus. There is no emulation in this case, and you get full > access to the MDIO/XMDIO bus just like via phylib. There is absolutely > no difference. > > If there is no PHY connected, then phylink will emulate the accesses > in just the same way as the fixed-phy support emulates accesses, and > in a bug-compatible way with fixed-phy. It only emulates for PHY > address 0. As there is no PHY, there is no MII bus known to phylink, > so it there is no MII bus for phylink to pass any non-zero address on > to. > > Split PCS support is relatively new, and this brings with it a whole > host of issues: > > 1) the PCS may not be on a MII bus, and may not even have a PHY-like > set of registers. How do we export that kind of setup through the > MII ioctls? > > 2) when we have a copper SFP plugged in with its own PHY, we export it > through the MII ioctls because phylink now has a PHY (so it falls > in the "PHY present" case above). If we also have a PCS on a MII > bus, we now have two completely different MII buses. Which MII bus > do we export? > > 3) in the non-SFP case, the PHY and PCS may be sitting on different > MII buses. Again, which MII bus do we export? > > The MII ioctls have no way to indicate which MII bus should be > accessed. We can't just look at the address - what if the PHY and PCS > are at the same address but on different buses? > > We may have cases where the PHY and PCS are sitting on the same MII bus > - and in that case, phylink does not restrict whether you can access > the PCS through the MII ioctls. > > Everything other case is "complicated" and unless we can come up with > a sane way to fit everything into two or more buses into these > antequated ioctls that are designed for a single MII bus, it's probably > best not to even bodge something at the phylink level - it probably > makes more sense for the network driver to do it. After all, the > network driver probably has more knowledge about the hardware around it > than phylink does. I am specifically objecting to the statement > The current API is good enough you can use it for debug Because for debugging purposes, the current API is simply inadequate. As you note above, there are many cases where there is no obvious mapping between a single network interface and a single PHY on a single MDIO bus. For this reason, it is necessary to allow userspace access to any address on any MDIO bus for debugging. Even a read-only debugfs interface would be useful, but from what I can tell, such patches have been NAK'd. I find this very frustrating. I have no opinion on the proposed patch above (due to the ioctl interface's more fundamental issues, which you note). You will continue to get patches trying to extend MDIO access until there is better debug access. --Sean