Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1704684imw; Sat, 16 Jul 2022 12:50:06 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sRyLJTAn3fOKGGgBqfdYuXFVY5ZMfrfapBt7rSMU1PpA0AiNCxFudVSd62QRs/qsc+g+YD X-Received: by 2002:a17:907:2722:b0:72b:6a93:bf9a with SMTP id d2-20020a170907272200b0072b6a93bf9amr18466722ejl.424.1658001006695; Sat, 16 Jul 2022 12:50:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658001006; cv=none; d=google.com; s=arc-20160816; b=o5dgt/v8vz1FyqJbMV7I1oKGwOmF+1EMkAHLEx2AQzeunaS04L/JKALs6V+fji8TKo /5Mjwia+FkcdDiuLl9AxNs91h1gXCfAJJra/dL+Y2vDsFVEmvjwsoZyphAqDeE5Bbyrg m4TIdhH2/iKQ72E64bOUQnOyQ6/8hP1KbX4c0uFX53S4KDX/NetZBHGLhDo7lb/c0mny R3fD8i6LylG99O+M2Cd1fXHimV37mH23+qyOPJOG1nLX+A5LvzgCXElM0S3nefvZPfFw nBD+w/Tq35RGAI7lM/feERhaNF2EsXD99KYT8nERhWZmv7DjXOhKi9cEZj+PFk/YnKU+ FvfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=LtAtzCZ8cJhp8hFf9hMUPei/xAdhBC+XgYV77Uq9zYg=; b=J77I7/bQSIFrJ//nNjQM0YzbXkcMqMSvVcl8BPGkV2mIHqyWjKZqYBBYi0NDhi8USk aEw6+JKUw1aAmbudX1SXGq/aHMruYuuuEnbHBs2nDKT9CbCqnbmNLCBsRJYGX2d+ZFOG X3oXFh7NXgdkBvTZRaubkdGwtxW67G6MkY4rwaLMgsbu1/vD2t8I2cIJabqRcoT/Gsrt CX2d81ZnIcOVTqF71iAiO6ZUZrGhNk+Jw9DoBtSo1UiMebd7grhgLbWSsUUfRCBvusWU 7jUr0fNXCxWwrazZ4d4nJ/UAATmxl41t/S87i1RLACIRVSKqzYGYc4mfkIJkz+R0wQKe RBeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=YznQjFgd; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hr5-20020a1709073f8500b0072af3c24981si9051251ejc.425.2022.07.16.12.49.42; Sat, 16 Jul 2022 12:50:06 -0700 (PDT) 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=pass header.i=@lunn.ch header.s=20171124 header.b=YznQjFgd; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232537AbiGPTju (ORCPT + 99 others); Sat, 16 Jul 2022 15:39:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229501AbiGPTjt (ORCPT ); Sat, 16 Jul 2022 15:39:49 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC0D3140A8; Sat, 16 Jul 2022 12:39:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=LtAtzCZ8cJhp8hFf9hMUPei/xAdhBC+XgYV77Uq9zYg=; b=YznQjFgd0fk/tF9iA6Yg9Xs1a+ sGg2QRsnbTm4gU896SJ/a2Oq1PN1C9xSt3N7My9hmdSxS2cv0hG/SabHxT5Izk7frk4E5c6pVnN8j 13WII0yIuYfyc0HLtOa4N7htN9NFjT1Nqf3V+nQBDK8Z05iWM0jgtvTiEboUsf04X/5E=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1oCndR-00AZPu-Sb; Sat, 16 Jul 2022 21:39:29 +0200 Date: Sat, 16 Jul 2022 21:39:29 +0200 From: Andrew Lunn To: Sean Anderson Cc: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org, Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Alexandru Marginean , Heiner Kallweit , Vladimir Oltean Subject: Re: [PATCH net-next v3 07/47] net: phy: Add support for rate adaptation Message-ID: References: <20220715215954.1449214-1-sean.anderson@seco.com> <20220715215954.1449214-8-sean.anderson@seco.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220715215954.1449214-8-sean.anderson@seco.com> 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_PASS,SPF_PASS 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 > drivers/net/phy/phy.c | 21 +++++++++++++++++++++ > include/linux/phy.h | 38 ++++++++++++++++++++++++++++++++++++++ > 2 files changed, 59 insertions(+) > > diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c > index 8d3ee3a6495b..cf4a8b055a42 100644 > --- a/drivers/net/phy/phy.c > +++ b/drivers/net/phy/phy.c > @@ -114,6 +114,27 @@ void phy_print_status(struct phy_device *phydev) > } > EXPORT_SYMBOL(phy_print_status); > > +/** > + * phy_get_rate_adaptation - determine if rate adaptation is supported > + * @phydev: The phy device to return rate adaptation for > + * @iface: The interface mode to use > + * > + * This determines the type of rate adaptation (if any) that @phy supports > + * using @iface. @iface may be %PHY_INTERFACE_MODE_NA to determine if any > + * interface supports rate adaptation. > + * > + * Return: The type of rate adaptation @phy supports for @iface, or > + * %RATE_ADAPT_NONE. > + */ > +enum rate_adaptation phy_get_rate_adaptation(struct phy_device *phydev, > + phy_interface_t iface) > +{ > + if (phydev->drv->get_rate_adaptation) > + return phydev->drv->get_rate_adaptation(phydev, iface); It is normal that any call into the driver is performed with the phydev->lock held. > #define PHY_INIT_TIMEOUT 100000 > #define PHY_FORCE_TIMEOUT 10 > @@ -570,6 +588,7 @@ struct macsec_ops; > * @lp_advertising: Current link partner advertised linkmodes > * @eee_broken_modes: Energy efficient ethernet modes which should be prohibited > * @autoneg: Flag autoneg being used > + * @rate_adaptation: Current rate adaptation mode > * @link: Current link state > * @autoneg_complete: Flag auto negotiation of the link has completed > * @mdix: Current crossover > @@ -637,6 +656,8 @@ struct phy_device { > unsigned irq_suspended:1; > unsigned irq_rerun:1; > > + enum rate_adaptation rate_adaptation; It is not clear what the locking is on this member. Is it only safe to access it during the adjust_link callback, when it is guaranteed that the phydev->lock is held, so the value is consistent? Or is the MAC allowed to access this at other times? Andrew