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=-4.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_PASS 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 CE507C43381 for ; Mon, 18 Mar 2019 12:16:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8F66720857 for ; Mon, 18 Mar 2019 12:16:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="RBbgy/7T" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726813AbfCRMQB (ORCPT ); Mon, 18 Mar 2019 08:16:01 -0400 Received: from mail-eopbgr80083.outbound.protection.outlook.com ([40.107.8.83]:3458 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726594AbfCRMQB (ORCPT ); Mon, 18 Mar 2019 08:16:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HaLmAtdQVXWNBAQ9/u9LxeV4xKj9U86By+69t7btp/I=; b=RBbgy/7TFHr2VpRdSWpUBadjnjQDQobMKJSokybV+GpL7u7WhHjrNQOp1Q0iPETKGU60abv4objkJmUq++p0/OzqAMqhqQHKMD6Zibzqhuif3hGTdxaq34ZASLgOQpMqH2jVtdAnK4kiM7qxMdi2pePIW6OlkwRczyt7QUEaJ0U= Received: from AM6PR05MB6133.eurprd05.prod.outlook.com (20.179.3.144) by AM6PR05MB6599.eurprd05.prod.outlook.com (20.179.2.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1709.13; Mon, 18 Mar 2019 12:15:56 +0000 Received: from AM6PR05MB6133.eurprd05.prod.outlook.com ([fe80::8c6:b0f3:d983:2fea]) by AM6PR05MB6133.eurprd05.prod.outlook.com ([fe80::8c6:b0f3:d983:2fea%2]) with mapi id 15.20.1709.015; Mon, 18 Mar 2019 12:15:56 +0000 From: Petr Machata To: Roopa Prabhu CC: "netdev@vger.kernel.org" , Jiri Pirko , Ido Schimmel , "davem@davemloft.net" , Tariq Toukan , "jakub.kicinski@netronome.com" , "andrew@lunn.ch" , "stephen@networkplumber.org" Subject: Re: [RFC PATCH net-next 1/3] net: rtnetlink: Add link-down reason to RTNL messages Thread-Topic: [RFC PATCH net-next 1/3] net: rtnetlink: Add link-down reason to RTNL messages Thread-Index: AQHU21hddEVxaeti1Ey0mD5+skDyyqYQbX2AgADkd4A= Date: Mon, 18 Mar 2019 12:15:56 +0000 Message-ID: <8736nkidje.fsf@mellanox.com> References: <3a247e91ebe81cdae4bae27ec1631c5015fb943f.1552672441.git.petrm@mellanox.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM6PR08CA0035.eurprd08.prod.outlook.com (2603:10a6:20b:c0::23) To AM6PR05MB6133.eurprd05.prod.outlook.com (2603:10a6:20b:af::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [78.45.160.211] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ccc0e456-3ed8-4b63-ccf7-08d6ab9b7953 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020);SRVR:AM6PR05MB6599; x-ms-traffictypediagnostic: AM6PR05MB6599: x-microsoft-antispam-prvs: x-forefront-prvs: 098076C36C x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(396003)(39860400002)(136003)(376002)(346002)(199004)(189003)(66066001)(486006)(4326008)(6116002)(3846002)(105586002)(106356001)(36756003)(71190400001)(71200400001)(5660300002)(6512007)(6916009)(25786009)(53936002)(97736004)(6506007)(386003)(478600001)(6486002)(26005)(6246003)(6436002)(52116002)(102836004)(68736007)(14454004)(86362001)(76176011)(81166006)(99286004)(81156014)(305945005)(8676002)(7736002)(14444005)(256004)(446003)(11346002)(2616005)(476003)(316002)(54906003)(229853002)(186003)(8936002)(2906002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM6PR05MB6599;H:AM6PR05MB6133.eurprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: XVuINU4YKeQUh8M/gNKA7qDSv1S8g74QpJ45OW1TyWjAeCqVOnSGVT+dNCLn6BvEsF7EmoPLdXwrtfesLtwAXX1Ik0T9Qmkme7EtJb++6Hq5RcaHz8WiSViDAedIR4lbpHtRHsRjZ+Y5m+2kJ5/WPETPfjnvEwuGNDL0crby+BQBcWeGkEP7sP/SzVj86RPdNZ7StisK+AkMEtVYsjzPEWtn28/NqT3YwfyMmNK1HntUUygwUxu+LPq7e5p/JHwXsTlo9/4hC8m52Khi3O+FNXVaWNqWS8V9OY/Pe8SWfUmmjDVNa7SktKHLkN3FvROtqJgAKGm99eh5kBR0mzOYHjHrVJDEiKlUgq+4Qyk/f3FG9AqDTfFQi4xewFvOP0rh5xDe3HtqoOv7ILGcyywpGGBjdH/AUCVsUO/u+c0SxX0= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: ccc0e456-3ed8-4b63-ccf7-08d6ab9b7953 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Mar 2019 12:15:56.6061 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB6599 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Roopa Prabhu writes: > This looks good and will be use-full. But i have some comments on the > implementation below. > Also, carrier can go down due to protocol down (IFLA_PROTODOWN). And I > get asked about supporting > reason codes or protocol owner for such protodown reason (I have not > given it much thought yet. I will see if there is a way > to use your series for that as well). My thinking was that since protocol down is set from userspace, it's under admin control, and that's where the reason signalling should be. >> --- >> include/net/rtnetlink.h | 3 +++ >> include/uapi/linux/if_link.h | 16 ++++++++++++++++ >> net/core/rtnetlink.c | 22 ++++++++++++++++++++++ >> 3 files changed, 41 insertions(+) >> >> diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h >> index e2091bb2b3a8..cfd9e86ff0ca 100644 >> --- a/include/net/rtnetlink.h >> +++ b/include/net/rtnetlink.h >> @@ -110,6 +110,9 @@ struct rtnl_link_ops { >> int (*fill_linkxstats)(struct sk_buff *skb, >> const struct net_devi= ce *dev, >> int *prividx, int att= r); >> + size_t (*link_down_reason_get_size)(const struc= t net_device *dev); >> + int (*fill_link_down_reason)(struct sk_buff = *skb, >> + const struct ne= t_device *dev); >> }; > > Any reason to restrict this to network interfaces which support rtnl_link= _ops ?. > I also saw that you added rtnl_link_ops to mlxsw for this. Which also > means every driver will now have to declare rtnl_link_ops to use this > ?. > I think we should keep rtnl_link_ops to logical links like bridge, > bonds etc (ie which support newlink and dellink). > > Can't we use netdev_ops for this ?. That will allow any driver to just > support this readily. I guess you are right. >> +enum rtnl_link_down_reason_major { >> + RTNL_LDR_OTHER, >> + RTNL_LDR_NO_CABLE, >> + RTNL_LDR_UNSUPPORTED_CABLE, >> + RTNL_LDR_AUTONEG_FAILURE, >> + RTNL_LDR_NO_LINK_PARTNER, >> + RTNL_LDR_LINK_TRAINING_FAILURE, >> + RTNL_LDR_LOGICAL_MISMATCH, >> + RTNL_LDR_REMOTE_FAULT, >> + RTNL_LDR_BAD_SIGNAL_INTEGRITY, >> + RTNL_LDR_CALIBRATION_FAILURE, >> + RTNL_LDR_POWER_BUDGET_EXCEEDED, >> +}; > > prefer LINK_DOWN_REASON_* or LINKDOWN_REASON_* > (Though there is no predefined convention, the prefix RTNL makes it > feel like a top-level attribute when its really a value for an IFLA_* > attribute.) OK.