From patchwork Tue Feb 2 18:25:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danielle Ratson X-Patchwork-Id: 12062597 X-Patchwork-Delegate: mkubecek+ethtool@suse.cz 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=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,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 E239EC43381 for ; Tue, 2 Feb 2021 18:28:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B10C064F68 for ; Tue, 2 Feb 2021 18:28:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238673AbhBBS2b (ORCPT ); Tue, 2 Feb 2021 13:28:31 -0500 Received: from hqnvemgate26.nvidia.com ([216.228.121.65]:5125 "EHLO hqnvemgate26.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238447AbhBBS01 (ORCPT ); Tue, 2 Feb 2021 13:26:27 -0500 Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Tue, 02 Feb 2021 10:25:35 -0800 Received: from dev-r-vrt-156.mtr.labs.mlnx (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 2 Feb 2021 18:25:33 +0000 From: Danielle Ratson To: CC: , , , , , Danielle Ratson Subject: [PATCH ethtool v2 3/5] netlink: settings: Expose the number of lanes in use Date: Tue, 2 Feb 2021 20:25:11 +0200 Message-ID: <20210202182513.325864-4-danieller@nvidia.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210202182513.325864-1-danieller@nvidia.com> References: <20210202182513.325864-1-danieller@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1612290335; bh=O3XsYI9i7i57xnl0NhZMDMhMKO1byPD2KZ5poayi7KE=; h=From:To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:Content-Type: X-Originating-IP:X-ClientProxiedBy; b=NPhacdgisr2p77R53wdPuhlo/l37TSywxrgu48T0sIBSmbfba+85aXR1o5mzwkme+ Eugn/09LMa3Q0pUYXGOJpSzkFHwBpxLtWOI1HkDlPI5Q5n0MxtCOYNS11H7SzVJuCw EOOZTIirADSrzvvsVoFfMS8l1NEBQ12Vv3hBPRiMSVPJ5W44xtRBvA7GUlZyvnpTQP eLL3T7c67WE0jUxvJnlMfFBYcgDN6cK7/uY5rRQkQ45QZvIq2+CvocFlQVVbfeylX5 yDxYdqMW1yQT/gebzKlhW548lfzzVZzWiZIUzx3zXptAwGpWuyndikvLyER2DASlsp aJmRH5bL3n1OQ== Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: mkubecek+ethtool@suse.cz Currently, the user does not have the information regarding how many lanes are used when the link is up. After adding a possibility to advertise or force a specific number of lanes this information becomes helpful. Expose the number of lanes in use if the information is passed from kernel. Signed-off-by: Danielle Ratson --- Notes: v2: * Remove possibility for printing unknown lanes, as now unknown lanes attribute doesn't pass to netlink. netlink/settings.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/netlink/settings.c b/netlink/settings.c index 6cb5d5b..2ebe4c9 100644 --- a/netlink/settings.c +++ b/netlink/settings.c @@ -474,6 +474,12 @@ int linkmodes_reply_cb(const struct nlmsghdr *nlhdr, void *data) else printf("\tSpeed: %uMb/s\n", val); } + if (tb[ETHTOOL_A_LINKMODES_LANES]) { + uint32_t val = mnl_attr_get_u32(tb[ETHTOOL_A_LINKMODES_LANES]); + + print_banner(nlctx); + printf("\tLanes: %u\n", val); + } if (tb[ETHTOOL_A_LINKMODES_DUPLEX]) { uint8_t val = mnl_attr_get_u8(tb[ETHTOOL_A_LINKMODES_DUPLEX]);