From patchwork Tue May 1 18:00:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Verma, Vishal L" X-Patchwork-Id: 10374275 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 72EA060540 for ; Tue, 1 May 2018 18:00:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62EB928D1F for ; Tue, 1 May 2018 18:00:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5682428D3B; Tue, 1 May 2018 18:00:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1239428D23 for ; Tue, 1 May 2018 18:00:34 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 0D1F7203B8BFE; Tue, 1 May 2018 11:00:34 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=vishal.l.verma@intel.com; receiver=linux-nvdimm@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id BEA76203B8BEA for ; Tue, 1 May 2018 11:00:32 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 May 2018 11:00:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,352,1520924400"; d="scan'208";a="36648264" Received: from vverma7-mobl4.lm.intel.com ([10.254.177.224]) by fmsmga008.fm.intel.com with ESMTP; 01 May 2018 11:00:32 -0700 From: Vishal Verma To: Subject: [ndctl PATCH 1/4] libndctl, ars: add an API to retrieve clear_err_unit Date: Tue, 1 May 2018 12:00:20 -0600 Message-Id: <20180501180023.30193-2-vishal.l.verma@intel.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180501180023.30193-1-vishal.l.verma@intel.com> References: <20180501180023.30193-1-vishal.l.verma@intel.com> X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP The ars_cap command contains a field called clear_err_unit which is the unit in which internal ARS related operations are carried out. In preparation for the error injection reworks, provide an API to expose this value to users. Cc: Dan Williams Signed-off-by: Vishal Verma --- ndctl/lib/ars.c | 15 +++++++++++++++ ndctl/lib/libndctl.sym | 5 +++++ ndctl/libndctl.h | 1 + 3 files changed, 21 insertions(+) diff --git a/ndctl/lib/ars.c b/ndctl/lib/ars.c index d53d898..1ff6cf7 100644 --- a/ndctl/lib/ars.c +++ b/ndctl/lib/ars.c @@ -180,6 +180,21 @@ NDCTL_EXPORT int ndctl_cmd_ars_cap_get_range(struct ndctl_cmd *ars_cap, return -EINVAL; } +NDCTL_EXPORT unsigned int ndctl_cmd_ars_cap_get_clear_unit( + struct ndctl_cmd *ars_cap) +{ + struct ndctl_ctx *ctx = ndctl_bus_get_ctx(cmd_to_bus(ars_cap)); + + if (ars_cap->type == ND_CMD_ARS_CAP && ars_cap->status == 0) { + dbg(ctx, "clear_err_unit: %d\n", + ars_cap->ars_cap->clear_err_unit); + return ars_cap->ars_cap->clear_err_unit; + } + + dbg(ctx, "invalid ars_cap\n"); + return 0; +} + NDCTL_EXPORT int ndctl_cmd_ars_in_progress(struct ndctl_cmd *cmd) { struct ndctl_ctx *ctx = ndctl_bus_get_ctx(cmd_to_bus(cmd)); diff --git a/ndctl/lib/libndctl.sym b/ndctl/lib/libndctl.sym index 65e735f..92822be 100644 --- a/ndctl/lib/libndctl.sym +++ b/ndctl/lib/libndctl.sym @@ -359,3 +359,8 @@ global: ndctl_bus_start_scrub; ndctl_region_deep_flush; } LIBNDCTL_14; + +LIBNDCTL_16 { +global: + ndctl_cmd_ars_cap_get_clear_unit; +} LIBNDCTL_15; diff --git a/ndctl/libndctl.h b/ndctl/libndctl.h index 498ae19..74fe0f4 100644 --- a/ndctl/libndctl.h +++ b/ndctl/libndctl.h @@ -209,6 +209,7 @@ struct ndctl_cmd *ndctl_bus_cmd_new_clear_error(unsigned long long address, unsigned long long len, struct ndctl_cmd *ars_cap); unsigned long long ndctl_cmd_clear_error_get_cleared( struct ndctl_cmd *clear_err); +unsigned int ndctl_cmd_ars_cap_get_clear_unit(struct ndctl_cmd *ars_cap); /* * Note: ndctl_cmd_smart_get_temperature is an alias for