From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 30D0BC43458 for ; Thu, 2 Jul 2026 18:00:12 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4grl5c3n08z2ynW; Fri, 03 Jul 2026 03:59:48 +1000 (AEST) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip="2600:3c04:e001:324:0:1991:8:25" ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1783015188; cv=none; b=m+4HtDqB517+6gMQhpTJCLmq/vNiopNHYbzJXf6Ik5clH+T9VrVz72Dl/ka8/oQMrII3TrHQ4ry5PGXcH9ByPhH8BgSNCqWINruuriiU/ugNaSOXfJ5VxGVkCdYF0/BPN3z7muEg5dd7UXgTKo4SFEPzgpKD+tSwt6bCBxJarZgD72La+4Ysr10VjlCfeMoe9zLIUA3WirSVaKbFIxhqgktk/sfbUVRshWGOR0ExTs99/nDBaYtLJEqjJ/RbQ/lU9n+86eygkh3Ik9y/QujBqcY3ghZb1aBycOzMPceb3hcv5zs/5ocmL48rsXL24UMDRQtSu4VSt5UIHWEszCUKZQ== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1783015188; c=relaxed/relaxed; bh=vqEOkKJ85EJpflBIoQwK56D/aBPRNHxFBZr7rSDoGpY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BiYvs85zWmlai4Ui+L1/sRRsO7haTyPEPVE0DnTkxOlOfupSNLhJIk1jBIeYjKiT5zNSiUHXT5jhg3S7Go+JmKYO0OqHzjybUZX4ioyFkwKxC0/tRi6gNaKmEomdjNk5fV3jaW+srXkxckvljrc3QJala7N875l6yDaY60FHAfRnaCZzyGDrc0wqHVxU6UPivXkXo2z7+d8Xy7Ww/DJvc2totjr8iQw2KkiS+RJxNTcRWj3evpzPg72lB2VPVrDkcRv4oAM1GP55c0BXCDOw+JVPhJcP1WebVMu/uqgnyj0tC4C9QrPNRs4TjdAqv04OTW8Y+jDBuMCng92H9kJ1zg== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=hlCHwBUt; dkim-atps=neutral; spf=pass (client-ip=2600:3c04:e001:324:0:1991:8:25; helo=tor.source.kernel.org; envelope-from=devnull+davemarq.linux.ibm.com@kernel.org; receiver=lists.ozlabs.org) smtp.mailfrom=kernel.org Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=hlCHwBUt; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=2600:3c04:e001:324:0:1991:8:25; helo=tor.source.kernel.org; envelope-from=devnull+davemarq.linux.ibm.com@kernel.org; receiver=lists.ozlabs.org) Received: from tor.source.kernel.org (tor.source.kernel.org [IPv6:2600:3c04:e001:324:0:1991:8:25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4grl5V5vkrz2xLq for ; Fri, 03 Jul 2026 03:59:42 +1000 (AEST) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id A0BE3601FA; Thu, 2 Jul 2026 17:59:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 3B4F1C19425; Thu, 2 Jul 2026 17:59:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1783015179; bh=V+wPl3lU6j8XsgO+L2eYLHk+nELXYJI0hF5MDCNy82k=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=hlCHwBUtSYYfMMBKi5KjAC5GqdR/WELXaR/UJ7Q6Ym1QouP3IdAS3a33MPllAFDEV vJciWuYaesUUNrdk+j3tPReN5d43cvGE99Rh62V+8sc1OKQRlhs525AORk6hSQcCUv QNQjQWWDWGGt9L2rXS+RhGel9GgLQ4dgog+YligVQA1qJ/WjuF6SOIxcN45kipUliB XwEArndVSj1YGCCAZQbeJKGIhj9cbQTLL+PuFpPJt7wTxp9cul6JEGGpZDZ68wXey8 56GsrDgGgZWgivI7T6aqMyylcw/gsXrbnsdt/aP5l1s/aZmhtQbp0CgEQIhehBvprb D9Y0DC5ZvCnfA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22E22C44501; Thu, 2 Jul 2026 17:59:39 +0000 (UTC) From: Dave Marquardt via B4 Relay Date: Thu, 02 Jul 2026 12:59:33 -0500 Subject: [PATCH v3 3/8] ibmvfc: make ibmvfc login to fabric X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , List-Unsubscribe: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260702-ibmvfc-fpin-support-v3-3-d95b9547cf88@linux.ibm.com> References: <20260702-ibmvfc-fpin-support-v3-0-d95b9547cf88@linux.ibm.com> In-Reply-To: <20260702-ibmvfc-fpin-support-v3-0-d95b9547cf88@linux.ibm.com> To: "James E.J. Bottomley" , "Martin K. Petersen" , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , "Christophe Leroy (CS GROUP)" , Tyrel Datwyler Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Brian King , Greg Joyce , Kyle Mahlkuch , Dave Marquardt X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1783015177; l=6265; i=davemarq@linux.ibm.com; s=20260216; h=from:subject:message-id; bh=rpPIEOvujTN+WgE8x24oWzRqWZEfZ3GVbDXgfk/DC3E=; b=ob37cDCQCl6ov7R/bF1mNfJXvEwFvhMST7Bta7d0TJs/ypUBN01I2QWP7ToofWyPF3OLozOjp HnJHZbjVfOhBzRPZdWXItGL8gJ2qxcH02khGfdRbeFfZNvFu3TSVMWr X-Developer-Key: i=davemarq@linux.ibm.com; a=ed25519; pk=vy0/nfobrje6EqZxuyw6a3ZstytG8WK2vf5Y3xtGrEg= X-Endpoint-Received: by B4 Relay for davemarq@linux.ibm.com/20260216 with auth_id=689 X-Original-From: Dave Marquardt Reply-To: davemarq@linux.ibm.com From: Dave Marquardt Add support for fabric login in order to support the asynchronous event queue with its own interrupt as required by NPIV specification to support the asynchronous sub-queue and interrupt and full and extended FPIN messages. Signed-off-by: Dave Marquardt --- drivers/scsi/ibmvscsi/ibmvfc.c | 96 ++++++++++++++++++++++++++++++++++++++++-- drivers/scsi/ibmvscsi/ibmvfc.h | 17 ++++++++ 2 files changed, 109 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c index 110d77b9aac3..6dd1e726d9b9 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c @@ -5261,6 +5261,88 @@ static void ibmvfc_discover_targets(struct ibmvfc_host *vhost) ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD); } +static void ibmvfc_fabric_login_done(struct ibmvfc_event *evt) +{ + struct ibmvfc_fabric_login *rsp = &evt->xfer_iu->fabric_login; + u32 mad_status = be16_to_cpu(rsp->common.status); + struct ibmvfc_host *vhost = evt->vhost; + int level = IBMVFC_DEFAULT_LOG_LEVEL; + + ENTER; + + switch (mad_status) { + case IBMVFC_MAD_SUCCESS: + fc_host_port_id(vhost->host) = be64_to_cpu(rsp->nport_id); + ibmvfc_free_event(evt); + break; + + case IBMVFC_MAD_FAILED: + if (ibmvfc_retry_cmd(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error))) + level += ibmvfc_retry_host_init(vhost); + else + ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD); + ibmvfc_log(vhost, level, "Fabric Login failed: %s (%x:%x)\n", + ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)), + be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)); + ibmvfc_free_event(evt); + LEAVE; + return; + + case IBMVFC_MAD_CRQ_ERROR: + ibmvfc_retry_host_init(vhost); + fallthrough; + + case IBMVFC_MAD_DRIVER_FAILED: + ibmvfc_free_event(evt); + LEAVE; + return; + + default: + dev_err(vhost->dev, "Invalid fabric Login response: 0x%x\n", mad_status); + ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD); + ibmvfc_free_event(evt); + LEAVE; + return; + } + + ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_QUERY); + wake_up(&vhost->work_wait_q); + + LEAVE; +} + +static void ibmvfc_fabric_login(struct ibmvfc_host *vhost) +{ + struct ibmvfc_fabric_login *mad; + struct ibmvfc_event *evt; + int level = IBMVFC_DEFAULT_LOG_LEVEL; + + if (vhost->scsi_scrqs.protocol != IBMVFC_PROTO_SCSI) { + ibmvfc_log(vhost, level, "Fabric Login failed: unknown protocol\n"); + ibmvfc_hard_reset_host(vhost); + return; + } + + evt = ibmvfc_get_reserved_event(&vhost->crq); + if (!evt) { + ibmvfc_log(vhost, level, "Fabric Login failed: no available events\n"); + ibmvfc_hard_reset_host(vhost); + return; + } + + ibmvfc_init_event(evt, ibmvfc_fabric_login_done, IBMVFC_MAD_FORMAT); + mad = &evt->iu.fabric_login; + memset(mad, 0, sizeof(*mad)); + mad->common.opcode = cpu_to_be32(IBMVFC_FABRIC_LOGIN); + mad->common.version = cpu_to_be32(1); + mad->common.length = cpu_to_be16(sizeof(*mad)); + + ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_INIT_WAIT); + + if (ibmvfc_send_event(evt, vhost, default_timeout)) + ibmvfc_link_down(vhost, IBMVFC_LINK_DOWN); +} + static void ibmvfc_channel_setup_done(struct ibmvfc_event *evt) { struct ibmvfc_host *vhost = evt->vhost; @@ -5307,8 +5389,12 @@ static void ibmvfc_channel_setup_done(struct ibmvfc_event *evt) return; } - ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_QUERY); - wake_up(&vhost->work_wait_q); + if (ibmvfc_check_caps(vhost, IBMVFC_SUPPORT_SCSI)) { + ibmvfc_fabric_login(vhost); + } else { + ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_QUERY); + wake_up(&vhost->work_wait_q); + } } static void ibmvfc_channel_setup(struct ibmvfc_host *vhost) @@ -5499,9 +5585,11 @@ static void ibmvfc_npiv_login_done(struct ibmvfc_event *evt) vhost->host->can_queue = be32_to_cpu(rsp->max_cmds) - IBMVFC_NUM_INTERNAL_REQ; vhost->host->max_sectors = npiv_max_sectors; - if (ibmvfc_check_caps(vhost, IBMVFC_CAN_SUPPORT_CHANNELS) && vhost->do_enquiry) { + if (ibmvfc_check_caps(vhost, IBMVFC_CAN_SUPPORT_CHANNELS) && vhost->do_enquiry) ibmvfc_channel_enquiry(vhost); - } else { + else if (ibmvfc_check_caps(vhost, IBMVFC_SUPPORT_SCSI)) + ibmvfc_fabric_login(vhost); + else { vhost->do_enquiry = 0; ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_QUERY); wake_up(&vhost->work_wait_q); diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h index 526632cb7237..adfd67e85af8 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h @@ -138,6 +138,7 @@ enum ibmvfc_mad_types { IBMVFC_CHANNEL_ENQUIRY = 0x1000, IBMVFC_CHANNEL_SETUP = 0x2000, IBMVFC_CONNECTION_INFO = 0x4000, + IBMVFC_FABRIC_LOGIN = 0x8000, }; struct ibmvfc_mad_common { @@ -180,6 +181,7 @@ struct ibmvfc_npiv_login { #define IBMVFC_CAN_HANDLE_FPIN 0x004 #define IBMVFC_CAN_USE_MAD_VERSION 0x008 #define IBMVFC_CAN_SEND_VF_WWPN 0x010 +#define IBMVFC_YES_SCSI 0x040 #define IBMVFC_CAN_USE_NOOP_CMD 0x200 __be64 node_name; struct srp_direct_buf async; @@ -227,6 +229,7 @@ struct ibmvfc_npiv_login_resp { #define IBMVFC_MAD_VERSION_CAP 0x0020 #define IBMVFC_HANDLE_VF_WWPN 0x0040 #define IBMVFC_CAN_SUPPORT_CHANNELS 0x0080 +#define IBMVFC_SUPPORT_SCSI 0x0200 #define IBMVFC_SUPPORT_NOOP_CMD 0x1000 __be32 max_cmds; __be32 scsi_id_sz; @@ -590,6 +593,19 @@ struct ibmvfc_connection_info { __be64 reserved[16]; } __packed __aligned(8); +struct ibmvfc_fabric_login { + struct ibmvfc_mad_common common; + __be64 flags; +#define IBMVFC_STRIP_MERGE 0x1 +#define IBMVFC_LINK_COMMANDS 0x2 + __be64 capabilities; + __be64 nport_id; + __be16 status; + __be16 error; + __be32 pad; + __be64 reserved[16]; +} __packed __aligned(8); + struct ibmvfc_trace_start_entry { u32 xfer_len; } __packed; @@ -715,6 +731,7 @@ union ibmvfc_iu { struct ibmvfc_channel_enquiry channel_enquiry; struct ibmvfc_channel_setup_mad channel_setup; struct ibmvfc_connection_info connection_info; + struct ibmvfc_fabric_login fabric_login; } __packed __aligned(8); enum ibmvfc_target_action { -- 2.54.0