Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A7DCC43381 for ; Mon, 25 Mar 2019 18:43:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D195220700 for ; Mon, 25 Mar 2019 18:43:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729632AbfCYSnZ (ORCPT ); Mon, 25 Mar 2019 14:43:25 -0400 Received: from mx2.suse.de ([195.135.220.15]:38490 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729322AbfCYSnZ (ORCPT ); Mon, 25 Mar 2019 14:43:25 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 01850AF23; Mon, 25 Mar 2019 18:43:23 +0000 (UTC) Received: by unicorn.suse.cz (Postfix, from userid 1000) id 46533E1404; Mon, 25 Mar 2019 19:43:22 +0100 (CET) Date: Mon, 25 Mar 2019 19:43:22 +0100 From: Michal Kubecek To: Heiner Kallweit Cc: Andrew Lunn , Florian Fainelli , David Miller , "John W. Linville" , "netdev@vger.kernel.org" Subject: Re: [PATCH net-next v2 1/2] ethtool: add PHY Fast Link Down support Message-ID: <20190325184322.GG26076@unicorn.suse.cz> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Mon, Mar 25, 2019 at 07:34:58PM +0100, Heiner Kallweit wrote: > This adds support for Fast Link Down as new PHY tunable. > Fast Link Down reduces the time until a link down event is reported > for 1000BaseT. According to the standard it's 750ms what is too long > for several use cases. > > v2: > - add comment describing the constants > > Signed-off-by: Heiner Kallweit Reviewed-by: Michal Kubecek > --- > include/uapi/linux/ethtool.h | 8 ++++++++ > net/core/ethtool.c | 2 ++ > 2 files changed, 10 insertions(+) > > diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h > index 3652b239d..50c76f4fa 100644 > --- a/include/uapi/linux/ethtool.h > +++ b/include/uapi/linux/ethtool.h > @@ -252,9 +252,17 @@ struct ethtool_tunable { > #define DOWNSHIFT_DEV_DEFAULT_COUNT 0xff > #define DOWNSHIFT_DEV_DISABLE 0 > > +/* Time in msecs after which link is reported as down > + * 0 = lowest time supported by the PHY > + * 0xff = off, link down detection according to standard > + */ > +#define ETHTOOL_PHY_FAST_LINK_DOWN_ON 0 > +#define ETHTOOL_PHY_FAST_LINK_DOWN_OFF 0xff > + > enum phy_tunable_id { > ETHTOOL_PHY_ID_UNSPEC, > ETHTOOL_PHY_DOWNSHIFT, > + ETHTOOL_PHY_FAST_LINK_DOWN, > /* > * Add your fresh new phy tunable attribute above and remember to update > * phy_tunable_strings[] in net/core/ethtool.c > diff --git a/net/core/ethtool.c b/net/core/ethtool.c > index b1eb32419..387d67eb7 100644 > --- a/net/core/ethtool.c > +++ b/net/core/ethtool.c > @@ -136,6 +136,7 @@ static const char > phy_tunable_strings[__ETHTOOL_PHY_TUNABLE_COUNT][ETH_GSTRING_LEN] = { > [ETHTOOL_ID_UNSPEC] = "Unspec", > [ETHTOOL_PHY_DOWNSHIFT] = "phy-downshift", > + [ETHTOOL_PHY_FAST_LINK_DOWN] = "phy-fast-link-down", > }; > > static int ethtool_get_features(struct net_device *dev, void __user *useraddr) > @@ -2432,6 +2433,7 @@ static int ethtool_phy_tunable_valid(const struct ethtool_tunable *tuna) > { > switch (tuna->id) { > case ETHTOOL_PHY_DOWNSHIFT: > + case ETHTOOL_PHY_FAST_LINK_DOWN: > if (tuna->len != sizeof(u8) || > tuna->type_id != ETHTOOL_TUNABLE_U8) > return -EINVAL; > -- > 2.21.0 > >