From patchwork Sun Oct 29 01:14:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 10031201 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 AE43460249 for ; Sun, 29 Oct 2017 01:15:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9FCF42883D for ; Sun, 29 Oct 2017 01:15:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 949F02888D; Sun, 29 Oct 2017 01:15:14 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 348F12883D for ; Sun, 29 Oct 2017 01:15:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751646AbdJ2BPN (ORCPT ); Sat, 28 Oct 2017 21:15:13 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:44480 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751755AbdJ2BPI (ORCPT ); Sat, 28 Oct 2017 21:15:08 -0400 Received: by mail-pf0-f196.google.com with SMTP id x7so7805131pfa.1 for ; Sat, 28 Oct 2017 18:15:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jxNBgFGogCEL1MOVj9cr0dpAP0q3KJTfglCsTClmOLI=; b=XemLr41P/JdS6BVJ6Rc+3nlNipVHV9NFnIP/0ZWsrRQ8SJxOUZXXif8/Bsd8RMZ7pY xbWeGnMp777n4zYGZxUEybLnU9sc1Zd/Tbfq8fgzrErX4tYrB/V0GbLwJ3oMk3SnUy/3 lnNZyPqYlKzlAggHTDGMUf6+VocO3CulSfTqlIJJyjg4oR+ON5SuRcHSHg/Uhwoi8DhC v8+9Qx+HVpXE8hcJqwy6XI5ZS+AFBUcIivFYPqb6vaobdbjs/8sLxwfC8+DF743tDiYw ulWGMjxyJntB8rNKwkZr+JZYrmNGkGF2DWZoBzjZB40GNx6pKiZBuHasrhiMbSDnzCjM XH5g== 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=jxNBgFGogCEL1MOVj9cr0dpAP0q3KJTfglCsTClmOLI=; b=s9UyRmYEyWJqfQIik3vICpHyukjWAkVin/nCj6VzeQLoaRH+Co5kSrN6+tY74HwJ3W 57hF33NtsFOsoVDymGBeatf3SPYWqrmjQ6LBdPwKRLD5Bh6tAkBIUXssC7NyvzdfkGBj /jAP4VPFFeNDc59054aarizEffjsYi+tsw9pejx6eTEDFO0cuHM+9ZOVZvA0lSI9tdjm gyYSp3tonNHwFxrleSz9Zv7CH3/obtXlpJHu90pKT/jGrnvAFr28vciPmiL9O8oVnJE5 OFXFY/ADO/e7GyLL4+36Dg/0oMPVNuULWknc7ga3L6BkiF8gZjy8ElJvWh7NsQPIl5bT w7qg== X-Gm-Message-State: AMCzsaU891M1HXB1BB+HCQkWFA+iMZ861hzlZTijrbkq2R9hAjFPt6Vv SmgCiA0qshmOwDtX5Qg5a0z66Q== X-Google-Smtp-Source: ABhQp+TKFhEYNC/2zBODIyvOkk699hCfRyhqZaOaAAKmMbyjmgE7jyIH2Xlu+gPdUabE2jothf8Ejw== X-Received: by 10.98.155.218 with SMTP id e87mr4643779pfk.96.1509239708179; Sat, 28 Oct 2017 18:15:08 -0700 (PDT) Received: from os42.localdomain (ip68-4-115-207.oc.oc.cox.net. [68.4.115.207]) by smtp.gmail.com with ESMTPSA id 74sm24267387pft.184.2017.10.28.18.15.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 28 Oct 2017 18:15:07 -0700 (PDT) From: James Smart To: linux-scsi@vger.kernel.org Cc: Dick Kennedy , James Smart Subject: [PATCH 5/5] lpfc: Add sysfs interface to post NVME RSCN Date: Sat, 28 Oct 2017 18:14:56 -0700 Message-Id: <20171029011456.12885-6-jsmart2021@gmail.com> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20171029011456.12885-1-jsmart2021@gmail.com> References: <20171029011456.12885-1-jsmart2021@gmail.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 From: Dick Kennedy To support scenarios which aren't bound to nvmetcli add port scenarios, which is currently where the transport invokes the nvme_subsystem_changed callback, add a syfs attribute to lpfc which can be written to cause an RSCN to be generated for the nport. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_attr.c | 62 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 157788f0bc10..52d403548a3a 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -781,6 +781,7 @@ struct lpfc_hba { uint32_t cfg_use_msi; uint32_t cfg_auto_imax; uint32_t cfg_fcp_imax; + uint32_t cfg_force_rscn; uint32_t cfg_fcp_cpu_map; uint32_t cfg_fcp_io_channel; uint32_t cfg_suppress_rsp; diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index c17677f494af..6e8e54e65e25 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -4469,6 +4469,66 @@ static DEVICE_ATTR(lpfc_req_fw_upgrade, S_IRUGO | S_IWUSR, lpfc_request_firmware_upgrade_store); /** + * lpfc_force_rscn_store + * + * @dev: class device that is converted into a Scsi_host. + * @attr: device attribute, not used. + * @buf: unused string + * @count: unused variable. + * + * Description: + * Force the switch to send a RSCN to all other NPorts in our zone + * If we are direct connect pt2pt, build the RSCN command ourself + * and send to the other NPort. Not supported for private loop. + * + * Returns: + * 0 - on success + * -EIO - if command is not sent + **/ +static ssize_t +lpfc_force_rscn_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct Scsi_Host *shost = class_to_shost(dev); + struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; + int i; + + i = lpfc_issue_els_rscn(vport, 0); + if (i) + return -EIO; + return strlen(buf); +} + +/* + * lpfc_force_rscn: Force an RSCN to be sent to all remote NPorts + * connected to the HBA. + * + * Value range is any ascii value + */ +static int lpfc_force_rscn; +module_param(lpfc_force_rscn, int, 0644); +MODULE_PARM_DESC(lpfc_force_rscn, + "Force an RSCN to be sent to all remote NPorts"); +lpfc_param_show(force_rscn) + +/** + * lpfc_force_rscn_init - Force an RSCN to be sent to all remote NPorts + * @phba: lpfc_hba pointer. + * @val: unused value. + * + * Returns: + * zero if val saved. + **/ +static int +lpfc_force_rscn_init(struct lpfc_hba *phba, int val) +{ + return 0; +} + +static DEVICE_ATTR(lpfc_force_rscn, 0644, + lpfc_force_rscn_show, lpfc_force_rscn_store); + +/** * lpfc_fcp_imax_store * * @dev: class device that is converted into a Scsi_host. @@ -5218,6 +5278,7 @@ struct device_attribute *lpfc_hba_attrs[] = { &dev_attr_lpfc_nvme_oas, &dev_attr_lpfc_auto_imax, &dev_attr_lpfc_fcp_imax, + &dev_attr_lpfc_force_rscn, &dev_attr_lpfc_fcp_cpu_map, &dev_attr_lpfc_fcp_io_channel, &dev_attr_lpfc_suppress_rsp, @@ -6238,6 +6299,7 @@ lpfc_get_cfgparam(struct lpfc_hba *phba) lpfc_nvme_oas_init(phba, lpfc_nvme_oas); lpfc_auto_imax_init(phba, lpfc_auto_imax); lpfc_fcp_imax_init(phba, lpfc_fcp_imax); + lpfc_force_rscn_init(phba, lpfc_force_rscn); lpfc_fcp_cpu_map_init(phba, lpfc_fcp_cpu_map); lpfc_enable_hba_reset_init(phba, lpfc_enable_hba_reset); lpfc_enable_hba_heartbeat_init(phba, lpfc_enable_hba_heartbeat);