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.5 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,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 52065C282D7 for ; Wed, 30 Jan 2019 21:25:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F0AB3218AF for ; Wed, 30 Jan 2019 21:25:20 +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="QaiBd+AM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388027AbfA3VZU (ORCPT ); Wed, 30 Jan 2019 16:25:20 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:55998 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727740AbfA3VZT (ORCPT ); Wed, 30 Jan 2019 16:25:19 -0500 Received: by mail-wm1-f66.google.com with SMTP id y139so356048wmc.5 for ; Wed, 30 Jan 2019 13:25:18 -0800 (PST) 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=8fZEz/ECXECsRGJ/1lv/eobFegEyWRTdexDKX1Bw+RM=; b=QaiBd+AMjmjgOCmS1W3crh8WQ04kw1cvLMyup7pV9MCqMHmaYNNEn1OXU9W3iEcAJY OrEwTlyE/EdcbvQ4HwAmvUbDaVzgiTEwVmy6yRoXIO8Mmb3mqUEw9lWo7ivmnRpb/pXp J3I/+BPekG5pCTrGf3DU8UysKFqYYi6ShgjQFBKWIcPh9Uw98q8wi5tO2ek73hee9nb2 bz+FGnowkO8EBWCyD38pOBblrugfk/8GisBUIHL6OTOE8HTiEP8u11ZA1/Hwqqq0TAgB 17s027xKRFCU/zQXy4wQ5bN1pE/9weBgQRuXrjcnYbsf167kA2p5tlVa8P3dvldB2CY4 ETqg== 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=8fZEz/ECXECsRGJ/1lv/eobFegEyWRTdexDKX1Bw+RM=; b=TTRmMLLYzaGNkARKCP/9VjxljWw5cYkSIPeWIqX27XC2wppU/kuVan8chyp6FQjKmG Uz6VhP+n6aLLLG9LG4CiSyZzxX2MeWB5Au6ZYJSd85UWGy9UGMxbOLuTfKBkVYMAI8es VQvae1TGhGTz4YSTuexIa/oFIJQSSkRYI5nYHCjZ4AFbyUScMMxoQMXguKhZJq9QWVib R24+wHaDPCksrdnbdwUZy1zYxZZ04jqwYy2Wh70zy1Lt+97kO0iJPTJQ0oUIB39OPfb8 MV23Dl3L1ad9HVH0b+r97+wgQ+FcIqWuhdtxb66Kq0RSDkB7rPI4xbNYmBH2Gy7XraA6 HPsA== X-Gm-Message-State: AJcUukffjZWTMMGpdg282hZxXkx7noZnxd3yZ2m8zMZveqqKuhN4g9ya y7mSmEciIIjKAHZKKTC2rzDhqMteXs0= X-Google-Smtp-Source: ALg8bN61T5+SiO4N+fUcFpxRCnTBXlIrS1up3jW7Pk/R7J1l2SZ3HEtQKsKE+9pbE8JkN5moRzTfiA== X-Received: by 2002:a7b:cb96:: with SMTP id m22mr27740188wmi.39.1548883517717; Wed, 30 Jan 2019 13:25:17 -0800 (PST) Received: from localhost (jirka.pirko.cz. [84.16.102.26]) by smtp.gmail.com with ESMTPSA id b18sm2749402wrr.43.2019.01.30.13.25.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Jan 2019 13:25:16 -0800 (PST) Date: Wed, 30 Jan 2019 22:16:16 +0100 From: Jiri Pirko To: Jakub Kicinski Cc: davem@davemloft.net, netdev@vger.kernel.org, oss-drivers@netronome.com, andrew@lunn.ch, f.fainelli@gmail.com, mkubecek@suse.cz, eugenem@fb.com, jonathan.lemon@gmail.com Subject: Re: [PATCH net-next v2 1/7] devlink: add device information API Message-ID: <20190130211616.GA349@nanopsycho.orion> References: <20190130190513.25718-1-jakub.kicinski@netronome.com> <20190130190513.25718-2-jakub.kicinski@netronome.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190130190513.25718-2-jakub.kicinski@netronome.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Wed, Jan 30, 2019 at 08:05:07PM CET, jakub.kicinski@netronome.com wrote: >ethtool -i has served us well for a long time, but its showing >its limitations more and more. The device information should Double space here -------------^^ >also be reported per device not per-netdev. > >Lay foundation for a simple devlink-based way of reading device >info. Add driver name and device serial number as initial pieces ^^---------------+ Double space here -----+ >of information exposed via this new API. > >RFC v2: > - wrap the skb into an opaque structure (Jiri); > - allow the serial number of be any length (Jiri & Andrew); > - add driver name (Jonathan). > >Signed-off-by: Jakub Kicinski >--- > include/net/devlink.h | 18 ++++++ > include/uapi/linux/devlink.h | 5 ++ > net/core/devlink.c | 114 +++++++++++++++++++++++++++++++++++ > 3 files changed, 137 insertions(+) > >diff --git a/include/net/devlink.h b/include/net/devlink.h >index 85c9eabaf056..5ef3570a3859 100644 >--- a/include/net/devlink.h >+++ b/include/net/devlink.h >@@ -429,6 +429,7 @@ enum devlink_param_wol_types { > } > > struct devlink_region; >+struct devlink_info_req; > > typedef void devlink_snapshot_data_dest_t(const void *data); > >@@ -484,6 +485,8 @@ struct devlink_ops { > int (*eswitch_encap_mode_get)(struct devlink *devlink, u8 *p_encap_mode); > int (*eswitch_encap_mode_set)(struct devlink *devlink, u8 encap_mode, > struct netlink_ext_ack *extack); >+ int (*info_get)(struct devlink *devlink, struct devlink_info_req *req, >+ struct netlink_ext_ack *extack); > }; > > static inline void *devlink_priv(struct devlink *devlink) >@@ -607,6 +610,10 @@ u32 devlink_region_shapshot_id_get(struct devlink *devlink); > int devlink_region_snapshot_create(struct devlink_region *region, u64 data_len, > u8 *data, u32 snapshot_id, > devlink_snapshot_data_dest_t *data_destructor); >+int devlink_info_report_serial_number(struct devlink_info_req *req, >+ const char *sn); I don't like the "report" part. The rest of the code uses "put". Also. I think that verb should be at the end of the function name, as it is common in the rest of the code. So please rename to: devlink_info_serial_number_put() Same for the rest. >+int devlink_info_report_driver_name(struct devlink_info_req *req, >+ const char *name); > > #else > >@@ -905,6 +912,17 @@ devlink_region_snapshot_create(struct devlink_region *region, u64 data_len, > return 0; > } > >+static inline int >+devlink_info_report_driver_name(struct devlink_info_req *req, const char *name) >+{ >+ return 0; >+} >+ >+static inline int >+devlink_info_report_serial_number(struct devlink_info_req *req, const char *sn) >+{ >+ return 0; >+} > #endif > > #endif /* _NET_DEVLINK_H_ */ >diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h >index 61b4447a6c5b..fd089baa7c50 100644 >--- a/include/uapi/linux/devlink.h >+++ b/include/uapi/linux/devlink.h >@@ -94,6 +94,8 @@ enum devlink_command { > DEVLINK_CMD_PORT_PARAM_NEW, > DEVLINK_CMD_PORT_PARAM_DEL, > >+ DEVLINK_CMD_INFO_GET, /* can dump */ >+ > /* add new commands above here */ > __DEVLINK_CMD_MAX, > DEVLINK_CMD_MAX = __DEVLINK_CMD_MAX - 1 >@@ -290,6 +292,9 @@ enum devlink_attr { > DEVLINK_ATTR_REGION_CHUNK_ADDR, /* u64 */ > DEVLINK_ATTR_REGION_CHUNK_LEN, /* u64 */ > >+ DEVLINK_ATTR_INFO_DRV_NAME, /* string */ Please be consistent across the names of function, attr etc. So: DEVLINK_ATTR_INFO_DRIVER_NAME, Otherwise, this looks good. Thanks! [...]