Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp538378lqa; Sat, 27 Apr 2024 12:34:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUDp6rtsL3IU1BRMG54dYFV/Pr6Hz8lZOXsnMH6FKeV4Jasj5Mw78URZJnUsgNrVBj1VWzXEB64MVegziejNgeLvou6xyE/uOIzYMmzbQ== X-Google-Smtp-Source: AGHT+IEVbwzFSSgbFEKGCcrr2wUWLT3abn14FUFB7IPYVOEoPHU1s3LVGqZVrk6mwt6fdxdOkFz0 X-Received: by 2002:a17:90a:7895:b0:2ae:6dc5:bfa5 with SMTP id x21-20020a17090a789500b002ae6dc5bfa5mr6260218pjk.8.1714246497367; Sat, 27 Apr 2024 12:34:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714246497; cv=pass; d=google.com; s=arc-20160816; b=YWxvwDFVsr/hw+semJIcHogxVT7VzZ2BQMQDo7WTEZUmQWYeeyBBSQ/5mOQq0nhOEl nNJTFeuvbvq/RWZTE1cvwyc7bx/One8xtqeL9uk4S5JYOZ1OTSTLMv8eM/KG/iABO3Ct hlTE4LMIXAcOnCdQz0ta0RHuTngeGjWtsQokbzC0HaS/kTNd7NcH/HgAoKV/IxBgZFlJ OZd0tKSiHuwKQL/V6M5iRwwgQEbSeJvkJTGq1DGHeHKjPCwXZTq67Rsrrde0ZeNOUkaa lYDKm4ZKIVVowjMw8intK0iz5dbtZNZYyWVQmeOh0zbc8gt21lgyb+d4DuJWm6zCVWBE pSJA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=MID+B2Bh0mPzhxqGE2XrI56q0o17m4WOrXDwuiavZWE=; fh=26OGDRFEzhn0LphQZ9iOJfgSTk9CUa33CxWNgtl+7Gk=; b=f42TJqhZiiLbaasgggRkT6cVA7I2n3d840Vmn/ka3uSUzkK3aYSKain0Cc93JASmy8 k/chK+5yI8Fs7XiCTHAjI3NOhRyToV2QAyj9aTFNNYrYHMmdVrnkTcIMprtTSam+TSwx Ej8WcyPGl5fE7exOvx+wajwbSqYG1vCdEgAE7MbLo8Auc0P3EVkfQzzGZl9sxTCZ4U5P WlalXJWl53QG8JT4bym6984WsNPyw9TkhexWOfE9/6Q47lP3HevoNYpYzrz/mVI1hlD2 edxlp43S9K2zRb8bpCs2r+wLx1YyPY40cIxximR6frUaYaiOLWoy1fCuWJBxBExwRwDk ErJA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="ZNwz/ZXV"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-161143-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161143-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id w8-20020a17090a1b8800b002a2a0367a89si18657688pjc.153.2024.04.27.12.34.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Apr 2024 12:34:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-161143-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="ZNwz/ZXV"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-161143-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161143-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id B1AC5B21A27 for ; Sat, 27 Apr 2024 19:34:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B4D261442F4; Sat, 27 Apr 2024 19:34:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZNwz/ZXV" Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1DE628F4; Sat, 27 Apr 2024 19:34:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714246466; cv=none; b=rhwpfhrAs2JpLxGbpFHfd1iSbcOsLRZcK4LKL1MB6u7GQEmbyH/mH3y4j9zjI3fLcwcGql0l5OO8e+nqIePnVW6bgcFmzfYIa8NKvhmhb3CVyuy0SudCrY8AYzHjCs+GyeQeokpOVakmi3T41DI2inTf+psiTtXZWpeNn+3OlUA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714246466; c=relaxed/simple; bh=q7rRxyGXdb9iLbeWC1LXBPTVWiaUAcj+jB9vx6mFOJM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=YeqS3gZGG2NJ/yC3FKZ6hNDVgn0ASNBTH8OCMAN1ywYKFfEEcEvSsLOyyppreJsFgd3vKJDwBNbnlJVidvDtxW0wGH1y9UzpMRCuXrd4OmZC26SVi7Ps392V+LcSKtY201QWuBE0vdS53c6GOaCdAlkDi4kbOWenGjDQCg9gC0I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZNwz/ZXV; arc=none smtp.client-ip=209.85.208.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-57232e47a81so5371151a12.0; Sat, 27 Apr 2024 12:34:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714246463; x=1714851263; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=MID+B2Bh0mPzhxqGE2XrI56q0o17m4WOrXDwuiavZWE=; b=ZNwz/ZXV11OIsgsRnXTk3Dbcgz/BULBKTchEiUbi77dWHdEgOiEK5IG6uGNBwi1+mO 3d1tjmdX4GNRwNSeHl4cu9G1T8WYs6G7tN78xe5VtVIdDJLEsO3kI9XqgMeJ6eQpKqtz Lcmhjn5tmWRLn+o5KNWLTZpnNRCmczYXvw7siAL4s9GdBXCMUh9ToQ3Hhtd8RZu033UY lCEzX4/rRnZ1sQ9th2aZG52imF8WgazyWbsCUxMfLM0UnxKVssw4qwbs7Zvh8J7E5LXJ VbcyRE/VJjEg+J6Pfh2oIdp3LlkvXKe8khsGZ1K/RbELhnM+4FDT3A3MuTLhRYkGYkq/ 0ZSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714246463; x=1714851263; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=MID+B2Bh0mPzhxqGE2XrI56q0o17m4WOrXDwuiavZWE=; b=swKru1WYoyocW8as84YOp4+fOtpnbAPQBGS27m5MHJRDQu67aWBZnsCfXZF+8GbE49 4jpK0A9mwg/x5pqcMUhrIadq6DYIpchenIaSVHRi0K4gWs9xoXDU2G0zCxZwvBL94jFW WUyeBWXZ5m2HdNbVqQdP6TZUJG0ilR8XBuxBieAavd+eG/yUjCcAEoDYItLAKQBuwmuq yoOcnqLi4F3ugZEscUc+wXtrGgkYsG+qQSEB2ol2kjqTowG8l64nylbIw3YrmRc06nhP nq/OhfwBej9Xm0kmvfHtQCP0dI+B9RdEqgFAjI3Ax+Hc6JhazIa+aUG/FXlYZbf24e8C xiTg== X-Forwarded-Encrypted: i=1; AJvYcCUPhCqMQzIKN0hp6HypdO9+gSHTJc1Eg5s+VWeTLvygXsTQkF1CVFLwpWNm02zrl9eo7evAB1qs9L31trqugUfdNpdS0JBOAQyEImqpjyuokFMtL/yimqqPaWkotFQ8UDkdgdO+ X-Gm-Message-State: AOJu0Ywi+iQ+RkVx20VtVFLcwg2NVc/FTkpl67xvWdTwLWpyExTvav0k QunGeV/sRsLqSYbZfr/PpXUpDXYY43d/1DcJNoKS2VAoyYGNwlWm X-Received: by 2002:a50:f614:0:b0:572:3f71:161f with SMTP id c20-20020a50f614000000b005723f71161fmr2906356edn.12.1714246462776; Sat, 27 Apr 2024 12:34:22 -0700 (PDT) Received: from ?IPV6:2a01:c23:c403:ad00:c9fe:f0c4:b80:4a0a? (dynamic-2a01-0c23-c403-ad00-c9fe-f0c4-0b80-4a0a.c23.pool.telefonica.de. [2a01:c23:c403:ad00:c9fe:f0c4:b80:4a0a]) by smtp.googlemail.com with ESMTPSA id l11-20020a50cbcb000000b0057030326144sm11310255edi.47.2024.04.27.12.34.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 27 Apr 2024 12:34:22 -0700 (PDT) Message-ID: Date: Sat, 27 Apr 2024 21:34:21 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next] net: phy: phy_link_topology: Handle NULL topologies To: Maxime Chevallier Cc: davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Paolo Abeni , Russell King , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Herve Codina , Florian Fainelli , Vladimir Oltean , =?UTF-8?Q?K=C3=B6ry_Maincent?= , Jesse Brandeburg , =?UTF-8?Q?Marek_Beh=C3=BAn?= , Piergiorgio Beruto , Oleksij Rempel , =?UTF-8?Q?Nicol=C3=B2_Veronese?= , Simon Horman , mwojtas@chromium.org, Nathan Chancellor , Antoine Tenart References: <20240412104615.3779632-1-maxime.chevallier@bootlin.com> <20240412152335.751a8dbb@device-28.home> Content-Language: en-US From: Heiner Kallweit Autocrypt: addr=hkallweit1@gmail.com; keydata= xsFNBF/0ZFUBEAC0eZyktSE7ZNO1SFXL6cQ4i4g6Ah3mOUIXSB4pCY5kQ6OLKHh0FlOD5/5/ sY7IoIouzOjyFdFPnz4Bl3927ClT567hUJJ+SNaFEiJ9vadI6vZm2gcY4ExdIevYHWe1msJF MVE4yNwdS+UsPeCF/6CQQTzHc+n7DomE7fjJD5J1hOJjqz2XWe71fTvYXzxCFLwXXbBiqDC9 dNqOe5odPsa4TsWZ09T33g5n2nzTJs4Zw8fCy8rLqix/raVsqr8fw5qM66MVtdmEljFaJ9N8 /W56qGCp+H8Igk/F7CjlbWXiOlKHA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uHBceY7Gc6zPZPWgXghEyQMTH2UhLgeam8yglyO+A6RXCh+s6ak Wje7Vo1wGK4eYxp6pwMPJXLMsI0ii/2k3YPEJPv+yJf90MbYyQSbkTwZhrsokjQEaIfjrIk3 rQRjTve/J62WIO28IbY/mENuGgWehRlTAbhC4BLTZ5uYS0YMQCR7v9UGMWdNWXFyrOB6PjSu Trn9MsPoUc8qI72mVpxEXQDLlrd2ijEWm7Nrf52YMD7hL6rXXuis7R6zY8WnnBhW0uCfhajx q+KuARXC0sDLztcjaS3ayXonpoCPZep2Bd5xqE4Ln8/COCslP7E92W1uf1EcdXXIrx1acg21 H/0Z53okMykVs3a8tECPHIxnre2UxKdTbCEkjkR4V6JyplTS47oWMw3zyI7zkaadfzVFBxk2 lo/Tny+FX1Azea3Ce7oOnRUEZtWSsUidtIjmL8YUQFZYm+JUIgfRmSpMFq8JP4VH43GXpB/S OCrl+/xujzvoUBFV/cHKjEQYBxo+MaiQa1U54ykM2W4DnHb1UiEf5xDkFd4= In-Reply-To: <20240412152335.751a8dbb@device-28.home> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 12.04.2024 15:23, Maxime Chevallier wrote: > Hello Heiner, > > On Fri, 12 Apr 2024 15:07:46 +0200 > Heiner Kallweit wrote: > >> On 12.04.2024 12:46, Maxime Chevallier wrote: >>> In situations where phylib is a module, the topology can be NULL as it's >>> not initialized at netdev creation. >>> >> >> What we see here is a bigger drawback of IS_REACHABLE(). For phylib it's >> false from net core, but true from r8169 driver. So topo_create is a stub, >> but topo_add is not. IS_REACHABLE() hides dependencies. >> >> topo_create et al don't really use something from phylib. >> Therefore, could/should it be moved to net core? > > That's a valid point, and a better solution indeed. > >> At least for topo_create this would resolve the dependency. >> >> We could also add a config symbol and the PHY topology an optional >> extension of net core. > > That could be a thing indeed. It could be selected by phylib then, I > don't see it being a user-controlled option, as this would make it very > confusing for users to only be able to see when there are mutiple PHYs > on the link when the relevant option is enabled (but I might be wrong). > AFAIK the issue still exists on net-next. Are you going to submit an updated version? > Maxime > >> >>> Allow passing a NULL topology pointer to phy_link_topo helpers. >>> >>> Signed-off-by: Maxime Chevallier >>> Closes: https://lore.kernel.org/netdev/2e11b89d-100f-49e7-9c9a-834cc0b82f97@gmail.com/ >>> Closes: https://lore.kernel.org/netdev/20240409201553.GA4124869@dev-arch.thelio-3990X/ >>> --- >>> >>> Hi, >>> >>> This patch fixes a commit that is in net-next, hence the net-next tag and the >>> lack of "Fixes" tag. >>> >>> Nathan, Heiner, can you confirm this solves what you're seeing ? >>> >>> I think we can improve on this solution by moving the topology init at >>> the first PHY insertion and clearing it at netdev destruction. >>> >>> Maxime >>> >>> drivers/net/phy/phy_link_topology.c | 10 +++++++++- >>> include/linux/phy_link_topology.h | 7 ++++++- >>> 2 files changed, 15 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/net/phy/phy_link_topology.c b/drivers/net/phy/phy_link_topology.c >>> index 985941c5c558..0f3973f07fac 100644 >>> --- a/drivers/net/phy/phy_link_topology.c >>> +++ b/drivers/net/phy/phy_link_topology.c >>> @@ -42,6 +42,9 @@ int phy_link_topo_add_phy(struct phy_link_topology *topo, >>> struct phy_device_node *pdn; >>> int ret; >>> >>> + if (!topo) >>> + return 0; >>> + >>> pdn = kzalloc(sizeof(*pdn), GFP_KERNEL); >>> if (!pdn) >>> return -ENOMEM; >>> @@ -93,7 +96,12 @@ EXPORT_SYMBOL_GPL(phy_link_topo_add_phy); >>> void phy_link_topo_del_phy(struct phy_link_topology *topo, >>> struct phy_device *phy) >>> { >>> - struct phy_device_node *pdn = xa_erase(&topo->phys, phy->phyindex); >>> + struct phy_device_node *pdn; >>> + >>> + if (!topo) >>> + return; >>> + >>> + pdn = xa_erase(&topo->phys, phy->phyindex); >>> >>> /* We delete the PHY from the topology, however we don't re-set the >>> * phy->phyindex field. If the PHY isn't gone, we can re-assign it the >>> diff --git a/include/linux/phy_link_topology.h b/include/linux/phy_link_topology.h >>> index 6b79feb607e7..21ca78127d0f 100644 >>> --- a/include/linux/phy_link_topology.h >>> +++ b/include/linux/phy_link_topology.h >>> @@ -40,7 +40,12 @@ struct phy_link_topology { >>> static inline struct phy_device * >>> phy_link_topo_get_phy(struct phy_link_topology *topo, u32 phyindex) >>> { >>> - struct phy_device_node *pdn = xa_load(&topo->phys, phyindex); >>> + struct phy_device_node *pdn; >>> + >>> + if (!topo) >>> + return NULL; >>> + >>> + pdn = xa_load(&topo->phys, phyindex); >>> >>> if (pdn) >>> return pdn->phy; >> >