From patchwork Thu Jan 31 18:50:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 1034438 Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=netronome.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=netronome-com.20150623.gappssmtp.com header.i=@netronome-com.20150623.gappssmtp.com header.b="I+JHFHfJ"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43r8VX0MCyz9sBQ for ; Fri, 1 Feb 2019 05:52:20 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727966AbfAaSwK (ORCPT ); Thu, 31 Jan 2019 13:52:10 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:34446 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726622AbfAaSwK (ORCPT ); Thu, 31 Jan 2019 13:52:10 -0500 Received: by mail-pf1-f196.google.com with SMTP id h3so1900586pfg.1 for ; Thu, 31 Jan 2019 10:52:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=bey9I8r36zZ+NgAg+iJ/rcVhjETAYjW+sfEuQIG7jm4=; b=I+JHFHfJg7CJrR/ItmVh5fNziIrJwpTttrh6AinrcRFSLJPRmK5rm5JD0OF+Mb3Izc Mb5b3XVDci1JDINuAHRfCp1Jw+wE57+DOw0guT9SklFLT+mKXkSaPIHfvd9ttvklqJ1o kFeQb6/k5reziOjqDDpOLvyugyvhedyB2zq71ma0+Q1S8vY1I1bw/+uDw7UgliO6OBlk EP7IthtncYqWpSWnCWfOlSU6XDtx8ncSXWFGVywTQ/HRKf/IiInb8eBSyhHClatXusRS e1T2qgZukmefiXNyaaw6S4BOpIvDYRjdsgQ9TrRT5mLMyavfZxSAq3hXQNbKWYVzn5Cu OU1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=bey9I8r36zZ+NgAg+iJ/rcVhjETAYjW+sfEuQIG7jm4=; b=IJyl8m2CH2C1llMIaIs/0tQLeCVa7nQU3D59Lu/SqvRcgBFsKXvcgJYoikfE4IcBgF COWsPmX3sL42FWfJkBz+ShIpYVyI7psORhKjcpHhh5d8JcS1yzcsd7pbZFt5OwOSLJ3U CDyuaeaKMbwMs3DSC/fb5N1fsa6v/D4ufECOvalmCL6+QHBd1fDHaeGMjQ5vQmDNvHHz nhHAMaZIqDsuOLk6u3j89v/pKkV01dpnWkJDjZGAYfOpqHH/EGe4gKw0FSH62wuK+n83 zV+fXMlDFlL5UCO6eFxrURymjOGoxojnqH/ckeD9SDP1wgHejffH5fveIjsceKNOtsnJ Q44A== X-Gm-Message-State: AJcUukcp8dHTeMrszLmKSDjTQpneBkIoypxe4/z0Y8ksPXBu7d9TBQjq a0AKGjR0tOQPjRPxqMN2/tseKw== X-Google-Smtp-Source: ALg8bN42ZM6lQT/0NP8mhsgq2Pj8G/sNZEoB4npUYe5j4XRJe9p9HMqQTMrOpfPWL/UFEm+VUmlAqg== X-Received: by 2002:a63:ce08:: with SMTP id y8mr32225652pgf.388.1548960729107; Thu, 31 Jan 2019 10:52:09 -0800 (PST) Received: from jkicinski-Precision-T1700.netronome.com ([66.60.152.14]) by smtp.gmail.com with ESMTPSA id o4sm7726169pgs.12.2019.01.31.10.52.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Jan 2019 10:52:08 -0800 (PST) From: Jakub Kicinski To: davem@davemloft.net Cc: netdev@vger.kernel.org, oss-drivers@netronome.com, jiri@resnulli.us, andrew@lunn.ch, f.fainelli@gmail.com, mkubecek@suse.cz, eugenem@fb.com, jonathan.lemon@gmail.com, Jakub Kicinski Subject: [PATCH net-next v4 0/8] devlink: add device (driver) information API Date: Thu, 31 Jan 2019 10:50:39 -0800 Message-Id: <20190131185047.27685-1-jakub.kicinski@netronome.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi! fw_version field in ethtool -i does not suit modern needs with 31 characters being quite limiting on more complex systems. There is also no distinction between the running and flashed versions of the firmware. Since the driver information pertains to the entire device, rather than a particular netdev, it seems wise to move it do devlink, at the same time fixing the aforementioned issues. The new API allows exposing the device serial number and versions of the components of the card - both hardware, firmware (running and flashed). Driver authors can choose descriptive identifiers for the version fields. A few version identifiers which seemed relevant for most devices have been added to the global devlink header. Example: $ devlink dev info pci/0000:05:00.0 pci/0000:05:00.0: driver nfp serial_number 16240145 versions: fixed: board.id AMDA0099-0001 board.rev 07 board.vendor SMA board.model carbon running: fw.mgmt: 010156.010156.010156 fw.cpld: 0x44 fw.app: sriov-2.1.16 stored: fw.mgmt: 010158.010158.010158 fw.cpld: 0x44 fw.app: sriov-2.1.20 Last patch also includes a compat code for ethtool. If driver reports no fw_version via the traditional ethtool API, ethtool can call into devlink and try to cram as many versions as possible into the 31 characters. v4: - use IS_REACHABLE instead of IS_ENABLED in last patch. v3 (Jiri): - rename various functions and attributes; - break out the version helpers per-type; - make the compat code parse a dump instead of special casing in each helper; - move generic version defines to a separate patch. v2: - rebase. this non-RFC, v3 some would say: - add three more versions in the NFP patches; - add last patch (ethool compat) - Andrew & Michal. RFCv2: - use one driver op; - allow longer serial number; - wrap the skb into an opaque request struct; - add some common identifier into the devlink header. Jakub Kicinski (8): devlink: add device information API devlink: add version reporting to devlink info API devlink: add generic info version names nfp: devlink: report driver name and serial number nfp: devlink: report fixed versions nfp: nsp: add support for versions command nfp: devlink: report the running and flashed versions ethtool: add compat for devlink info .../networking/devlink-info-versions.rst | 38 +++ Documentation/networking/index.rst | 1 + .../net/ethernet/netronome/nfp/nfp_devlink.c | 145 +++++++++++ .../ethernet/netronome/nfp/nfpcore/nfp_nsp.c | 61 +++++ .../ethernet/netronome/nfp/nfpcore/nfp_nsp.h | 20 ++ include/net/devlink.h | 75 ++++++ include/uapi/linux/devlink.h | 10 + net/core/devlink.c | 232 ++++++++++++++++++ net/core/ethtool.c | 7 + 9 files changed, 589 insertions(+) create mode 100644 Documentation/networking/devlink-info-versions.rst