Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp517805lqs; Thu, 13 Jun 2024 18:26:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU01+GDM8WKao35YsaEbuw4d+vlVt2KZiSZwBnnGreFrw6m+cHycl6oZQ/kk8miQJ8GEFmhVZjm8E/ewqrhbnc/keJ6bn8qtEwiPA60mQ== X-Google-Smtp-Source: AGHT+IGaJg1wHYDKKj4YBneQzWKkQOMD9oXOHInIo4teXRCxtWkOtaprHwvvvKeEQpcqPX4R+Jqu X-Received: by 2002:a17:906:7c9:b0:a68:a800:5f7e with SMTP id a640c23a62f3a-a6f60cefe50mr86749966b.10.1718328387068; Thu, 13 Jun 2024 18:26:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718328387; cv=pass; d=google.com; s=arc-20160816; b=CJ4A9EJqH8VFCiLa/1qx5+f/fENkJh3123HctAWCFDr76crDoG2Ww6RJrKFSPsC5jB E4XNVD80y4HxpKLmNAH5Apu/tOulVJOcORwRAW1KwVuL273oNRB4ZsWDIRIC7G7qLEoH d8MIvC1NNp/yLYkh92fIjkaheXL2PdCLnmONnym54cGd3R5LrUlGtLSxQKgQWKFbmJUb 5OUTD/+oUka++LXdYplgAzmZk0/OKvopLx1hGA96+Z+U7QlPFZJrBZpkDEeVnD4HJSAB aqN+iNYmpYvk1qaeFvsfuGq9EqgmA80dC2MwO8T0xZePHXlDhHXc+/LyFElkfrARV0Yg l6ig== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=88dKCpZy3JYAEMg5JQvnT6/IrmllsAbq8TRuMF6c/MU=; fh=6qDCUBeIV0fcb2uHEPZQSYe1u17wWht3pNX+p92lUNY=; b=SVxCGQy76V78V9ztRjuIzEWFFR5kugNZM1SBLdF0GsIuM1BeoteIyUxOC6p3mJUBQu 619eu6YUSbeqgKca6jWb2AgTj6UgCrsf5+fZiefKd79uHvXSTStWisbH83vrJCce8TkK yknqGfwRPVdNbFp8UOXilCj5WB8eD3C/HVvqdlPlUr+OPOv4clg7uIOoTGLCG0hB23tr tamg4Z9PYbCkJ6bqvngpRkmTA3hi7Czo2Lt+gRPjtOeC2hBwoJ9dMT7rMSl96SYHqDMo ZFZWn4YIhIyyANY7Klv/Vjc3/NVUBoOWq4ImYbpvuCivrzHB1Vywg5897pQy3fGf1pXj q9UQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="p5yRX/sg"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-214180-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214180-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f56d43d76si118261866b.215.2024.06.13.18.26.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 18:26:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-214180-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="p5yRX/sg"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-214180-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214180-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 C412F1F22E88 for ; Fri, 14 Jun 2024 01:26:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2ACAE1822E4; Fri, 14 Jun 2024 01:26:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="p5yRX/sg" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4EB4B3211; Fri, 14 Jun 2024 01:26:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718328376; cv=none; b=ULJYDw/9fxMVlwX1kRpH2WMEqRxXDF668ZeDbHQo5wq0/gw2D+6fAvsNltOSQg/B+UeHbp/LNKeE1+L7FB6bVx16Ge50dfUtvNqwuei+i6Sf4+rrV9krOZ3azJOIiETgw3qrDA8atacHR0tQHYnfq+xcRIhFwgx9eTjNavjMs2k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718328376; c=relaxed/simple; bh=kLV3z/ZGpX0PFgVq4+W+L1l79K/SNekMA3Nls7V9LDI=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uO49PQk69ojhrcqDwx2sKe+OjnJv1L/xTGFOzNp40rYy7ytP/5dqyhR/o221AqZ8vXxBpmKA07jJOXqe6NM2UGtAiUhPj+JXmgwIlBh/2fmfgqwbu6qy5a6LVHpAGRH9MUQH5FHhkmaceZ326h+RiuMG9ZNMS6QY2WnjfJwKCCw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=p5yRX/sg; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA883C2BBFC; Fri, 14 Jun 2024 01:26:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718328375; bh=kLV3z/ZGpX0PFgVq4+W+L1l79K/SNekMA3Nls7V9LDI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=p5yRX/sgFHhSCyE1qpFsoNIBt6Y2UZ6rkbsoHegv2vTVfzQ55eJys+UTgCg6D/l7M qxA6M4OM2bP4dPGmlTaSlSNQjHisl3Hq/uXybTsbLT6lchJxJlmVqUG3lNChcddAku kD+1/v56gaENCnMg3QzlfBgjd5EAmb+WWrms4Nbl2XnlK4xyBVfizfeD1zA+lpUIaN gLT1wkY3WkXsSS7NHdNvbwxrA8Tc2ga+sTxyeCFogKX7R5GgEmCGHXzwXAdwYdnzgT jz7IYVTSxuMSb5qJApf88t5mUAShqacevfS4YPuoHNfBYZjiOEtEqBAr0Gday3MrMP SnFGAiAt4d7og== Date: Thu, 13 Jun 2024 18:26:13 -0700 From: Jakub Kicinski To: Maxime Chevallier Cc: davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn , Eric Dumazet , Paolo Abeni , Russell King , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Herve Codina , Florian Fainelli , Heiner Kallweit , Vladimir Oltean , =?UTF-8?B?S8O2cnk=?= Maincent , Jesse Brandeburg , Marek =?UTF-8?B?QmVow7pu?= , Piergiorgio Beruto , Oleksij Rempel , =?UTF-8?B?Tmljb2zDsg==?= Veronese , Simon Horman , mwojtas@chromium.org, Nathan Chancellor , Antoine Tenart Subject: Re: [PATCH net-next v13 05/13] net: ethtool: Allow passing a phy index for some commands Message-ID: <20240613182613.5a11fca5@kernel.org> In-Reply-To: <20240607071836.911403-6-maxime.chevallier@bootlin.com> References: <20240607071836.911403-1-maxime.chevallier@bootlin.com> <20240607071836.911403-6-maxime.chevallier@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 7 Jun 2024 09:18:18 +0200 Maxime Chevallier wrote: > + if (tb[ETHTOOL_A_HEADER_PHY_INDEX]) { > + struct nlattr *phy_id; > + > + phy_id = tb[ETHTOOL_A_HEADER_PHY_INDEX]; > + phydev = phy_link_topo_get_phy(dev, > + nla_get_u32(phy_id)); Sorry for potentially repeating question (please put the answer in the commit message) - are phys guaranteed not to disappear, even if the netdev gets closed? this has no rtnl protection > + if (!phydev) { > + NL_SET_BAD_ATTR(extack, phy_id); > + return -ENODEV; > + } > + } else { > + /* If we need a PHY but no phy index is specified, fallback > + * to dev->phydev please double check the submission for going over 80 chars, this one appears to be particularly pointlessly over 80 chars... > + */ > + phydev = dev->phydev;