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.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED, 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 062DEC43381 for ; Mon, 18 Mar 2019 14:02:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BD8AA206C0 for ; Mon, 18 Mar 2019 14:02:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="cSVJ/nZw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727646AbfCROC4 (ORCPT ); Mon, 18 Mar 2019 10:02:56 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:57464 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727602AbfCROC4 (ORCPT ); Mon, 18 Mar 2019 10:02:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=to/y5K6KU+4E0oj1FCX2wkQsWOHYVqomQwzXlTwVa+8=; b=cSVJ/nZwsVgsXCKTIssNndNm4I 9gGjGZd39Tb26+M4l+HnQR1rOn7+iYaq393IZRRC4g4QQaPlOT9yvQNG212njEIvXSClSh0S7rhrz XQLvYRWdYl1yJXudu8YxTl0Mh5qwxSAOoASibUekodUyN1xNBWP2giW7GWwAa0k2gN+Q=; Received: from andrew by vps0.lunn.ch with local (Exim 4.89) (envelope-from ) id 1h5sqr-0005JH-Td; Mon, 18 Mar 2019 15:02:53 +0100 Date: Mon, 18 Mar 2019 15:02:53 +0100 From: Andrew Lunn To: Petr Machata Cc: "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: <20190318140253.GH30224@lunn.ch> References: <3a247e91ebe81cdae4bae27ec1631c5015fb943f.1552672441.git.petrm@mellanox.com> <20190316022658.GC29548@lunn.ch> <87zhpsgw7j.fsf@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87zhpsgw7j.fsf@mellanox.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Mon, Mar 18, 2019 at 01:15:41PM +0000, Petr Machata wrote: > > Andrew Lunn writes: > > >> +enum rtnl_link_down_reason_major { > >> + RTNL_LDR_OTHER, > > > > Does 'other' make any sense? Seem better to just not report anything > > at all, or add a comment that more reasons should be added at the end > > to reflect whatever the hardware or software can determine. > > You still have the minor code to give you some information. The problem i have with OTHER, is that you know it is not NO_CABLE, UNSUPPORTED_CABLE, AUTONEG_FAILURE, etc. But for people to know what OTHER cannot be, they have to know all the codes. But then later, some other driver writer does the right thing, adds a new value to the end for a code they can detect. Say for example SFP_OVERHEATED. This happened to be what the previous driver was using for OTHER. Now we have one driver returning SFP_OVERHEATED and the older driver OTHER. So OTHER no longer actually mean 'other', it just means something random, which could actually be the same as one of the listed codes. You can stop this from happening by not having OTHER. Always add a new code if there is something you can report, but there currently is no code for it. And the userspace tool should just print the decimal value if it does not know what text to translate it into. Andrew