Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5636739rwb; Mon, 5 Dec 2022 01:49:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf4CmlRMrNvoTjbWa9HV4lww+8solkuKTFkonHnIoLZk4gvMg06eZYfPb9SI4xzmoQTg9JBM X-Received: by 2002:a17:902:864c:b0:189:4139:2054 with SMTP id y12-20020a170902864c00b0018941392054mr59442614plt.64.1670233774879; Mon, 05 Dec 2022 01:49:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670233774; cv=none; d=google.com; s=arc-20160816; b=GsO2+ViCcnHdglQvRYYuY0fd6t7VjOdgBvBOgKmJus7FRMxIk6HVvIThPBHd4/uc2u Wm8xeu4Z9AI7xtroUVdABTmshXTLnqr0ds4dA4rnfI6J6nER4gN3ZhhBbRrM8NHgJtqN uQzPrX+VLlerccS+Xlw8M9txcUiUBWYDpAcWx9zrEiOfrzD5uooZT0PlIvc/Bun4W/y2 EXgjjx5r9yqhhy+rU10oONWdZElDpqCfbZ0QgtZyH9GJKUiDjwk5cssfyZeeV+NBX40h JB8LhEpUDhdumgw/3kiUnUWzNETB6bgSG1vFnuAeyHleSKom+gT/j+W6evwmFFx8fX47 ysAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=uYIGjJD2wgkVcMrKaqHksISnsayovI84ZVgDoXZJbZM=; b=Mx+zzERpgzHLQxa/ufWEb/DuI8hdDHjlWnx0kafkmTzBm8Djed9kSK1OYCLoMz96HJ +LsPgRbjvJAXymkbEA+h5jQHtDwPIPP4fMwRpAhFSWz8B+fFdQvB/UL7QZZnPd1q4oby SmRerkfF0Lcx8GpW+fQxoxehDGrAjUuT8Hw2q95E0bIipB1taHwMhI/WYCL2wqAaCzf+ tIl5EiaSLqUdTmTtYPXUN+Jhdg4Q0FpL8QYm0LeBeNNW7OWVdjucsvpP4HkF8oe6vZzm nkd8WaEzrsw5/lom+8Tx+7FJ0JcRfEo983gG0kmmpItSCdJFANAPGlVnWQDWTLLADsgs fOFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=XUShWzoG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q6-20020a056a00150600b005754106e36dsi15459973pfu.78.2022.12.05.01.49.24; Mon, 05 Dec 2022 01:49:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=XUShWzoG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230335AbiLEJ3J (ORCPT + 82 others); Mon, 5 Dec 2022 04:29:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230006AbiLEJ3H (ORCPT ); Mon, 5 Dec 2022 04:29:07 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85EB715738; Mon, 5 Dec 2022 01:28:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=uYIGjJD2wgkVcMrKaqHksISnsayovI84ZVgDoXZJbZM=; b=XUShWzoGgZRjua1LdqRbH3lpeo kJvToInvKRelfGJisTV+Sq0WROK9101f/+PnxcP65ttNQ2SA/0wbutD2NpMJow+Bf0mvUPDUPUiws o6xvb/W69BxN8BbcsixypAUEiqwspCxAGju6J13Sshd8N7Q20NqVX9MpOfQgWaPWupaZ2p9qDljY9 y6BSAVLwQGSvwtMwPQatSyNIvshqHiASHjLER9dsY78MpzMFv50Nb0m6sxUS2byMZrCyfz58xOWKU gOB2kJ9E23qab889cfBvyw02yB7CEZCGmuwm9WU7biH9H79ED7APpsNw0qLJDkH5rcOyuhkHkkGZk Gdf8a3yA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:35576) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1p27mP-0006ZO-Qo; Mon, 05 Dec 2022 09:28:53 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1p27mN-00078a-J7; Mon, 05 Dec 2022 09:28:51 +0000 Date: Mon, 5 Dec 2022 09:28:51 +0000 From: "Russell King (Oracle)" To: Piergiorgio Beruto Cc: Andrew Lunn , Heiner Kallweit , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Oleksij Rempel Subject: Re: [PATCH v2 net-next 1/4] net/ethtool: add netlink interface for the PLCA RS Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Russell King (Oracle) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham 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 On Mon, Dec 05, 2022 at 02:41:35AM +0100, Piergiorgio Beruto wrote: > +int ethnl_set_plca_cfg(struct sk_buff *skb, struct genl_info *info) > +{ > + struct ethnl_req_info req_info = {}; > + struct nlattr **tb = info->attrs; > + const struct ethtool_phy_ops *ops; > + struct phy_plca_cfg plca_cfg; > + struct net_device *dev; > + > + bool mod = false; > + int ret; > + > + ret = ethnl_parse_header_dev_get(&req_info, > + tb[ETHTOOL_A_PLCA_HEADER], > + genl_info_net(info), info->extack, > + true); > + if (ret < 0) > + return ret; > + > + dev = req_info.dev; > + > + // check that the PHY device is available and connected > + if (!dev->phydev) { > + ret = -EOPNOTSUPP; > + goto out; > + } This check should really be done under the RTNL lock. phydevs can come and go with SFP cages. > + > + rtnl_lock(); -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!