From mboxrd@z Thu Jan 1 00:00:00 1970 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=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 8F029C35243 for ; Wed, 5 Feb 2020 09:33:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6FAEF20661 for ; Wed, 5 Feb 2020 09:33:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728188AbgBEJdu (ORCPT ); Wed, 5 Feb 2020 04:33:50 -0500 Received: from mga05.intel.com ([192.55.52.43]:19048 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728035AbgBEJdt (ORCPT ); Wed, 5 Feb 2020 04:33:49 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Feb 2020 01:33:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,405,1574150400"; d="scan'208";a="378683518" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga004.jf.intel.com with ESMTP; 05 Feb 2020 01:33:43 -0800 Received: from andy by smile with local (Exim 4.93) (envelope-from ) id 1izH43-0000Hp-JV; Wed, 05 Feb 2020 11:33:43 +0200 Date: Wed, 5 Feb 2020 11:33:43 +0200 From: Andy Shevchenko To: Michal Kubecek Cc: Kai-Heng Feng , davem@davemloft.ne, jeffrey.t.kirsher@intel.com, "David S. Miller" , Jakub Kicinski , Jiri Pirko , Pablo Neira Ayuso , Maxime Chevallier , Heiner Kallweit , Florian Fainelli , Greg Kroah-Hartman , Ido Schimmel , Jouni Hogander , YueHaibing , Eric Dumazet , Wang Hai , Thomas Gleixner , Li RongQing , open list , "open list:NETWORKING [GENERAL]" Subject: Re: [PATCH v2 2/2] net-sysfs: Ensure begin/complete are called in speed_show() and duplex_show() Message-ID: <20200205093343.GT10400@smile.fi.intel.com> References: <20200205081616.18378-1-kai.heng.feng@canonical.com> <20200205081616.18378-2-kai.heng.feng@canonical.com> <20200205090638.GS10400@smile.fi.intel.com> <20200205092345.GA14294@unicorn.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200205092345.GA14294@unicorn.suse.cz> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, Feb 05, 2020 at 10:23:45AM +0100, Michal Kubecek wrote: > On Wed, Feb 05, 2020 at 11:06:38AM +0200, Andy Shevchenko wrote: > > On Wed, Feb 05, 2020 at 04:16:16PM +0800, Kai-Heng Feng wrote: > > > Device like igb gets runtime suspended when there's no link partner. We > > > can't get correct speed under that state: > > > $ cat /sys/class/net/enp3s0/speed > > > 1000 > > > > > > In addition to that, an error can also be spotted in dmesg: > > > [ 385.991957] igb 0000:03:00.0 enp3s0: PCIe link lost > > > > > > It's because the igb device doesn't get runtime resumed before calling > > > get_link_ksettings(). > > > > > > So let's use a new helper to call begin() and complete() like what > > > dev_ethtool() does, to runtime resume/suspend or power up/down the > > > device properly. > > > > > > Once this fix is in place, igb can show the speed correctly without link > > > partner: > > > $ cat /sys/class/net/enp3s0/speed > > > -1 > > > > What is the meaning of -1? Does it tells us "Hey, something is bad in hardware > > I can't tell you the speed" or does it imply anything else? > > It's SPEED_UNKNOWN constant printed with "%d" template. > > > Wouldn't be better to report 0? > > > > Where is the documentation part of this ABI change? > > It's not an ABI change, /sys/class/net/*/speed already shows -1 when the > device reports SPEED_UNKNOWN. The only change is that after this patch, > igb driver reports SPEED_UNKNOWN rather than an outdated value if there > is no link. Thanks for elaboration. Perhaps add a couple of words to the commit message that there is no ABI changes. -- With Best Regards, Andy Shevchenko