From patchwork Sun Mar 24 15:02:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 1063212 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="pp8ok44J"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44S0zc3C8Qz9sRx for ; Mon, 25 Mar 2019 02:04:28 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727137AbfCXPE0 (ORCPT ); Sun, 24 Mar 2019 11:04:26 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:35126 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726317AbfCXPE0 (ORCPT ); Sun, 24 Mar 2019 11:04:26 -0400 Received: by mail-wm1-f65.google.com with SMTP id y197so6483129wmd.0 for ; Sun, 24 Mar 2019 08:04:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=WD3LoYfOLLO0Nh/pJZ+3Yz4q2oZew1QS5P1EFmVHK+U=; b=pp8ok44Jm5S6xQDKpcsBBiSPLz7ggdjwoLS4fn2glk3FAoDVJiDdS2gQr4qlkrdmnb UCbK0pktGOMUw00cELwp9B4eTOvWTkwRpgSWBYjvl2Vjc8AfkMkT15XoIZoSVLmId3rk G49txn/g9DlFJdZA3CCHtasr8vvPVLm3ctZDGA8iBVPW7GEqhPN7qa04wqqQPwfN19oD LwPjvhnzS7tZCRaMHX8m8zlI1BdptLKzdaFBRL8AtP6m1xJSrOBiKRsga+k4L6nkLQ8H T97Qeso3WpUrDCkBuxg3dkal0yeqq0fZKVRTtuv+v1WRxWU+2QHwEVrUUP0WBlf7KEq1 F3TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=WD3LoYfOLLO0Nh/pJZ+3Yz4q2oZew1QS5P1EFmVHK+U=; b=On0zR78UXkXfbFas/I8cdTVgWaFCrsENw2zp5x4qcrUQT0hKKVrsFhALrVhpjtoN2z M19MM5Ilpy704m0MdK9t21dhCvSQBPOnrvW4ni5ITUIjto3HcLuXyf5GtCJparMV3EIw v0MBfROQOJqSQTrPev7XotO6LL7PE4XbT4f2B+JTBKeyDs+4R5V8bP+MStGubv1ecZQU 9bQCEqE3Z0uoVcSArZlyxWqMGSr8hkXggei9RvUv2qYpx1tAnbC79rvbkbFdsAn+zk3L DysKsnb2Q+Pnr+1ytSzhwFp+25xc/DJYbwsRcT+YCr52VeuKwc0ICS73sso28DkK5VQ3 dtsA== X-Gm-Message-State: APjAAAUl1EHbSacH9uQBExSDI8+u+eCrVbWAywW5r3oizAqecK1L/WTh 6djul/Sk1YgSWwicanMnG3pECrSj X-Google-Smtp-Source: APXvYqyMZ+ADPw64cK3mVRjv/vRdukaXZd1t7PEztd7OWb+eRQ/Y3b7qvvikG6nEKwTXC7UWzJurSQ== X-Received: by 2002:a7b:c3c5:: with SMTP id t5mr8697061wmj.110.1553439864603; Sun, 24 Mar 2019 08:04:24 -0700 (PDT) Received: from ?IPv6:2003:ea:8bc4:dc00:5ca8:2950:7dd3:94a3? (p200300EA8BC4DC005CA829507DD394A3.dip0.t-ipconnect.de. [2003:ea:8bc4:dc00:5ca8:2950:7dd3:94a3]) by smtp.googlemail.com with ESMTPSA id d17sm6589697wrw.88.2019.03.24.08.04.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Mar 2019 08:04:23 -0700 (PDT) Subject: [PATCH net-next 1/2] ethtool: add PHY Fast Link Down support From: Heiner Kallweit To: Andrew Lunn , Florian Fainelli , David Miller , "John W. Linville" Cc: "netdev@vger.kernel.org" References: Message-ID: <506ae10e-5d93-f64e-a615-c320010a5529@gmail.com> Date: Sun, 24 Mar 2019 16:02:43 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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. Signed-off-by: Heiner Kallweit --- include/uapi/linux/ethtool.h | 4 ++++ net/core/ethtool.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h index 3652b239d..2c7136adc 100644 --- a/include/uapi/linux/ethtool.h +++ b/include/uapi/linux/ethtool.h @@ -252,9 +252,13 @@ struct ethtool_tunable { #define DOWNSHIFT_DEV_DEFAULT_COUNT 0xff #define DOWNSHIFT_DEV_DISABLE 0 +#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;