From patchwork Wed May 3 21:03:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 13230585 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A766C77B75 for ; Wed, 3 May 2023 21:05:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229544AbjECVE7 (ORCPT ); Wed, 3 May 2023 17:04:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbjECVE6 (ORCPT ); Wed, 3 May 2023 17:04:58 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3B4B7A94 for ; Wed, 3 May 2023 14:04:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683147846; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=8sEtZ4KKiBJy1POn8D3R9hO+Z4vqPZk3VVqn1QTUgNY=; b=Fl0StGMScfdWS7y8nPnARb6S3q6N7CXoh8IHOnh4Tu8P28pliEzYgly91397z0PeF7J2lL qekDbazPdBtllTwe6jGt423PuBMSNN23CAT83OQf2O4KbsGEzizH1te7imyuzRqak1BgCP 76lc2cHus0ktg3O7FNx1ftsbUGcKvpA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-451-fJg2bl7TOeqo1WYiWd5sJg-1; Wed, 03 May 2023 17:04:05 -0400 X-MC-Unique: fJg2bl7TOeqo1WYiWd5sJg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B3B4710504A5; Wed, 3 May 2023 21:04:04 +0000 (UTC) Received: from fedora-x1.redhat.com (unknown [10.22.10.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B0452166B26; Wed, 3 May 2023 21:04:03 +0000 (UTC) From: Kamal Heib To: Stephen Hemminger Cc: Leon Romanovsky , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, kheib@redhat.com Subject: [PATCH iproute2-next] rdma: Report device protocol Date: Wed, 3 May 2023 17:03:42 -0400 Message-Id: <20230503210342.66155-1-kheib@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Add support for reporting the device protocol. $ rdma dev 11: mlx5_0: node_type ca proto roce fw 12.28.2006 node_guid 248a:0703:004b:f094 sys_image_guid 248a:0703:004b:f094 12: mlx5_1: node_type ca proto ib fw 12.28.2006 node_guid 248a:0703:0049:d4f0 sys_image_guid 248a:0703:0049:d4f0 13: mlx5_2: node_type ca proto ib fw 12.28.2006 node_guid 248a:0703:0049:d4f1 sys_image_guid 248a:0703:0049:d4f0 17: siw0: node_type rnic proto iw node_guid 0200:00ff:fe00:0000 sys_image_guid 0200:00ff:fe00:0000 Signed-off-by: Kamal Heib Acked-by: Leon Romanovsky --- rdma/dev.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/rdma/dev.c b/rdma/dev.c index c684dde4a56f..04c2a574405c 100644 --- a/rdma/dev.c +++ b/rdma/dev.c @@ -189,6 +189,16 @@ static void dev_print_node_type(struct rd *rd, struct nlattr **tb) node_str); } +static void dev_print_dev_proto(struct rd *rd, struct nlattr **tb) +{ + const char *str; + if (!tb[RDMA_NLDEV_ATTR_DEV_PROTOCOL]) + return; + + str = mnl_attr_get_str(tb[RDMA_NLDEV_ATTR_DEV_PROTOCOL]); + print_color_string(PRINT_ANY, COLOR_NONE, "proto", "proto %s ", str); +} + static int dev_parse_cb(const struct nlmsghdr *nlh, void *data) { struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {}; @@ -206,6 +216,7 @@ static int dev_parse_cb(const struct nlmsghdr *nlh, void *data) print_color_string(PRINT_ANY, COLOR_NONE, "ifname", "%s: ", name); dev_print_node_type(rd, tb); + dev_print_dev_proto(rd, tb); dev_print_fw(rd, tb); dev_print_node_guid(rd, tb); dev_print_sys_image_guid(rd, tb);