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=-2.5 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 B763CC10F14 for ; Tue, 23 Apr 2019 13:41:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 76422214AE for ; Tue, 23 Apr 2019 13:41:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=resnulli-us.20150623.gappssmtp.com header.i=@resnulli-us.20150623.gappssmtp.com header.b="nvmh3oGe" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727794AbfDWNlk (ORCPT ); Tue, 23 Apr 2019 09:41:40 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:38238 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727695AbfDWNlk (ORCPT ); Tue, 23 Apr 2019 09:41:40 -0400 Received: by mail-wr1-f65.google.com with SMTP id f14so19707398wrj.5 for ; Tue, 23 Apr 2019 06:41:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=pZCVRl8Qt7ag82uk6ie+R8MYHss8mwrQonoTBfQT90k=; b=nvmh3oGeOcle7QdQU8IJ7ATAIeP4zX64whoh6X4QJkWda+UmqptjO2OwpQvbvvFTvm JsQS/lcq15mZOINFjhAN54WwcgeT6sQk+hWYRdFq2lvMQtTybB4XmfOWM3OuPk4Pv1ql mV0rmZmkk/hT/Fjx9mkib8Om3WWs0z3xBmnbkuV36VZhYAYjJVqV/zWjLJZzv1v8S0iU O3rDU8FppN03DaxWnt8hevhk6kytcUaUdQTiSaUGp5aQjyrAeNUKHn8rZCOhg15QGK3v Qg4abLFAUBBDmDCkV/Hb21RgaXG3uGJYawu5totY+nyHEIVrMEQwLFUVHhzpT3dQ0+Xf rbkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=pZCVRl8Qt7ag82uk6ie+R8MYHss8mwrQonoTBfQT90k=; b=ienJDfLRGuJAm1hc7TLp8lGwHGaR3+Jqd0cHyIqPzwNtVsyAKB2C5UB8y1QtUVAvJt mJvkS6Zl+1xw9q1Hur6Vpyz0a0b2llm/124396AF085f1c89odlXkar/RERmEoEQgb+C tnFDovuTQHm3VaFXgyBh14Zg7zP2qWiDmpnZDOvOGzQmj2PO7OMrw0/sgZO+ASCPjntP 3L4NzzAhm9zA/ETYu4gu7DF5jqVYSCmSM9JfbVyjoQ2yRk3VCap+vhU8EDpbN6yLnMFc 62fKCSzmI+Y3HWVydFJTzJuuRze1z5jKPE8m21jQdEx6YjXdWp3XKALBzksV4Ro/pe/a Mfkw== X-Gm-Message-State: APjAAAXcKfjBxphWiUqmbu/mS62+6NiXy+QbM7TMSPHCuj1dahfqB7Fl RR/+wYqevJHnhEFZRCX2M486CA== X-Google-Smtp-Source: APXvYqwdGP+qfobe4mZEMOZGg27tHu43PAMNLW4/lzUqFXlBPZlK/yV43HyoF5lRTsLtWAXHHtcmuQ== X-Received: by 2002:adf:ea88:: with SMTP id s8mr17363439wrm.300.1556026898270; Tue, 23 Apr 2019 06:41:38 -0700 (PDT) Received: from localhost (jirka.pirko.cz. [84.16.102.26]) by smtp.gmail.com with ESMTPSA id k5sm3516873wrg.55.2019.04.23.06.41.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Apr 2019 06:41:37 -0700 (PDT) Date: Tue, 23 Apr 2019 15:41:36 +0200 From: Jiri Pirko To: Andrew Lunn Cc: Petr Machata , Roopa Prabhu , "netdev@vger.kernel.org" , Jiri Pirko , Ido Schimmel , "davem@davemloft.net" , Tariq Toukan , "jakub.kicinski@netronome.com" , "stephen@networkplumber.org" Subject: Re: [RFC PATCH net-next 1/3] net: rtnetlink: Add link-down reason to RTNL messages Message-ID: <20190423134136.GF2677@nanopsycho.orion> References: <3a247e91ebe81cdae4bae27ec1631c5015fb943f.1552672441.git.petrm@mellanox.com> <20190318000312.GB30224@lunn.ch> <87zhpeg9rg.fsf@mellanox.com> <20190328195134.GB5446@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190328195134.GB5446@lunn.ch> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Thu, Mar 28, 2019 at 08:51:34PM CET, andrew@lunn.ch wrote: >On Thu, Mar 28, 2019 at 05:59:50PM +0000, Petr Machata wrote: > >Hi Petr > >> - PHY driver: dev->phydev->drv->get_link_down_reason >> Certain PHY drivers might want to have a custom handling for some >> PHY-specific insight. Something like: >> >> modified include/linux/phy.h >> @@ -636,4 +636,7 @@ struct phy_driver { >> struct ethtool_tunable *tuna, >> const void *data); >> int (*set_loopback)(struct phy_device *dev, bool enable); >> + int (*get_link_down_reason)(struct phy_device *dev, >> + enum link_down_reason_major *major, >> + u32 *minor); >> }; >> >> Return -ENODATA to indicate there's nothing to report. >> >> - Generic PHY >> It would be possible to add a function that e.g. consults the PHY >> state machine to figure out what went wrong. Phy as such may have to >> be extended to keep track of e.g. why the state machine is PHY_HALTED, >> or possibly other problems worthy of reporting. > >I would suggest changing the order of these two. Put the generic PHY >first. If it sees the driver has a OP to get more specific detail, it >would make the call into the driver. You don't violate any layering >that way, and the locking is done correctly. > >The PHY being in state HALTED probably means there is a hardware error >at the MDIO level. That does not happen very often at all. > >What you are more interested is state PHY_NOLINK, which indicates >there is no link. Maybe because auto-neg didn't complete, if it was >turned on, or if auto-neg is off and the link is forced, the peer is >using something different, or is not there at all. > >> - phylink >> I'm not sure how to generically plug in the phylink library, because >> it is a private property of a MAC driver. There are currently only >> three drivers using phylink (mvvp2, mvneta, DSA), but it looks as if >> the intention is that phylink is used much more widely. So maybe it >> would make sense to have an NDO like get_phylink and use that to call >> into the phylink library for some generic handling. > >We need to consider adding a phylink pointer to the netdev structure >soon, in the same way there is a phylib structure. > >> Speaking specifically, my patch set would only do the first step above, >> because neither mlxsw nor mlx5 use the PHY subsystem. > >Shame. With just mlx, you will get a coverage of ~0. If you did the >generic phylib work, you might get coverage of > 50% of the MAC >drivers. It then becomes something useful and really used. Yeah, that's what it is. But maybe someone would pick up the work and do the phylib implementation too. Let's see. > > Andrew