From patchwork Wed Jun 24 10:40:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 217197 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=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, 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 9662EC433DF for ; Wed, 24 Jun 2020 10:40:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6CF252088E for ; Wed, 24 Jun 2020 10:40:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592995223; bh=/LuP1CKMXdtgZUDTYAu2VlJFVHifJlNcs9/SpCpdqzU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=GuffDNrsBuaD7A6m25mh4x+HFkp/+77rYAq3ewUu2UC8ttuYjzZnRs2SEabUwyH0N SIBgzp9l+QPYltX6x6zYHaZtVe1ASPpZ6LrZ4ejVzIVlO8y27GWJWYuYRokqDSknwc XxrOY2z3pdJ7v5ZwUgrmwyiwInLXoWAUg/tTwlOI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390445AbgFXKkW (ORCPT ); Wed, 24 Jun 2020 06:40:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:60076 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388197AbgFXKkV (ORCPT ); Wed, 24 Jun 2020 06:40:21 -0400 Received: from localhost (unknown [213.57.247.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B3FF820644; Wed, 24 Jun 2020 10:40:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592995221; bh=/LuP1CKMXdtgZUDTYAu2VlJFVHifJlNcs9/SpCpdqzU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=clENcuFgJfi9vdrHOfJH/jfZsNMmZQehsIINg2HVTZLkZDZ6BU1wqiBqpcer3Ln93 Icads1/WfK0CYfp0xx/B/5fNnCDcEeH8r6OuxKiWZwXXBFYsWX0b2Rfb7u12NBRIi8 JZ2ok6HSoU0ynHnG4JA30veEd217MVg0pd2UAhDY= From: Leon Romanovsky To: David Ahern Cc: Maor Gottlieb , Doug Ledford , Jason Gunthorpe , linux-netdev , RDMA mailing list Subject: [PATCH iproute2-next v1 1/4] rdma: update uapi headers Date: Wed, 24 Jun 2020 13:40:09 +0300 Message-Id: <20200624104012.1450880-2-leon@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200624104012.1450880-1-leon@kernel.org> References: <20200624104012.1450880-1-leon@kernel.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Maor Gottlieb Update rdma_netlink.h file upto kernel commit ba1f4991cc55 ("RDMA: Add support to dump resource tracker in RAW format") Signed-off-by: Maor Gottlieb Signed-off-by: Leon Romanovsky --- rdma/include/uapi/rdma/rdma_netlink.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rdma/include/uapi/rdma/rdma_netlink.h b/rdma/include/uapi/rdma/rdma_netlink.h index ae5a77a1..fe127b88 100644 --- a/rdma/include/uapi/rdma/rdma_netlink.h +++ b/rdma/include/uapi/rdma/rdma_netlink.h @@ -287,6 +287,12 @@ enum rdma_nldev_command { RDMA_NLDEV_CMD_STAT_DEL, + RDMA_NLDEV_CMD_RES_QP_GET_RAW, /* can dump */ + + RDMA_NLDEV_CMD_RES_CQ_GET_RAW, /* can dump */ + + RDMA_NLDEV_CMD_RES_MR_GET_RAW, /* can dump */ + RDMA_NLDEV_NUM_OPS }; @@ -525,6 +531,8 @@ enum rdma_nldev_attr { */ RDMA_NLDEV_ATTR_DEV_DIM, /* u8 */ + RDMA_NLDEV_ATTR_RES_RAW, /* binary */ + /* * Always the end */ From patchwork Wed Jun 24 10:40:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 217196 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=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, 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 F34E2C433E1 for ; Wed, 24 Jun 2020 10:40:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C2B4E20644 for ; Wed, 24 Jun 2020 10:40:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592995231; bh=tGK1okVPgt2njxAjuzlmFZ/M+OmmEZMahmYSAsSFUcU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=v5OYSWgupgitU5UL0PyuMD84W5b3alOaJWOgrZyZ313x0Ri8O46AO2DpgGWrvm8BD YGAfyNZogQ0N6raoxSV4Eel7pmc5t5GtEdga43GY05+nXoxMVUpSn0Oc6h4gAcAri1 YEfeH61rxrIkMAmMHwNdM80SWqbNY06EY5KWtpuE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390510AbgFXKkb (ORCPT ); Wed, 24 Jun 2020 06:40:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:60148 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390493AbgFXKka (ORCPT ); Wed, 24 Jun 2020 06:40:30 -0400 Received: from localhost (unknown [213.57.247.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 82CEA20CC7; Wed, 24 Jun 2020 10:40:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592995229; bh=tGK1okVPgt2njxAjuzlmFZ/M+OmmEZMahmYSAsSFUcU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YCcTDVAKWNx5JlH3Stk520PRPzIL+tiOgl08FqUoH9ILd4gXhgtheF7xbADGDaV2x iWfw3ydM/4myR8sk7emzWlOmX5ihlOX3svmZau0aHIvRWDmVcWsE09rj9h1tyanAMI qE/Usamp0EZuJFwe9gS3ru5Qzno7lssLheOrjGFk= From: Leon Romanovsky To: David Ahern Cc: Maor Gottlieb , Doug Ledford , Jason Gunthorpe , linux-netdev , RDMA mailing list Subject: [PATCH iproute2-next v1 3/4] rdma: Add support to get CQ in raw format Date: Wed, 24 Jun 2020 13:40:11 +0300 Message-Id: <20200624104012.1450880-4-leon@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200624104012.1450880-1-leon@kernel.org> References: <20200624104012.1450880-1-leon@kernel.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Maor Gottlieb Add the required support to print CQ data in raw format. Example: $rdma res show cq dev mlx5_2 cqn 1 -r -j [{"ifindex":8,"ifname":"mlx5_2", "data":[0,4,255,254,0,0,0,0,0,0,0,0,16,28,...]}] Signed-off-by: Maor Gottlieb Signed-off-by: Leon Romanovsky --- rdma/res-cq.c | 20 ++++++++++++++++++-- rdma/res.h | 2 ++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/rdma/res-cq.c b/rdma/res-cq.c index e1efe3ba..313f929a 100644 --- a/rdma/res-cq.c +++ b/rdma/res-cq.c @@ -39,6 +39,20 @@ static void print_cq_dim_setting(struct rd *rd, struct nlattr *attr) print_on_off(rd, "adaptive-moderation", dim_setting); } +static int res_cq_line_raw(struct rd *rd, const char *name, int idx, + struct nlattr **nla_line) +{ + if (!nla_line[RDMA_NLDEV_ATTR_RES_RAW]) + return MNL_CB_ERROR; + + open_json_object(NULL); + print_dev(rd, idx, name); + print_raw_data(rd, nla_line); + newline(rd); + + return MNL_CB_OK; +} + static int res_cq_line(struct rd *rd, const char *name, int idx, struct nlattr **nla_line) { @@ -128,7 +142,8 @@ int res_cq_idx_parse_cb(const struct nlmsghdr *nlh, void *data) name = mnl_attr_get_str(tb[RDMA_NLDEV_ATTR_DEV_NAME]); idx = mnl_attr_get_u32(tb[RDMA_NLDEV_ATTR_DEV_INDEX]); - return res_cq_line(rd, name, idx, tb); + return (rd->show_raw) ? res_cq_line_raw(rd, name, idx, tb) : + res_cq_line(rd, name, idx, tb); } int res_cq_parse_cb(const struct nlmsghdr *nlh, void *data) @@ -156,7 +171,8 @@ int res_cq_parse_cb(const struct nlmsghdr *nlh, void *data) if (ret != MNL_CB_OK) break; - ret = res_cq_line(rd, name, idx, nla_line); + ret = (rd->show_raw) ? res_cq_line_raw(rd, name, idx, nla_line) : + res_cq_line(rd, name, idx, nla_line); if (ret != MNL_CB_OK) break; diff --git a/rdma/res.h b/rdma/res.h index 24eee2a1..bb0f19e0 100644 --- a/rdma/res.h +++ b/rdma/res.h @@ -31,6 +31,8 @@ static inline uint32_t res_get_command(uint32_t command, struct rd *rd) switch (command) { case RDMA_NLDEV_CMD_RES_QP_GET: return RDMA_NLDEV_CMD_RES_QP_GET_RAW; + case RDMA_NLDEV_CMD_RES_CQ_GET: + return RDMA_NLDEV_CMD_RES_CQ_GET_RAW; default: return command; }