Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1056324iob; Fri, 13 May 2022 21:23:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRhFG9xyH0VbKQUMuMKRxWZLZCIvkByKeM4xWGe3x10htfPYfOdAztJhFkZYVlUCUcMifH X-Received: by 2002:a1c:f018:0:b0:37b:c13c:3128 with SMTP id a24-20020a1cf018000000b0037bc13c3128mr17479993wmb.157.1652502206912; Fri, 13 May 2022 21:23:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1652502206; cv=pass; d=google.com; s=arc-20160816; b=I03ZWJ75LYcLvQtnpXcgF+LHgKhdlCArxs6aMraUnXwvq5349aswpLzjS9hJSScgy1 dP0A/5oupN1EK03+7XTt+bSbGdcGwT7H91IjZnB1a9OJxQ0Z/Z49WqYVw8ligtDnZfKE +doKsYUxQYXsj8aDNzC0apgn3rHaxx0U9lo6pX/+LgiCY0EVadG2y3zEdc4NBquWULi9 fj7QRuu10/6FhvMGv74lImnsm4NEOD7LhzFxHzdpmOn6WmI9Ta84R1B1EFcZdpgBX9ew RMlZzDncNVY7o0eP89vvSN5UtI6G1xrsZJxmZL492L/sgyk3yUaI6n7tY6M6vY1/EtLE bkCQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=bXOPANpBNjnOyKkHgo456XUMdbWCu+obzivZ6tLsZpE=; b=I0V7WfWc8sfPffkvl0qKRLZjwJ3WmYih8l1Ad8ay/g1pre2r6Lb4UnDMTGLDnjyeFO 6mjMOr1UI9zx4WP6eCANFZSFFyWWGgOGB/KyV0PGidqvH0FU4s3c38B47qWZfBIHjtMu Lsg/wxKxYoXqAngjVVMWj5mtyfd4CBMdM1HvUk1EQU5PGF+6F6TlyBjSxyT9/GiDmeVq 4KjbRu8QI9i+9d9Wf8qKrPme3Ki9kQjbl1/8uz3xfRyfp0q1OSnKD/3n16Uzd0TpIoH1 wt9pctSIbi4iQSup7cOtvLATKQQXEPQy0UFQwR/TOqPT/NdOGEeV4g2oWGREKQBW6c2f yOsA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=J9vDTe6b; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id h5-20020a05600c414500b00391983fce87si3857284wmm.68.2022.05.13.21.23.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 21:23:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=J9vDTe6b; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8D37734E1CE; Fri, 13 May 2022 17:53:24 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229741AbiEMXrR (ORCPT + 99 others); Fri, 13 May 2022 19:47:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229478AbiEMXrO (ORCPT ); Fri, 13 May 2022 19:47:14 -0400 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50079.outbound.protection.outlook.com [40.107.5.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4434C3731B1; Fri, 13 May 2022 16:36:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ArgbjvX3nSbul8QEk75iI4Ef4eGSUmIii3CiLqE6c2RtbFyOwRUkdya3sbLHnEgjLkBECSDT/VVlGRkcOhd1NSjy8khW+DpmhAjA0bSbpPG3/TKkXqPjYTO5NC0YdZsobCzA3LnRZpAlsB30hk4UbtbpeTW4dhQwGRPz9Msoo8o00cb/sn/GmsaUuutjiPeY+ddBjoQ75/Ho1ve+pbCWBSz5o2I7HgxWYwnFnmIbacCvod558ll7ZAec0yTDeyCBEujLPOF+0nI3ykbRqoU9n08E0uro4T/3HDrELi4bDv/n/WP74vqI3oEioPsMRUzzswgc/XBySKFEUP5You6Mdg== 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=bXOPANpBNjnOyKkHgo456XUMdbWCu+obzivZ6tLsZpE=; b=kSZ3LyZSPcsRW32MLU6VPGPzQIjWRtMzN2p6rhKRuCMfJg+lnDy+ddsgSBDQNCBihDraEUAVUpW33C31s94s+IO1Yj0GH+YesbexQhdT+T68QqfazABBKjvRPAt6Q7bC4twqXTXZdmRkq9TV4ruMbGkm6URq1Js8lzYBFY8Nu4qdhn9ss9/ypKNNQAC6X/Md0X+tf5f2e2P4DlyxpSiijsqSbYOauITbUfh8/m5sima5g+remqnOE6v70zGEiTDi+/iOPKuBGl5o7lEWxoCQoEzY3oNRgfDPugEkw2QL2niWmBDz2T1lXKV3Mnp7KjMPF/HrKmgxWzRTGmu07AB4ng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bXOPANpBNjnOyKkHgo456XUMdbWCu+obzivZ6tLsZpE=; b=J9vDTe6b6Q2JXX9oyOyWtzUuc42BNT8rjXEbxeoA/WjXp0OW4V+bCc2DAP6SNzQWo5uhhj/DIx/96vviLS7JwUhIiEdblsFWnu2CyxSrpDKr30zIrKZQxbIe2BevqTnJ9CM/UdccgalPxq1MPkhtPASHzoLcvTGYPvMow1xzfhw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by DB7PR04MB4972.eurprd04.prod.outlook.com (2603:10a6:10:1c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.17; Fri, 13 May 2022 23:36:55 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::fd1f:cc16:dafe:4bf5]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::fd1f:cc16:dafe:4bf5%5]) with mapi id 15.20.5250.014; Fri, 13 May 2022 23:36:55 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Jakub Kicinski , "David S. Miller" , Paolo Abeni , Eric Dumazet , Florian Fainelli , Vivien Didelot , Andrew Lunn , Vladimir Oltean , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Saravana Kannan , Greg Kroah-Hartman , "Rafael J. Wysocki" , Robin Murphy , Geert Uytterhoeven , Rob Herring , Frank Rowand , John Stultz , =?UTF-8?q?Alvin=20=C5=A0ipraga?= , Russell King , Heiner Kallweit Subject: [RFC PATCH net 0/2] Make phylink and DSA wait for PHY driver that defers probe Date: Sat, 14 May 2022 02:36:38 +0300 Message-Id: <20220513233640.2518337-1-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: AM6PR08CA0027.eurprd08.prod.outlook.com (2603:10a6:20b:c0::15) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b9c15b0f-0c3b-4304-5102-08da3539768f X-MS-TrafficTypeDiagnostic: DB7PR04MB4972:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PqoGby/kig92F9Y8xCQmzBi/VWXaA96EhSFzYUYfvy7hguUHqP6y7FdrUNP1BPvWoYFIUy3Xjcms2iUwDpQDtAjc/4u3RiEK40rzj4AQtBVwUIyXDxUk/2b9rgWHT9veLnEyH3r4yw6R116T5Ct6ZKOvwDryj6/27QtcBeHh0F+TDNpNQTmJ14Cxg0oZmo6vGtxgg+WenIMvuuFJ/BnYPE8Qk+oRHCgrRNMccvak2MXUJ0f6+kRLMXMo/UCyAT+NsKJmaS4YlLv3bUEhfEOw/IUSwV/u5zON2vmNl82hXRd5rY4mijfRnP8p5l+svmB87k+VT0UTYQCX2uul8FxnFTed7b7uDMnW7A3QN7ZCj7qf+55Oo6PJoYxeMWeSaZNK5fSWsjWdxp3Ku0i2xzAaB5lBuv/H4L+HwI+LHDhtpJfD4PY5K76O/jGcHL/P4XLwjkao3flZGKpNnOjAcg17FO7FKv63pbpWTzR9U3M45SfosA1qd2EoXfWvV4w6gokwo9lpyuyyzLJzm98YbaKakJFSJgk8q4PuDl2GtJDQZf0yhhbyy5h9IsUXRiZz/oNd/U4kkl6kaM1Ydl/o2QQp95n7JNcS0eLWbVWnGTbGj5wJX2n5Z54+Q1MObEApPlcqVejdUgZ7OGDvzVF9+/hp66a8qj0XRQdB6yCWvD0eLaHmHXSq2HrMrLiJ9j2EMlDAtXhpqAhwTgSevcdLgNepHiw+znpAlQezSdprGoQxwgTE1A8NKyHxGdzs+XvHXVLrcpkFObT2EDusGQeuVBGRKGOIvyl7NVnCqqqxa0z9tb8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(66476007)(508600001)(38100700002)(38350700002)(6486002)(66556008)(8676002)(66946007)(966005)(4326008)(6916009)(83380400001)(54906003)(86362001)(186003)(316002)(1076003)(2616005)(6666004)(6506007)(52116002)(26005)(6512007)(36756003)(2906002)(5660300002)(7416002)(44832011)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?uQ2ikYvS1QXgyCrX1eFXNjiT+yXArbqodxvdOnqtT08gvMj9Acgd+YXs6MTj?= =?us-ascii?Q?GUShpurP2AdR+paoaOR6C6VkZG/NdfDbHN3n4KqXBz4l455mLkVPIsGqRMTM?= =?us-ascii?Q?MVHEVutt1uLxBejTUKRDGNWtuMma3PD4tnrqQdMDJEMVs3BWTETfskv2STCs?= =?us-ascii?Q?FQCTQwtFK4CIE7HMF8Qi9PwTaHx3m/Pm9RRjOwAZsOQ7aY1bZKegG+9JlmhE?= =?us-ascii?Q?MG9RHcl6LcWpkgAfIsxW/mqW18d7z2kEvypczkmsnVOwNeF92VFh9fv8xBe1?= =?us-ascii?Q?dREVv56Oc8b3Q4ZNsGIISXx20F2PQYr0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DJRJTC6hGFwtq25xgbeihodO6IMMrO7hWUncQo5J23rUc7prADKlrtL5?= =?us-ascii?Q?SIdJYvDkQr/sYf/tu9OARljnkCeezLJCIbMKqJrjKtWYNWQ/ISd0QLGPdtQX?= =?us-ascii?Q?iGOM7u2ho5WdiwsaVLa1X3VEm0e7v6yFH4OGiJhIrym9IX4BFM2IuUv1RNIw?= =?us-ascii?Q?N4tOQcJp1r0Ap2FFi7MG87OSjFRUgLASWKx7XXHs3vmfbpTtIq++GD/wAKVG?= =?us-ascii?Q?JAwdxpDGReHG3+GpiTDlFM5JuQTy9cIJ6o0YxHaZUjSf9GCQ6YJm2QQCNI9y?= =?us-ascii?Q?77YAJ1ZZC0qp6Hg49Dsww42cp9B9RhqFxcP2sFf8c3VidXptoGHEOFROqF4O?= =?us-ascii?Q?jmr1xsbYPBPdIKvRdxXT90q6N5HzY/Mzauo5oBB0dOE8ek5yF92hD4BFptiV?= =?us-ascii?Q?gBUV2geLvYX9ItqvnTt/dxAEPZYZkv/KA31i1HMMPtzNzxShVMweBwiWaphp?= =?us-ascii?Q?BUVHjdzYroKyvKUzDpA97/mbXJRkxjnIiyW1yNr1N78TprmxDUKuPFAKKGJf?= =?us-ascii?Q?uYUws7HFSeE6RjqaIRqE4jWgB3UQFdk=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b9c15b0f-0c3b-4304-5102-08da3539768f X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 May 2022 23:36:55.1732 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: RrantO96apQNRRZmV2Uw3LovxiHXDokjmEpNMOoQfAds/Xrm9/sGFTaVvSWg0NvtNh0C3lb47NSTLeZ/+n8c6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4972 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch set completes the picture described by '[RFC,devicetree] of: property: mark "interrupts" as optional for fw_devlink' https://patchwork.kernel.org/project/netdevbpf/patch/20220513201243.2381133-1-vladimir.oltean@nxp.com/ I've CCed non-networking maintainers just in case they want to gain a better understanding. If not, apologies and please ignore the rest. My use case is to migrate a PHY driver from poll mode to interrupt mode without breaking compatibility between new device trees and old kernels which did not have a driver for that IRQ parent, and therefore (for things to work) did not even have that interrupt listed in the "vintage correct" DT blobs. Note that current kernels as of today are also "old kernels" in this description. Creating some degree of compatibility has multiple components. 1. A PHY driver must eventually give up waiting for an IRQ provider, since the dependency is optional and it can fall back to poll mode. This is currently supported thanks to commit 74befa447e68 ("net: mdio: don't defer probe forever if PHY IRQ provider is missing"). 2. Before it finally gives up, the PHY driver has a transient phase of returning -EPROBE_DEFER. That transient phase causes some breakage which is handled by this patch set, details below. 3. PHY device probing and Ethernet controller finding it and connecting to it are async events. When both happen during probing, the problem is that finding the PHY fails if the PHY defers probe, which results in a missing PHY rather than waiting for it. Unfortunately there is no universal way to address this problem, because the majority of Ethernet drivers do not connect to the PHY during probe. So the problem is fixed only for the driver that is of interest to me in this context, DSA, and with special API exported by phylink specifically for this purpose, to limit the impact on other drivers. Note that drivers that connect to the PHY at ndo_open are superficially "fixed" by the patch at step 1 alone, and therefore don't need the mechanism introduced in phylink here. This is because of the larger span of time between PHY probe and opening the network interface (typically initiated by user space). But this is the catch, nfsroot and other in-kernel networking users can also open the net device, and this will still expose the EPROBE_DEFER as a hard error for this second kind of drivers. I don't know how to fix that. From this POV, it's better to do what DSA does (connect to the PHY on probe). Vladimir Oltean (2): net: phylink: allow PHY driver to defer probe when connecting via OF node net: dsa: wait for PHY to defer probe drivers/net/phy/phylink.c | 73 ++++++++++++++++++++++++++++++--------- include/linux/phylink.h | 2 ++ net/dsa/dsa2.c | 2 ++ net/dsa/port.c | 6 ++-- net/dsa/slave.c | 10 +++--- 5 files changed, 70 insertions(+), 23 deletions(-) -- 2.25.1