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=-8.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_PASS,USER_AGENT_GIT 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 44450C43381 for ; Fri, 15 Mar 2019 17:56:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 15C1E218D0 for ; Fri, 15 Mar 2019 17:56:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="ihTDGRxU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726697AbfCOR4K (ORCPT ); Fri, 15 Mar 2019 13:56:10 -0400 Received: from mail-eopbgr70050.outbound.protection.outlook.com ([40.107.7.50]:62178 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726496AbfCOR4K (ORCPT ); Fri, 15 Mar 2019 13:56:10 -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=Hn1iybgf+MSX1UGBHSJyXzRhbIiLCeH73sQan5NN+lc=; b=ihTDGRxUwHpXrJZ2IFHJ6YkbeHnkdwgf/lJ546Bvp9zxLHlD5h+0xjLox5VcR4MhZUdRkhDRPtSLMDWlSfnzzHazsqNIRfsulZHj7AL3UsBNWrzn6ClUpBYo6OU8rMPShVJ87A34vGiVb1pgSbT78lYDvqqh7FpeEnCdEoPKS7U= Received: from HE1PR05MB3243.eurprd05.prod.outlook.com (10.170.243.17) by HE1PR05MB4730.eurprd05.prod.outlook.com (20.176.164.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1709.13; Fri, 15 Mar 2019 17:56:05 +0000 Received: from HE1PR05MB3243.eurprd05.prod.outlook.com ([fe80::9d92:b76c:69a:95ce]) by HE1PR05MB3243.eurprd05.prod.outlook.com ([fe80::9d92:b76c:69a:95ce%3]) with mapi id 15.20.1709.011; Fri, 15 Mar 2019 17:56:05 +0000 From: Petr Machata To: "netdev@vger.kernel.org" CC: Petr Machata , Jiri Pirko , Ido Schimmel , "davem@davemloft.net" , Tariq Toukan , "jakub.kicinski@netronome.com" , "andrew@lunn.ch" , "stephen@networkplumber.org" Subject: [RFC PATCH net-next 0/3] RTNL: Add link-down reason reporting Thread-Topic: [RFC PATCH net-next 0/3] RTNL: Add link-down reason reporting Thread-Index: AQHU21hcWgMiHXK9AUSlhr7FhLV8bQ== Date: Fri, 15 Mar 2019 17:56:05 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.4.11 x-clientproxiedby: LO2P265CA0183.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a::27) To HE1PR05MB3243.eurprd05.prod.outlook.com (2603:10a6:7:35::17) authentication-results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [37.142.13.130] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0538347a-37f9-4453-f38b-08d6a96f7eb0 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:HE1PR05MB4730; x-ms-traffictypediagnostic: HE1PR05MB4730: x-ms-exchange-purlcount: 1 x-microsoft-antispam-prvs: x-forefront-prvs: 09778E995A x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(376002)(136003)(39860400002)(366004)(346002)(199004)(189003)(186003)(50226002)(14454004)(8936002)(2351001)(3846002)(2616005)(316002)(81156014)(1730700003)(26005)(6116002)(966005)(106356001)(102836004)(66066001)(6916009)(105586002)(81166006)(52116002)(6506007)(8676002)(6436002)(68736007)(6486002)(486006)(476003)(5640700003)(305945005)(5660300002)(53936002)(6512007)(25786009)(2906002)(386003)(6306002)(7736002)(86362001)(54906003)(256004)(71200400001)(71190400001)(36756003)(478600001)(2501003)(99286004)(4326008)(97736004);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR05MB4730;H:HE1PR05MB3243.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: acLzmuQ2+zo/pF45oe+OOpmsmJHSom9YMdO5kiwroofC+XU84LkwRa8KfntYlazSbEsK1OtV16zjx8LlSgru/+H/pNPr0yrOkticTuOBkQhpGATsbMGcRerq8xWEcCc+xxCfj5US31hkGtwpKUbALYRd4AH9ith80IC+F7KG5AhArnSUyUwLIdAPJdzt1mNwe0WlOGN/QZRXApMJC53t3EDovmASonebiUGzt51u1nr5sJTDSRa6R8TvksCKXkHdVBhx7yZ3L6v1j4nsbfP7CwGJS2lD11jkEUOGb8g1gMX7fOUkT75jXSvfBDeQu+jP/BODBjcmEXn6tLhgKBqWqxLOKv9mUmcf8iDMzIFnEKQPak8OpIhzlmbL9QMYsnNH+sqlvMW6nr2Ow4atNHBfJN49cTv+digwTMnxrKBQJtE= 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: 0538347a-37f9-4453-f38b-08d6a96f7eb0 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Mar 2019 17:56:05.6227 (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: HE1PR05MB4730 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org In general, after a port is put administratively up, certain handshake protocols have to finish successfully, otherwise the port is left in a NO-CARRIER or DORMANT state. When that happens, it would be useful to communicate the reasons to the administrator, so that the problem that prevents the link from being established can be corrected. This patch set adds two new RTNL attributes, IFLA_LINK_DOWN_REASON_MAJOR and _MINOR, to carry the information. Major reason codes are drawn from a well-known enum that is part of the kernel interface. They serve as broad categories intended to convey a general idea of where the problem is. Minor codes are arbitrary numbers specific for the driver in question that add detail to the major reasons. The hope is that an average user will not need to dive into the minor reason codes. It is for example largely immaterial what it is that makes any given cable unsupported, because the administrator will just take another cable anyway. The minor code may still be provided though, for the cases where further information is actually necessary. The party with visibility into details of this process is the driver. Therefore add two new RTNL hooks, link_down_reason_get_size and fill_link_down_reason, to provide the necessary information. Link-down reason is not included if the port is up or administratively down, because those two state are easy to discover through existing interfaces. The new interface is intended for debugging of the transition between these two states. This is all in patch #1. Patches #2 and #3 add implementation of the new interfaces for mlxsw. A preliminary iproute patch that implements display of the new attributes is available here: https://github.com/pmachata/iproute2/tree/link_down_reason And this is an example output: # ip -d link show dev sw1p1 393: sw1p1: mtu 1500 qdisc pfifo_fa= st state DOWN mode DEFAULT group default qlen 1000 link/ether 7c:fe:90:f5:a3:7d brd ff:ff:ff:ff:ff:ff promiscuity 0 mi= nmtu 0 maxmtu 65535 mlxsw addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65= 536 gso_max_segs 65535 \ portname p1 switchid 7cfe90f5a340 down_reason NO_CABLE 1024 Petr Machata (3): net: rtnetlink: Add link-down reason to RTNL messages mlxsw: reg: Add Port Diagnostics Database Register mlxsw: spectrum: Add rtnl_link_ops drivers/net/ethernet/mellanox/mlxsw/reg.h | 54 +++++++++++++ drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 108 +++++++++++++++++++++= ++++ include/net/rtnetlink.h | 3 + include/uapi/linux/if_link.h | 16 ++++ net/core/rtnetlink.c | 22 +++++ 5 files changed, 203 insertions(+) --=20 2.4.11