From patchwork Sun Oct 29 01:14:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 10031195 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 13B0E60249 for ; Sun, 29 Oct 2017 01:15:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 05EF02883D for ; Sun, 29 Oct 2017 01:15:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EEEB12888D; Sun, 29 Oct 2017 01:15:09 +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 8BCC92883D for ; Sun, 29 Oct 2017 01:15:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751759AbdJ2BPI (ORCPT ); Sat, 28 Oct 2017 21:15:08 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:52666 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751501AbdJ2BPG (ORCPT ); Sat, 28 Oct 2017 21:15:06 -0400 Received: by mail-pf0-f194.google.com with SMTP id e64so7789281pfk.9 for ; Sat, 28 Oct 2017 18:15:05 -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=d532XQGaaLBhyB9pSoBuW62K7yClZoUbfQyOxURxS4c=; b=S4O1IRfAYqH5JphZPShGjveqW1PweN5ZGPR98uYuEE0vvdtCQZguR21CGM5OwXuqo9 FKLiia/BpgNUcgtEauKDBwzxmveM9az0PkYzFMI5NRHqyIxZzgx/KunfciNTCtFyZHZn jM6OHY7acmcWJ/VoGSLzGHZYlO6JnxG10e6CuEsnu4aJplwjD4i12W5Ymzs4bJlbfK4U rUSXpb/epyIZwE877MvElkf5zh8iOq63LyXjsADu07XuXcdzYdb6eRT7veUKoY++72Ks VTSGAX6OW6SUeBV5IFL8AAA+ztkVbmpSAP/6RIko2vRG7frLylEtUMNQMvO7lwirVLtw DCRQ== 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=d532XQGaaLBhyB9pSoBuW62K7yClZoUbfQyOxURxS4c=; b=SwunHnx90U6pPlU6N5UCbQGgrLL5Jdvi7oVoZxzltMyyRM/DFtpTUWTsZtDi6tIBN/ +vKDJnJJP9eRsDCrWbNrDCCVkL17B81fpVCPxDy9SgNEXlyA2QupLOnTd0S+KGOWellT 4CTbwKP09kPKHe0GJmpr70LrGYfSq67JLLQA4aSe0YYGjnrQ+4kYNbmGPjEn4gGYxF8u 0GaXNtHBgE1TQZdaN875xNtbD0N627vG4vKg9ZgrDid7OUNnuEvh0bJXUqDeiHEeLV40 F3Eys9v/3tFVW8YWqSmlDhauLCzQ5hr6LyY1CUu3LN0jfPT2CixrMnA1FZgqBZPtnpny F+zg== X-Gm-Message-State: AMCzsaXMQjNPqyIX7Klo8cyfg3kayTE5BIVhycl1IrgK7Q6EhNux2OTi zrxWloYSVJ90rjr1LNI66+oXDA== X-Google-Smtp-Source: ABhQp+R7LpZm/S3oTNblC4eaeM/l8Ez1Vu4rtP4w592EcwYiZ1erdHIHKsBBED/xw7JzsTuVCzKZFA== X-Received: by 10.98.214.143 with SMTP id a15mr4723814pfl.154.1509239705301; Sat, 28 Oct 2017 18:15:05 -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.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 28 Oct 2017 18:15:04 -0700 (PDT) From: James Smart To: linux-scsi@vger.kernel.org Cc: James Smart , James Smart Subject: [PATCH 2/5] nvmet_fc: support transport subsystem events Date: Sat, 28 Oct 2017 18:14:53 -0700 Message-Id: <20171029011456.12885-3-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 This patch adds support for transport events to signal discovery controller changes. Add new lldd api for a subsystem change. The lldd is to generate the appropriate RSCN for the FC-NVME targetport. Add transport op for discov_chg callback from the nvmet layer. Signed-off-by: James Smart --- drivers/nvme/target/fc.c | 10 ++++++++++ include/linux/nvme-fc-driver.h | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c index 58e010bdda3e..590133c35d11 100644 --- a/drivers/nvme/target/fc.c +++ b/drivers/nvme/target/fc.c @@ -2546,6 +2546,15 @@ nvmet_fc_remove_port(struct nvmet_port *port) nvmet_fc_tgtport_put(tgtport); } +static void +nvmet_fc_port_subsys_event(struct nvmet_port *port) +{ + struct nvmet_fc_tgtport *tgtport = port->priv; + + if (tgtport && tgtport->ops->nvme_subsystem_change) + tgtport->ops->nvme_subsystem_change(&tgtport->fc_target_port); +} + static struct nvmet_fabrics_ops nvmet_fc_tgt_fcp_ops = { .owner = THIS_MODULE, .type = NVMF_TRTYPE_FC, @@ -2554,6 +2563,7 @@ static struct nvmet_fabrics_ops nvmet_fc_tgt_fcp_ops = { .remove_port = nvmet_fc_remove_port, .queue_response = nvmet_fc_fcp_nvme_cmd_done, .delete_ctrl = nvmet_fc_delete_ctrl, + .discov_chg = nvmet_fc_port_subsys_event, }; static int __init nvmet_fc_init_module(void) diff --git a/include/linux/nvme-fc-driver.h b/include/linux/nvme-fc-driver.h index 2be4db353937..ac9d7f190650 100644 --- a/include/linux/nvme-fc-driver.h +++ b/include/linux/nvme-fc-driver.h @@ -344,6 +344,11 @@ struct nvme_fc_remote_port { * indicating an FC transport Aborted status. * Entrypoint is Mandatory. * + * @nvme_subsystem_change: Called by the transport to generate FC state change + * notifications to NVME initiators. The state change notifications should + * cause the initiator to reconnect to the discovery controller on the + * targetport to look for new discovery log records. + * * @max_hw_queues: indicates the maximum number of hw queues the LLDD * supports for cpu affinitization. * Value is Mandatory. Must be at least 1. @@ -856,6 +861,7 @@ struct nvmet_fc_target_template { struct nvmefc_tgt_fcp_req *fcpreq); void (*defer_rcv)(struct nvmet_fc_target_port *tgtport, struct nvmefc_tgt_fcp_req *fcpreq); + void (*nvme_subsystem_change)(struct nvmet_fc_target_port *tgtport); u32 max_hw_queues; u16 max_sgl_segments;