Received: by 2002:ab2:7041:0:b0:1f4:bcc8:f211 with SMTP id x1csp81206lql; Fri, 12 Apr 2024 04:36:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWYHeoVWXH9he4RIdqiMFpOjjEqksUypphZsxmQLrrvU+jpvadP0VbdwNLrHYhlxjo6izp2lYfBrfi7klE0AsiZSBuztXnG/SzOs5Mxog== X-Google-Smtp-Source: AGHT+IFUtw1fkLTQGWDqFGXxeJUhpGWIU04s32MKy/ZKGs2jHQ6Hmi0anfxjpyyRz755eRsc7Xye X-Received: by 2002:a50:d4d8:0:b0:56d:f075:72f6 with SMTP id e24-20020a50d4d8000000b0056df07572f6mr1196998edj.40.1712921760604; Fri, 12 Apr 2024 04:36:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712921760; cv=pass; d=google.com; s=arc-20160816; b=dgrn9Cw63DIomNerq6Q+A9MVUrpnEHRCAsdv0iM2Du4JjqWt2NEE/+KEAzOY7aB9JX 06lW9OnKJrpLVFHEmBijVzYdeYEhIcKsQw/r7BE/NxQUSRbKGgiS/az4CC/32wWWg7gf Al3d2wiKq7QW8HDgu7rGY1hplwiwZcVVsRvZ5NSDa2M7zhyLvmVEGj40QxR8Zf0FpXvl NqfVwoXgM3FcsZasZJmd0fIGj18mrarHWVdV+TFntYrx+HtqRYZpwO+fPSii04riFRgn 18axTuwlqkN5EQqD4/0W/xRyYJDzVYzhKBQ9kRBEEohEqimUudsRWjHTTFYa418NtAGt bjZA== 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=WYB9yyaCzAwqXK/Ahmpy8sL9cF8RGoNGdT7aUNX4d3I=; fh=cammmCXYZZveqb42OewYiYu7Mn839/GHqj6FJ4+5fNw=; b=lp4gttrxxoWdJEWlxRkMoE6mwjlDQ/7rCJOQaxAMnyPaX92/8EofMnHKINiIiJwnT4 XkN6IC91V1EGm0eLSuTJ46N2wRSOmN/jiOjy3fyrMpeWn0S+CBISlKI2AQCVeDgqfgd0 Hf8bLW3gdcCRrGfGkwFWK3ukf8uC9Dl+A9HQu2twGTeocXaGBJMMA0oT2R17NZU1iR1Z j0s09XV8Mf6QEa2rZmCTQQ6JYVYMSMpUsYiVU4B00FQvqrWhNnflTyAioroEP69qbSzi 2gf2CGREzNg1ZhMVf0UNbh+DsZq98b+8vvGq6+imi2Vew+Gxw2Ggfh0oLUbn7IVdOXS0 R1+w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=KdASKxz9; 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-142590-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142590-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id y20-20020a056402271400b0056e5c5c072fsi1696908edd.598.2024.04.12.04.36.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 04:36:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142590-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=KdASKxz9; 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-142590-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142590-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 2D58D1F2421B for ; Fri, 12 Apr 2024 11:36:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3CC4F54FB5; Fri, 12 Apr 2024 11:35:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KdASKxz9" Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (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 07B6456457; Fri, 12 Apr 2024 11:35:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712921730; cv=none; b=aK6BLwxWaaqQAbNWmRy1Nl4qKOqTk2i+6+KgWd3myNiz9MQOXnzyPBYj+QKzn9oOdVnQIWjytJUjcW+dx3P6235Wd1BgSynIR0ZH3cGqXpL+WfgL1gXpFXHH9LWQe2DRXrihHpu73CbvWLx+RNqeEAmJrWCLEJyZ7UMFNYhvQ3I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712921730; c=relaxed/simple; bh=1akF5iagUaB6cD6uyJ9MQX0Y3EivkySknkIgwedFIaY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=r8BPEdvH2DzosClMlWQ0JSTyB4dTnNVAbmYpmNOp3ZBLT3PqlWg68NWP1K54bGuDmeXE2Vl5rPNPKFHv7T8LX6uyY+M+Rvp/R6kwy/04wT1oBwDH0mQUBEMma66VGczAnxFSHvWiy8xdGMwBJlp+Iw40IwY/0wULcZn5CVpklQI= 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=KdASKxz9; arc=none smtp.client-ip=209.85.218.50 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-ej1-f50.google.com with SMTP id a640c23a62f3a-a51d3193e54so89772166b.2; Fri, 12 Apr 2024 04:35:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712921726; x=1713526526; 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=WYB9yyaCzAwqXK/Ahmpy8sL9cF8RGoNGdT7aUNX4d3I=; b=KdASKxz9mJ4Nt5BhenH1mIseVAnZbE5OuUfXcAHXOapFUynBFtMS8TzaUEcqLNxQNE iCBKOdFmqi9oQ33ldJPo3vkL4Kr2EJ4h2osbM4ayCOcIDOqoMrwQYMQ4OTGGuumezJys TP+24ylpep+Y5URM9FBG3hUixPikVv59QT/Dngo9rXAeF7JqLQWD/+AUKu/CKkCYleHC slcJvu+dBF0l2mAMjnDEyO/vYPNJNssi+JmeVBbKQbUWP+WfoMe7dK43ZiXTvP32StrA VfSqbFphM3EXkh4DK3aRKLeDUH2+VgUARdFwjFgRlHdRqxq85FQy7Wg1TDS7PEuXV8fU jnog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712921726; x=1713526526; 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=WYB9yyaCzAwqXK/Ahmpy8sL9cF8RGoNGdT7aUNX4d3I=; b=om6GhreDYL9kY5BcjuGk/usM8laJj6oqLuPgIwZ/GBuL/fEqUo75BDl4L1aZn46KXH PTdzjtseWPVIZgm2gg2rLvwDPEd9GQ7rasIGFZOB0CANqFaPaFJy2Wy8XH5bQtVYVsuO WWXid1gazSrQwn6g2lyDTbsdLAMG58l9NANpw1AgfDOaOXel3PZujUJ/KTroF4mJujcX ud3hgoq8TqV5acul+py67Jzonko3YwkdtU5yEhxLhz6p7JBAsq094Ss3meILnvqOc+/B d8rJWaNBvIT7nP1JNmXNUZoYuDIOSIMsWgteHKcP4bPKEw72yWp1C63dsfQ2AqONpWZH 86iA== X-Forwarded-Encrypted: i=1; AJvYcCVSa0VtQx8XjhAOaFwNE4SMvoZQ4CK+D7ZwfUaaZw00znxO9z2QgNOddFEdnUkiZ4sRzP8k8fA+hyWDIC6VaM6LHKH08DZxcNQqgnFu X-Gm-Message-State: AOJu0Yz/xWoIeQmsG65A3YG2F4mFT/QqLbO/mcuQXg9I3WdPB6eGqSGA If/8K34159cf2Yg/T0xswYnmfwHK5dtZd0tgNwsgViSadK1YPrZ9 X-Received: by 2002:a17:906:ef0c:b0:a51:d80c:157d with SMTP id f12-20020a170906ef0c00b00a51d80c157dmr1878318ejs.26.1712921725945; Fri, 12 Apr 2024 04:35:25 -0700 (PDT) Received: from ?IPV6:2a01:c22:7a91:3c00:4937:6ff3:a774:89f7? (dynamic-2a01-0c22-7a91-3c00-4937-6ff3-a774-89f7.c22.pool.telefonica.de. [2a01:c22:7a91:3c00:4937:6ff3:a774:89f7]) by smtp.googlemail.com with ESMTPSA id do21-20020a170906c11500b00a46baba1a0asm1708212ejc.100.2024.04.12.04.35.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 12 Apr 2024 04:35:25 -0700 (PDT) Message-ID: <503a066b-e2be-48ad-91d5-15ea9fd5bb62@gmail.com> Date: Fri, 12 Apr 2024 13:35:25 +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 , davem@davemloft.net Cc: 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 References: <20240412104615.3779632-1-maxime.chevallier@bootlin.com> 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/F7CjlbWXiOlKHA25mPTmbVp7VlFsvsmMokr/imQr+0nXtmvYVaKEUwY2g 86IU6RAOuA8E0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vo1wGK4eYxp6pwMPJXLMsI0ii/2k3YPEJPv+yJf90MbYyQSbkTwZhrsokjQEaIfjrIk3 rQRjTve/J62WIO28IbY/mENuGgWehRlTAbhC4BLTZ5uYS0YMQCR7v9UGMWdNWXFyrOB6PjSu Trn9MsPoUc8qI72mVpxEXQDLlrd2ijEWm7Nrf52YMD7hL6rXXuis7R6zY8WnnBhW0uCfhajx q+KuARXC0sDLztcjaS3ayXonpoCPZep2Bd5xqE4Ln8/COCslP7E92W1uf1EcdXXIrx1acg21 H/0Z53okMykVs3a8tECPHIxnre2UxKdTbCEkjkR4V6JyplTS47oWMw3zyI7zkaadfzVFBxk2 lo/Tny+FX1Azea3Ce7oOnRUEZtWSsUidtIjmL8YUQFZYm+JUIgfRmSpMFq8JP4VH43GXpB/S OCrl+/xujzvoUBFV/cHKjEQYBxo+MaiQa1U54ykM2W4DnHb1UiEf5xDkFd4= In-Reply-To: <20240412104615.3779632-1-maxime.chevallier@bootlin.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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. > > 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. > Not on every system the topology extension is needed, it may just create overhead on such systems. Would it make sense to hide it behind a config symbol? > 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; > + This one I added as temporary workaround already, it fixes the issue for me. > 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;