From patchwork Fri Apr 26 09:37:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10918953 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6DADD1575 for ; Fri, 26 Apr 2019 09:39:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B52928D55 for ; Fri, 26 Apr 2019 09:39:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E36928D69; Fri, 26 Apr 2019 09:39:07 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC03E28D55 for ; Fri, 26 Apr 2019 09:39:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726295AbfDZJjG (ORCPT ); Fri, 26 Apr 2019 05:39:06 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:43925 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725944AbfDZJjG (ORCPT ); Fri, 26 Apr 2019 05:39:06 -0400 Received: by mail-pg1-f195.google.com with SMTP id z9so1346119pgu.10 for ; Fri, 26 Apr 2019 02:39:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PHatEoaMWFs4FZHmh6Wx4FdHzegrx2ZW/QIt/upfph8=; b=A8QUMqJqNzQYTjT1itm5pt+t2cVX73+faBzWIMppLj33FNgbCAhwjAWkKl0sA4Vt07 p7sglyuuRab5BHo7hqjSBSq95447zTg9uDkzsqGy20+IzB+qMSXH+R+fqYuxukGbugRT gc6DZAQ2FswmQsd9Fi+J1n9ykCRSoV3+K1oQI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PHatEoaMWFs4FZHmh6Wx4FdHzegrx2ZW/QIt/upfph8=; b=L5x7r4e5sCqBGgUOIw/BZt1WB1wE3ETk0RlsFSNvZ7sY+8MfXoDr2+edavB4owxTrx Byo7+Aa4RoY6MwzCaMJxredCQOSs3IPYiQLLtfaAq10HH3zoUtFD3NNb95EHfcolB0BO CTYft5qzLrQlU3j8KNkXw54Ojp/RfIsOrnJGhu/6U0bN6xK8q/6c7+VnZoRNXU08ieNH 2my60SgLSVA5iZoDlmuVqp0yGuWrqgo8+AUoDgYVPOWjc0+ZKXhbwNZhTXGhGAI9LfX9 NeeRLJBYnJTY1/vY1vwuIVTsVKz3osRQO949citu4gpip27dWdJBgw0rTXFJE4W4svRt cOxw== X-Gm-Message-State: APjAAAUV/nmT8UUZRzIcJCNsFEqpltwC+8sE19qpF3h/YvEs09Yz8fBN tqp9dOg5QmsoWF2KZT1X2zxV7+9I0LmVIpKqXg8PXc2zaeXr6QGnB8CQLcX4s6MUOt9EciZ9qpu MPpU/IDoxwA2S7Fv2amnt6jvvAMCSB9sVVed08fEokCiatNBc2+9ifMrBB4ZluqlR72cwIHrDoU PQ1vmrZTgKWUjY5n2f6zQD X-Google-Smtp-Source: APXvYqxVbOqnrq9/fcKqJugXLjuKQAVbmJpETBqK5/zNAPnQ/+C5AGvjah+KogZfkgT0I+Ca85b++w== X-Received: by 2002:aa7:8c86:: with SMTP id p6mr19888004pfd.37.1556271545324; Fri, 26 Apr 2019 02:39:05 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r4sm37994649pgl.69.2019.04.26.02.39.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 02:39:04 -0700 (PDT) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, chandrakanth.patil@broadcom.com, Shivasharan S Subject: [PATCH 14/21] megaraid_sas: Export RAID map id through sysfs Date: Fri, 26 Apr 2019 02:37:08 -0700 Message-Id: <1556271435-27252-15-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a sysfs interface to get the raid map index that is being used by driver. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas_base.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 84ec4ab03364..7a903bde2f48 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -3275,6 +3275,18 @@ megasas_dump_system_regs_show(struct device *cdev, return megasas_dump_sys_regs(instance->reg_set, buf); } +static ssize_t +megasas_raid_map_id_show(struct device *cdev, struct device_attribute *attr, + char *buf) +{ + struct Scsi_Host *shost = class_to_shost(cdev); + struct megasas_instance *instance = + (struct megasas_instance *)shost->hostdata; + + return snprintf(buf, PAGE_SIZE, "%ld\n", + (unsigned long)instance->map_id); +} + static DEVICE_ATTR(fw_crash_buffer, S_IRUGO | S_IWUSR, megasas_fw_crash_buffer_show, megasas_fw_crash_buffer_store); static DEVICE_ATTR(fw_crash_buffer_size, S_IRUGO, @@ -3289,6 +3301,8 @@ static DEVICE_ATTR(fw_cmds_outstanding, S_IRUGO, megasas_fw_cmds_outstanding_show, NULL); static DEVICE_ATTR(dump_system_regs, S_IRUGO, megasas_dump_system_regs_show, NULL); +static DEVICE_ATTR(raid_map_id, S_IRUGO, + megasas_raid_map_id_show, NULL); struct device_attribute *megaraid_host_attrs[] = { &dev_attr_fw_crash_buffer_size, @@ -3298,6 +3312,7 @@ struct device_attribute *megaraid_host_attrs[] = { &dev_attr_ldio_outstanding, &dev_attr_fw_cmds_outstanding, &dev_attr_dump_system_regs, + &dev_attr_raid_map_id, NULL, };