From nobody Fri Jul 24 22:17:37 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D4AFDEEA8; Thu, 23 Jul 2026 00:02:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764924; cv=none; b=U+bCPuVDMBKapFP6QEbhbDDxXf8tr9WSRYFVhwslcw+7Wkszk05VFcmMCmJ4qvuJ1gDMimCabV/m7h9rmYmYM3Z37OOkFUdHUeG8ayhrMeTNwYOhp1pFt22WjgcHizAsy7NV/eE1tv6blTDCZ7t4Ht9kgpdMn3iWASKCD5gDmgI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764924; c=relaxed/simple; bh=kPwMDJfn8oY3sPtqsePW84/vl0bf/i7xxG7ZJicuvm0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PCY+VnWTvqorc+oWcymoPUZvyX1E2m/8vaJyvVMl1vCF6CD5aq2tuW0d8y0jO20njEg0u8ktQEkN6+4GBPt7Zm3DSrB8413u9FLTEIF/9p9Zk3qFSueSvdZBowikIPkn8uK3k12I77WB9tL+IZLiNlAcczX7OtyDfO823NptPX0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=nwp9Anr2; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="nwp9Anr2" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIC26j606737; Thu, 23 Jul 2026 00:01:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=MfXlpQ9U0Pnz7LP8n XUemnalX3ZKpIT95W7d8gsiaeY=; b=nwp9Anr2SdtaXxx5koRl8SdcF4eR9LxJ6 ZCOcsrBAQzM+1aWVNTo0BNrRk/WsxawZJrPA2cHIUaIky9zVCT2Clz0AsPV7jqwM TuImG4cTwzHbKmnCEGsxL3rZ4Zmr6Pgn1qMuBIAlMghEtEVvPPuPC8zMiO+Ca67W 2933dQpTwLYljyHR8PZBHQ1jRmPAISQaFjx0fqMq1PMUvrks8Q2tkze4PWR/PGph 71pE7tyGMamxiqyjFbeciQy7rgzOtXJb1XXFw+6uCBzoikJzIxBa4q8vrdFUh5N9 WcVVQTybltliMBP5pKzfWs3b3x9fD1PMdRAo0HYr/Sp7BWN7wzhaw== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg78gcbyn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:01:56 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNnaeJ009366; Thu, 23 Jul 2026 00:01:56 GMT Received: from smtprelay05.wdc07v.mail.ibm.com ([172.16.1.72]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4fgp1ghj9e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:01:56 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay05.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N01sTg15598258 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:01:54 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 265C75803F; Thu, 23 Jul 2026 00:01:54 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7C94A58056; Thu, 23 Jul 2026 00:01:53 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:01:53 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 01/33] ibmvfc: don't call locked done variant for MADs on send failure Date: Wed, 22 Jul 2026 17:01:17 -0700 Message-ID: <20260723000149.969416-2-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX+UGoEHsSfV84 4AykICTcnrCNO3UHhQitPlkW8P5ms0YuPhHfDN6OoSWYbUAADTdtvJEq/737rhCz+45eiI7MJei tNmhJ/1Vw3qdUvlEamzLM462datFxWW48du2FSOkwFpdWt3h0U4lzVocnuJSpPxrIdSmYAHzRzI DFsK1zY7KcrXTwtClSJM/mvUz/m6KhrDhmD8XdwJQ1rbrxJ2OJnMskMWZLMosUjhtmu4ozGAeUe ncjM8u+HMmpCUVTZ0OUADDmj4obLRoeyqWJiGylj8Bg0UbXuQk8sYjiRf3o24mOYP9UrpfAFJJf FsbR5nyy5xzs2LdODzCU1PmQ1Pqxoo9zN0oSdu1VgExAquWMx9ZiSX6eZCM9fRX4BeIPO9FsY/r jX+2areW/0S9SfW5Ow3/zkL8D2w769VTli1Su687QLU0T+dcSiShAN2jowD3geyBc2WwzW1mb4R FAQSSQeeMLpmO91XX/w== X-Proofpoint-GUID: eYZ2FdG2RZhtR2cR-OVyG95BKalfOkGS X-Authority-Analysis: v=2.4 cv=MelcfZ/f c=1 sm=1 tr=0 ts=6a6159f4 cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VnNF1IyMAAAA:8 a=4c2M-Vx5SB3eEEvsMGgA:9 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX4Ttoal5cik/N Fe2A/znflOSltnIqHYmcykn6GOCiZ8laGzLk8VHMen2JhTBOL+LPN+ge+ktI6ObqGVFXa9eVw4H p5lzmLrqEr5M/zP2+QZ10Wzq+XCwCt8= X-Proofpoint-ORIG-GUID: eYZ2FdG2RZhtR2cR-OVyG95BKalfOkGS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 spamscore=0 clxscore=1015 malwarescore=0 phishscore=0 adultscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" MADs are processed with the requirement that the host_lock is held for MAD sends and completions. When a MAD job step is called the host lock is already held and there is an unlikely scenario where h_send_crq fails with something other than H_CLOSED. If this happens there is a special done handler for MADs that tries to take the host lock. In this failure scenario fall back to the saved evt->_done unlocked completion handler. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c index 3dd2adda195e..0a5f73df8d7d 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c @@ -1774,8 +1774,10 @@ static int ibmvfc_send_event(struct ibmvfc_event *ev= t, if (evt->cmnd) { evt->cmnd->result =3D DID_ERROR << 16; evt->done =3D ibmvfc_scsi_eh_done; - } else + } else { evt->xfer_iu->mad_common.status =3D cpu_to_be16(IBMVFC_MAD_CRQ_ERROR); + evt->done =3D evt->_done; + } =20 evt->done(evt); } else { --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3830928F5; Thu, 23 Jul 2026 00:02:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764925; cv=none; b=KgO+coxNo3axsDUvQkVkSHP55E7p0BC50uW0gBTOI9K5VZ9bbaT3ZknyIXETynsbFgKy+cjbdeaQYinIWExJhtZrW6yo3g+9xBW7ymUwZJGXoYxxL7A5ff+U2MpiKVfPOIZasch2PPuTCTlHaI3+E+JTgDBGL1ojSvkiN8UfVoA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764925; c=relaxed/simple; bh=4NxmnQcBSJdxwMteQti9McJir7YVLTDDM60QwECPlo0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JUuJpmCuLuxV/w+lY2jqQXqryqjxwvvnDAE9u1+9/Je1Kn0176FXcxFRB6CMVaMkr5aXnM5sD2YE8bHHPMDuvwCThuZlv2iXS6OJ5GKTfxoTOhcHbVH9BXosHhbtrG9HunBG6pVc6O6dBbXaKC3cDYoQxLPmUGl1jH+dAkE/0zg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=mFjZLlcT; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="mFjZLlcT" Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIBex2712555; Thu, 23 Jul 2026 00:01:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=1Lz7oJ0FYsIcYPqSc Rr9iYBlx+edI7pmVOtn6kcMoUo=; b=mFjZLlcTiIHfziubtH0X4OgiM7Do2jvjf mwEVEgqS/8ik1fT1+9tG6o3vEQYhD/woZs/C+DruSobtLWCl89YSoP3/1ZD/fTB0 rz+jV4j6NHB/FMv1o8yhfQ9dsNYMHcvmVcf1Ho/rFnIxl15XiWsJCA+AK7yI21Qi uNWYrA2RYYX8RTLSxp82hUlqIyiPFtTY0TmTuW4bmGp+Lvlk5ojGGxwSU472oBRu CF723HcSL/vmYs75ALkB5r2Sucahw3FM1siMY2KgzGowq9oCSCwbSfX+wkvwq0zD 1WmxczybxquGXcj68SJ6RGCILGPyJT2t+13+fZf/m7scB4ryCq3tw== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg7914xpa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:01:57 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNnbP4028169; Thu, 23 Jul 2026 00:01:56 GMT Received: from smtprelay06.wdc07v.mail.ibm.com ([172.16.1.73]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fgnah9q24-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:01:56 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay06.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N01tq710551912 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:01:55 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E0CB75806C; Thu, 23 Jul 2026 00:01:54 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4209858060; Thu, 23 Jul 2026 00:01:54 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:01:54 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 02/33] ibmvfc: flush rport_add_work_q during driver teardown Date: Wed, 22 Jul 2026 17:01:18 -0700 Message-ID: <20260723000149.969416-3-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: yzqOtq8TbEjUww9LYSZqN4JFUgwo-NEA X-Authority-Analysis: v=2.4 cv=V6RNF+ni c=1 sm=1 tr=0 ts=6a6159f5 cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=U7nrCbtTmkRpXpFmAIza:22 a=VnNF1IyMAAAA:8 a=SsuO-E3m-kVTftWxl74A:9 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX8B31M3haJ6D5 5rGfNw7WjJwlTmMA9mkjTCaXx+oIqom20DyFdtr6mWvVLH7p107wbp2qkXKoGGHAMxlMwCiAgBd iyf288ANZMdVSLXvurCKWL3TGomLj2Y= X-Proofpoint-GUID: yzqOtq8TbEjUww9LYSZqN4JFUgwo-NEA X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX5AwV9Ejwn5+K Q38Rfgd+vRcpr3mU9dnMK2ixQu3TrUxKhi321ouKSt0XsCBWbhB6+EfXVzk598lFbtTuunux0H/ B6eYMJpum3JIIRztxJtwSBPrXGmJP03LXWOt0R44P87U63zRHxCI0W2nPLdg186R07O379EGDRH TmL6kreWqrQDCnlLzaN82PEQwBQYV6YrktLtMy9QvznvyJAmeqtrfdP2unpod01GrpZyb0O/JWS 1CkmXKftoKvVvCcBaKhQE6QtVpu2GmZrV0RTyk++PcYwotUjjPJ/ilhJ6JTbttXkNf7jGbfYjmh pgOXi0108vJbTKmWvdb9AZZQd5c2TMZ+4E/VYz95cJ5BIWOMjH6HYTQ+Dc4XzXEevCYi49qQPIs nZmcg2WfW1QxInu5p2A0i527hzR7BiSCUm34QRMef5EzVMqpY6pfqHSLSTN6P9oDyngAU0i+WCX i8It2jx8twOArUOEquA== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 adultscore=0 bulkscore=0 lowpriorityscore=0 clxscore=1015 spamscore=0 impostorscore=0 phishscore=0 priorityscore=1501 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" INIT_WORK is called on rport_add_work_q during driver probe. When the adapter is removed, ibmvfc_remove() stops the work thread and proceeds to tear down the FC host, but any work item queued via schedule_work() that raced the teardown could still be running or pending in the system workqueue. Add a flush_work() call after kthread_stop() and before fc_remove_host() to drain any outstanding rport add work before the FC host and its rports are torn down. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c index 0a5f73df8d7d..72317d7840a5 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c @@ -6443,6 +6443,7 @@ static void ibmvfc_remove(struct vio_dev *vdev) =20 ibmvfc_wait_while_resetting(vhost); kthread_stop(vhost->work_thread); + flush_work(&vhost->rport_add_work_q); fc_remove_host(vhost->host); scsi_remove_host(vhost->host); =20 --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F110E1F4631; Thu, 23 Jul 2026 00:02:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764928; cv=none; b=hKbG8CcBwiRtH1JZkDKTQW9hUVr5s1vLhwNaLjvJCbzzpZ9dLmGd8DTh1oOMlGSVLGQDFIANm0QwIAZq7Owt0ACju1u38914jKPGIy55CRervtytL4Bob+Ga6IPHYBLFvuic4Ye+jav5YWCo8TL61uxD54rxpEFehpyxbx3qb/o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764928; c=relaxed/simple; bh=4vf3RRREXqzKtN4RWv4dL/+lZvU8ttDaMKRwI4K+JXc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XbVqlJ5xEfYyi7iKdBAI2/gTgbb0wkG5wLtE3Z8HS2BpCsoghOu7zI6Rv7+DPqk+ytKEzWFTNSAOw1so2wf5hu3ZlWyddFkwBo/1d+Clpd/g9PohH1PBZOK2DoWWYiOvNg9GzTlCPsD3zuUkn5ZRDlqVFqCHkdLDDOV6MPWcn1U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=PQNrBeCX; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="PQNrBeCX" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIBopq704742; Thu, 23 Jul 2026 00:01:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=/0ALfZUO8FIrmuzVJ zhsUTrsPYLDqHKPAEdKzBn6xE8=; b=PQNrBeCXj/J6cvvVU3/KVpJP01uJyMHhC okM+1NDSz3whCeqnznHJQRVz47/mix5U/7dlifuGWEhK65HD/D4PyZWytRtb/XVo g0LnJwp30MoUWCe1N18/FFp9VEIHXCtU2hO2E3ZjwGdx+rsRccUhRl6NyUaJvL8K ImM2JR1XJuDfajZlxQRhpmkndetluqQ5zOf5GDdVZiunVyXJYUqBr9pA+jZsCcvy M7JhSmbbLipLKJRBmVprf3tzEHPdZsmBsBdaCXACfq/8VryWFlm1vUEF0x5X5HUA xYBq1ov+RFljRT4FjK+dXqt5w1w9HeyXeVel/A3W8O8/tSVDvEe6Q== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg7abmymt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:01:58 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNnfg7032317; Thu, 23 Jul 2026 00:01:57 GMT Received: from smtprelay06.wdc07v.mail.ibm.com ([172.16.1.73]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fgmtk1rrk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:01:57 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay06.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N01tEk44368196 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:01:56 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B6AC858061; Thu, 23 Jul 2026 00:01:55 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1216D5806A; Thu, 23 Jul 2026 00:01:55 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:01:54 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 03/33] ibmvfc: check for NULL evt in implicit LOGO and target delete path Date: Wed, 22 Jul 2026 17:01:19 -0700 Message-ID: <20260723000149.969416-4-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfXxdFPVYwve6Ur Xj1yYyI1vfaMb9/WalGd+X7Lw2ZoLkOn6T/m4EJOazOqArSYXuo3KEJf4EzZJwT5JHoa1QxIVu3 wX/rOg+7Isc+jStjIqH/cxyZJTrQ2ZlEWCJ5ZIEq7MApAnv9b0M/W0wK1en0jclAWG0Wg3jfcKr rL3oI+DadXJeyS1H7cxPHkIP78xeEFr8TNzv99Vf5i2KHyTopZccO911sYZIiXPqQ7T+pGcnQei 91RtOUXywf32AZVx0t4bb8bHcDEqNEoK9MUzj+KZJjbrAgefLQTmtY0KAc0VdlR9oUkFxsDQGRw bt0ThYUiNmvlRIOwV+JpyqGsZZJL0l7oZR/62EMGeE+a2efkyBDpMGNpBSCeAcG9XdJ6B7bSCaP NTlTWUhp9XSlIZRjrad8GOxURTSWuJqK0OwzlcZxujGdMVZ9CfcgBDFdEN0vHTVWMA9tVLf5SI3 Xmb8Pc/eU1g/cE/1BQA== X-Authority-Analysis: v=2.4 cv=F7ZnsKhN c=1 sm=1 tr=0 ts=6a6159f6 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=VnNF1IyMAAAA:8 a=0xhV0qCuJtyj5y_2DJ0A:9 X-Proofpoint-ORIG-GUID: rtMMAuddeTgQsNBS-ACVZIMGPSU53l5d X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX3aXHbBQ5b6m6 DeBUNPTwc6Z/ygmFT8l3vc3QlbNYEnf9YswqI4qnnqtxCVIJKuA/CCu+EGSnaiC8yKDJ8K5i8tI CqQCa8/NX+mCd15Az8vPrNuRcUvC+qc= X-Proofpoint-GUID: rtMMAuddeTgQsNBS-ACVZIMGPSU53l5d X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 phishscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 impostorscore=0 lowpriorityscore=0 suspectscore=0 malwarescore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" Unlike ibmvfc_tgt_implicit_logout the ibmvfc_tgt_implicit_logout_and_del path fails to check for a NULL evt returned from ibmvfc_get_reserved_event and passes that directly to ibmvfc_send_event which will unconditionally derefence the evt. Check for a NULL evt and perform same escalation as ibmvfc_implicit_logout. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c index 72317d7840a5..59102dd1c787 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c @@ -4406,6 +4406,14 @@ static void ibmvfc_tgt_implicit_logout_and_del(struc= t ibmvfc_target *tgt) evt =3D __ibmvfc_tgt_get_implicit_logout_evt(tgt, ibmvfc_tgt_implicit_logout_and_del_done); =20 + if (!evt) { + vhost->discovery_threads--; + ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE); + kref_put(&tgt->kref, ibmvfc_release_tgt); + __ibmvfc_reset_host(vhost); + return; + } + ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_LOGOUT_RPORT_WAIT); if (ibmvfc_send_event(evt, vhost, default_timeout)) { vhost->discovery_threads--; --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 32EB918CBE1; Thu, 23 Jul 2026 00:02:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764933; cv=none; b=Phy48D30zwhgTrmGhNFUQNc9PqXsrQI+zs3vimvQtFHEc7IYsvsrtWJ6H2qa+8ATbrRklworIyA88T0zNjoozfw+Ema7UcJ5LUOz2VH0SBeRJ9bbMZiz9SOQ+Vat8jGsKL3VNWRZXMzEqT69vM2sBonlyjxT82MYMiHx69AUjVw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764933; c=relaxed/simple; bh=xQQqB9rTucLo3FCn44UAcKEBIvblWg55WWd/NuDpvCY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GSQVHDncwisAPmw5Yi2xnsmDeTaEITsEgtsCPGrcdwIqWS0bhEO4JMOxqGC/ad8JvlD10fZ9pGo/wSzyyqXv47Poo6ZrLfzZ+lebjXoR53BESFXFmn5W5XNbVgX8wFdJqZROAUSiYTmQ/upWr4CeiGx+Kl7a2sC7ydbbWmYWLQE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=dxkapA0D; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="dxkapA0D" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIC04w713608; Thu, 23 Jul 2026 00:01:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=QTcx3GUwnUGWervFw OBNbS/xCBTHJ2fcCNdUSchFYis=; b=dxkapA0DX/yryGShitVIbxLiedarpRWgf lroCRb80XjgmXnfj+BVVhiBlFLW14wOXmsrvqqrOh52pQ5yr3Y3dDFFF0f5o4zx7 t1zCraz4qUEG1fjnnGo0vEcmrJMPECjhI2VExIl4GYe5LViU0UdHNLvjOfD7Awwz r+gF8lsW4wL6rUiutUS1Ge7n5wq1hc/hFuxiYGzrtR5ZVjII3CVpEdugPZlRQ9jd ZgqQRAsYkRjdomjBFfPE9Ho8ki7Rq46vj5qq65ST6ZPDCnRsN/mCd5dkxs3KRIdH sZe8vRXvegQR9Lvn9bQgs+dGtf3+vB9CgcpnFvgG87pSUH/hY7H7g== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg7ahccsq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:01:58 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNnaIF028159; Thu, 23 Jul 2026 00:01:57 GMT Received: from smtprelay07.wdc07v.mail.ibm.com ([172.16.1.74]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fgnah9q27-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:01:57 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay07.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N01usj30802528 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:01:56 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8723258068; Thu, 23 Jul 2026 00:01:56 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D47AE58064; Thu, 23 Jul 2026 00:01:55 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:01:55 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 04/33] ibmvfc: free ibmvfc_target allocations with mempool_free Date: Wed, 22 Jul 2026 17:01:20 -0700 Message-ID: <20260723000149.969416-5-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 7D5iPR5E4_REOKeDKMM0Iu3NaGJykQ58 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX7FLFT9meQCbW jQjq1zgmjGDz3mphtB8RFcuA4VhyMDfnJrNK+Ao7SjY6+pYniSiSiDl/vGxwyShoPsFN1Up+W07 uk/BW2Lw85LKjNrOWqgn9g+N5GCBBfgbh4PKNCvD8InIMhREQm+8FgUGBjg96zfhlH+gHx9X5wI Ks9GRwdAH6vjTeQ80IkXlCGUNsTNoBq+R4uUfsuFjS/wAO5nNbhPUKTHnGYSYCdWhn3nV9nnuk+ tV78cztRXQ4wRDsQSp9qc4UhFlwOae8ha9gphBMipwYGbIjfr7olm/m6BvQi3Uedzv7HFEjtVrN 28cWddPpretQYr5kcjWgx450l84l11wKI73V+6qLn7qx8EhnzG3jWKDDadDi8KIi8Amxe0GbntJ raw3Q7B7SPITjP0oNSDDWAzyHvQV85NAq39xYhJREo0t1aM1DYpgoAabCXX4nB9AzhT7VocwQhj bvyhB4kbjJnHCV0AIAw== X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX/UHiy6AMRO9v laFRAsVxJIw2qEiIuUZL7hkRmlNNqKOhyDHfl0GufDw0JQCrgrK4oNg6Bp1gQku4EngtY3Jcqlm OHO9fUpZq0awSrjZ75VA4usl2SXzD+4= X-Proofpoint-GUID: 7D5iPR5E4_REOKeDKMM0Iu3NaGJykQ58 X-Authority-Analysis: v=2.4 cv=SM5ykuvH c=1 sm=1 tr=0 ts=6a6159f6 cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=VnNF1IyMAAAA:8 a=CDwl4yW-xjfRfShkF8wA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 lowpriorityscore=0 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 priorityscore=1501 phishscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" The ibmvfc_target *tgt structures for discovery are allocated using mempool_alloc but in turn free'd via kfree in ibmvfc_release_target breaking pool guarentees. Fixup ibmvfc_release_target to call mempool_free instead so that memory is properly returned to the mempool instead of the general allocator. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c index 59102dd1c787..412e946abcb7 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c @@ -1366,7 +1366,7 @@ static void ibmvfc_set_rport_dev_loss_tmo(struct fc_r= port *rport, u32 timeout) static void ibmvfc_release_tgt(struct kref *kref) { struct ibmvfc_target *tgt =3D container_of(kref, struct ibmvfc_target, kr= ef); - kfree(tgt); + mempool_free(tgt, tgt->vhost->tgt_pool); } =20 /** --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4DD8965192; Thu, 23 Jul 2026 00:02:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764937; cv=none; b=BBcwPpzvOZ+q+c8fWRJRvMzzz6WsUXra++ebcPho8I3Z2RIS0kUxyKF+Mhoohn6wEJXTYdsEvu2M9P+aVM3dMgBapJkn4J4kLsXmwoBVAMs27qx5Pf2UgkTHshuaO+9dzsyiEq8hlkBZDcXNMcEz5s3zcQjbKORfObsgofleHyM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764937; c=relaxed/simple; bh=wH52HurCCEyEpCTpml3yT69cz0+PwY3haXx363vKcIo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ukXWdGFGZ+vLL0PwkgxIYHgT11ih6qoQWvWhBBgntPVm6wOhT/xNuhvl97PfeQh7vhNz0zwW+Y2B14kiNbriNHTngfMJWqa3JQ9FSwocrVGaUdl3jha+W7B0JYZfoX3oYuOd9+ESxjRkS45g/N/F6G5QsT/jA1f0VdtaBO/PIH0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=K6rOuwMF; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="K6rOuwMF" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIBwLk705318; Thu, 23 Jul 2026 00:02:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=RR5jRZ40pgCx7orHG IjgvXuGQmSuE9vcqGnLzyWm4eM=; b=K6rOuwMFpYSnTE9t6GNbo8ayZr7lBqfPr CACSmsGf7mHvQoxatGlgXJw2wlO0a1UzosZsG8Ma9RjmlchuAOEc64vYv5FAYeKY 4Yxgr1rYZOc/6qMRew7czx94fqjHWlOYBee+7Lr7KpdS6RmMv21tf/eayDfRggOi CQ/FwqteDqDhRIazug3rbU5NNRKeAewSpdafIDAF/nNO77uwBYumqn56ZuFDbaNy 0KzhyDz06xzfdSP4lSXN6W1kVI+PdxwyYIJabLlo4cdI9wrjgFRMUWrcMhGcaU9f ImGvertyGqEmC1iTUWtzY4S+QPChSNH8nt3e29uXRFj6EqZk+RvXQ== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg7abmymu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:01:59 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNncJn028176; Thu, 23 Jul 2026 00:01:58 GMT Received: from smtprelay06.dal12v.mail.ibm.com ([172.16.1.8]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fgnah9q28-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:01:58 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N01vM45374508 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:01:57 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4682858060; Thu, 23 Jul 2026 00:01:57 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A487658063; Thu, 23 Jul 2026 00:01:56 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:01:56 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 05/33] ibmvfc: move target list from host to protocol specific channel groups Date: Wed, 22 Jul 2026 17:01:21 -0700 Message-ID: <20260723000149.969416-6-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX96BqVQ+uIBJw cdQGzAQZvsdUo9MhJq6LJqDaAUDIwdrWAAINGEMd2L8H80oZ3CnzbtSf10DW7VjRwaIYw7YajMp icFM0zZY9zwJ7FdaCmlvdXaQTCMoW7lTiBPvnEogy99BUGl22ZgJQG5Ds3LM1Wi9h9SgwxV6yp2 7krsElkL3Gpns89/jtuOxlsGzijkhdIwlobXH9+/+qzuTLC+F12A6M9oAeouhGmXcmuyvPuqTa6 LqGm/jnEBZlcw3RJt//p4QzNH9M6+1+j9xop/zIsEzOPFJM8lgKwU0wrpIO9COFPan/7bRju16e 84cTfghLEjVN4bPnBUUIvl21/OnyK9FMEGQowoA8leKYhN/zrg0pdtTYu8X6xcv1pBNVDCBmj4K H43ud8fxqKC2x1si/SSkh/Tu94VAz3o4airUy+3BX76+ZyoCVJlSPUQLMqVWdo4/3Uq+Rq6yJIW F/TpY9eaQNhvgZotNjA== X-Authority-Analysis: v=2.4 cv=F7ZnsKhN c=1 sm=1 tr=0 ts=6a6159f7 cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=VnNF1IyMAAAA:8 a=jQP8Ix9JCXI5f8BnMGsA:9 X-Proofpoint-ORIG-GUID: 46UsOOT-52-sI5she-8l_vqdUisWHvXh X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfXxqFSf2NWovRY RmWF9BNMCPxY+LHt5HxSkdVbe5caubnhKs3dGLMPx39QB9Oz7WEQmgUfjW/FXbpvbj+YrjBofD4 YEGxH+S8tqdnhI6UbOPVxArOeCnD/I0= X-Proofpoint-GUID: 46UsOOT-52-sI5she-8l_vqdUisWHvXh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 phishscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 impostorscore=0 lowpriorityscore=0 suspectscore=0 malwarescore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" Prepare the driver for protocol-specific target management by moving the target list and target count out of struct ibmvfc_host and into struct ibmvfc_channels. Today the driver only maintains a single SCSI target list, but NVMe/FC support will require separate target tracking for each protocol-specific channel group. Update the existing target iteration, allocation, and discovery paths to use the SCSI channel group's target list instead of a host-wide list. This is a preparatory refactoring only. No functional change is intended for existing SCSI operation. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc.c | 52 +++++++++++++++++----------------- drivers/scsi/ibmvscsi/ibmvfc.h | 4 +-- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c index 412e946abcb7..78b4ac201a49 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c @@ -682,7 +682,7 @@ static void ibmvfc_link_down(struct ibmvfc_host *vhost, =20 ENTER; scsi_block_requests(vhost->host); - list_for_each_entry(tgt, &vhost->targets, queue) + list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) ibmvfc_del_tgt(tgt); ibmvfc_set_host_state(vhost, state); ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_TGT_DEL); @@ -715,7 +715,7 @@ static void ibmvfc_init_host(struct ibmvfc_host *vhost) memset(vhost->async_crq.msgs.async, 0, PAGE_SIZE); vhost->async_crq.cur =3D 0; =20 - list_for_each_entry(tgt, &vhost->targets, queue) { + list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) { if (vhost->client_migrated) tgt->need_login =3D 1; else @@ -1232,7 +1232,7 @@ static struct ibmvfc_target *__ibmvfc_get_target(stru= ct scsi_target *starget) struct ibmvfc_host *vhost =3D shost_priv(shost); struct ibmvfc_target *tgt; =20 - list_for_each_entry(tgt, &vhost->targets, queue) + list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) if (tgt->target_id =3D=3D starget->id) { kref_get(&tgt->kref); return tgt; @@ -1834,7 +1834,7 @@ static void ibmvfc_relogin(struct scsi_device *sdev) unsigned long flags; =20 spin_lock_irqsave(vhost->host->host_lock, flags); - list_for_each_entry(tgt, &vhost->targets, queue) { + list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) { if (rport =3D=3D tgt->rport) { ibmvfc_del_tgt(tgt); break; @@ -2132,7 +2132,7 @@ static int ibmvfc_bsg_plogi(struct ibmvfc_host *vhost= , unsigned int port_id) =20 ENTER; spin_lock_irqsave(vhost->host->host_lock, flags); - list_for_each_entry(tgt, &vhost->targets, queue) { + list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) { if (tgt->scsi_id =3D=3D port_id) { issue_login =3D 0; break; @@ -3104,7 +3104,7 @@ static void ibmvfc_terminate_rport_io(struct fc_rport= *rport) =20 spin_lock_irqsave(shost->host_lock, flags); found =3D 0; - list_for_each_entry(tgt, &vhost->targets, queue) { + list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) { if (tgt->scsi_id =3D=3D rport->port_id) { found++; break; @@ -3244,7 +3244,7 @@ static void ibmvfc_handle_async(struct ibmvfc_async_c= rq *crq, case IBMVFC_AE_ELS_LOGO: case IBMVFC_AE_ELS_PRLO: case IBMVFC_AE_ELS_PLOGI: - list_for_each_entry(tgt, &vhost->targets, queue) { + list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) { if (!crq->scsi_id && !crq->wwpn && !crq->node_name) break; if (crq->scsi_id && cpu_to_be64(tgt->scsi_id) !=3D crq->scsi_id) @@ -4873,14 +4873,14 @@ static int ibmvfc_alloc_target(struct ibmvfc_host *= vhost, =20 /* Look to see if we already have a target allocated for this SCSI ID or = WWPN */ spin_lock_irqsave(vhost->host->host_lock, flags); - list_for_each_entry(tgt, &vhost->targets, queue) { + list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) { if (tgt->wwpn =3D=3D wwpn) { wtgt =3D tgt; break; } } =20 - list_for_each_entry(tgt, &vhost->targets, queue) { + list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) { if (tgt->scsi_id =3D=3D scsi_id) { stgt =3D tgt; break; @@ -4937,7 +4937,7 @@ static int ibmvfc_alloc_target(struct ibmvfc_host *vh= ost, ibmvfc_init_tgt(tgt, ibmvfc_tgt_implicit_logout); spin_lock_irqsave(vhost->host->host_lock, flags); tgt->cancel_key =3D vhost->task_set++; - list_add_tail(&tgt->queue, &vhost->targets); + list_add_tail(&tgt->queue, &vhost->scsi_scrqs.targets); =20 unlock_out: spin_unlock_irqrestore(vhost->host->host_lock, flags); @@ -4955,7 +4955,7 @@ static int ibmvfc_alloc_targets(struct ibmvfc_host *v= host) { int i, rc; =20 - for (i =3D 0, rc =3D 0; !rc && i < vhost->num_targets; i++) + for (i =3D 0, rc =3D 0; !rc && i < vhost->scsi_scrqs.num_targets; i++) rc =3D ibmvfc_alloc_target(vhost, &vhost->scsi_scrqs.disc_buf[i]); =20 return rc; @@ -4976,8 +4976,8 @@ static void ibmvfc_discover_targets_done(struct ibmvf= c_event *evt) switch (mad_status) { case IBMVFC_MAD_SUCCESS: ibmvfc_dbg(vhost, "Discover Targets succeeded\n"); - vhost->num_targets =3D min_t(u32, be32_to_cpu(rsp->num_written), - max_targets); + vhost->scsi_scrqs.num_targets =3D min_t(u32, be32_to_cpu(rsp->num_writte= n), + max_targets); ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_ALLOC_TGTS); break; case IBMVFC_MAD_FAILED: @@ -5393,7 +5393,7 @@ static int ibmvfc_dev_init_to_do(struct ibmvfc_host *= vhost) { struct ibmvfc_target *tgt; =20 - list_for_each_entry(tgt, &vhost->targets, queue) { + list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) { if (tgt->action =3D=3D IBMVFC_TGT_ACTION_INIT || tgt->action =3D=3D IBMVFC_TGT_ACTION_INIT_WAIT) return 1; @@ -5413,7 +5413,7 @@ static int ibmvfc_dev_logo_to_do(struct ibmvfc_host *= vhost) { struct ibmvfc_target *tgt; =20 - list_for_each_entry(tgt, &vhost->targets, queue) { + list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) { if (tgt->action =3D=3D IBMVFC_TGT_ACTION_LOGOUT_RPORT || tgt->action =3D=3D IBMVFC_TGT_ACTION_LOGOUT_RPORT_WAIT) return 1; @@ -5443,10 +5443,10 @@ static int __ibmvfc_work_to_do(struct ibmvfc_host *= vhost) case IBMVFC_HOST_ACTION_QUERY_TGTS: if (vhost->discovery_threads =3D=3D disc_threads) return 0; - list_for_each_entry(tgt, &vhost->targets, queue) + list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) if (tgt->action =3D=3D IBMVFC_TGT_ACTION_INIT) return 1; - list_for_each_entry(tgt, &vhost->targets, queue) + list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) if (tgt->action =3D=3D IBMVFC_TGT_ACTION_INIT_WAIT) return 0; return 1; @@ -5454,10 +5454,10 @@ static int __ibmvfc_work_to_do(struct ibmvfc_host *= vhost) case IBMVFC_HOST_ACTION_TGT_DEL_FAILED: if (vhost->discovery_threads =3D=3D disc_threads) return 0; - list_for_each_entry(tgt, &vhost->targets, queue) + list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) if (tgt->action =3D=3D IBMVFC_TGT_ACTION_LOGOUT_RPORT) return 1; - list_for_each_entry(tgt, &vhost->targets, queue) + list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) if (tgt->action =3D=3D IBMVFC_TGT_ACTION_LOGOUT_RPORT_WAIT) return 0; return 1; @@ -5645,12 +5645,12 @@ static void ibmvfc_do_work(struct ibmvfc_host *vhos= t) vhost->job_step(vhost); break; case IBMVFC_HOST_ACTION_QUERY: - list_for_each_entry(tgt, &vhost->targets, queue) + list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) ibmvfc_init_tgt(tgt, ibmvfc_tgt_query_target); ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_QUERY_TGTS); break; case IBMVFC_HOST_ACTION_QUERY_TGTS: - list_for_each_entry(tgt, &vhost->targets, queue) { + list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) { if (tgt->action =3D=3D IBMVFC_TGT_ACTION_INIT) { tgt->job_step(tgt); break; @@ -5662,7 +5662,7 @@ static void ibmvfc_do_work(struct ibmvfc_host *vhost) break; case IBMVFC_HOST_ACTION_TGT_DEL: case IBMVFC_HOST_ACTION_TGT_DEL_FAILED: - list_for_each_entry(tgt, &vhost->targets, queue) { + list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) { if (tgt->action =3D=3D IBMVFC_TGT_ACTION_LOGOUT_RPORT) { tgt->job_step(tgt); break; @@ -5674,7 +5674,7 @@ static void ibmvfc_do_work(struct ibmvfc_host *vhost) return; } =20 - list_for_each_entry(tgt, &vhost->targets, queue) { + list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) { if (tgt->action =3D=3D IBMVFC_TGT_ACTION_DEL_RPORT) { tgt_dbg(tgt, "Deleting rport\n"); rport =3D tgt->rport; @@ -5749,7 +5749,7 @@ static void ibmvfc_do_work(struct ibmvfc_host *vhost) spin_lock_irqsave(vhost->host->host_lock, flags); break; case IBMVFC_HOST_ACTION_TGT_INIT: - list_for_each_entry(tgt, &vhost->targets, queue) { + list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) { if (tgt->action =3D=3D IBMVFC_TGT_ACTION_INIT) { tgt->job_step(tgt); break; @@ -6286,7 +6286,7 @@ static void ibmvfc_rport_add_thread(struct work_struc= t *work) if (vhost->state !=3D IBMVFC_ACTIVE) break; =20 - list_for_each_entry(tgt, &vhost->targets, queue) { + list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) { if (tgt->add_rport) { did_work =3D 1; tgt->add_rport =3D 0; @@ -6351,7 +6351,7 @@ static int ibmvfc_probe(struct vio_dev *vdev, const s= truct vio_device_id *id) shost->nr_hw_queues =3D mq_enabled ? min(max_scsi_queues, nr_scsi_hw_queu= es) : 1; =20 vhost =3D shost_priv(shost); - INIT_LIST_HEAD(&vhost->targets); + INIT_LIST_HEAD(&vhost->scsi_scrqs.targets); INIT_LIST_HEAD(&vhost->purge); sprintf(vhost->name, IBMVFC_NAME); vhost->host =3D shost; diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h index c73ed2314ad0..0e259e9d2e9b 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h @@ -828,6 +828,8 @@ struct ibmvfc_channels { unsigned int active_queues; unsigned int desired_queues; unsigned int max_queues; + int num_targets; + struct list_head targets; int disc_buf_sz; struct ibmvfc_discover_targets_entry *disc_buf; dma_addr_t disc_buf_dma; @@ -871,8 +873,6 @@ struct ibmvfc_host { #define IBMVFC_TRACE_SIZE (sizeof(struct ibmvfc_trace_entry) * IBMVFC_NUM_= TRACE_ENTRIES) struct ibmvfc_trace_entry *trace; atomic_t trace_index; - int num_targets; - struct list_head targets; struct list_head purge; struct device *dev; struct dma_pool *sg_pool; --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 55CE11A9F96; Thu, 23 Jul 2026 00:02:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764936; cv=none; b=GCP3m7lzI2NVGHbT7WpryKfTKwDaZpUFlluurIzptIJ3dppe7t4WQLzt1fgpv/uMsMBVK6Y6AZBTixw9XzDHljZYM5udQBCEDJMtwtMt9iNslYAyz8cSXB4MgoHzDPHCulV3XlrRgpCO9c3AGEbzjXSSMjZWgUyAVVHqJ6WazCI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764936; c=relaxed/simple; bh=bJk5PbBVtwKb8lu35ZK2YVS3/p0RhAXrRXWZ0dfVmRI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OpC+HzHDall9c9bfZ3cHzLr6I4qX91rGXlh3YnkI8iH2L9pE5gAWQSMt5+H+iQYvrpU1wR5gx0C4YhfXk/qoyT0qwYGb4juix4NeOZJfGzYzpPS/UhZMqtZfgYhcoGhUOnaw6/DqbDl9L4DEcee6IxUX2tik1Ij4qOvx8l6G4Vk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=rUSIOqMV; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="rUSIOqMV" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIBudb705156; Thu, 23 Jul 2026 00:02:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=agN8V79pErUO0/2gw muh66huQw0XwWe/OJeuoB79Igk=; b=rUSIOqMVulkHDIVX5qTpHn2G24AYdvZGX B1b5BJaDLKQf3s8AV5Y6LuFL2DG/h41q/EHULUjd9zA8Zr4oGyyuXx8EoZJQ7mu0 Gpwco5fOV2lbjizaCQRyTY7US8wmyqEnbNJNARJqYgKTFVNr2oAg57gxdO+PPYCN CHaEI4J1ewpCQYWX5YDYbDFDoGrpr2RF5TpfcVmf3456g8e0JHKvpJFfMcz+EPKJ Gzy5O2XgcWyIZuQa6pTy+YE8MLw18U+CU7e/xXQp73j5eBkDi8c+jlI6UG1BYXbf dcVPBoT4EgGF7yxx4JiPSzl3+4nPQ0oWX8cIFtIaMNijQoLH5IkaA== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg7abmymv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:01:59 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNndSR009395; Thu, 23 Jul 2026 00:01:58 GMT Received: from smtprelay07.dal12v.mail.ibm.com ([172.16.1.9]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4fgp1ghj9q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:01:58 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay07.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N01wD126018514 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:01:58 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 06CB358060; Thu, 23 Jul 2026 00:01:58 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 67B6E5803F; Thu, 23 Jul 2026 00:01:57 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:01:57 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 06/33] ibmvfc: add NVMe/FC protocol interface definitions Date: Wed, 22 Jul 2026 17:01:22 -0700 Message-ID: <20260723000149.969416-7-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX4M4rN5H3YF+A PA/nUp10SUeCSjqceFZD0vahu4G3boT7MLXqxBy/LKMEV1uswgYLi2OLhqk2X0u7Xyv/htdouQV 7WcT5KRJ3f/BpE+Cqe7CkQRja7N0ED8h/dxooGQpX7lGwmYQkwGvgs4L+5W7m/sEQifUuhU7TKv XJUqi4zBCfIbJZbNjMp8lFkUVupP6A3+MXLX2SKLDPWIX23yDItFuT2bL6pv/P0ArmoOAkh0psq NrTKIHFQQEJV/iKg/6ISkCSKsUK/teonG4tjscNYUwCI9uMMltuwyPXFfn0SY4/RvUxHgJHHvXL DAVoFiuTnVZ314NRyUedBVnXC5B10i+Ij9T+LuiX8HXd3o1RmMkBe/Xw7fxi/u2wB3y+dy5M87j eSIycMcKtWOiGLIBwW7ZCH35Fk0+15WGGK5buce9JrqhjUBoIjsplqrgWFboEmZwhPVTHwilh62 +GWd4wVNd56EGDu80HA== X-Authority-Analysis: v=2.4 cv=F7ZnsKhN c=1 sm=1 tr=0 ts=6a6159f7 cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=VnNF1IyMAAAA:8 a=JmYX4WQfQ2vWtGjAzx0A:9 X-Proofpoint-ORIG-GUID: sRzojwPz4zN74hZnsV0A2CxILSEQipNf X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfXy9PVB+4wZ/09 2hdxHdhJxFTX6MkopOx6EE0YQvaxTycwrKmkV1faA6Q1eKkaJrPBKGOm532EPYXsb2Can1oWlB/ PIyuhDgb6pvRMnroTb2kJr9ZNfkiW5I= X-Proofpoint-GUID: sRzojwPz4zN74hZnsV0A2CxILSEQipNf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 phishscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 impostorscore=0 lowpriorityscore=0 suspectscore=0 malwarescore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" Add the protocol definitions for client-VIOS interface updates needed to support NVMe/FC over the ibmvfc NPIV transport. Extend the ibmvfc interface with: - NVMe/FC-specific capability bits and opcodes - protocol-specific channel and queue definitions - updated channel enquiry/setup fields for NVMe queues - v3 command layout support for protocol-specific payloads These changes provide the common header and interface plumbing needed by later patches that add NVMe/FC login, discovery, remote-port handling, and I/O submission. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc.h | 153 +++++++++++++++++++++++++-------- 1 file changed, 119 insertions(+), 34 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h index 0e259e9d2e9b..f8a2bf92da41 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h @@ -13,6 +13,8 @@ #include #include #include +#include +#include =20 #define IBMVFC_NAME "ibmvfc" #define IBMVFC_DRIVER_VERSION "1.0.11" @@ -92,6 +94,7 @@ enum ibmvfc_cmd_status_flags { IBMVFC_FC_SCSI_ERROR =3D 0x0008, IBMVFC_HW_EVENT_LOGGED =3D 0x0010, IBMVFC_VIOS_LOGGED =3D 0x0020, + IBMVFC_FC_NVME_STATUS =3D 0x0040, }; =20 enum ibmvfc_fabric_mapped_errors { @@ -124,20 +127,37 @@ enum ibmvfc_vios_errors { IBMVFC_COMMAND_FAILED =3D 0x8000, }; =20 +enum ibmvfc_fc_nvme_errors { + IBMVFC_NVMS_VALID_ERSP =3D 0x0001, + IBMVFC_NVMS_VALID_NODMA_CQE =3D 0x0002, +}; + enum ibmvfc_mad_types { IBMVFC_NPIV_LOGIN =3D 0x0001, - IBMVFC_DISC_TARGETS =3D 0x0002, + IBMVFC_DISC_TARGETS =3D 0x0002, + IBMVFC_DISC_NVMF_TARGETS =3D 0x0003, IBMVFC_PORT_LOGIN =3D 0x0004, - IBMVFC_PROCESS_LOGIN =3D 0x0008, - IBMVFC_QUERY_TARGET =3D 0x0010, + IBMVFC_NVMF_PORT_LOGIN =3D 0x0005, + IBMVFC_PROCESS_LOGIN =3D 0x0008, + IBMVFC_NVMF_PROCESS_LOGIN =3D 0x0009, + IBMVFC_QUERY_TARGET =3D 0x0010, + IBMVFC_NVMF_QUERY_TARGET =3D 0x0011, IBMVFC_MOVE_LOGIN =3D 0x0020, - IBMVFC_IMPLICIT_LOGOUT =3D 0x0040, - IBMVFC_PASSTHRU =3D 0x0200, - IBMVFC_TMF_MAD =3D 0x0100, - IBMVFC_NPIV_LOGOUT =3D 0x0800, - IBMVFC_CHANNEL_ENQUIRY =3D 0x1000, - IBMVFC_CHANNEL_SETUP =3D 0x2000, - IBMVFC_CONNECTION_INFO =3D 0x4000, + IBMVFC_NVMF_MOVE_LOGIN =3D 0x0021, + IBMVFC_IMPLICIT_LOGOUT =3D 0x0040, + IBMVFC_NVMF_IMPLICIT_LOGOUT =3D 0x0041, + IBMVFC_RNID =3D 0x0080, + IBMVFC_NVMF_RNID =3D 0x0081, + IBMVFC_TMF_MAD =3D 0x0100, + IBMVFC_NVMF_TMF_MAD =3D 0x0101, + IBMVFC_PASSTHRU =3D 0x0200, + IBMVFC_NVMF_PASSTHRU =3D 0x0201, + IBMVFC_NPIV_LOGOUT =3D 0x0800, + IBMVFC_CHANNEL_ENQUIRY =3D 0x1000, + IBMVFC_CHANNEL_SETUP =3D 0x2000, + IBMVFC_CONNECTION_INFO =3D 0x4000, + IBMVFC_FABRIC_LOGIN =3D 0x8000, + IBMVFC_NVMF_FABRIC_LOGIN =3D 0x8001, }; =20 struct ibmvfc_mad_common { @@ -175,11 +195,16 @@ struct ibmvfc_npiv_login { #define IBMVFC_FLUSH_ON_HALT 0x02 __be32 max_cmds; __be64 capabilities; -#define IBMVFC_CAN_MIGRATE 0x01 -#define IBMVFC_CAN_USE_CHANNELS 0x02 -#define IBMVFC_CAN_HANDLE_FPIN 0x04 -#define IBMVFC_CAN_USE_MAD_VERSION 0x08 -#define IBMVFC_CAN_SEND_VF_WWPN 0x10 +#define IBMVFC_CAN_MIGRATE 0x001 +#define IBMVFC_CAN_USE_CHANNELS 0x002 +#define IBMVFC_CAN_HANDLE_FPIN 0x004 +#define IBMVFC_CAN_USE_MAD_VERSION 0x008 +#define IBMVFC_CAN_SEND_VF_WWPN 0x010 +#define IBMVFC_YES_NVMEOF 0x020 +#define IBMVFC_YES_SCSI 0x040 +#define IBMVFC_CAN_USE_WWPN_ALL 0x080 +#define IBMVFC_USE_ASYNC_SUBQ 0x100 +#define IBMVFC_CAN_USE_NOOP_CMD 0x200 __be64 node_name; struct srp_direct_buf async; u8 partition_name[IBMVFC_MAX_NAME]; @@ -219,13 +244,18 @@ struct ibmvfc_npiv_login_resp { __be16 error; __be32 flags; #define IBMVFC_NATIVE_FC 0x01 - __be32 reserved; + __be32 possible_nports; __be64 capabilities; -#define IBMVFC_CAN_FLUSH_ON_HALT 0x08 -#define IBMVFC_CAN_SUPPRESS_ABTS 0x10 -#define IBMVFC_MAD_VERSION_CAP 0x20 -#define IBMVFC_HANDLE_VF_WWPN 0x40 -#define IBMVFC_CAN_SUPPORT_CHANNELS 0x80 +#define IBMVFC_CAN_FLUSH_ON_HALT 0x0008 +#define IBMVFC_CAN_SUPPRESS_ABTS 0x0010 +#define IBMVFC_MAD_VERSION_CAP 0x0020 +#define IBMVFC_HANDLE_VF_WWPN 0x0040 +#define IBMVFC_CAN_SUPPORT_CHANNELS 0x0080 +#define IBMVFC_SUPPORT_NVMEOF 0x0100 +#define IBMVFC_SUPPORT_SCSI 0x0200 +#define IBMVFC_SUPPORT_WWPN_ALL 0x0400 +#define IBMVFC_ASYNC_SUBQ 0x0800 +#define IBMVFC_SUPPORT_NOOP_CMD 0x1000 __be32 max_cmds; __be32 scsi_id_sz; __be64 max_dma_len; @@ -238,7 +268,7 @@ struct ibmvfc_npiv_login_resp { u8 port_loc_code[IBMVFC_MAX_NAME]; u8 drc_name[IBMVFC_MAX_NAME]; struct ibmvfc_service_parms service_parms; - __be64 reserved2; + __be64 reserved; } __packed __aligned(8); =20 union ibmvfc_npiv_login_data { @@ -246,6 +276,17 @@ union ibmvfc_npiv_login_data { struct ibmvfc_npiv_login_resp resp; } __packed __aligned(8); =20 +struct ibmvfc_fabric_login_mad { + struct ibmvfc_mad_common common; + __be64 flags; + __be64 capabilities; + __be64 nport_id; + __be16 status; + __be16 error; + __be32 reserved; + __be64 reserved2[16]; +} __packed __aligned(8); + struct ibmvfc_discover_targets_entry { __be32 scsi_id; __be32 pad; @@ -287,6 +328,7 @@ enum ibmvfc_fc_type { IBMVFC_FABRIC_BUSY =3D 0x04, IBMVFC_PORT_BUSY =3D 0x05, IBMVFC_BASIC_REJECT =3D 0x06, + IBMVFC_FC4_LS_REJECT =3D 0x07, }; =20 enum ibmvfc_gs_explain { @@ -377,20 +419,27 @@ struct ibmvfc_query_tgt { struct ibmvfc_implicit_logout { struct ibmvfc_mad_common common; __be64 old_scsi_id; - __be64 reserved[2]; + __be64 reserved[8]; + __be64 target_wwpn; } __packed __aligned(8); =20 struct ibmvfc_tmf { struct ibmvfc_mad_common common; __be64 scsi_id; - struct scsi_lun lun; + union { + struct scsi_lun lun; + __be64 assoc_id; + }; __be32 flags; -#define IBMVFC_TMF_ABORT_TASK 0x02 -#define IBMVFC_TMF_ABORT_TASK_SET 0x04 -#define IBMVFC_TMF_LUN_RESET 0x10 -#define IBMVFC_TMF_TGT_RESET 0x20 -#define IBMVFC_TMF_LUA_VALID 0x40 -#define IBMVFC_TMF_SUPPRESS_ABTS 0x80 +#define IBMVFC_TMF_ABORT_TASK 0x002 +#define IBMVFC_TMF_ABORT_TASK_SET 0x004 +#define IBMVFC_TMF_LUN_RESET 0x010 +#define IBMVFC_TMF_TGT_RESET 0x020 +#define IBMVFC_TMF_LUA_VALID 0x040 +#define IBMVFC_TMF_SUPPRESS_ABTS 0x080 +#define IBMVFC_TMF_NVMF_ASSOC 0x100 +#define IBMVFC_TMF_NVMF_TARGET 0x200 +#define IBMVFC_TMF_BITMASK_VALID 0x400 __be32 cancel_key; __be32 my_cancel_key; __be32 pad; @@ -446,6 +495,8 @@ enum ibmvfc_cmd_flags { IBMVFC_WRITE =3D 0x0008, IBMVFC_TMF =3D 0x0080, IBMVFC_CLASS_3_ERR =3D 0x0100, + IBMVFC_NVMEOF_PROTOCOL =3D 0x0200, + IBMVFC_NVMF_SLER =3D 0x0400, }; =20 enum ibmvfc_fc_task_attr { @@ -493,7 +544,7 @@ struct ibmvfc_cmd { __be64 tgt_scsi_id; __be64 tag; __be64 target_wwpn; - __be64 reserved3; + __be64 assoc_id; union { struct { struct ibmvfc_fcp_cmd_iu iu; @@ -504,6 +555,15 @@ struct ibmvfc_cmd { struct ibmvfc_fcp_cmd_iu iu; struct ibmvfc_fcp_rsp rsp; } v2; + struct { + __be64 reserved5[4]; + struct ibmvfc_fcp_cmd_iu iu; + struct ibmvfc_fcp_rsp rsp; + } v3scsi; + struct { + __be64 reserved[4]; + struct nvme_fc_cmd_iu iu; + } v3nvme; }; } __packed __aligned(8); =20 @@ -522,6 +582,9 @@ struct ibmvfc_passthru_iu { __be32 flags; #define IBMVFC_FC_ELS 0x01 #define IBMVFC_FC_CT_IU 0x02 +#define IBMVFC_PT_PRLI 0x04 +#define IBMVFC_FC4_LS_OTH 0x08 +#define IBMVFC_FC4_LS_DSC_CTRL 0x10 __be32 cancel_key; #define IBMVFC_PASSTHRU_CANCEL_KEY 0x80000000 #define IBMVFC_INTERNAL_CANCEL_KEY 0x80000001 @@ -559,7 +622,7 @@ struct ibmvfc_channel_setup_mad { struct srp_direct_buf buffer; } __packed __aligned(8); =20 -#define IBMVFC_MAX_CHANNELS 502 +#define IBMVFC_MAX_CHANNELS 501 =20 struct ibmvfc_channel_setup { __be32 flags; @@ -574,6 +637,7 @@ struct ibmvfc_channel_setup { struct srp_direct_buf buffer; __be64 reserved2[5]; __be64 channel_handles[IBMVFC_MAX_CHANNELS]; + __be64 async_sub_crq_handle; } __packed __aligned(8); =20 struct ibmvfc_connection_info { @@ -620,7 +684,8 @@ struct ibmvfc_trace_entry { =20 enum ibmvfc_crq_formats { IBMVFC_CMD_FORMAT =3D 0x01, - IBMVFC_ASYNC_EVENT =3D 0x02, + IBMVFC_ASYNC_EVENT =3D 0x02, + IBMVFC_NOOP =3D 0x03, IBMVFC_MAD_FORMAT =3D 0x04, }; =20 @@ -639,6 +704,9 @@ enum ibmvfc_async_event { IBMVFC_AE_RESUME =3D 0x0800, IBMVFC_AE_ADAPTER_FAILED =3D 0x1000, IBMVFC_AE_FPIN =3D 0x2000, + IBMVFC_NVME_DISCONNECT =3D 0x4000, + IBMVFC_NVMEOF_PROTO_AVAIL =3D 0x40000000, + IBMVFC_SCSI_PROTO_AVAIL =3D 0x80000000, }; =20 struct ibmvfc_async_desc { @@ -683,13 +751,30 @@ struct ibmvfc_async_crq { volatile __be64 scsi_id; volatile __be64 wwpn; volatile __be64 node_name; - __be64 reserved; + __be64 assoc_id; +} __packed __aligned(8); + +struct ibmvfc_async_sub_crq { + volatile u8 valid; + u8 flags; +#define IBMVFC_ASYNC_ID_IS_ASSOC_ID 0x01 + u8 link_state; + u8 fpin_status; + __be16 event; + __be16 pad; + __be64 wwpn; + __be64 nport_id; + union { + __be64 node_name; + __be64 assoc_id; + } id; } __packed __aligned(8); =20 union ibmvfc_iu { struct ibmvfc_mad_common mad_common; struct ibmvfc_npiv_login_mad npiv_login; struct ibmvfc_npiv_logout_mad npiv_logout; + struct ibmvfc_fabric_login_mad fabric_login; struct ibmvfc_discover_targets discover_targets; struct ibmvfc_port_login plogi; struct ibmvfc_process_login prli; --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1EB91F09A8; Thu, 23 Jul 2026 00:02:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764937; cv=none; b=gjUMCtFTFdKoN2SAFe4PoY5rx2bO4K1wSscOdK3Mhg4pr+rI8ai/I21fS8oJgM+2k9Pm+GWRPqaOwLghOVaVECKEmY0OQ5MHtJnQFwaOrkZPbrPAKelkRWBRfuJt51F/8S2WOUNIMBH4GUdqE6p357+wMKR5wwm5gCtlaHsBIkU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764937; c=relaxed/simple; bh=ulEkcQ9TkuiQl9DO+x3sAN2usV7oas5mslN8eG/zUOA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C9tYzjMqJTyT8pplGW2V/o35vR3hZJtFMsKHogzPkJvfk8XIkmWnJ0J6Nbx8H/4jLJQVNDaef4OEVBdI3Wdyy0b14FFwiC5uMw0TY9ogNJt214k/3Pi036l1zgZp7Ej2HqKnn69QJZgg567h02Gj9sZTLjD7pQ49PPP5C+8Tgf8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=nURIKGF2; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="nURIKGF2" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIBeQl704617; Thu, 23 Jul 2026 00:02:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=MCx2SKsdTvOPd257e JjO62OaAhnxhj5wgcZ1jWwH9XA=; b=nURIKGF2b6rI1BLJz9t5GGkaQddAtbjxv zOkQniaroyaUcevsVqa5Ax+P+IHXV/azjN5hCPYsKEoBtDKmvETI9cG3TQ7ZX7zk 7IRpKLQZ/RQEMouEMNRHvr2oUj52mfCv4Aqdq09vVSfFRKPeRMkMlDSTC12A1MSi yYdBKy8sQjCBEnGkLdXtcQBpC+jM7Hw+iy8wkQaThglgmtnAz5FIFcfoQCJHVWYh 1q6lg2TdVdczKwaDTDLodIZOgsmipwqdCSjjQ3vaepQ4rz45ueZZhgpAcdOO2E8v BI3Z+Fz6y51HvWbvFMc4fglrSv5P7iBc5Gcv+feqyscLKGx1HBmmw== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg7abmyn0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:01 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNnt25021850; Thu, 23 Jul 2026 00:01:59 GMT Received: from smtprelay07.dal12v.mail.ibm.com ([172.16.1.9]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fgm6w9uj1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:01:59 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay07.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N01wsp62259632 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:01:58 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B5EE558063; Thu, 23 Jul 2026 00:01:58 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2356D58061; Thu, 23 Jul 2026 00:01:58 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:01:58 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 07/33] ibmvfc: split NVMe support into separate source file and add transport stubs Date: Wed, 22 Jul 2026 17:01:23 -0700 Message-ID: <20260723000149.969416-8-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX8V/IJaqbSqLw xMZnSs37XIOoAoXaiaNp5dF/43D39l5ARkjsnsFn9PYRhWzRnv1meu/sHNCxv9J62beLOTrgdS/ fIQeLlQS5sdI3sEpk2ZCZi37jH5vUhKbFm5Bcy36MZJo6xswULCy1XGUivptsUoWGxJIb1T5zQd 3lMhX2wD6N9MPQRMC7b9oeM5OrQ2RLxEUVpa+ukEEU6dk0acaeJGscAc5c99cAj/RTfiNOVkOpN lwLjqz8Vmohbg7h9VUjk9F+6esZpBmW+uE1mOIgdg92RkNEwfFf0vamPaDTLUOv5rMNvRpx6uZf k7M7HiQuMQtZq1TuRm5eQps5VUWKer9cIuTSpKngXbAOKEmoB9et5J56Xpk/EXZpS+tS1qyIxm5 B6P4Wg1W0atbVMMLJPD0I4B+pdUSXsdZaLzPAFU7dnIJbNE8uUQ3ynR4CCSesY8923I6lsil4Pj 6VEBnUkNRjiO888DqHA== X-Authority-Analysis: v=2.4 cv=F7ZnsKhN c=1 sm=1 tr=0 ts=6a6159f9 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=VnNF1IyMAAAA:8 a=yJGABh1QRkCQoVjB2OEA:9 X-Proofpoint-ORIG-GUID: BHX69P6FTkIEuNN-5sCCStkaey8OTkBj X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX2n7WXpH2WRcX Ns01HLerT4X9ota4ohv42rPuFbVarG0Zr819kcwDRblLWZa7k0xgXfsMTuqAGE3eE+tZ3hGk8lT VHCsBdRx70eUh/BNcm5L1Xbo2DnrrsY= X-Proofpoint-GUID: BHX69P6FTkIEuNN-5sCCStkaey8OTkBj X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 phishscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 impostorscore=0 lowpriorityscore=0 suspectscore=0 malwarescore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" Rename ibmvfc.c to ibmvfc-core.c as first step in decoupling each protocol from the core driver logic. Add ibmvfc-nvme.[ch] files, and register an nvme_fc_port_template with empty callback stubs. Add empty registration functions definitions for local and remote ports. No functional NVMe/FC support is added yet. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/Makefile | 2 + .../scsi/ibmvscsi/{ibmvfc.c =3D> ibmvfc-core.c} | 19 +++- drivers/scsi/ibmvscsi/ibmvfc-nvme.c | 97 +++++++++++++++++++ drivers/scsi/ibmvscsi/ibmvfc-nvme.h | 32 ++++++ drivers/scsi/ibmvscsi/ibmvfc.h | 10 +- 5 files changed, 156 insertions(+), 4 deletions(-) rename drivers/scsi/ibmvscsi/{ibmvfc.c =3D> ibmvfc-core.c} (99%) create mode 100644 drivers/scsi/ibmvscsi/ibmvfc-nvme.c create mode 100644 drivers/scsi/ibmvscsi/ibmvfc-nvme.h diff --git a/drivers/scsi/ibmvscsi/Makefile b/drivers/scsi/ibmvscsi/Makefile index 5eb1cb1a0028..9408c7f4cdee 100644 --- a/drivers/scsi/ibmvscsi/Makefile +++ b/drivers/scsi/ibmvscsi/Makefile @@ -1,3 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only +ibmvfc-objs :=3D ibmvfc-core.o ibmvfc-nvme.o + obj-$(CONFIG_SCSI_IBMVSCSI) +=3D ibmvscsi.o obj-$(CONFIG_SCSI_IBMVFC) +=3D ibmvfc.o diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc-= core.c similarity index 99% rename from drivers/scsi/ibmvscsi/ibmvfc.c rename to drivers/scsi/ibmvscsi/ibmvfc-core.c index 78b4ac201a49..56f4fb200a69 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c @@ -1,10 +1,11 @@ -// SPDX-License-Identifier: GPL-2.0-or-later +/* SPDX-License-Identifier: GPL-2.0-or-later */ + /* * ibmvfc.c -- driver for IBM Power Virtual Fibre Channel Adapter * * Written By: Brian King , IBM Corporation * - * Copyright (C) IBM Corporation, 2008 + * Copyright (C) IBM Corporation, 2008-2026 */ =20 #include @@ -46,6 +47,9 @@ static unsigned int cls3_error =3D IBMVFC_CLS3_ERROR; static unsigned int mq_enabled =3D IBMVFC_MQ; static unsigned int nr_scsi_hw_queues =3D IBMVFC_SCSI_HW_QUEUES; static unsigned int nr_scsi_channels =3D IBMVFC_SCSI_CHANNELS; +static unsigned int nvme_enabled =3D IBMVFC_NVME; +static unsigned int nr_nvme_hw_queues =3D IBMVFC_NVME_HW_QUEUES; +static unsigned int nr_nvme_channels =3D IBMVFC_NVME_CHANNELS; static unsigned int mig_channels_only =3D IBMVFC_MIG_NO_SUB_TO_CRQ; static unsigned int mig_no_less_channels =3D IBMVFC_MIG_NO_N_TO_M; =20 @@ -74,6 +78,16 @@ module_param_named(mig_no_less_channels, mig_no_less_cha= nnels, uint, S_IRUGO); MODULE_PARM_DESC(mig_no_less_channels, "Prevent migration to system with l= ess channels. " "[Default=3D" __stringify(IBMVFC_MIG_NO_N_TO_M) "]"); =20 +module_param_named(nvme, nvme_enabled, uint, S_IRUGO); +MODULE_PARM_DESC(nvme, "Enable NVMe over FC support. " + "[Default=3D" __stringify(IBMVFC_NVME) "]"); +module_param_named(nvme_host_queues, nr_nvme_hw_queues, uint, S_IRUGO); +MODULE_PARM_DESC(nvme_host_queues, "Number of NVMeoF Host submission queue= s. " + "[Default=3D" __stringify(IBMVFC_NVME_HW_QUEUES) "]"); +module_param_named(nvme_hw_channels, nr_nvme_channels, uint, S_IRUGO); +MODULE_PARM_DESC(nvme_hw_channels, "Number of hw NVMeoF channels to reques= t. " + "[Default=3D" __stringify(IBMVFC_NVME_CHANNELS) "]"); + module_param_named(init_timeout, init_timeout, uint, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(init_timeout, "Initialization timeout in seconds. " "[Default=3D" __stringify(IBMVFC_INIT_TIMEOUT) "]"); @@ -468,6 +482,7 @@ static const struct { { IBMVFC_FABRIC_BUSY, "fabric busy" }, { IBMVFC_PORT_BUSY, "port busy" }, { IBMVFC_BASIC_REJECT, "basic reject" }, + { IBMVFC_FC4_LS_REJECT, "fc4 ls reject" }, }; =20 static const char *unknown_fc_type =3D "unknown fc type"; diff --git a/drivers/scsi/ibmvscsi/ibmvfc-nvme.c b/drivers/scsi/ibmvscsi/ib= mvfc-nvme.c new file mode 100644 index 000000000000..2ee1c64665d9 --- /dev/null +++ b/drivers/scsi/ibmvscsi/ibmvfc-nvme.c @@ -0,0 +1,97 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +/* + * ibmvfc-nvme.c -- IBM Power Virtual Fibre Channel NVMeoF HBA driver + * + * Written By: Tyrel Datwyler , IBM Corporation + * + * Copyright (C) IBM Corporation, 2026 + */ + +#include + +#include "ibmvfc-nvme.h" + +static void ibmvfc_nvme_localport_delete(struct nvme_fc_local_port *lport) +{ +} + +static void ibmvfc_nvme_remoteport_delete(struct nvme_fc_remote_port *rpor= t) +{ +} + +static int ibmvfc_nvme_ls_req(struct nvme_fc_local_port *lport, + struct nvme_fc_remote_port *rport, + struct nvmefc_ls_req *ls_req) +{ + return 0; +} + +static void ibmvfc_nvme_ls_abort(struct nvme_fc_local_port *lport, + struct nvme_fc_remote_port *rport, + struct nvmefc_ls_req *ls_abort) +{ +} + +static int ibmvfc_nvme_fcp_io(struct nvme_fc_local_port *lport, + struct nvme_fc_remote_port *rport, + void *hw_queue_handle, + struct nvmefc_fcp_req *fcp_req) +{ + return 0; +} + +static void ibmvfc_nvme_fcp_abort(struct nvme_fc_local_port *lport, + struct nvme_fc_remote_port *rport, + void *hw_queue_handle, + struct nvmefc_fcp_req *abort_req) +{ +} + +static struct nvme_fc_port_template ibmvfc_nvme_fc_transport =3D { + .localport_delete =3D ibmvfc_nvme_localport_delete, + .remoteport_delete =3D ibmvfc_nvme_remoteport_delete, + .create_queue =3D NULL, + .delete_queue =3D NULL, + .ls_req =3D ibmvfc_nvme_ls_req, + .ls_abort =3D ibmvfc_nvme_ls_abort, + .fcp_io =3D ibmvfc_nvme_fcp_io, + .fcp_abort =3D ibmvfc_nvme_fcp_abort, + .map_queues =3D NULL, + .max_hw_queues =3D IBMVFC_NVME_HW_QUEUES, + .max_sgl_segments =3D 1024, + .max_dif_sgl_segments =3D 64, + .dma_boundary =3D 0xFFFFFFFF, + .local_priv_sz =3D sizeof(struct ibmvfc_host *), + .remote_priv_sz =3D sizeof(struct ibmvfc_target *), + .lsrqst_priv_sz =3D sizeof(struct ibmvfc_event *), + .fcprqst_priv_sz =3D sizeof(struct ibmvfc_event *), +}; + +int ibmvfc_nvme_register_remoteport(struct ibmvfc_target *tgt) +{ + if (!IS_ENABLED(CONFIG_NVME_FC)) + return 0; + + return 0; +} + +void ibmvfc_nvme_unregister_remoteport(struct ibmvfc_target *tgt) +{ + if (!IS_ENABLED(CONFIG_NVME_FC)) + return; +} + +int ibmvfc_nvme_register(struct ibmvfc_host *vhost) +{ + if (!IS_ENABLED(CONFIG_NVME_FC)) + return 0; + + return 0; +} + +void ibmvfc_nvme_unregister(struct ibmvfc_host *vhost) +{ + if (!IS_ENABLED(CONFIG_NVME_FC)) + return; +} diff --git a/drivers/scsi/ibmvscsi/ibmvfc-nvme.h b/drivers/scsi/ibmvscsi/ib= mvfc-nvme.h new file mode 100644 index 000000000000..97e267871df2 --- /dev/null +++ b/drivers/scsi/ibmvscsi/ibmvfc-nvme.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +/* + * ibmvfc-nvme.h -- IBM Power Virtual Fibre Channel NVMeoF HBA driver + * + * Written By: Tyrel Datwyler , IBM Corporation + * + * Copyright (C) IBM Corporation, 2026 + */ + +#ifndef _IBMVFC_NVME_H +#define _IBMVFC_NVME_H + +#include +#include +#include + +#include "ibmvfc.h" + +#define IBMVFC_NVME 0 +#define IBMVFC_NVME_HW_QUEUES 8 +#define IBMVFC_MAX_NVME_QUEUES 16 +#define IBMVFC_NVME_CHANNELS 8 + +struct ibmvfc_host; +struct ibmvfc_target; + +int ibmvfc_nvme_register_remoteport(struct ibmvfc_target *tgt); +void ibmvfc_nvme_unregister_remoteport(struct ibmvfc_target *tgt); +int ibmvfc_nvme_register(struct ibmvfc_host *vhost); +void ibmvfc_nvme_unregister(struct ibmvfc_host *vhost); +#endif diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h index f8a2bf92da41..f137b61ce422 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h @@ -1,22 +1,27 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ + /* * ibmvfc.h -- driver for IBM Power Virtual Fibre Channel Adapter * * Written By: Brian King , IBM Corporation * - * Copyright (C) IBM Corporation, 2008 + * Copyright (C) IBM Corporation, 2008-2026 */ =20 #ifndef _IBMVFC_H #define _IBMVFC_H =20 +#include #include #include +#include #include #include #include =20 -#define IBMVFC_NAME "ibmvfc" +#include "ibmvfc-nvme.h" + +#define IBMVFC_NAME "ibmvfc" #define IBMVFC_DRIVER_VERSION "1.0.11" #define IBMVFC_DRIVER_DATE "(April 12, 2013)" =20 @@ -984,6 +989,7 @@ struct ibmvfc_host { unsigned int mq_enabled:1; unsigned int using_channels:1; unsigned int do_enquiry:1; + unsigned int nvme_enabled:1; unsigned int aborting_passthru:1; unsigned int scan_complete:1; int scan_timeout; --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 735981DFFB; Thu, 23 Jul 2026 00:02:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764935; cv=none; b=IPK5mFr3K3/8NV6nXf/oGUUCgMqzTf1comkCd8V2wtjQ9kxjpt9oGRlyNO4BOLlPp+VaLlJRwGLEroRCajfGlSPumFv6qAwKt6i9s3yOPdQVKcVpi8L7H8odowlP/MFhbVHEsubE0ZHPAigBV0YAOLKPRPKqyGeNSSvXtwIMG/8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764935; c=relaxed/simple; bh=4SWQ+FLI+6BWglQ5Nwhk/vxLarIajlVkt1J0JGlautA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=E4acxmJ+1X9/MFW8Gbq4i1/+mFyD4fiiUxp4eXpESHmST7/SVvDzXS5tt4GatO65ekW83um8zLPMIIypxjWLUQJ4+evQ/C4aeniVP5UPYofx8JRx4fGxiJ4xq5XfSFFBY8yeTCp6gbRNF/dtkFihYTMdAkhtUgQKWPebFZPX7c8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=XFGJA2PA; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="XFGJA2PA" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIBig4606050; Thu, 23 Jul 2026 00:02:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=QJuPDUZQEn8FY4ewc 0Dk1y391Q9X161lJ+J4pwM+3A8=; b=XFGJA2PAfa//DyEHAjUatS5nO/hpGTzi4 OhIS5Mhu3U738II2vlNP83kHErSINU1ZCQtwj/cRwydqENng9sfA3EQuEjdeE64k MIYkYOXmjeJaxlDPZqqqr/0d8nZpXmR9ZreHfOkEzkGoTTJ9J9AAKFrM0DAYFB+2 gHXev0VnbQfUvKZNlul755t/OtuApkf1nitcVvodqTFK0fTslxR3/pFmlZcT4QA4 kZAMX8GZA/Zp5UCBYBcEfC3cNUPVlcNVNJ4vswpHktwzPCoS/t1PNrHWiBcQusBI ww89TMgiL8DbvP4R/GzDySap3s2uOKrtAr2kECZldlMPR+F18c4xg== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg78gcbyx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:02 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNncnX009390; Thu, 23 Jul 2026 00:02:01 GMT Received: from smtprelay01.wdc07v.mail.ibm.com ([172.16.1.68]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4fgp1ghj9s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:01 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay01.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N01x1L61604170 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:01:59 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 707B65806C; Thu, 23 Jul 2026 00:01:59 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D1A9A58068; Thu, 23 Jul 2026 00:01:58 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:01:58 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 08/33] ibmvfc: initialize NVMe channel configuration during driver probe Date: Wed, 22 Jul 2026 17:01:24 -0700 Message-ID: <20260723000149.969416-9-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX/9yHLaPAHv6P n7ny9V0cfgNcZW7G7hjhHIudzb7D2/PP0JJrArWrgBrz/vUcCOfPRP5aX52LN+CBKGijRl2fY+L 4bJHXDImKEE5g99cwBnHSjv9amKoF4MAmfO90YZB6p0zv/9kJhckW4KYca3ewl1RthOCUDeVa9g PTxDNLeYX9fjvaO7HXZR9sFEKwvIpUEmt3zdP5GbDTaSDMPblHM62W/BHuYoVrB6EL++uGuxe2r 98k1w1Vrozh0iilYitscmWwLe+eMXLq4FCsqtIXVQLF65vjsXa19vJ6XIOAeqsRF+L92AxJ2OCT qZRdWKT8fFjqmIt++ka611CDXy4f2eppEDJ8t+MVcTj6eI1hMm5GL50xAFrSSyOqJeBYRiNB7R/ v6EnNzztsqgwZ6/TA3Ff+l+ECA0RRVozWytyS9SDG66xb5G3UDYI+PmbaQ/3pPh3IZDVkw6eU6u J1dSkrPkXLUGvOdNi6w== X-Proofpoint-GUID: oXO1Gj-HjWN-DtFCWWtZW7Vv-Xnb3ror X-Authority-Analysis: v=2.4 cv=MelcfZ/f c=1 sm=1 tr=0 ts=6a6159fa cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VnNF1IyMAAAA:8 a=3ohZfi8XXq2KePb_45kA:9 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX33VGTihbc0B2 QuxdvPrJJvWy0o4WRZMSY0T6ev/llJAc2wVqTtZdA2hI9Xq5O72OiDftA/fFUYwN9RKu0Z3Mnr+ SsZXDNOHjV56jt+xroGKKNNfSgmUTAk= X-Proofpoint-ORIG-GUID: oXO1Gj-HjWN-DtFCWWtZW7Vv-Xnb3ror X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 spamscore=0 clxscore=1015 malwarescore=0 phishscore=0 adultscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" Initialize the host's NVMe channel-group state during probe. Set up the NVMe channel list head, desired queue count, maximum queue count, protocol identifier, and enablement state alongside the existing SCSI channel-group initialization in ibmvfc_probe(). This prepares the driver with a NVMe/FC channel group that can will be used by later patches for NVMe queue allocation, discovery buffers, target management, and IO submission. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc-core.c | 8 +++++++- drivers/scsi/ibmvscsi/ibmvfc.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ib= mvfc-core.c index 56f4fb200a69..5b6570232df3 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c @@ -6347,7 +6347,8 @@ static int ibmvfc_probe(struct vio_dev *vdev, const s= truct vio_device_id *id) struct device *dev =3D &vdev->dev; int rc =3D -ENOMEM; unsigned int online_cpus =3D num_online_cpus(); - unsigned int max_scsi_queues =3D min((unsigned int)IBMVFC_MAX_SCSI_QUEUES= , online_cpus); + unsigned int max_scsi_queues =3D min_t(unsigned int, IBMVFC_MAX_SCSI_QUEU= ES, online_cpus); + unsigned int max_nvme_queues =3D min_t(unsigned int, IBMVFC_MAX_NVME_QUEU= ES, online_cpus); =20 ENTER; shost =3D scsi_host_alloc(&driver_template, sizeof(*vhost)); @@ -6367,6 +6368,7 @@ static int ibmvfc_probe(struct vio_dev *vdev, const s= truct vio_device_id *id) =20 vhost =3D shost_priv(shost); INIT_LIST_HEAD(&vhost->scsi_scrqs.targets); + INIT_LIST_HEAD(&vhost->nvme_scrqs.targets); INIT_LIST_HEAD(&vhost->purge); sprintf(vhost->name, IBMVFC_NAME); vhost->host =3D shost; @@ -6381,6 +6383,10 @@ static int ibmvfc_probe(struct vio_dev *vdev, const = struct vio_device_id *id) vhost->scsi_scrqs.protocol =3D IBMVFC_PROTO_SCSI; vhost->using_channels =3D 0; vhost->do_enquiry =3D 1; + vhost->nvme_enabled =3D mq_enabled ? nvme_enabled : 0; + vhost->nvme_scrqs.desired_queues =3D min(max_nvme_queues, nr_nvme_channel= s); + vhost->nvme_scrqs.max_queues =3D max_nvme_queues; + vhost->nvme_scrqs.protocol =3D IBMVFC_PROTO_NVME; vhost->scan_timeout =3D 0; =20 strcpy(vhost->partition_name, "UNKNOWN"); diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h index f137b61ce422..01c49d81b135 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h @@ -970,6 +970,7 @@ struct ibmvfc_host { struct ibmvfc_queue crq; struct ibmvfc_queue async_crq; struct ibmvfc_channels scsi_scrqs; + struct ibmvfc_channels nvme_scrqs; struct ibmvfc_npiv_login login_info; union ibmvfc_npiv_login_data *login_buf; dma_addr_t login_buf_dma; --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 736611684B0; Thu, 23 Jul 2026 00:02:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764935; cv=none; b=rAy5wUkSj8bVcuD5Ty6Obi3lbOCZcbt61N7GyXpJQfwe1WvDmXQiF37W/AlAFtjsuc1f7HCijmZ25U1DpMb508MCU1HYcDutOxiGABSghWdqHfu6Fc2qwdpG/q1BfnNMZFvakuKWDiDWpfc6PBtxcIkvT2BBLIIT0ctvSp88NhI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764935; c=relaxed/simple; bh=LIv8A1DVjhPDdmF4lw8uCEO/RaLC53TmvGWVnnxZjVk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sqmUoo15xGeZGmC17T9EvhqCcjOwFZt2X9J37SYfeQPOeTd6caPAehjnnpelAdzhu6wSjnEur5X5GJevZhLgQdhpvX/SOEkNsIfUKujAUj5R5rRsBWAxeN1Tnj+5DeS0rfklMwg8z6NkgrWW8+mSZlsRl551PzoEkfwbS08r8hw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=m2vl2Yc9; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="m2vl2Yc9" Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIC1nf634553; Thu, 23 Jul 2026 00:02:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=JzjuO0piW/Wlabhoj 6SakOr3QawIrQcZMn/ofM3+RiU=; b=m2vl2Yc9CTTm1ivWTyLdw6cFknOHwpvkj vTMMpklyg+0DdETudapUi2C454GPPO0gjVUgW0K67KoVULmQ8nGXoIpkm0R/7HQ8 ECP2C3ZorPEycxgXKWhh9IRyaDGOCByRTNDpF/DBrrZQG32iNUesbtQu7zj4/5O/ DnnBGJDo/FQKQdQ2tdxcx9ZprtqubJ69V/SHG+m0V9K2I6fIrMCcrsKp6KXJ1lPZ 5rM1SEOrWwOTxo/nABP/UodlgGCDndAXTZN5Bos0/kSYyXnvUgZlghRo2QLqJfWs EVmfO+k3WlAuRv8c9AJLUPR9Zatt88/9IO/zWzKOkSCzY/fajG8Hw== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg77kce64-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:02 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNnbAd009379; Thu, 23 Jul 2026 00:02:02 GMT Received: from smtprelay02.wdc07v.mail.ibm.com ([172.16.1.69]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4fgp1ghj9v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:01 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay02.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N020ks12321392 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:02:00 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2BE1F58063; Thu, 23 Jul 2026 00:02:00 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8C62D58061; Thu, 23 Jul 2026 00:01:59 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:01:59 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 09/33] ibmvfc: alloc/dealloc sub-queues for nvme channels Date: Wed, 22 Jul 2026 17:01:25 -0700 Message-ID: <20260723000149.969416-10-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Authority-Analysis: v=2.4 cv=HJXz0Itv c=1 sm=1 tr=0 ts=6a6159fa cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VnNF1IyMAAAA:8 a=7MaZqFay8etFDbkFh6wA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX3kqUY5UjD2J5 6wRyu46FJFxRrjTpjbyGZ1CQ92s+lD5TRu0ae0RqRFk4PPD1lIGCSQSfASVCeEjkUwMfsIsk2Ml jEunYab0eXutNjmW5uKv91/Q39xevSlfb29BHTV+bVYBVMAoutEpLLea0AXK/5zobONYEd9jST6 lkRU13iAbtIut1cvU72zCmU1ujiDXY5Y56hzSnarpRjsXIEIQ/hBc/c8+RUtkf3iS12AP7PGLjE 8hX3eg2y4jLDBLtWOlVB1SLH4RfLuAwjh9SmlANaVNRrV3G9zU6V7dfKkMB6TFbJrZmKgs6Q16U meuanUyuW1H2apO3u639Yi9yYREXTw8JiKrwu7ydoydBmuKaT5DOBNuxsMhW4G5YSRw8tyv9G7y Arg48AcCZ8thjreYU6qR1VR84KZNG6Xytz/b7GsfcaxJCtgnt1CsQPVs4vZd0YHoIwi9LluIGkB s5td8QXEvkNV/InoFgA== X-Proofpoint-ORIG-GUID: V_8h92FWuiE2fwYQs9oMiTylfnaI_xJw X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX5amWqg59Owi5 d1DRuOMBSXZaioNmgGBBetWpZ1z4BcQy/PDwrjZ9KqdXUllBgOuQPj2j53Up8m057PV7xL0Z1vD qZkyilirOxdnRF12O+wdMtxLIiIDLYA= X-Proofpoint-GUID: V_8h92FWuiE2fwYQs9oMiTylfnaI_xJw X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 malwarescore=0 impostorscore=0 clxscore=1015 phishscore=0 spamscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" Allocate, register, deregister, and release NVMe subordinate CRQs alongside the existing SCSI sub-CRQs. Update the CRQ reset and re-enable paths to tear down and recreate NVMe sub-queues, extend sub-CRQ initialization to allocate NVMe channels when enabled, and release NVMe channel resources during adapter teardown. This keeps the NVMe queue lifecycle aligned with the existing SCSI queue lifecycle so both protocols are reset consistently across probe, remove, and connection recovery. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc-core.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ib= mvfc-core.c index 5b6570232df3..d8c2b56258ee 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c @@ -945,6 +945,7 @@ static int ibmvfc_reenable_crq_queue(struct ibmvfc_host= *vhost) unsigned long flags; =20 ibmvfc_dereg_sub_crqs(vhost, &vhost->scsi_scrqs); + ibmvfc_dereg_sub_crqs(vhost, &vhost->nvme_scrqs); =20 /* Re-enable the CRQ */ do { @@ -964,6 +965,7 @@ static int ibmvfc_reenable_crq_queue(struct ibmvfc_host= *vhost) spin_unlock_irqrestore(vhost->host->host_lock, flags); =20 ibmvfc_reg_sub_crqs(vhost, &vhost->scsi_scrqs); + ibmvfc_reg_sub_crqs(vhost, &vhost->nvme_scrqs); =20 return rc; } @@ -983,6 +985,7 @@ static int ibmvfc_reset_crq(struct ibmvfc_host *vhost) struct ibmvfc_queue *crq =3D &vhost->crq; =20 ibmvfc_dereg_sub_crqs(vhost, &vhost->scsi_scrqs); + ibmvfc_dereg_sub_crqs(vhost, &vhost->nvme_scrqs); =20 /* Close the CRQ */ do { @@ -1016,6 +1019,7 @@ static int ibmvfc_reset_crq(struct ibmvfc_host *vhost) spin_unlock_irqrestore(vhost->host->host_lock, flags); =20 ibmvfc_reg_sub_crqs(vhost, &vhost->scsi_scrqs); + ibmvfc_reg_sub_crqs(vhost, &vhost->nvme_scrqs); =20 return rc; } @@ -6119,6 +6123,13 @@ static void ibmvfc_init_sub_crqs(struct ibmvfc_host = *vhost) =20 ibmvfc_reg_sub_crqs(vhost, &vhost->scsi_scrqs); =20 + if (vhost->nvme_enabled) { + if (ibmvfc_alloc_channels(vhost, &vhost->nvme_scrqs)) + vhost->nvme_enabled =3D 0; + else + ibmvfc_reg_sub_crqs(vhost, &vhost->nvme_scrqs); + } + LEAVE; } =20 @@ -6147,8 +6158,10 @@ static void ibmvfc_release_sub_crqs(struct ibmvfc_ho= st *vhost) return; =20 ibmvfc_dereg_sub_crqs(vhost, &vhost->scsi_scrqs); - ibmvfc_release_channels(vhost, &vhost->scsi_scrqs); + + ibmvfc_dereg_sub_crqs(vhost, &vhost->nvme_scrqs); + ibmvfc_release_channels(vhost, &vhost->nvme_scrqs); LEAVE; } =20 --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E9CE35957; Thu, 23 Jul 2026 00:02:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764946; cv=none; b=Pogy6TBw0cZfJtLZM985boN0UUsYtY9BN7ZvVqMrlZnX/Ov/tceoWZ9HPuDRrEHRnINbuIUWIPox1coWnec94MICjNYJozYJFcC8BNvXUcYOi3Dp6VND2BU8YiX3Ev5HxrngxGIfHDekhAfKW0ytXq4IwP9ToOfcptqilhSdito= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764946; c=relaxed/simple; bh=yic6PIDmBhqORlP50GHs4yLLGk9Jk3P1wDFGjWjskiM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LUv4bszd9KVlbmZDTncqF2v89FhQjRJVNag6yg02PX+3xZHZTFsqM1Bs/fZgPz/Xufs9zbNxEFlIIRB3n3Ag1cS+Cda0i13141RYjWzOJZScCi5STAVUDWwY6BF1FQRFt7IxVVQaxLnoO/hZ4WB8DBGUenokozbhL56zhMzf+GI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=JBXKYCDG; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="JBXKYCDG" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIBops704742; Thu, 23 Jul 2026 00:02:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=9oZF5eKYWTktbd3MC UKEqg1YGV0TwxcKFYdkYfPr/j8=; b=JBXKYCDGE2Qt4MxZ/47dd5HnP+bc4o0tt dM9OSZyy3v9aL9aiJVBtQMGW9c8mApWJYrd3Pqp6uDlmWRPf6+nSqrVNW0oj6GnP /NVERgCRKyipbdUgEbCvdTA2qn2ESH5F1NvLSWiOnO9dmbr0V6yjwaT9Zp9cPj8U vqc9Bx779YYRovSIc0ByaGdKufppJOVZPXaie4vIRAHxUlhqYyMk9PG7gJjeoYSK eQUDna9HxYAb35ZowGZgcZ0HiSsRxGrwBQ9norMM3uvw+Jq17Ftv3TsfFisnPrQu 7mpRLqfuRWGVg4mTf/furGGh1dwhZd2ImzGmD0Owb1XSDyZM/WXjQ== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg7abmyn6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:03 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNnfgA032317; Thu, 23 Jul 2026 00:02:02 GMT Received: from smtprelay02.dal12v.mail.ibm.com ([172.16.1.4]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fgmtk1rry-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:02 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay02.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N021Dk20579026 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:02:01 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DD54958060; Thu, 23 Jul 2026 00:02:00 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 47D125805A; Thu, 23 Jul 2026 00:02:00 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:02:00 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 10/33] ibmvfc: add logic for protocol specific fabric logins Date: Wed, 22 Jul 2026 17:01:26 -0700 Message-ID: <20260723000149.969416-11-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX7znpq3SV6KD5 BS+5OFaVXXfFLNr5dUXO5p+DYyjX40dw5X2bgFIks1SDBC1qV93MOpJLeKlBGMjAgVRSpnp+kXI qdpX5cJCM/amujoIz5b3DvSqtiiTmEYR+GY/2W01YsKLiE/YrEZE8/Aw8CwqRm4cdcP0XTcQKxC HWLbkgmmvkLk1RM5kbRBEOD2UGg3GvG/FaGHiZmX30shMmGsXpYJafqbo9GMHRpCFK57ZFcQf6/ fwd8TErQLgz0xC9jPzdfBCc5QUms7ChU2sXuyCAJUppfRpwMGPleMXYb4xvvOX8T1bVtOuoFaI8 u4V6Hq/1V0MB6mph2vvHz7K4523bv3RQ4143jqdiG0WBfX6qx+tD+f0K+VOIUClRA3shP9a3gtb YXQR2/79ezI6v5HbAcbF1KSnhDdPYBlnxFYFvg7hD6QUOimC8cdsavmWZDuGcJFK1zervuAuhdW Z1n/xWScR8p649rHfOw== X-Authority-Analysis: v=2.4 cv=F7ZnsKhN c=1 sm=1 tr=0 ts=6a6159fb cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=VnNF1IyMAAAA:8 a=FovE9xXL7NGL95JtJZEA:9 X-Proofpoint-ORIG-GUID: tglKqAi-9u085gSVshxuUWz2BRKYHBOI X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX4iEH84kD29GD mb/bwG7UqoQ5iMs+VFKL21z/2qqBhRjvqas3eYRhSCSqnh/rqYY03rH4k+bLkzfFUFv2ulwQHNF 9PDLWjcYKhgl34mMLXOexJEfqCdr6JA= X-Proofpoint-GUID: tglKqAi-9u085gSVshxuUWz2BRKYHBOI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 phishscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 impostorscore=0 lowpriorityscore=0 suspectscore=0 malwarescore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" Add support for the protocol-specific fabric login flow introduced by the updated client/VIOS interface. After NPIV login, a VIOS that advertises protocol-specific support requires separate fabric login MADs for SCSI and NVMe/FC. Track whether SCSI and NVMe/FC fabric login are needed, extend channel enquiry/setup handling to negotiate both SCSI and NVMe queue counts, and issue the appropriate fabric login MADs before target discovery begins. Also update command layout selection so the driver uses the v3 command format when the VIOS advertises NVMe/FC-capable framing. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc-core.c | 230 ++++++++++++++++++++++++---- drivers/scsi/ibmvscsi/ibmvfc.h | 11 +- 2 files changed, 206 insertions(+), 35 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ib= mvfc-core.c index d8c2b56258ee..e0edd71e9fd4 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c @@ -210,7 +210,9 @@ static int ibmvfc_check_caps(struct ibmvfc_host *vhost,= unsigned long cap_flags) static struct ibmvfc_fcp_cmd_iu *ibmvfc_get_fcp_iu(struct ibmvfc_host *vho= st, struct ibmvfc_cmd *vfc_cmd) { - if (ibmvfc_check_caps(vhost, IBMVFC_HANDLE_VF_WWPN)) + if (ibmvfc_check_caps(vhost, IBMVFC_SUPPORT_NVMEOF)) + return &vfc_cmd->v3scsi.iu; + else if (ibmvfc_check_caps(vhost, IBMVFC_HANDLE_VF_WWPN)) return &vfc_cmd->v2.iu; else return &vfc_cmd->v1.iu; @@ -219,7 +221,9 @@ static struct ibmvfc_fcp_cmd_iu *ibmvfc_get_fcp_iu(stru= ct ibmvfc_host *vhost, static struct ibmvfc_fcp_rsp *ibmvfc_get_fcp_rsp(struct ibmvfc_host *vhost, struct ibmvfc_cmd *vfc_cmd) { - if (ibmvfc_check_caps(vhost, IBMVFC_HANDLE_VF_WWPN)) + if (ibmvfc_check_caps(vhost, IBMVFC_SUPPORT_NVMEOF)) + return &vfc_cmd->v3scsi.rsp; + else if (ibmvfc_check_caps(vhost, IBMVFC_HANDLE_VF_WWPN)) return &vfc_cmd->v2.rsp; else return &vfc_cmd->v1.rsp; @@ -961,6 +965,8 @@ static int ibmvfc_reenable_crq_queue(struct ibmvfc_host= *vhost) spin_lock(vhost->crq.q_lock); vhost->do_enquiry =3D 1; vhost->using_channels =3D 0; + vhost->do_scsi_login =3D 0; + vhost->do_nvme_login =3D 0; spin_unlock(vhost->crq.q_lock); spin_unlock_irqrestore(vhost->host->host_lock, flags); =20 @@ -1000,6 +1006,8 @@ static int ibmvfc_reset_crq(struct ibmvfc_host *vhost) vhost->logged_in =3D 0; vhost->do_enquiry =3D 1; vhost->using_channels =3D 0; + vhost->do_scsi_login =3D 0; + vhost->do_nvme_login =3D 0; =20 /* Clean out the queue */ memset(crq->msgs.crq, 0, PAGE_SIZE); @@ -1512,7 +1520,7 @@ static void ibmvfc_set_login_info(struct ibmvfc_host = *vhost) max_cmds =3D scsi_qdepth + IBMVFC_NUM_INTERNAL_REQ; if (mq_enabled) max_cmds +=3D (scsi_qdepth + IBMVFC_NUM_INTERNAL_SUBQ_REQ) * - vhost->scsi_scrqs.desired_queues; + (vhost->scsi_scrqs.desired_queues + vhost->nvme_scrqs.desired_queues); =20 memset(login_info, 0, sizeof(*login_info)); =20 @@ -1530,8 +1538,14 @@ static void ibmvfc_set_login_info(struct ibmvfc_host= *vhost) login_info->max_cmds =3D cpu_to_be32(max_cmds); login_info->capabilities =3D cpu_to_be64(IBMVFC_CAN_MIGRATE | IBMVFC_CAN_= SEND_VF_WWPN); =20 - if (vhost->mq_enabled || vhost->using_channels) + if (vhost->mq_enabled || vhost->using_channels) { login_info->capabilities |=3D cpu_to_be64(IBMVFC_CAN_USE_CHANNELS); + if (vhost->nvme_enabled) { + login_info->capabilities |=3D cpu_to_be64(IBMVFC_YES_NVMEOF); + login_info->capabilities |=3D cpu_to_be64(IBMVFC_YES_SCSI); + login_info->capabilities |=3D cpu_to_be64(IBMVFC_CAN_USE_WWPN_ALL); + } + } =20 login_info->async.va =3D cpu_to_be64(vhost->async_crq.msg_token); login_info->async.len =3D cpu_to_be32(async_crq->size * @@ -1956,11 +1970,13 @@ static struct ibmvfc_cmd *ibmvfc_init_vfc_cmd(struc= t ibmvfc_event *evt, struct s size_t offset; =20 memset(vfc_cmd, 0, sizeof(*vfc_cmd)); - if (ibmvfc_check_caps(vhost, IBMVFC_HANDLE_VF_WWPN)) { + if (ibmvfc_check_caps(vhost, IBMVFC_SUPPORT_NVMEOF)) + offset =3D offsetof(struct ibmvfc_cmd, v3scsi.rsp); + else if (ibmvfc_check_caps(vhost, IBMVFC_HANDLE_VF_WWPN)) offset =3D offsetof(struct ibmvfc_cmd, v2.rsp); - vfc_cmd->target_wwpn =3D cpu_to_be64(rport->port_name); - } else + else offset =3D offsetof(struct ibmvfc_cmd, v1.rsp); + vfc_cmd->target_wwpn =3D cpu_to_be64(rport->port_name); vfc_cmd->resp.va =3D cpu_to_be64(be64_to_cpu(evt->crq.ioba) + offset); vfc_cmd->resp.len =3D cpu_to_be32(sizeof(*rsp)); vfc_cmd->frame_type =3D cpu_to_be32(IBMVFC_SCSI_FCP_TYPE); @@ -5052,14 +5068,141 @@ static void ibmvfc_discover_targets(struct ibmvfc_= host *vhost) ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD); } =20 +static void ibmvfc_fabric_login_nvme_done(struct ibmvfc_event *evt) +{ + struct ibmvfc_host *vhost =3D evt->vhost; + struct ibmvfc_fabric_login_mad *rsp =3D &evt->xfer_iu->fabric_login; + u32 mad_status =3D be16_to_cpu(rsp->common.status); + int level =3D IBMVFC_DEFAULT_LOG_LEVEL; + + switch (mad_status) { + case IBMVFC_MAD_SUCCESS: + ibmvfc_dbg(vhost, "NVMe fabric login succeeded\n"); + break; + case IBMVFC_MAD_FAILED: + if (ibmvfc_retry_cmd(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error))) + level +=3D ibmvfc_retry_host_init(vhost); + else + ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD); + ibmvfc_log(vhost, level, "NVMe fabric login failed: %s (%x:%x)\n", + ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), be16_to_cpu(rsp->erro= r)), + be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)); + ibmvfc_free_event(evt); + return; + case IBMVFC_MAD_DRIVER_FAILED: + ibmvfc_free_event(evt); + return; + default: + dev_err(vhost->dev, "Invalid NVMe fabric login response: 0x%x\n", mad_st= atus); + ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD); + break; + } + + ibmvfc_free_event(evt); + + ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_QUERY); + wake_up(&vhost->work_wait_q); +} + +static void ibmvfc_fabric_login_nvme(struct ibmvfc_host *vhost) +{ + struct ibmvfc_fabric_login_mad *mad; + struct ibmvfc_event *evt =3D ibmvfc_get_reserved_event(&vhost->crq); + + if (!evt) { + ibmvfc_retry_host_init(vhost); + return; + } + + ibmvfc_init_event(evt, ibmvfc_fabric_login_nvme_done, IBMVFC_MAD_FORMAT); + mad =3D &evt->iu.fabric_login; + memset(mad, 0, sizeof(*mad)); + mad->common.version =3D cpu_to_be32(1); + mad->common.opcode =3D cpu_to_be32(IBMVFC_NVMF_FABRIC_LOGIN); + mad->common.length =3D cpu_to_be16(sizeof(*mad)); + + ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_INIT_WAIT); + + if (!ibmvfc_send_event(evt, vhost, default_timeout)) + ibmvfc_dbg(vhost, "Send NVMe fabric login\n"); + else + ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD); +} + +static void ibmvfc_fabric_login_scsi_done(struct ibmvfc_event *evt) +{ + struct ibmvfc_host *vhost =3D evt->vhost; + struct ibmvfc_fabric_login_mad *rsp =3D &evt->xfer_iu->fabric_login; + u32 mad_status =3D be16_to_cpu(rsp->common.status); + int level =3D IBMVFC_DEFAULT_LOG_LEVEL; + + switch (mad_status) { + case IBMVFC_MAD_SUCCESS: + ibmvfc_dbg(vhost, "SCSI fabric login succeeded\n"); + break; + case IBMVFC_MAD_FAILED: + if (ibmvfc_retry_cmd(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error))) + level +=3D ibmvfc_retry_host_init(vhost); + else + ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD); + ibmvfc_log(vhost, level, "SCSI fabric login failed: %s (%x:%x)\n", + ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), be16_to_cpu(rsp->erro= r)), + be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)); + ibmvfc_free_event(evt); + return; + case IBMVFC_MAD_DRIVER_FAILED: + ibmvfc_free_event(evt); + return; + default: + dev_err(vhost->dev, "Invalid SCSI fabric login response: 0x%x\n", mad_st= atus); + ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD); + break; + } + + ibmvfc_free_event(evt); + + if (vhost->do_nvme_login) { + ibmvfc_fabric_login_nvme(vhost); + } else { + ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_QUERY); + wake_up(&vhost->work_wait_q); + } +} + +static void ibmvfc_fabric_login_scsi(struct ibmvfc_host *vhost) +{ + struct ibmvfc_fabric_login_mad *mad; + struct ibmvfc_event *evt =3D ibmvfc_get_reserved_event(&vhost->crq); + + if (!evt) { + ibmvfc_retry_host_init(vhost); + return; + } + + ibmvfc_init_event(evt, ibmvfc_fabric_login_scsi_done, IBMVFC_MAD_FORMAT); + mad =3D &evt->iu.fabric_login; + memset(mad, 0, sizeof(*mad)); + mad->common.version =3D cpu_to_be32(1); + mad->common.opcode =3D cpu_to_be32(IBMVFC_FABRIC_LOGIN); + mad->common.length =3D cpu_to_be16(sizeof(*mad)); + + ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_INIT_WAIT); + + if (!ibmvfc_send_event(evt, vhost, default_timeout)) + ibmvfc_dbg(vhost, "Send SCSI fabric login\n"); + else + ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD); +} + static void ibmvfc_channel_setup_done(struct ibmvfc_event *evt) { struct ibmvfc_host *vhost =3D evt->vhost; struct ibmvfc_channel_setup *setup =3D vhost->channel_setup_buf; - struct ibmvfc_channels *scrqs =3D &vhost->scsi_scrqs; + struct ibmvfc_channels *scsi =3D &vhost->scsi_scrqs; + struct ibmvfc_channels *nvme =3D &vhost->nvme_scrqs; u32 mad_status =3D be16_to_cpu(evt->xfer_iu->channel_setup.common.status); int level =3D IBMVFC_DEFAULT_LOG_LEVEL; - int flags, active_queues, i; + int flags, i; =20 ibmvfc_free_event(evt); =20 @@ -5068,22 +5211,28 @@ static void ibmvfc_channel_setup_done(struct ibmvfc= _event *evt) ibmvfc_dbg(vhost, "Channel Setup succeeded\n"); flags =3D be32_to_cpu(setup->flags); vhost->do_enquiry =3D 0; - active_queues =3D be32_to_cpu(setup->num_scsi_subq_channels); - scrqs->active_queues =3D active_queues; + scsi->active_queues =3D be32_to_cpu(setup->num_scsi_subq_channels); + nvme->active_queues =3D be32_to_cpu(setup->num_nvme_subq_channels); =20 if (flags & IBMVFC_CHANNELS_CANCELED) { ibmvfc_dbg(vhost, "Channels Canceled\n"); vhost->using_channels =3D 0; - } else { - if (active_queues) - vhost->using_channels =3D 1; - for (i =3D 0; i < active_queues; i++) - scrqs->scrqs[i].vios_cookie =3D - be64_to_cpu(setup->channel_handles[i]); - - ibmvfc_dbg(vhost, "Using %u channels\n", - vhost->scsi_scrqs.active_queues); + break; } + + if (scsi->active_queues || nvme->active_queues) + vhost->using_channels =3D 1; + for (i =3D 0; i < scsi->active_queues; i++) + scsi->scrqs[i].vios_cookie =3D + be64_to_cpu(setup->channel_handles[i]); + for (i =3D 0; i < nvme->active_queues; i++) + nvme->scrqs[i].vios_cookie =3D + be64_to_cpu(setup->channel_handles[scsi->active_queues + i]); + + ibmvfc_dbg(vhost, "Using %u SCSI channels\n", + scsi->active_queues); + ibmvfc_dbg(vhost, "Using %u NVMe channels\n", + nvme->active_queues); break; case IBMVFC_MAD_FAILED: level +=3D ibmvfc_retry_host_init(vhost); @@ -5098,8 +5247,12 @@ static void ibmvfc_channel_setup_done(struct ibmvfc_= event *evt) return; } =20 - ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_QUERY); - wake_up(&vhost->work_wait_q); + if (vhost->do_scsi_login) { + ibmvfc_fabric_login_scsi(vhost); + } else { + ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_QUERY); + wake_up(&vhost->work_wait_q); + } } =20 static void ibmvfc_channel_setup(struct ibmvfc_host *vhost) @@ -5107,9 +5260,12 @@ static void ibmvfc_channel_setup(struct ibmvfc_host = *vhost) struct ibmvfc_channel_setup_mad *mad; struct ibmvfc_channel_setup *setup_buf =3D vhost->channel_setup_buf; struct ibmvfc_event *evt =3D ibmvfc_get_reserved_event(&vhost->crq); - struct ibmvfc_channels *scrqs =3D &vhost->scsi_scrqs; - unsigned int num_channels =3D - min(scrqs->desired_queues, vhost->max_vios_scsi_channels); + struct ibmvfc_channels *scsi =3D &vhost->scsi_scrqs; + struct ibmvfc_channels *nvme =3D &vhost->nvme_scrqs; + unsigned int scsi_channels =3D + min(scsi->desired_queues, vhost->max_vios_scsi_channels); + unsigned int nvme_channels =3D + min(nvme->desired_queues, vhost->max_vios_nvme_channels); int level =3D IBMVFC_DEFAULT_LOG_LEVEL; int i; =20 @@ -5120,12 +5276,17 @@ static void ibmvfc_channel_setup(struct ibmvfc_host= *vhost) } =20 memset(setup_buf, 0, sizeof(*setup_buf)); - if (num_channels =3D=3D 0) + if (!scsi_channels && !nvme_channels) setup_buf->flags =3D cpu_to_be32(IBMVFC_CANCEL_CHANNELS); else { - setup_buf->num_scsi_subq_channels =3D cpu_to_be32(num_channels); - for (i =3D 0; i < num_channels; i++) - setup_buf->channel_handles[i] =3D cpu_to_be64(scrqs->scrqs[i].cookie); + setup_buf->num_scsi_subq_channels =3D cpu_to_be32(scsi_channels); + setup_buf->num_nvme_subq_channels =3D cpu_to_be32(nvme_channels); + for (i =3D 0; i < scsi_channels; i++) + setup_buf->channel_handles[i] =3D + cpu_to_be64(scsi->scrqs[i].cookie); + for (i =3D 0; i < nvme_channels; i++) + setup_buf->channel_handles[scsi_channels + i] =3D + cpu_to_be64(nvme->scrqs[i].cookie); } =20 ibmvfc_init_event(evt, ibmvfc_channel_setup_done, IBMVFC_MAD_FORMAT); @@ -5156,6 +5317,7 @@ static void ibmvfc_channel_enquiry_done(struct ibmvfc= _event *evt) case IBMVFC_MAD_SUCCESS: ibmvfc_dbg(vhost, "Channel Enquiry succeeded\n"); vhost->max_vios_scsi_channels =3D be32_to_cpu(rsp->num_scsi_subq_channel= s); + vhost->max_vios_nvme_channels =3D be32_to_cpu(rsp->num_nvme_subq_channel= s); ibmvfc_free_event(evt); break; case IBMVFC_MAD_FAILED: @@ -5290,8 +5452,14 @@ static void ibmvfc_npiv_login_done(struct ibmvfc_eve= nt *evt) vhost->host->can_queue =3D be32_to_cpu(rsp->max_cmds) - IBMVFC_NUM_INTERN= AL_REQ; vhost->host->max_sectors =3D npiv_max_sectors; =20 - if (ibmvfc_check_caps(vhost, IBMVFC_CAN_SUPPORT_CHANNELS) && vhost->do_en= quiry) { - ibmvfc_channel_enquiry(vhost); + + if (ibmvfc_check_caps(vhost, IBMVFC_CAN_SUPPORT_CHANNELS)) { + if (ibmvfc_check_caps(vhost, IBMVFC_SUPPORT_SCSI)) + vhost->do_scsi_login =3D 1; + if (ibmvfc_check_caps(vhost, IBMVFC_SUPPORT_NVMEOF)) + vhost->do_nvme_login =3D 1; + if (vhost->do_enquiry) + ibmvfc_channel_enquiry(vhost); } else { vhost->do_enquiry =3D 0; ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_QUERY); diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h index 01c49d81b135..454968de925b 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h @@ -617,9 +617,9 @@ struct ibmvfc_channel_enquiry { #define IBMVFC_SUPPORT_VARIABLE_SUBQ_MSG 0x02 #define IBMVFC_NO_N_TO_M_CHANNELS_SUPPORT 0x04 __be32 num_scsi_subq_channels; - __be32 num_nvmeof_subq_channels; + __be32 num_nvme_subq_channels; __be32 num_scsi_vas_channels; - __be32 num_nvmeof_vas_channels; + __be32 num_nvme_vas_channels; } __packed __aligned(8); =20 struct ibmvfc_channel_setup_mad { @@ -636,9 +636,9 @@ struct ibmvfc_channel_setup { #define IBMVFC_CHANNELS_CANCELED 0x04 __be32 reserved; __be32 num_scsi_subq_channels; - __be32 num_nvmeof_subq_channels; + __be32 num_nvme_subq_channels; __be32 num_scsi_vas_channels; - __be32 num_nvmeof_vas_channels; + __be32 num_nvme_vas_channels; struct srp_direct_buf buffer; __be64 reserved2[5]; __be64 channel_handles[IBMVFC_MAX_CHANNELS]; @@ -979,6 +979,7 @@ struct ibmvfc_host { int log_level; struct mutex passthru_mutex; unsigned int max_vios_scsi_channels; + unsigned int max_vios_nvme_channels; int task_set; int init_retries; int discovery_threads; @@ -991,6 +992,8 @@ struct ibmvfc_host { unsigned int using_channels:1; unsigned int do_enquiry:1; unsigned int nvme_enabled:1; + unsigned int do_scsi_login:1; + unsigned int do_nvme_login:1; unsigned int aborting_passthru:1; unsigned int scan_complete:1; int scan_timeout; --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 24A9C2E54D3; Thu, 23 Jul 2026 00:02:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764939; cv=none; b=O2gygS3juLPBfzDJbUXSZkVAf2GtM5NFIKk5WQsXV8SFZXDQsrrrO+IrlOmIOwdkWP9/iFfcdgifn7LjS6hBDHLJ5pJt768IKF5BUygc4SWg3/0RzlesL+U3p7Qo+egfX/LYsupeNS1aULpV901uFbH6jIdrjH5tumAoHDVtHJE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764939; c=relaxed/simple; bh=wn5KyesstrINpD48PMHM/6aTzCfwlj0p6IUSyjMsrAk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jpNLCL8pMgU/WUs9Tz0CW5iT26bYTulILPhbDcnbZIv4jlGsEJwPB/BNP2K9LJsnczMrenmrrxOFqrYQkTB35A35zfYlbTo/303sPypGlx5IGOW7c96o415LcWoG2x0sM+0QrDMniuC7JZX33SebGgqnggRPDy4U3ecQ1il5W4c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=O4dofb19; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="O4dofb19" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIBkOm712855; Thu, 23 Jul 2026 00:02:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=+CV+3oeauSD53h+iE 18B3fD83narQ9ScmrEbL6F/fLc=; b=O4dofb19wGSefWdHRV7Aap71fbZzrwhT8 ca/e2fbbNVkL0WzaOjLs4kgOIzkAvTLLk0bNAl0QN0rwRkQel9+w94mnArwPoePl cdiXToHuKlWD+QNdUNvaxu0Ulc4JLx7XuNsJyySv8ezw9H+gu6bLtBV3VesyfLRc 1axnJOfFfFnwEpkfUCyiVYyS6ShL/LI7mqo64QU7AzWUD+hW/bqLmyeTX7YEmZp0 p/n46Sscc7A95kUMFClGlwcVHyKP82eY5wevGtZXyhFvE8XYm1FBXOZvmgvgLt6Z PuYMNd7oG30WTINDJjj0IipjPQrJRsgt1xw36zXVi2/ld+kIqKOOQ== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg7ahcct1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:03 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNnr2q021831; Thu, 23 Jul 2026 00:02:03 GMT Received: from smtprelay02.dal12v.mail.ibm.com ([172.16.1.4]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fgm6w9uj8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:02 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay02.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N021xs58982878 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:02:01 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ADDB258061; Thu, 23 Jul 2026 00:02:01 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1207D58056; Thu, 23 Jul 2026 00:02:01 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:02:00 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 11/33] ibmvfc: add wrapper to get vhost associated with a channel struct Date: Wed, 22 Jul 2026 17:01:27 -0700 Message-ID: <20260723000149.969416-12-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: BhCmXeIcrOEyCkim8HofqM-Y156p43W_ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX63hp360X0nrj OjHi2juBkPQHqVnt+Ty6MkVlsT6EvJVHV6qUN9yRjb1wSV35MR0eLMC1O5cNdxnMBhEZ9sufPfR tv3BgU0IEdWtro3qspAZVYTu2MdzBJBjl12eDc+/XxQui2kDDyfwY7way2V861/rWH5p3Cm8LQb C1kXjouBkv53QNcg2kiKB0N2VVkpqoXdJUukoOEd7zOGzhg/69S9VUtU+OMPWWGwW9hK24jggs5 pOF01s83wgvZL34YwOfI49DZV0xGSdy8qg59pDEDZxV0pZQqpWsz9o5ArkzMBDy4jiHl0bZu51j VeR+dNJZ7fMYN+fhZXi4UzoLdz0e3GYZV9vZZNlchkJxoT+6fYgtOuC8cl1bNNkOh9r68lxHx3V 4kXUgkZd+/XTzNO8gnSJGBabuEBJV1b5mTSSeQSZJYX6r/TczlpkO0TdNMNheKmQAZJwpa0uEuI oqyarZhu93vBlDKTkHQ== X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX4vfywXRGGBJS 72CQHHNb8scDV6SKy4o2kYnwMf80/4e3HTVPj1QxkZ7UWtC7DNgM9HQfz82XoOTLm/Jxbp+cK6M AdtD5db0Wo7wXoYeuVJH9r/YcvVgWcI= X-Proofpoint-GUID: BhCmXeIcrOEyCkim8HofqM-Y156p43W_ X-Authority-Analysis: v=2.4 cv=SM5ykuvH c=1 sm=1 tr=0 ts=6a6159fb cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=VnNF1IyMAAAA:8 a=LqRknZQVlxeFVEtwFW4A:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 lowpriorityscore=0 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 priorityscore=1501 phishscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" Add ibmvfc_channels_to_vhost() to recover the parent struct ibmvfc_host from a protocol-specific struct ibmvfc_channels. Later patches need to operate on either the SCSI or NVMe channel group and still access host-wide state such as the primary CRQ, device, and logging context. Centralize that mapping in a helper instead of open- coding container lookups at each call site. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h index 454968de925b..67f546ff092e 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h @@ -1011,6 +1011,16 @@ struct ibmvfc_host { wait_queue_head_t work_wait_q; }; =20 +static inline struct ibmvfc_host *ibmvfc_channels_to_vhost(struct ibmvfc_c= hannels *channels) +{ + if (channels->protocol =3D=3D IBMVFC_PROTO_SCSI) + return container_of(channels, struct ibmvfc_host, scsi_scrqs); + else if (channels->protocol =3D=3D IBMVFC_PROTO_NVME) + return container_of(channels, struct ibmvfc_host, nvme_scrqs); + + return NULL; +} + #define DBG_CMD(CMD) do { if (ibmvfc_debug) CMD; } while (0) =20 #define tgt_dbg(t, fmt, ...) \ --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5ABBA3264C2; Thu, 23 Jul 2026 00:02:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764940; cv=none; b=mf+SDEOT1hJlbQdgznjf71F9XcT4CpRNruQ02IA66Q8/LtK0jCnsjRS3tyTWB43fZhBOGKyGmhb+6YyHZqMxmjlCOVkbXPgkOXVKVFScf18+bMAcMEeCRojIbqqu8gpLr169KFaMSrpKMYBITse9E9dhob/8g+mXNKE9HtiABP0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764940; c=relaxed/simple; bh=s2TBXQ+3iM4Gh1jF53zyC15GSgCprr636mZ3hJd/cK8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UjK8eV2/hTEt295Y3pdI6nUcGD3al7kgCjklh+V9CR/wCxQHFU3o99qLn7azMRGkdu1buZxm6/lxoKgg/z3F5iN+r9FAnMViKAnVPZ1pkQMzsaX4SQSCUXxHfMrLBwTmWOaD+mZDsKBoCjAnFgH0VWYNvm48TGkR2drwewJ2TTw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=iWRgIuk2; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="iWRgIuk2" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIBxKK606649; Thu, 23 Jul 2026 00:02:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=9puitqZwLH8kiVP/Z puEifIvBtjQAMW/MHJpov32270=; b=iWRgIuk2Ci7h7ppm1bFkbYqeIqHhRflSa ikgwdWsc2Tc3WSXuqo7/xT0F8CgG8vb7420gwbbCGcOeVSXz1woQkA9OuMw86G+Y LwrEnMGraA4IxOAn7hkSqk6udJXZPsdZqwyEJwa7tAfH/NfTCcrcLTDp1rvAxe+u YSV6px4YP+RzzmeDGWIgnAMsdbW6bfCNpoxr0ud7Vt9TaMaHGS92sJPikHsLOMYx jVe/OAP+HEm140iLJiBSh/4CdHHaYWcxfs3AfNm0zvsfNbs/srCj0mKiRcS3RETl o8opc2KpBCQosLMlGrbcOL3OUvyf6I5ARlaDD1c00x2hrO97aX2yw== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg78gcc05-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:04 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNnbP7028169; Thu, 23 Jul 2026 00:02:03 GMT Received: from smtprelay03.dal12v.mail.ibm.com ([172.16.1.5]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fgnah9q2n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:03 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay03.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N022fc29885138 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:02:02 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6D8C458056; Thu, 23 Jul 2026 00:02:02 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C9BF55803F; Thu, 23 Jul 2026 00:02:01 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:02:01 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 12/33] ibmvfc: add helper for creating protocol specific discovery event Date: Wed, 22 Jul 2026 17:01:28 -0700 Message-ID: <20260723000149.969416-13-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX7ERrU0rmmtqM ltL9SE7wLsOmQjdGbATJ/m6gpGR3aZ+KlV59Di0RNS4nDwul5yUNgCfa5Pz4TqMtbT9lTxtzIjz nw5lVOXC3RrOEEXwECaHkFVzKwT/G1mf/4IJioyEII5oQqXssatbXOULY+YP4ZEBzoATuNepewi TcxuXlgUwpu9JdWr5kJaoMELKtb+quB84hmw+dOg7kSR1W1tRtwOhb/BfzzYbv8Su+136AqmrlT cd224ghBpObUDNcIXRUYtsntA6F47Ytv4hLdalKwrDfk7PkvN5ZX61Ercv2pytS1bO0ywhJ8RUc fwQBHOiQrg93j8FwQAtawvr/2gc2/C749DwBLu25d8zHUQfPuqeptLDEtY5Lr1tO6r4raUIz0Tn kAObAD7UHSgcAzk4sh2EpAgjFHcZHfSHWPBpin6iMOLtcd5cQMEYc6cGt/3ZNk/H21YKTDB1lne KmoQgdY29mkBZhX1lSA== X-Proofpoint-GUID: Pur9GUyRdV_gyoOmP6Ksp8mYKMi3tAaL X-Authority-Analysis: v=2.4 cv=MelcfZ/f c=1 sm=1 tr=0 ts=6a6159fc cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VnNF1IyMAAAA:8 a=cvol4pHx2ldDu_PevKwA:9 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX+XlwswkFpmBb v9NB8eUHX4FZysp2I7gvwzy9jAq7aG/WJ+Fw1qVw01E33STvC4FYV36Ttv/qa02wFtyH1jB0vFD yQkRjn9fzRAINQ4t5kGDTtPhMGvjxgY= X-Proofpoint-ORIG-GUID: Pur9GUyRdV_gyoOmP6Ksp8mYKMi3tAaL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 spamscore=0 clxscore=1015 malwarescore=0 phishscore=0 adultscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" Refactor discover-target event creation so it can be shared by both SCSI and NVMe/FC discovery. Introduce a helper that takes a protocol-specific channel group, selects the correct discover-target opcode, and maps the corresponding discovery buffer into the MAD. This is a preparatory cleanup for issuing protocol-specific discovery MADs in later patches. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc-core.c | 39 ++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ib= mvfc-core.c index e0edd71e9fd4..84302f982a6a 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c @@ -5033,6 +5033,32 @@ static void ibmvfc_discover_targets_done(struct ibmv= fc_event *evt) wake_up(&vhost->work_wait_q); } =20 +static struct ibmvfc_event *ibmvfc_get_disc_event(struct ibmvfc_channels *= channels) +{ + struct ibmvfc_discover_targets *mad; + struct ibmvfc_host *vhost =3D ibmvfc_channels_to_vhost(channels); + struct ibmvfc_event *evt =3D ibmvfc_get_reserved_event(&vhost->crq); + + if (!evt) + return NULL; + + ibmvfc_init_event(evt, ibmvfc_discover_targets_done, IBMVFC_MAD_FORMAT); + mad =3D &evt->iu.discover_targets; + memset(mad, 0, sizeof(*mad)); + mad->common.version =3D cpu_to_be32(1); + if (channels->protocol =3D=3D IBMVFC_PROTO_SCSI) + mad->common.opcode =3D cpu_to_be32(IBMVFC_DISC_TARGETS); + else + mad->common.opcode =3D cpu_to_be32(IBMVFC_DISC_NVMF_TARGETS); + mad->common.length =3D cpu_to_be16(sizeof(*mad)); + mad->bufflen =3D cpu_to_be32(channels->disc_buf_sz); + mad->buffer.va =3D cpu_to_be64(channels->disc_buf_dma); + mad->buffer.len =3D cpu_to_be32(channels->disc_buf_sz); + mad->flags =3D cpu_to_be32(IBMVFC_DISC_TGT_PORT_ID_WWPN_LIST); + + return evt; +} + /** * ibmvfc_discover_targets - Send Discover Targets MAD * @vhost: ibmvfc host struct @@ -5040,8 +5066,7 @@ static void ibmvfc_discover_targets_done(struct ibmvf= c_event *evt) **/ static void ibmvfc_discover_targets(struct ibmvfc_host *vhost) { - struct ibmvfc_discover_targets *mad; - struct ibmvfc_event *evt =3D ibmvfc_get_reserved_event(&vhost->crq); + struct ibmvfc_event *evt =3D ibmvfc_get_disc_event(&vhost->scsi_scrqs); int level =3D IBMVFC_DEFAULT_LOG_LEVEL; =20 if (!evt) { @@ -5050,16 +5075,6 @@ static void ibmvfc_discover_targets(struct ibmvfc_ho= st *vhost) return; } =20 - ibmvfc_init_event(evt, ibmvfc_discover_targets_done, IBMVFC_MAD_FORMAT); - mad =3D &evt->iu.discover_targets; - memset(mad, 0, sizeof(*mad)); - mad->common.version =3D cpu_to_be32(1); - mad->common.opcode =3D cpu_to_be32(IBMVFC_DISC_TARGETS); - mad->common.length =3D cpu_to_be16(sizeof(*mad)); - mad->bufflen =3D cpu_to_be32(vhost->scsi_scrqs.disc_buf_sz); - mad->buffer.va =3D cpu_to_be64(vhost->scsi_scrqs.disc_buf_dma); - mad->buffer.len =3D cpu_to_be32(vhost->scsi_scrqs.disc_buf_sz); - mad->flags =3D cpu_to_be32(IBMVFC_DISC_TGT_PORT_ID_WWPN_LIST); ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_INIT_WAIT); =20 if (!ibmvfc_send_event(evt, vhost, default_timeout)) --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2293306774; Thu, 23 Jul 2026 00:02:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764939; cv=none; b=dJCXebbqrX8VSpwDSPfvMAKdh6Pej5cuYnrnE3sn5AiDVOKHYaS5UmwQ0r2hTN/9Wg9VsZmP+oKQYPv2GsYNSAILKTjlESnMCIIlUuUHMR9P+Fs4tjcAOI9vit6sLDP6iAeKNa1OHZ3UQ4wJlyzNvomV5d1sdTduHu4sZ6zzW88= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764939; c=relaxed/simple; bh=1r3en/L9ONvbvUXUWlyc4iRKf0SW5WtsYogliFBB/oQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IrjL1ljJ6eAjcQNB0P99G6qnooXUbsRvuREfxa+FznvQ9rGAx1BfqOTfIN6VJfmWSdDFG58YXDmCBUCefafW97rY3HeD3GH+WOvbn/FKbTOAIlhilUVHNzoDapEzyrITzLlkvOTUiorhdS8oM4xpo89CLWLx2FQ/kDcbe3Mwsyw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=qLxHey/O; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="qLxHey/O" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIBghn704661; Thu, 23 Jul 2026 00:02:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=iKP19Gy0I7YPiZgvG eYzV8XDayV05CWOuwTMZlJYS2U=; b=qLxHey/OEA4HYfEIy7niFjdvpOS4PbO7F ayszK5pJEJbLM9XUrtq4AQHow34wV4qHZYP2EtxDJCakugxn40zOZoBpmhXEvhVU wLtWQHnBor8BBp4JDNy9T5nFf+QUFf1NFsDxnODj9fhNDafhkEYtN/E4IGzqO9kz BwHFAAi54ZScmzqFL7n0kVeOKQ5CEsUXTrYYYjPG643tFgHzDtXG63bNl0DoCB8u tdCkhp/ysLXm5VE9ypf+DOijfX/sDilspku+Vv3L4A1MpQXu5viIxHJmiWJfaAus iMv7B6/bf5ThiTjhAtlqj4+dyEFj2qT7KCmXSgF3yZ3Fjm3O2QvSQ== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg7abmynb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:05 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNnaPc028971; Thu, 23 Jul 2026 00:02:04 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4fgpgyhfqr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:04 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N023qn21234260 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:02:03 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 30C2F58061; Thu, 23 Jul 2026 00:02:03 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 894695803F; Thu, 23 Jul 2026 00:02:02 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:02:02 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 13/33] ibmvfc: add helper to check NVMe/FC support with active channels Date: Wed, 22 Jul 2026 17:01:29 -0700 Message-ID: <20260723000149.969416-14-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX5YgSDN194RHq myrqK3HySiNyXAIJ5rzsnyQJG3aRyzeUeHdhzMrlYlbGookYxvRvd3fi4yimCFmoH3UQ7d9BTeQ zUzCmevudOLSZdrLLDxMlE9FKgP3QAa9XJ0h+j7ajHR7hyJjrUvS/tM3kAogLZfD2xu5IwQyiNW 8IT3fIydkp0DnfYpUXhBKHlmASI4utwagw9/HnbyNHTvZ4i3wD34838Di4M+9j8M+HSTEe8h91g kKAbXFN9Q+NQocx4rcZQojwwG1oT3fiWJxUIbwELn4tkWAoloGZ3ty49Mw2YtN3gm5auKtCZ3FH vo6yO8v2nPDwTsEMgRXxt45MZW0D0ixwz1UsYJzvDA3SlveI4pJC97eAG1WAEkBfrLv05oFnQt3 YFCON0iI/BeS3sm7TfSqxhmms6c/I9455s2sLE+H8uOqVf/sD/meIF2svKsJHiuljkAPJ3X2iSf 3yZ9megMPT3eHoJ0fQw== X-Authority-Analysis: v=2.4 cv=F7ZnsKhN c=1 sm=1 tr=0 ts=6a6159fd cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=VnNF1IyMAAAA:8 a=9D5glHWTs2YOxXNpKTwA:9 X-Proofpoint-ORIG-GUID: fhaIbfKXM5g4EUlIehfpZYMvkdI4pPoE X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfXxmi+qEE/LQDw pJXumRDvVIwaXXSWJsLEsjHC9ChNOdaGwr5ZQ0WoFLtzLk5rPCAEIfXl7LfkaX85v9VY2zBrZ2T +1i/a5tK3jFKk02bnFpBkxhQiItS0Dg= X-Proofpoint-GUID: fhaIbfKXM5g4EUlIehfpZYMvkdI4pPoE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 phishscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 impostorscore=0 lowpriorityscore=0 suspectscore=0 malwarescore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" It can be the case that NVMeoF is enabled on both the client and VIOS, but no queues are configured making the need to do NVMe target discovery pointless. Add a helper to short hand the capabilities check and active NVMe queue check. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc-core.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ib= mvfc-core.c index 84302f982a6a..088167ec04ff 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c @@ -207,6 +207,12 @@ static int ibmvfc_check_caps(struct ibmvfc_host *vhost= , unsigned long cap_flags) return (host_caps & cap_flags) ? 1 : 0; } =20 +static int ibmvfc_nvme_active(struct ibmvfc_host *vhost) +{ + return (ibmvfc_check_caps(vhost, IBMVFC_SUPPORT_NVMEOF) && + vhost->nvme_scrqs.active_queues); +} + static struct ibmvfc_fcp_cmd_iu *ibmvfc_get_fcp_iu(struct ibmvfc_host *vho= st, struct ibmvfc_cmd *vfc_cmd) { --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E984333D6CA; Thu, 23 Jul 2026 00:02:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764941; cv=none; b=oPaA6c9f1Y8DaCB759aWCyWPPz+5jU8IJNsPWONTPQ2cm/EfXSv+NCOPyZuHb3G5JoohKj++B/Rc5UWwqMJq+3EYxQ+ZJ1ISdBYnbPFSfk1geHlBJRFA4G4i7KbKuStdf38imZNMGBAs7UhLxl1a0a1misIYzMymM5nHaroHwng= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764941; c=relaxed/simple; bh=znw8sDpBwUz3+TV2aAwWSg5Zd+56kJ0sYGMgiWqNipU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BS26u12SMbB8RtZ7d1Z9g3pyi7HS8NrdVMMmMkj76N1sFUB0u4IJFKD9P67Zh+mOHIvx5FI7bqjFoQoe+ZB+NjAcxXa9NVqGNJPHnAmnr0iVvplV0zMjbhKdEjEkX2nPc9mCwjjKgimNsu+eVV7j5lTy5BpMSmgq7DWq98lySV4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=Ly3YWDUQ; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="Ly3YWDUQ" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MICSqM714590; Thu, 23 Jul 2026 00:02:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=LU8iUAZRNHYghpMlB jgOCU4nmEYRCejYOKDMT+BakN4=; b=Ly3YWDUQsRnGee8KeCVsXCT2xZ/kH7rOw Dyarl04VAivZT0GpMdUczteTSQdZRWJzQ9/pGFjoHOcNGS7ojTnxELjd3vY06bYo naYoa7tlGIhI6REK+YJ595cn+LIBKxbSOG/ZjIRVmJivEGCAe+EOxsw1ljr9xDFK u5l7d/rJ/EXG/qqANaXVPRDsKMS1iBrJ02DabsVO46+KkhewXWycQ/IXw68JjXmL J2OacIYV/rHykoLJbI7VLxkEG+7nhPZgI063kwuzhSTjKCPwLKRuU8S/7X9Xew8X C1nBI89IE/8/m5QJ2JMm3Ab44lkqr7Y9P06p4Xeqs1uIHbUDK8cMg== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg7ahcct6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:05 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNnuoF026514; Thu, 23 Jul 2026 00:02:04 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4fgktq9x2f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:04 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N023ao19464800 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:02:04 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E1F305805A; Thu, 23 Jul 2026 00:02:03 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4D9C858063; Thu, 23 Jul 2026 00:02:03 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:02:03 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 14/33] ibmvfc: allocate and free NVMe channel group discover buffer Date: Wed, 22 Jul 2026 17:01:30 -0700 Message-ID: <20260723000149.969416-15-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: DD9qkgwYUMEwGKjFOPlWTa3EJmqOu9ZY X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX4i0Q5kIrqTK8 d1F+tbSr+CmxBd19r3UhTYrmYorbpZB0obqQQqJfG1NQ+8G2bPJI8oZp83Lc/VTcMJrITknCFoe fFhWiqTs48xXWBe4szapRxHxvjK0JhXMwnoOflEqt+YisXHebuKdjdE/9Tqax5zFWrmDMRcK2d+ nTQKo3prf/8U8DLmCdbjcOs7XI02mMvWHmL8ikKZGjpwnmcQ+Vd6wvhEVceaaPexWJji+4pmWyi eDqz2XXUgmm8xKjydwOPiZNl9td+2uRpMil9Ut11pXbo+58QXwXZyXYSvR7sAjN5msNPypVSGL9 A2X91Z6YZJw2D9HZU5yDYkw6kB6Q5EkmU4z9NLyg9vJHJ+PmozUz02jPEY40IDbgfjvEvJ9stqj 2Ihen3+SM71rsmb0jc0YqMzXZae1uqjB0wIooWKOZSngTwM9gJfrWcClUzbQf5q84h1kY5vZsWt zXJzdIExS/63L/HBQfg== X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX+SSHhF8yEo5z Lbfj02bOzxK69JJM0QaJIHPiTJQMUGoRp8UwBSRabNadZu+iD8UOZN6tKfpynOJ73MZjll0bUnT 4ulkLV9xIl6zMeB1pfDdVPtoOMPz9VE= X-Proofpoint-GUID: DD9qkgwYUMEwGKjFOPlWTa3EJmqOu9ZY X-Authority-Analysis: v=2.4 cv=SM5ykuvH c=1 sm=1 tr=0 ts=6a6159fd cx=c_pps a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=VnNF1IyMAAAA:8 a=FxNEJgEJPZLGpAZHG_oA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 lowpriorityscore=0 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 priorityscore=1501 phishscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" Allocate a discovery buffer for the NVMe channel group and free it on all teardown and error paths. The existing discovery-buffer allocation only covered the SCSI channel group. This patch is prepratory for sending NVMe/FC target discovery MAD. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc-core.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ib= mvfc-core.c index 088167ec04ff..a700e2554e69 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c @@ -6375,6 +6375,7 @@ static void ibmvfc_free_mem(struct ibmvfc_host *vhost) mempool_destroy(vhost->tgt_pool); kfree(vhost->trace); ibmvfc_free_disc_buf(vhost->dev, &vhost->scsi_scrqs); + ibmvfc_free_disc_buf(vhost->dev, &vhost->nvme_scrqs); dma_free_coherent(vhost->dev, sizeof(*vhost->login_buf), vhost->login_buf, vhost->login_buf_dma); dma_free_coherent(vhost->dev, sizeof(*vhost->channel_setup_buf), @@ -6437,12 +6438,15 @@ static int ibmvfc_alloc_mem(struct ibmvfc_host *vho= st) if (ibmvfc_alloc_disc_buf(dev, &vhost->scsi_scrqs)) goto free_login_buffer; =20 + if (ibmvfc_alloc_disc_buf(dev, &vhost->nvme_scrqs)) + goto free_scsi_disc_buffer; + vhost->trace =3D kzalloc_objs(struct ibmvfc_trace_entry, IBMVFC_NUM_TRACE_ENTRIES); atomic_set(&vhost->trace_index, -1); =20 if (!vhost->trace) - goto free_scsi_disc_buffer; + goto free_nvme_disc_buffer; =20 vhost->tgt_pool =3D mempool_create_kmalloc_pool(IBMVFC_TGT_MEMPOOL_SZ, sizeof(struct ibmvfc_target)); @@ -6468,6 +6472,8 @@ static int ibmvfc_alloc_mem(struct ibmvfc_host *vhost) mempool_destroy(vhost->tgt_pool); free_trace: kfree(vhost->trace); +free_nvme_disc_buffer: + ibmvfc_free_disc_buf(dev, &vhost->nvme_scrqs); free_scsi_disc_buffer: ibmvfc_free_disc_buf(dev, &vhost->scsi_scrqs); free_login_buffer: --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB86B360EF9; Thu, 23 Jul 2026 00:02:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764943; cv=none; b=m1jVNdaT+83sTg+S26g2Y86D2AHtKJC3WSVy0/4tYAiRoePMip23wKYtwpBTC78o5TcdcO6DN4KUcLmzoo/TTFJKOcsu1xmcR3F9hR9RAWoHJo7ZVZPhG69Vt422CwOAF9/6Bfb8ld0MBJLJ/kb5W/2VOGRwqH3rBG+i5Q/XFho= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764943; c=relaxed/simple; bh=rSIblivDt/BmBKpzCS8ZCThGbbde0mHfR0rFh0FLQs8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oPE6CCsFLjm4HQ4Vcm4ftpDVZjIqw6qNjBc838cyGraOlRKjiJrUz5Pbd+s6nN3Z0zunfXVnKikC5Mljp/nY8mSz5L8zmUShLp64O0G1J4swHTgb31jn1Sv8AdD/ooxBj6wGb/7E4RSWHruHRg+le7wjsIflq5ledC13BHDXZs4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=eYU8SD0F; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="eYU8SD0F" Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIBuWI713174; Thu, 23 Jul 2026 00:02:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=/J48jdanjixDF2dUb fBjqE0vgyyWu4PVAZaKChOMabk=; b=eYU8SD0FKpdoRNnt9KoK5D3CIa9/bzXpm 6v/XBqA8b9TqYJrh774WKTVcypVcKLxyc3I7REmGQn0JHBHtkkFlCCEasVuttyCH 8DjnrwMoI20ZoZnYiU+GddYdZTzsZP86DS2S+TS2UCWnqYeohQWXCmrj17Z0g+x6 rHxLbBj/rtY8zEYihawiR8CR0dUzHkILj9ubLUGnpBeTCNLsG3VWdr3ib34KCHgx VdMQMtNQzs14UACfJaGvvj8XY3gYPzo1DAN4terfinoKDyy4bpLEaTUkJbPkm4b2 QqQBPif/b7lcl222gIvETpY8TMsI1IH7Mg3ied6lQWovoXlFtd9lA== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg7914xpw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:06 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNnr2r021831; Thu, 23 Jul 2026 00:02:05 GMT Received: from smtprelay05.dal12v.mail.ibm.com ([172.16.1.7]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fgm6w9ujk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:05 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay05.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N024HV30671360 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:02:04 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9C44F58063; Thu, 23 Jul 2026 00:02:04 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0940A58060; Thu, 23 Jul 2026 00:02:04 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:02:03 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 15/33] ibmvfc: send NVMe target discovery MAD Date: Wed, 22 Jul 2026 17:01:31 -0700 Message-ID: <20260723000149.969416-16-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: ZTwC0VCp6K9EbmREQ65I2aQHjOnpRmiZ X-Authority-Analysis: v=2.4 cv=V6RNF+ni c=1 sm=1 tr=0 ts=6a6159ff cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=U7nrCbtTmkRpXpFmAIza:22 a=VnNF1IyMAAAA:8 a=tsEFHN6dr6_4AEcdNwsA:9 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX1juZ5ywvBmXM JoMxT+DEbENrLpN88D4dqpCtXUS95E3rxmLxXjGSM0NlFDo/arYQ9P/kP2oFT8kBpslGokuHclc dKje+aTCEBUqOvGTgh/ZR83h+lFWj8Q= X-Proofpoint-GUID: ZTwC0VCp6K9EbmREQ65I2aQHjOnpRmiZ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX/S0rGFDiFBY7 CaoFJwQlhWdqFpST9m5Qbzmb6pJbkjt0EqH9u2Ep7yW/6j51SKyLwMT4VKQvZvlGxWwJlrmJPlA mgIU8X+SbEYQxVhAaN9RqYm+YqJVA9Hov7fz98ajqRMefgwIGtKahZLyOTeM5AvXkjgYxrcQ5Uu YIrnDm+BZFJ30jpUwEOcDpJsDA7lgMfpyJJfeaTc1d05Unx3oNxOSLM8EkrnylqLrv6EE6AFOQk bpENCRD0neXoYJhIBR5KV5qRvMmRauf+f6P+kq7mfb6b5QqRaUUYH8Lk7cf0Mj7UUlcdInBiSXC 32hNjywEaNERyd+/WffUJJ/AQhi3zswI3l3qDxHxwMPKgtzkFE5fj+4FUVin5Ei51LbI4iW5Stx cjcPvj84nN00w98TTFxVbsoA/v+nVcq9eoKcg7CmrXGO2rkokMpTaMqOAs2ebh2+72mnU2B9VHC ABH8uwoFXO6OFc8IVyA== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 adultscore=0 bulkscore=0 lowpriorityscore=0 clxscore=1015 spamscore=0 impostorscore=0 phishscore=0 priorityscore=1501 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" Extend target discovery to send protocol-specific discover-target MADs for NVMe/FC. Use the protocol-aware discovery helper to build an NVMe discover-target request, submit it when NVMe/FC support is active, and process the returned target count using the NVMe channel group's discovery buffer. This allows the driver to discover NVMe/FC targets in parallel with the existing SCSI discovery flow while keeping protocol-specific target data separate. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc-core.c | 50 +++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ib= mvfc-core.c index a700e2554e69..1d2a88e9fe94 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c @@ -173,6 +173,11 @@ static const struct { { IBMVFC_FC_SCSI_ERROR, IBMVFC_COMMAND_FAILED, DID_ERROR, 0, 1, "PRLI to = device failed." }, }; =20 +static const char *proto_type[] =3D { + "SCSI", + "NVMe", +}; + static void ibmvfc_npiv_login(struct ibmvfc_host *); static void ibmvfc_tgt_send_prli(struct ibmvfc_target *); static void ibmvfc_tgt_send_plogi(struct ibmvfc_target *); @@ -5011,19 +5016,30 @@ static void ibmvfc_discover_targets_done(struct ibm= vfc_event *evt) { struct ibmvfc_host *vhost =3D evt->vhost; struct ibmvfc_discover_targets *rsp =3D &evt->xfer_iu->discover_targets; + struct ibmvfc_channels *channels; u32 mad_status =3D be16_to_cpu(rsp->common.status); + u32 opcode =3D be32_to_cpu(rsp->common.opcode); int level =3D IBMVFC_DEFAULT_LOG_LEVEL; =20 + if (opcode =3D=3D IBMVFC_DISC_TARGETS) + channels =3D &vhost->scsi_scrqs; + else + channels =3D &vhost->nvme_scrqs; + switch (mad_status) { case IBMVFC_MAD_SUCCESS: - ibmvfc_dbg(vhost, "Discover Targets succeeded\n"); - vhost->scsi_scrqs.num_targets =3D min_t(u32, be32_to_cpu(rsp->num_writte= n), - max_targets); + ibmvfc_dbg(vhost, "Discover %s Targets succeeded\n", + proto_type[channels->protocol]); + channels->num_targets =3D min_t(u32, be32_to_cpu(rsp->num_written), + max_targets); + ibmvfc_dbg(vhost, "%d %s targets found\n", channels->num_targets, + proto_type[channels->protocol]); ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_ALLOC_TGTS); break; case IBMVFC_MAD_FAILED: level +=3D ibmvfc_retry_host_init(vhost); - ibmvfc_log(vhost, level, "Discover Targets failed: %s (%x:%x)\n", + ibmvfc_log(vhost, level, "Discover %s Targets failed: %s (%x:%x)\n", + proto_type[channels->protocol], ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), be16_to_cpu(rsp->erro= r)), be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)); break; @@ -5076,7 +5092,7 @@ static void ibmvfc_discover_targets(struct ibmvfc_hos= t *vhost) int level =3D IBMVFC_DEFAULT_LOG_LEVEL; =20 if (!evt) { - ibmvfc_log(vhost, level, "Discover Targets failed: no available events\n= "); + ibmvfc_log(vhost, level, "Discover SCSI Targets failed: no available eve= nts\n"); ibmvfc_hard_reset_host(vhost); return; } @@ -5084,9 +5100,29 @@ static void ibmvfc_discover_targets(struct ibmvfc_ho= st *vhost) ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_INIT_WAIT); =20 if (!ibmvfc_send_event(evt, vhost, default_timeout)) - ibmvfc_dbg(vhost, "Sent discover targets\n"); + ibmvfc_dbg(vhost, "Sent discover SCSI targets\n"); else - ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD); + goto link_down; + + if (!ibmvfc_nvme_active(vhost)) + return; + + evt =3D ibmvfc_get_disc_event(&vhost->nvme_scrqs); + if (!evt) { + ibmvfc_log(vhost, level, "Discover NVMe Targets failed: no available eve= nts\n"); + ibmvfc_hard_reset_host(vhost); + return; + } + + if (!ibmvfc_send_event(evt, vhost, default_timeout)) + ibmvfc_dbg(vhost, "Sent discover NVMe targets\n"); + else + goto link_down; + + return; + +link_down: + ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD); } =20 static void ibmvfc_fabric_login_nvme_done(struct ibmvfc_event *evt) --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D1083803D3; Thu, 23 Jul 2026 00:02:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764950; cv=none; b=YNvpJHJrc1lczhzW7CcgqYxPsKKPYjq2DMkjRI40YU2Cw7g3YQaNiwhqebkBAYSjQJa4/rO+t40RUFG+8EqTeN7HaftHmSy4MKS1Rqskvk+TG4yq0a2nJTt2uzEVM+sTBHJ7OTr0nGeE934PIyKPRa2JPSz+ujyo9axM/3aTK9o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764950; c=relaxed/simple; bh=Zqa8K+KAZxBW9y31V1RwMmP+mGfZcbAiT48y2hTZU/w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M+XY2gnvN2ILU6KZ0iEKzJ5AEEGXLmQRwXPRO2dg+nudXo6UpsVPvWIeN9igf+87fZb7T091u/A9rKeGyw4MmbNLXO3hDEthS0AA4C3AcYYINmhrj5bgsh8/YVrZPzUFAF7G4faL5/HL9J9773xUkWKk0X+RXosLcapRZmeG+DQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=Op9uRFsy; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="Op9uRFsy" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIBkqt712893; Thu, 23 Jul 2026 00:02:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=2EWbeYjqIEIHDerH8 OnXaiH3xR3pLUb5ZY1bKI1oaTU=; b=Op9uRFsyazVQ36ZuUiXHTg4xp3IPn5r7z zF1vYpVZVJ/ltlcrm6434n38ghB8qx0QDUpUrEmsGYesVkPgLfQpI7CYve7Q7i28 Kj+dpxUA4GuFzKiVPmdfUC4MCTeaLV1a7Tf4bJ6svSeuv+j/h7EtPU6RS0ngZX8w JhIDLzmGXRiUUcUeyZrX8Y0HLCbmx1UcFxy63y4frUg+PM4eeHsceO2XCZnTVWpj dTXzQcz3+pQ+jD9aOBaUCbJ2Q8EQU8fdLw3SPucJfXGMdpZzuweS/t9m4OcS0jjB D/N1UbdRYg6VDpTgMX+sKC6PM7HatZdP05DC+t1HlSOaalagkEzjA== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg7ahcctb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:08 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNncnY009390; Thu, 23 Jul 2026 00:02:07 GMT Received: from smtprelay03.wdc07v.mail.ibm.com ([172.16.1.70]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4fgp1ghja8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:07 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay03.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N01TF37340716 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:01:30 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6440E58068; Thu, 23 Jul 2026 00:02:05 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B8C9658060; Thu, 23 Jul 2026 00:02:04 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:02:04 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 16/33] ibmvfc: add NVMe/FC Implicit Logout and Move Login support Date: Wed, 22 Jul 2026 17:01:32 -0700 Message-ID: <20260723000149.969416-17-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: M-K_QW-daduJz-yE8PrzUfl4lwNzvZSp X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX9qxDODB7tpAI RxkKh/mGZ2jHxnksxo9jSXG16A9XsmCbq6vr98GfmthaKtSLNdUNIBS/grORnNLP2dtRjSj7I5e exYpKU8GvFSdva8i2SG2o5HtILbXYXFcFiE2CqibO4mq+C2j79LPV6ziBp6TnGxtNMeQFOqLkOz eBQsEfaGKmLzWVAVe8W7xtnlU7/QplDVWb/zU8fgaPgtS+dQGCKSu6S8OkDKNaLo3swi9yUP1ht fkHg/GloGMEYeOjq2Psc8z5xveQCdZ2bOdjtVPhs0kZ669mCc6CaZ2fxkZmdyhrxvlv77qz42Pq kTm6gUdzMEh3vhQEXQGEKRzI0/56u798kmUyibLOLxhp4YMBF3qkd7lSazlQ/Rid51ZLGPAHsh9 u2m9jm3x2aAjhYj3gzbeX1UsY0wu2NZ6TZR3xxA1MvVKwa1qBfHbr9oKcN63gvsQGl1Z2UVDvyT FiQeEdYkpQVyLVW/prQ== X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX1eV6lT5xpI9/ BCImDxNQU7WCccj5ICBHHy2kGhFSQkxklT/kDyA0yvht3Nce/1TTOr0x1oob/5khehiyynpX2p1 fkvtOz/zB2T1ckF15A3AFOo7Bm51I2I= X-Proofpoint-GUID: M-K_QW-daduJz-yE8PrzUfl4lwNzvZSp X-Authority-Analysis: v=2.4 cv=SM5ykuvH c=1 sm=1 tr=0 ts=6a615a00 cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=VnNF1IyMAAAA:8 a=vOiCItosospfXf71XmMA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 lowpriorityscore=0 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 priorityscore=1501 phishscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" Add protocol-specific handling for implicit logout and move-login operations on NVMe/FC targets. Select the NVMe/FC-specific implicit logout opcode when operating on an NVMe target and update the associated logging so protocol-specific operations are visible in debug output. This extends the existing target relogin and migration-related flows to work with NVMe targets as well as SCSI targets. These changes are needed so target reauthentication and target movement continue to work once NVMe/FC targets are added to the driver's state machine. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc-core.c | 33 +++++++++++++++++++---------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ib= mvfc-core.c index 1d2a88e9fe94..66fcff7ac834 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c @@ -4318,7 +4318,7 @@ static void ibmvfc_tgt_implicit_logout_done(struct ib= mvfc_event *evt) =20 switch (status) { case IBMVFC_MAD_SUCCESS: - tgt_dbg(tgt, "Implicit Logout succeeded\n"); + tgt_dbg(tgt, "%s Implicit Logout succeeded\n", proto_type[tgt->protocol]= ); break; case IBMVFC_MAD_DRIVER_FAILED: kref_put(&tgt->kref, ibmvfc_release_tgt); @@ -4326,7 +4326,8 @@ static void ibmvfc_tgt_implicit_logout_done(struct ib= mvfc_event *evt) return; case IBMVFC_MAD_FAILED: default: - tgt_err(tgt, "Implicit Logout failed: rc=3D0x%02X\n", status); + tgt_err(tgt, "%s Implicit Logout failed: rc=3D0x%02X\n", + proto_type[tgt->protocol], status); break; } =20 @@ -4359,7 +4360,10 @@ static struct ibmvfc_event *__ibmvfc_tgt_get_implici= t_logout_evt(struct ibmvfc_t mad =3D &evt->iu.implicit_logout; memset(mad, 0, sizeof(*mad)); mad->common.version =3D cpu_to_be32(1); - mad->common.opcode =3D cpu_to_be32(IBMVFC_IMPLICIT_LOGOUT); + if (tgt->protocol =3D=3D IBMVFC_PROTO_SCSI) + mad->common.opcode =3D cpu_to_be32(IBMVFC_IMPLICIT_LOGOUT); + else + mad->common.opcode =3D cpu_to_be32(IBMVFC_NVMF_IMPLICIT_LOGOUT); mad->common.length =3D cpu_to_be16(sizeof(*mad)); mad->old_scsi_id =3D cpu_to_be64(tgt->scsi_id); return evt; @@ -4395,7 +4399,7 @@ static void ibmvfc_tgt_implicit_logout(struct ibmvfc_= target *tgt) ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE); kref_put(&tgt->kref, ibmvfc_release_tgt); } else - tgt_dbg(tgt, "Sent Implicit Logout\n"); + tgt_dbg(tgt, "%s Sent Implicit Logout\n", proto_type[tgt->protocol]); } =20 /** @@ -4425,7 +4429,8 @@ static void ibmvfc_tgt_implicit_logout_and_del_done(s= truct ibmvfc_event *evt) else ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_AND_LOGOUT_RPORT); =20 - tgt_dbg(tgt, "Implicit Logout %s\n", (status =3D=3D IBMVFC_MAD_SUCCESS) ?= "succeeded" : "failed"); + tgt_dbg(tgt, "%s Implicit Logout %s\n", proto_type[tgt->protocol], + (status =3D=3D IBMVFC_MAD_SUCCESS) ? "succeeded" : "failed"); kref_put(&tgt->kref, ibmvfc_release_tgt); wake_up(&vhost->work_wait_q); } @@ -4466,7 +4471,7 @@ static void ibmvfc_tgt_implicit_logout_and_del(struct= ibmvfc_target *tgt) ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); kref_put(&tgt->kref, ibmvfc_release_tgt); } else - tgt_dbg(tgt, "Sent Implicit Logout\n"); + tgt_dbg(tgt, "%s Sent Implicit Logout\n", proto_type[tgt->protocol]); } =20 /** @@ -4486,7 +4491,8 @@ static void ibmvfc_tgt_move_login_done(struct ibmvfc_= event *evt) ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE); switch (status) { case IBMVFC_MAD_SUCCESS: - tgt_dbg(tgt, "Move Login succeeded for new scsi_id: %llX\n", tgt->new_sc= si_id); + tgt_dbg(tgt, "%s Move Login succeeded for new scsi_id: %llX\n", + proto_type[tgt->protocol], tgt->new_scsi_id); tgt->ids.node_name =3D wwn_to_u64(rsp->service_parms.node_name); tgt->ids.port_name =3D wwn_to_u64(rsp->service_parms.port_name); tgt->scsi_id =3D tgt->new_scsi_id; @@ -4507,8 +4513,9 @@ static void ibmvfc_tgt_move_login_done(struct ibmvfc_= event *evt) level +=3D ibmvfc_retry_tgt_init(tgt, ibmvfc_tgt_move_login); =20 tgt_log(tgt, level, - "Move Login failed: new scsi_id: %llX, flags:%x, vios_flags:%x, rc=3D0x= %02X\n", - tgt->new_scsi_id, be32_to_cpu(rsp->flags), be16_to_cpu(rsp->vios_flags), + "%s Move Login failed: new scsi_id: %llX, flags:%x, vios_flags:%x, rc= =3D0x%02X\n", + proto_type[tgt->protocol], tgt->new_scsi_id, + be32_to_cpu(rsp->flags), be16_to_cpu(rsp->vios_flags), status); break; } @@ -4548,7 +4555,10 @@ static void ibmvfc_tgt_move_login(struct ibmvfc_targ= et *tgt) move =3D &evt->iu.move_login; memset(move, 0, sizeof(*move)); move->common.version =3D cpu_to_be32(1); - move->common.opcode =3D cpu_to_be32(IBMVFC_MOVE_LOGIN); + if (tgt->protocol =3D=3D IBMVFC_PROTO_SCSI) + move->common.opcode =3D cpu_to_be32(IBMVFC_MOVE_LOGIN); + else + move->common.opcode =3D cpu_to_be32(IBMVFC_NVMF_MOVE_LOGIN); move->common.length =3D cpu_to_be16(sizeof(*move)); =20 move->old_scsi_id =3D cpu_to_be64(tgt->scsi_id); @@ -4561,7 +4571,8 @@ static void ibmvfc_tgt_move_login(struct ibmvfc_targe= t *tgt) ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); kref_put(&tgt->kref, ibmvfc_release_tgt); } else - tgt_dbg(tgt, "Sent Move Login for new scsi_id: %llX\n", tgt->new_scsi_id= ); + tgt_dbg(tgt, "Sent %s Move Login for new scsi_id: %llX\n", + proto_type[tgt->protocol], tgt->new_scsi_id); } =20 /** --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 13177280035; Thu, 23 Jul 2026 00:02:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764937; cv=none; b=kdYggVjvjRdVqNoPjQrZrYtdxRLkEdEPh3REYCZ/fXbSL546vEHm+0HKt9CsLeUzx6WV93qJVXSmAPCJFvpHoA3/7JB+3F/L2ZzVnqWY+rH8GWRr/gII6KWTKZlGC+pbV2srZ/ow6+Hl26NfnJeiJUdBTgxzeCxJJBDSY/Fls+Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764937; c=relaxed/simple; bh=1FmI0xZDxl0OUKydPNlL9j035hNUnbMb+0Od8wi8Sj0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=miYpP5LPCoMTT0Bo0vBdN78kHpAgfolMVBYGGuwf3J9/8aK5rgj99/J7uuJR6RTsC6IJVw2NI0Oiqv6Imfbcpce6KAhzLuP/vRyPriBbJh+hFEYpOJLU/5oJSvUx79N5rpp41Unjnafp/a333wO1/xIodiS2QHsJ/0MzaOgJ5Vk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=dDcASaBv; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="dDcASaBv" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIBr4a606181; Thu, 23 Jul 2026 00:02:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=5T3t5wko42x8GZLKI QnyK5Y8+nUeiQvsNZVby6tzL18=; b=dDcASaBvQRurdagr6lshMen6sM6gprevE z1eUDIYAlI00Zlce1esdNAXPIM3w6TKspfKhYKT+arO0vs0KasLtwhK9CM4XFKfg hazx1w5W2b4dT9WyCfH77HEZGSqLQmUTTFajTle4Tt7FHLwfHH1+vLXpm9PtGco7 f3YGPt2pWUc+zaDECdmVfeSeIoibwmkiFqY+U7V66N0KgCVO40C6yD7zK91ZSFU8 p7loNv0Q8O4MutST+Z8HhfARcx/fAEjOpd+Sz3RYv1h6gZMs7DTKg7LIr8scOSOU G1qAV4/k9eb1LMsKHB9D4uDwTOyDpmRzovtfj/LePIt/OwMn7hBQw== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg78gcc0f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:08 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNnaeO009366; Thu, 23 Jul 2026 00:02:08 GMT Received: from smtprelay04.wdc07v.mail.ibm.com ([172.16.1.71]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4fgp1ghjaa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:08 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay04.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N026Q129033148 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:02:06 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2C9FA58056; Thu, 23 Jul 2026 00:02:06 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8257558063; Thu, 23 Jul 2026 00:02:05 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:02:05 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 17/33] ibmvfc: add NVMe/FC Port Login support Date: Wed, 22 Jul 2026 17:01:33 -0700 Message-ID: <20260723000149.969416-18-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX/yc3bPWMh8N7 1XYE51KdIriGcxIBHRB/RmRZarOEol//Qw0IHBBIWXU22O58JunrktRgSuuh9O5zChQBYzi/3vx bortUrdB/0/ZYS0Q2cMwod7J2EqpVr0puDx1C4cVmJvJEGLfZqJ2db80XN21ltBMAlBwZY6wCRD Q3Pi43SGhVro1jKjshcTym4JDQEK27FHGuzQNbMYpcYe3gRQ0oBxKt0hsqF+fRotJlImDhBPmau yi/IQrKvfsfmU1Qq3TnAPZJ+YnSUHe7PJzqG02w1+1SIAZi4ey213mDp3P/4DMhfcxGsZ7sadw2 bZE+yfhtxFXVRmJXiuxEbgZqBJrXUxyCRcJBbFDhZf+///r1j7viRGsiordqJzsSpgmcWh9Y0hb M/4c+ux65fDjyeybwwhX4jQyVLdM6pqThHUohuZ6HzanXmD5SSTQH+xdWHCKLKSNqc4t73+NoBU WTYGu7jwlWG/MuOCrpw== X-Proofpoint-GUID: jsa1z3KzLTsohhNb5xsmBti4VSF2vDV7 X-Authority-Analysis: v=2.4 cv=MelcfZ/f c=1 sm=1 tr=0 ts=6a615a00 cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VnNF1IyMAAAA:8 a=6rG7Qs-5UubFV84h7OMA:9 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX1/f5J2uBAf/T IuJgLaceccSGcrq6f39OgDHorqS45eyyxfBRMzkNGf//BCWlHQYI8iP7ZVE0qIbh881hF/ma5Js 3bJFx4EYCrpHIRkd647bsTrYHE455aY= X-Proofpoint-ORIG-GUID: jsa1z3KzLTsohhNb5xsmBti4VSF2vDV7 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 spamscore=0 clxscore=1015 malwarescore=0 phishscore=0 adultscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" Expand the target login path to issue the NVMe/FC-specific port login MAD for NVMe targets. Select the correct PLOGI MAD opcode based on the target protocol and include the protocol name in success and failure logging. The rest of the target login flow remains shared with the existing SCSI implementation. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc-core.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ib= mvfc-core.c index 66fcff7ac834..adc146214e66 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c @@ -4212,7 +4212,7 @@ static void ibmvfc_tgt_plogi_done(struct ibmvfc_event= *evt) ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE); switch (status) { case IBMVFC_MAD_SUCCESS: - tgt_dbg(tgt, "Port Login succeeded\n"); + tgt_dbg(tgt, "%s Port Login succeeded\n", proto_type[tgt->protocol]); if (tgt->ids.port_name && tgt->ids.port_name !=3D wwn_to_u64(rsp->service_parms.port_name)) { vhost->reinit =3D 1; @@ -4240,9 +4240,9 @@ static void ibmvfc_tgt_plogi_done(struct ibmvfc_event= *evt) else ibmvfc_del_tgt(tgt); =20 - tgt_log(tgt, level, "Port Login failed: %s (%x:%x) %s (%x) %s (%x) rc=3D= 0x%02X\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), + tgt_log(tgt, level, "%s Port Login failed: %s (%x:%x) %s (%x) %s (%x) rc= =3D0x%02X\n", + proto_type[tgt->protocol], ibmvfc_get_cmd_error(be16_to_cpu(rsp->status= ), + be16_to_cpu(rsp->error)), be16_to_cpu(rsp->status), be16_to_cpu(rsp->er= ror), ibmvfc_get_fc_type(be16_to_cpu(rsp->fc_type)), be16_to_cpu(rsp->fc_type= ), ibmvfc_get_ls_explain(be16_to_cpu(rsp->fc_explain)), be16_to_cpu(rsp->f= c_explain), status); break; @@ -4288,7 +4288,10 @@ static void ibmvfc_tgt_send_plogi(struct ibmvfc_targ= et *tgt) } else { plogi->common.version =3D cpu_to_be32(1); } - plogi->common.opcode =3D cpu_to_be32(IBMVFC_PORT_LOGIN); + if (tgt->protocol =3D=3D IBMVFC_PROTO_SCSI) + plogi->common.opcode =3D cpu_to_be32(IBMVFC_PORT_LOGIN); + else + plogi->common.opcode =3D cpu_to_be32(IBMVFC_NVMF_PORT_LOGIN); plogi->common.length =3D cpu_to_be16(sizeof(*plogi)); plogi->scsi_id =3D cpu_to_be64(tgt->scsi_id); =20 @@ -4297,7 +4300,7 @@ static void ibmvfc_tgt_send_plogi(struct ibmvfc_targe= t *tgt) ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE); kref_put(&tgt->kref, ibmvfc_release_tgt); } else - tgt_dbg(tgt, "Sent port login\n"); + tgt_dbg(tgt, "Sent %s port login\n", proto_type[tgt->protocol]); } =20 /** --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C36E37E5C1; Thu, 23 Jul 2026 00:02:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764946; cv=none; b=jsPvtKpRsGVZbEefiy7MfenoK92qP/zaUZUeQSkTmC+AO8/TuhUtOP662RTvOBIYGKdMN1zdRtU6+RjnFFktfliKw7KJmBcHQH2MbtIW2GNaoRt4u0ePumpi5qH4wVGyWMngOx+qCkZpXZjbGWywtdt5XJuO7UKUrmwbQWRWBrA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764946; c=relaxed/simple; bh=l+7f9aM9uwlGdSpVe9cpH3IYDMvh6GXfoTa5RLNPlZo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qj2vut2F2ELv9HJB8AYU77HeP2q9NEdRfbE/F6ZfxjZblqj1FNG7dMLuTAzKTg+H+bFRl0kG5W1jVW5DpnTp8+nWz5VXz0HwpPa8UBpUcm8wFOUcVWFszx991ecNDO9sQl1/m0BE1Z+46lKN2jZ982Y8KXjXtbz1r1qngFH/iEA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=QO/aFYoO; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="QO/aFYoO" Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIBgHE3019601; Thu, 23 Jul 2026 00:02:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=+8OllIJQnFuZpMkR4 GBt9dgJ+A2dcKG757z4kf5zDSc=; b=QO/aFYoOnu8zSPXJl5Ttc57UtBBT+2lEM q3bS9ioFrBkmVxekKRz1bJ6YA/Zuf0edkL2tFo7gQCw2tG4Otm6DlBQ6ZYvvQx+k IdRQoRe56yCsv4aIwPeYpMlf1xxrDcGLVF1Ek/CAq3l3EP29iRfhfZO3ES0Ntwrr 16vKdtzPelBEoefSKBphLZ6AkoTm+OsHhKElyBj55Mexwf7etEQYZexEPozp/FF0 F7y2pX3YRHBPE36UiO+L7aaK1R1u7Th6AAFCOCxOqq8SaRuzpzKBYa+80iSyhht0 +qFm6vWyBljizW0SrKyVaHfu08T/xI9KAbvWjhWhsuPsbl4TZUWKQ== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg77amx6b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:09 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNnr2t021831; Thu, 23 Jul 2026 00:02:08 GMT Received: from smtprelay05.wdc07v.mail.ibm.com ([172.16.1.72]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fgm6w9ujw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:08 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay05.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N027kw33686056 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:02:07 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EE70958061; Thu, 23 Jul 2026 00:02:06 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4A70A58060; Thu, 23 Jul 2026 00:02:06 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:02:06 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 18/33] ibmvfc: add NVMe/FC Process Login support Date: Wed, 22 Jul 2026 17:01:34 -0700 Message-ID: <20260723000149.969416-19-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: n_wfozIbCFxsdgqa6LDNiNfU1BNTQXok X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX6140JPHht7MN wexP79AAuuOO1v8gk8HSM+vC4hkOuQ9He26txAjQBYzKmzGPzSPA4YNJwgnS06RAJA3vqimb2l/ Vf6bCG8/KtbbiA1H+nuMRqiuACIdmNU= X-Proofpoint-GUID: n_wfozIbCFxsdgqa6LDNiNfU1BNTQXok X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfXyHhv0ABfl3pt Mur8s/9hsyX7GlWNHH7pZB9xqCsUDJSW2YQT383x+EipIladGiAI/yir4ZtcE5ihx+YD8oAmfyE S4rFehXOctKWT52uiW9lQM/YEtMhFO7OjMOVWS1JVDR0h44sIKWZzIUm/OKcImch9AcByFt+jR4 ddDpAoN4LhVLxSh6j/H/wbMN8jcjGPXrLauR2ydsnwo6uxXLFC7a1T/IvzjUdG/kRVn683jQ+XX 7MO3EIPbx5KlOdsRBD5QmH5XDe0EgPn3eJ/yFGL9BO/v/kVpn6Nzk+qMHGembElMS5hWpOhsb6s EhdzG/gK4Mr/EQ/7ngmAjntOzXFSVI7VraDXbxIecUWO3gbB3ZGXfC6kmxSFe16vwovIIsdjDwT KZcUjRup8JN74dsQOx4VUO+7A57n68YQsBqrBHfjAuDPJuxc88s6YhXsQHmKOXaluHF+QWh+4YV eGFjPhPdjk4mP/sjXpQ== X-Authority-Analysis: v=2.4 cv=K7AS2SWI c=1 sm=1 tr=0 ts=6a615a01 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=VnNF1IyMAAAA:8 a=BBChT4-wVwiCfiflK1sA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 spamscore=0 phishscore=0 malwarescore=0 adultscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" Extend PRLI handling code to support NVMe/FC targets. When the target protocol is NVMe/FC, issue the NVMe process login MAD, set the NVMe FC-4 type, and populate NVMe-specific service parameters. On completion, decode the returned PRLI service parameters and derive the appropriate remote-port roles for NVMe initiator, target, and discovery ports. Keep the existing SCSI PRLI flow unchanged while allowing the common target state machine to complete login for NVMe/FC targets. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc-core.c | 55 ++++++++++++++++++++--------- drivers/scsi/ibmvscsi/ibmvfc.h | 6 ++++ 2 files changed, 45 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ib= mvfc-core.c index adc146214e66..5950f143e9a1 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c @@ -4090,11 +4090,12 @@ static void ibmvfc_tgt_prli_done(struct ibmvfc_even= t *evt) ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE); switch (status) { case IBMVFC_MAD_SUCCESS: - tgt_dbg(tgt, "Process Login succeeded: %X %02X %04X\n", - parms->type, parms->flags, parms->service_parms); + tgt_dbg(tgt, "%s Process Login succeeded: %X %02X %04X\n", + proto_type[tgt->protocol], parms->type, parms->flags, + parms->service_parms); =20 + index =3D ibmvfc_get_prli_rsp(be16_to_cpu(parms->flags)); if (parms->type =3D=3D IBMVFC_SCSI_FCP_TYPE) { - index =3D ibmvfc_get_prli_rsp(be16_to_cpu(parms->flags)); if (prli_rsp[index].logged_in) { if (be16_to_cpu(parms->flags) & IBMVFC_PRLI_EST_IMG_PAIR) { tgt->need_login =3D 0; @@ -4110,6 +4111,22 @@ static void ibmvfc_tgt_prli_done(struct ibmvfc_event= *evt) ibmvfc_retry_tgt_init(tgt, ibmvfc_tgt_send_prli); else ibmvfc_del_tgt(tgt); + } else if (parms->type =3D=3D IBMVFC_NVME_FCP_TYPE) { + if (prli_rsp[index].logged_in) { + /* For FC-NVMe PRLI the Image Pair field is always set to zero (see 6.= 3.3) */ + tgt->need_login =3D 0; + tgt->ids.roles =3D 0; + if (be32_to_cpu(parms->service_parms) & IBMVFC_PRLI_NVME_TARGET) + tgt->ids.roles |=3D FC_PORT_ROLE_NVME_TARGET; + if (be32_to_cpu(parms->service_parms) & IBMVFC_PRLI_NVME_INITIATOR) + tgt->ids.roles |=3D FC_PORT_ROLE_NVME_INITIATOR; + if (be32_to_cpu(parms->service_parms) & IBMVFC_PRLI_NVME_DISCOVERY) + tgt->ids.roles |=3D FC_PORT_ROLE_NVME_DISCOVERY; + tgt->add_rport =3D 1; + } else if (prli_rsp[index].retry) + ibmvfc_retry_tgt_init(tgt, ibmvfc_tgt_send_prli); + else + ibmvfc_del_tgt(tgt); } else ibmvfc_del_tgt(tgt); break; @@ -4130,9 +4147,10 @@ static void ibmvfc_tgt_prli_done(struct ibmvfc_event= *evt) else ibmvfc_del_tgt(tgt); =20 - tgt_log(tgt, level, "Process Login failed: %s (%x:%x) rc=3D0x%02X\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), status); + tgt_log(tgt, level, "%s Process Login failed: %s (%x:%x) rc=3D0x%02X\n", + proto_type[tgt->protocol], ibmvfc_get_cmd_error(be16_to_cpu(rsp->status= ), + be16_to_cpu(rsp->error)), be16_to_cpu(rsp->status), + be16_to_cpu(rsp->error), status); break; } =20 @@ -4174,25 +4192,30 @@ static void ibmvfc_tgt_send_prli(struct ibmvfc_targ= et *tgt) } else { prli->common.version =3D cpu_to_be32(1); } - prli->common.opcode =3D cpu_to_be32(IBMVFC_PROCESS_LOGIN); + if (tgt->protocol =3D=3D IBMVFC_PROTO_SCSI) { + prli->common.opcode =3D cpu_to_be32(IBMVFC_PROCESS_LOGIN); + prli->parms.type =3D IBMVFC_SCSI_FCP_TYPE; + prli->parms.flags =3D cpu_to_be16(IBMVFC_PRLI_EST_IMG_PAIR); + prli->parms.service_parms =3D cpu_to_be32(IBMVFC_PRLI_INITIATOR_FUNC); + prli->parms.service_parms |=3D cpu_to_be32(IBMVFC_PRLI_READ_FCP_XFER_RDY= _DISABLED); + + if (cls3_error) + prli->parms.service_parms |=3D cpu_to_be32(IBMVFC_PRLI_RETRY); + } else { + prli->common.opcode =3D cpu_to_be32(IBMVFC_NVMF_PROCESS_LOGIN); + prli->parms.type =3D IBMVFC_NVME_FCP_TYPE; + prli->parms.service_parms =3D cpu_to_be32(IBMVFC_PRLI_NVME_INITIATOR); + } prli->common.length =3D cpu_to_be16(sizeof(*prli)); prli->scsi_id =3D cpu_to_be64(tgt->scsi_id); =20 - prli->parms.type =3D IBMVFC_SCSI_FCP_TYPE; - prli->parms.flags =3D cpu_to_be16(IBMVFC_PRLI_EST_IMG_PAIR); - prli->parms.service_parms =3D cpu_to_be32(IBMVFC_PRLI_INITIATOR_FUNC); - prli->parms.service_parms |=3D cpu_to_be32(IBMVFC_PRLI_READ_FCP_XFER_RDY_= DISABLED); - - if (cls3_error) - prli->parms.service_parms |=3D cpu_to_be32(IBMVFC_PRLI_RETRY); - ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_INIT_WAIT); if (ibmvfc_send_event(evt, vhost, default_timeout)) { vhost->discovery_threads--; ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE); kref_put(&tgt->kref, ibmvfc_release_tgt); } else - tgt_dbg(tgt, "Sent process login\n"); + tgt_dbg(tgt, "%s Sent process login\n", proto_type[tgt->protocol]); } =20 /** diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h index 67f546ff092e..66025e6ffeed 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h @@ -381,6 +381,7 @@ struct ibmvfc_move_login { struct ibmvfc_prli_svc_parms { u8 type; #define IBMVFC_SCSI_FCP_TYPE 0x08 +#define IBMVFC_NVME_FCP_TYPE 0x28 u8 type_ext; __be16 flags; #define IBMVFC_PRLI_ORIG_PA_VALID 0x8000 @@ -396,6 +397,11 @@ struct ibmvfc_prli_svc_parms { #define IBMVFC_PRLI_TARGET_FUNC 0x00000010 #define IBMVFC_PRLI_READ_FCP_XFER_RDY_DISABLED 0x00000002 #define IBMVFC_PRLI_WR_FCP_XFER_RDY_DISABLED 0x00000001 +#define IBMVFC_PRLI_NVME_PI_CTRL 0x00000200 +#define IBMVFC_PRLI_NVME_SLER 0x00000100 +#define IBMVFC_PRLI_NVME_INITIATOR 0x00000020 +#define IBMVFC_PRLI_NVME_TARGET 0x00000010 +#define IBMVFC_PRLI_NVME_DISCOVERY 0x00000008 } __packed __aligned(4); =20 struct ibmvfc_process_login { --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B13736E46C; Thu, 23 Jul 2026 00:02:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764945; cv=none; b=ive6itvkxFp2RCdAYz/P+zU8zceGSFSDcaA/+klgyJgfKSRC9oaiacZ67RzHHqyZO+Tp2EVR8dPIJ+0Nn3+VA0OQ77lY3qxTp7owEEx3RUUyxe0T5Q6EStVyiLuTINGzHnoFEXL0khq9qXIDu0KvHEYFZPmNyP0JSmTQlYHIZ7I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764945; c=relaxed/simple; bh=I3HUJu6Ldo79ADi9Ky3KhD4lZXqo1suCdDH6sIEk6eI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YiT8RHWSEp/azwnzcH93FEnfCk/ui/aTPZ45NfOZjw7TFKLs7wX3R2RUM2xnBTYGvqvnlf21gtXZDgC5CULkHMRxefoGQ4qZBltDwxovIJGF9AGyXifEtukrVFN1rW8YMBez/M8nFJQWiR7SDJJzPQcflVlNGR/Z1UYSkL26JQQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=JS///tho; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="JS///tho" Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIBuF1633559; Thu, 23 Jul 2026 00:02:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=BJ5jHeQTDxl67GLnf ENEsPi2OjxPVgqvUKko7n43C8U=; b=JS///tho+PGpi+vLPCATKLcZNgxLuRGTn 3xrb6hgIkbP2Ctb+vfch2ByngQ6ZYWLJoIUDWciiUv4AoTO8oqo0J5LaqB8JSY5r Y4OK6KbVyNgm2GiZ8BRgrO8uKLKVKeESiZ53TAEwCYR8czYVfx5wXEmFrrqdWzwH fW2v5FDQ6Vh4eWX/Q6E+nzoiKpR1Opx0kCEcbhgMuicsuoJ57zn3bHjTgJgwA6PI h93DuMnp8HGJZEJzBwxrMzYLfjX7FpFckEQwrL5P57oKRcH86vpP4QuV/ivOhzRy tqEC7dQvG2TmTNQLC+W5BVyi/Eh+dI6VQThOh/r8lJ/4xNhest5Nw== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg77kce6t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:09 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNnaIJ028159; Thu, 23 Jul 2026 00:02:09 GMT Received: from smtprelay05.wdc07v.mail.ibm.com ([172.16.1.72]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fgnah9q36-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:09 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay05.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N027qq14156420 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:02:08 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B87A158068; Thu, 23 Jul 2026 00:02:07 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 17A935803F; Thu, 23 Jul 2026 00:02:07 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:02:06 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 19/33] ibmvfc: add NVMe/FC Query Target support Date: Wed, 22 Jul 2026 17:01:35 -0700 Message-ID: <20260723000149.969416-20-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Authority-Analysis: v=2.4 cv=HJXz0Itv c=1 sm=1 tr=0 ts=6a615a01 cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VnNF1IyMAAAA:8 a=LC8GvMgr8iK42x-OS58A:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX+3H/9POlusqS KXSeVXXf5ZDEinGR16MbQZAtOUSCqLQDKK7xF8nX/TIVoJoCyFVCt5QboGUg6PvmnftBRrmGOXv OcfEvKK2Qgz6vykRXO77VcugrLJFSOlPOjzq/zZGq+wAQuo0WspfISas/uqCQBrVG7YuczZhr7J H9Bsfsr/bsxIPxOwMdJv4vSAEqvdIkoZB8Nl5K/VfO9XCj7E9bw53xqqWYEVnPYL7Z5bgGmQ3Ir y2ecnTVl+oc7q6QkLe9pwwCY25ccrC0EDaqZunxGqUNgRr66b9NEvJuFLePK/sfe2dMCYLbojpV z4IFX9sXXtpf1AUAM0zPx6U7D8XePDhEimXE7hb81LvZyp1Q1iaeZfQDmPgsUY2j9NRiMgnEks6 O4+QtCoOzYHeychQvWhbvCTk+PBgrcXhELGXu2EViOgkEYeMs/thSkOmgCUXCYo9WfLlowxpWV+ 9XPUHVksTO6/LVUnu3g== X-Proofpoint-ORIG-GUID: JC3hbpfeB_YtXl0IXdqFDRJrborjFnpL X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX1jvrgDXIBcjG nkbask1xBF0bE41DmymkZ5lq1bm9K+hiprTEdmPqmWQNxjlwYNwB/SfCyvgyOOt5kEdzEvyxnGS 4HIQLIC0LbiGgIT2UdWIrJpAqEcVnaU= X-Proofpoint-GUID: JC3hbpfeB_YtXl0IXdqFDRJrborjFnpL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 malwarescore=0 impostorscore=0 clxscore=1015 phishscore=0 spamscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" Add protocol-specific query-target support for NVMe/FC targets. Use the NVMe query-target specific MAD when querying an NVMe target and update the associated debug and error logging to include the target protocol. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc-core.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ib= mvfc-core.c index 5950f143e9a1..b479537e9e78 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c @@ -4859,7 +4859,7 @@ static void ibmvfc_tgt_query_target_done(struct ibmvf= c_event *evt) ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE); switch (status) { case IBMVFC_MAD_SUCCESS: - tgt_dbg(tgt, "Query Target succeeded\n"); + tgt_dbg(tgt, "%s Query Target succeeded\n", proto_type[tgt->protocol]); if (be64_to_cpu(rsp->scsi_id) !=3D tgt->scsi_id) ibmvfc_del_tgt(tgt); else @@ -4881,9 +4881,9 @@ static void ibmvfc_tgt_query_target_done(struct ibmvf= c_event *evt) else ibmvfc_del_tgt(tgt); =20 - tgt_log(tgt, level, "Query Target failed: %s (%x:%x) %s (%x) %s (%x) rc= =3D0x%02X\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), + tgt_log(tgt, level, "%s Query Target failed: %s (%x:%x) %s (%x) %s (%x) = rc=3D0x%02X\n", + proto_type[tgt->protocol], ibmvfc_get_cmd_error(be16_to_cpu(rsp->status= ), + be16_to_cpu(rsp->error)), be16_to_cpu(rsp->status), be16_to_cpu(rsp->er= ror), ibmvfc_get_fc_type(be16_to_cpu(rsp->fc_type)), be16_to_cpu(rsp->fc_type= ), ibmvfc_get_gs_explain(be16_to_cpu(rsp->fc_explain)), be16_to_cpu(rsp->f= c_explain), status); @@ -4923,7 +4923,10 @@ static void ibmvfc_tgt_query_target(struct ibmvfc_ta= rget *tgt) query_tgt =3D &evt->iu.query_tgt; memset(query_tgt, 0, sizeof(*query_tgt)); query_tgt->common.version =3D cpu_to_be32(1); - query_tgt->common.opcode =3D cpu_to_be32(IBMVFC_QUERY_TARGET); + if (tgt->protocol =3D=3D IBMVFC_PROTO_SCSI) + query_tgt->common.opcode =3D cpu_to_be32(IBMVFC_QUERY_TARGET); + else + query_tgt->common.opcode =3D cpu_to_be32(IBMVFC_NVMF_QUERY_TARGET); query_tgt->common.length =3D cpu_to_be16(sizeof(*query_tgt)); query_tgt->wwpn =3D cpu_to_be64(tgt->ids.port_name); =20 @@ -4933,7 +4936,7 @@ static void ibmvfc_tgt_query_target(struct ibmvfc_tar= get *tgt) ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE); kref_put(&tgt->kref, ibmvfc_release_tgt); } else - tgt_dbg(tgt, "Sent Query Target\n"); + tgt_dbg(tgt, "Sent %s Query Target\n", proto_type[tgt->protocol]); } =20 /** --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 735EB72627; Thu, 23 Jul 2026 00:02:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764935; cv=none; b=CgjlsRdxQpWaxWdzr292SwkgTifJDzSSANhCDHBmr0OCc5PnYSvKTaEmqmrjcmOJUUur3n2cUqHeWrAn/F8xYpMh/Zzqxee9uIuQYDSsNrsbps9NBk24MVVV+/Av+OezxSe9gdzEdM3rYX8AaY1MJ4VJsZPRNQp3kmI6kQOxOZk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764935; c=relaxed/simple; bh=hcaP+UUhsl9paq/noixz2uMopCQ3/VRP+BPfb2yrbAc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pujC1HFjmAuHKU1D3uL8irS0m1CZB8WMQwnxh7KYG0e64rnOkVPm4yLTBei9pfXDTNXTO8KBTNsmHJhBkp2c6hbAyO/AWOPOG/XEocQEVVs05fkwbapWd9BBm11AQn/uS1wcn9Qc/g+KiJUJ5pbnTjN5KTcYd5PukPPqjsv4efs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=k1GlJGjS; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="k1GlJGjS" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIC3q8606747; Thu, 23 Jul 2026 00:02:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=caN6QTCi3vodLwzr/ GXf+fo/2yOLoAia6bLAva7bBsE=; b=k1GlJGjSy5pJXEmRiST50gCT+gHo21Fhz D7P4buoPhQV1afEtkEpYGpxIF94GIM8UyUgcALh6Ju5rTV4YoWy6h2p3e+fCpAWj EiVQpYbj8A0oikM8cTU062fu8HZLlITCSyEEXuCJB6QGPGX8SV+GAj03nAyheN9j Umh5wWtqoh1V0xVSwkY3qezBL+eHWBTXk84dUHkizxK40oVJMnvvpPMloqWmc/Hv Oayv4C23jjdkijsRujLiyqs587dKC2IaJVws6vvk2R4dAOzFNXOrIilvPSnWdY84 dv8dthaQzjPgR2HVnxWdgbagbL6xEta2B6gOa+gVbUBnz4xKH+2Dw== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg78gcc0j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:10 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNneRT032303; Thu, 23 Jul 2026 00:02:10 GMT Received: from smtprelay06.wdc07v.mail.ibm.com ([172.16.1.73]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fgmtk1rsu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:10 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay06.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N028IG24969790 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:02:08 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7DE735805A; Thu, 23 Jul 2026 00:02:08 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D61505803F; Thu, 23 Jul 2026 00:02:07 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:02:07 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 20/33] ibmvfc: allocate targets based on protocol Date: Wed, 22 Jul 2026 17:01:36 -0700 Message-ID: <20260723000149.969416-21-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfXyxioiXmttTlr v0xuXD87UmofymsIlP3LCN7GgwqpG2ejRy5wQSr1i7gzjp4FgcIOJjTUJBb83SsbhpLD4P3ChXV 2tPAZgrvPH8mRYkVITr164Yd14N84SyHSvh5ju1aesMso/krL2E2rTVa2BjV5hH6sMLTNsYeXB1 ubct/zxpT87eDHLPGhQ7aSBmdf2f21kWOaZ8ZAofwufLpF8k3uG3HIb7KN0wwTY9RtVHfXOh7iK 5ZxU5bI9WWe1XWC4fzs7n+Djg2qdXPGjSNz3LQtA849dJbRwlpO/p1mkPvSovgEutsm2wNBgLOT /gdk4ooUPEM0UwSTdiBtEP0AdvcBqxkWl8Vum7wm4p83ss9ejn7VeZpA8CcGULgHAhfPJeyoDpL tHHL1yLCQbJjZAT0KRQM0rnsZh1RGmwhFFdgbiB/NxPutpG/lZDpZJ2gjiLrY7qteHtULBYYveV P00m1mB8viJjjL7Zdxg== X-Proofpoint-GUID: u-_bKvDAHzfNUjaj9tgowUoBS9cTsJ-K X-Authority-Analysis: v=2.4 cv=MelcfZ/f c=1 sm=1 tr=0 ts=6a615a02 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VnNF1IyMAAAA:8 a=ns_GeCvhB5WbLELA1zwA:9 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfXzRvFP3L55BUg 3z2Am4gl0NbPgoZzHhnpl66U9aw9cma5lWtr8XELtpNjrbu4GtAW7EwcNlNaER38j0HdQQfSUos jMEMJmPk4vLygXPIhfv6EZvFNzm4O3g= X-Proofpoint-ORIG-GUID: u-_bKvDAHzfNUjaj9tgowUoBS9cTsJ-K X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 spamscore=0 clxscore=1015 malwarescore=0 phishscore=0 adultscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" Allocate discovered targets onto the channel-group list that matches their protocol. When a target is created, use the discovered protocol type to decide which list it belongs on. This keeps protocol-specific discovery results isolated and allows later state-machine and remote-port code to walk the correct target set. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc-core.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ib= mvfc-core.c index b479537e9e78..92c286cfc69c 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c @@ -4948,25 +4948,32 @@ static void ibmvfc_tgt_query_target(struct ibmvfc_t= arget *tgt) * 0 on success / other on failure **/ static int ibmvfc_alloc_target(struct ibmvfc_host *vhost, - struct ibmvfc_discover_targets_entry *target) + struct ibmvfc_discover_targets_entry *target, + enum ibmvfc_protocol protocol) { struct ibmvfc_target *stgt =3D NULL; struct ibmvfc_target *wtgt =3D NULL; struct ibmvfc_target *tgt; + struct ibmvfc_channels *channels; unsigned long flags; u64 scsi_id =3D be32_to_cpu(target->scsi_id) & IBMVFC_DISC_TGT_SCSI_ID_MA= SK; u64 wwpn =3D be64_to_cpu(target->wwpn); =20 + if (protocol =3D=3D IBMVFC_PROTO_SCSI) + channels =3D &vhost->scsi_scrqs; + else + channels =3D &vhost->nvme_scrqs; + /* Look to see if we already have a target allocated for this SCSI ID or = WWPN */ spin_lock_irqsave(vhost->host->host_lock, flags); - list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) { + list_for_each_entry(tgt, &channels->targets, queue) { if (tgt->wwpn =3D=3D wwpn) { wtgt =3D tgt; break; } } =20 - list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) { + list_for_each_entry(tgt, &channels->targets, queue) { if (tgt->scsi_id =3D=3D scsi_id) { stgt =3D tgt; break; @@ -5014,6 +5021,7 @@ static int ibmvfc_alloc_target(struct ibmvfc_host *vh= ost, =20 tgt =3D mempool_alloc(vhost->tgt_pool, GFP_NOIO); memset(tgt, 0, sizeof(*tgt)); + tgt->protocol =3D protocol; tgt->scsi_id =3D scsi_id; tgt->wwpn =3D wwpn; tgt->vhost =3D vhost; @@ -5023,7 +5031,7 @@ static int ibmvfc_alloc_target(struct ibmvfc_host *vh= ost, ibmvfc_init_tgt(tgt, ibmvfc_tgt_implicit_logout); spin_lock_irqsave(vhost->host->host_lock, flags); tgt->cancel_key =3D vhost->task_set++; - list_add_tail(&tgt->queue, &vhost->scsi_scrqs.targets); + list_add_tail(&tgt->queue, &channels->targets); =20 unlock_out: spin_unlock_irqrestore(vhost->host->host_lock, flags); @@ -5042,7 +5050,11 @@ static int ibmvfc_alloc_targets(struct ibmvfc_host *= vhost) int i, rc; =20 for (i =3D 0, rc =3D 0; !rc && i < vhost->scsi_scrqs.num_targets; i++) - rc =3D ibmvfc_alloc_target(vhost, &vhost->scsi_scrqs.disc_buf[i]); + rc =3D ibmvfc_alloc_target(vhost, &vhost->scsi_scrqs.disc_buf[i], + vhost->scsi_scrqs.protocol); + for (i =3D 0; !rc && i < vhost->nvme_scrqs.num_targets; i++) + rc =3D ibmvfc_alloc_target(vhost, &vhost->nvme_scrqs.disc_buf[i], + vhost->nvme_scrqs.protocol); =20 return rc; } --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1E331E7C23; Thu, 23 Jul 2026 00:02:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764936; cv=none; b=g60I+MEBE4KPRtOeAVHcxUkO/5Uw9WrNXf+NrNTTi+sv8NUP085X41rXFzNkw9YtgZpxZ7j5Sgvid5h38A7cAnvrDsZ/M28feyjE5w6dcLxEn5M7PEoSDH/6Cq5PUy6buCmJDV0z0Qk9kNTMSsLVkfJ7QM2SphR3LSVQSmOD4Oo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764936; c=relaxed/simple; bh=8+d554IROI+RqAFe/tyHotlF1/1g0QZmSJQGR6lJnFY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ilgVvWJjAPyjrx+chDBvlcpfmOGo/pulFEJ2jGzc6WS43kTWVJ+l3x9wv8qwaym7ht5++OVEx/AzkVpjPOCkNsbJ1UF5KdDacnu+KvpFPgCSODxXWNBocBO8sYe6A6A+/nhX3KiyuslAfS+wv9ssgK1qs+PihGphcJf7DOGj0j8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=nLgW2L2k; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="nLgW2L2k" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIBeQm704617; Thu, 23 Jul 2026 00:02:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=US34XbCYd7ORMPavV Lu5i7Qe98UktG9XrvNR6jCdDhE=; b=nLgW2L2kEDgdUMaP5ohZi/JX0ovMK1hWR 7BdLcbL3JXjOLh4F7Szd0OJh7Jx069n1HIqIszGZGUvR+Jo8rMBPH1o6SBrDUc4u g8h4m+T73GpOWGf2btczrTo6V2R6dZT5emHyxnPQXZ+srtDog8jrvpIRlH9RrahR amxQMYP9lBikEDsLzpAbWOheGoYJNYL4bmAuyywww9AcOi8PKGw9Mq2yOEs0hZ8S h7j/7u6qxiVyJ2geEBEzVPAgteFFGzMg5ZNj3VOIttlGTRL++HZNekMsjLbE7Te3 U/7NATwpzxi7SGJYnxnJ7NrjvAAdhJVVqN23Q7AUze3Io7L9Uso/A== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg7abmynr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:11 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNndSY032298; Thu, 23 Jul 2026 00:02:10 GMT Received: from smtprelay07.wdc07v.mail.ibm.com ([172.16.1.74]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fgmtk1rsv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:10 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay07.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N0299T19399180 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:02:09 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4063A58061; Thu, 23 Jul 2026 00:02:09 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9B7975803F; Thu, 23 Jul 2026 00:02:08 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:02:08 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 21/33] ibmvfc: delete NVMe/FC targets as well as SCSI Date: Wed, 22 Jul 2026 17:01:37 -0700 Message-ID: <20260723000149.969416-22-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfXyIPaHWqsleSB tKp5yQGoGXVXvcPncbGxL0hI861gjhyYQ2rCx3QqmandpnesNPEgtMzyuNArtiJg/Bwrgdiccw+ Ns7W9pW/hbElYvLTB++EuaR+FGQQbxbwVEUhhMNYVOWiKeuRsoIxJdrm6fa/GEkgY3BhJHCjHe6 GDi3obt3jTVhgxLdruO8V4P6x605dWA9Mq3LBy4Ena+lqLJjHuIq+L7AT32Jy/EkRtTNL3Yj+cQ z8v0jo1y0zSc13jOZej0x3z7q++5jY1voOeatdOUtccPNB/49x5qHR1C5K3qyYwHv1qjGsynP+S Eq+IXSaxQy3qngv84XWQH/00Hbx71JrGPOQrrmFp0Rp2IR8k02CeUZO+fUQHpVk2vO1DqPiSwaD lU7if1gIbMUZ4SlK7dtFTkYv8jcY6duVDlstHFl7w3ZOP+7xbP5/1kNQr8usseyoJe+6HeamSCl BvDmy7cse/ZstxWVrGQ== X-Authority-Analysis: v=2.4 cv=F7ZnsKhN c=1 sm=1 tr=0 ts=6a615a03 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=VnNF1IyMAAAA:8 a=ogk_YF86eJEipFHfCJ4A:9 X-Proofpoint-ORIG-GUID: eGejvfYrabx76NvuXhR0-ltW6kqH-feq X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX8IuyRxl/JozX pR+I+ur8KRMZHgMPhGWnhD3QLlFRmgL1xFgimKWYinbX50OY4EofJ2iBG/47iX/FB+wh0LJD1kL I3COxQY6Ij+gtZMA0jXnYEHi1qjy/Yc= X-Proofpoint-GUID: eGejvfYrabx76NvuXhR0-ltW6kqH-feq X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 phishscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 impostorscore=0 lowpriorityscore=0 suspectscore=0 malwarescore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" Extend target deletion paths to process NVMe targets as well as SCSI targets. Update link-down, and host reinitialization flows to walk both the SCSI and NVMe target lists when marking targets for deletion. This ensures that protocol-specific target state stays consistent across adapter resets and fabric events. Rename ibmvfc_relogin to ibmvfc_scsi_relogin as it acts on a scsi command. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc-core.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ib= mvfc-core.c index 92c286cfc69c..1185d72a8a73 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c @@ -714,6 +714,8 @@ static void ibmvfc_link_down(struct ibmvfc_host *vhost, scsi_block_requests(vhost->host); list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) ibmvfc_del_tgt(tgt); + list_for_each_entry(tgt, &vhost->nvme_scrqs.targets, queue) + ibmvfc_del_tgt(tgt); ibmvfc_set_host_state(vhost, state); ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_TGT_DEL); vhost->events_to_log |=3D IBMVFC_AE_LINKDOWN; @@ -751,6 +753,12 @@ static void ibmvfc_init_host(struct ibmvfc_host *vhost) else ibmvfc_del_tgt(tgt); } + list_for_each_entry(tgt, &vhost->nvme_scrqs.targets, queue) { + if (vhost->client_migrated) + tgt->need_login =3D 1; + else + ibmvfc_del_tgt(tgt); + } =20 scsi_block_requests(vhost->host); ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_INIT); @@ -1870,7 +1878,7 @@ static void ibmvfc_log_error(struct ibmvfc_event *evt) * @sdev: scsi device struct * **/ -static void ibmvfc_relogin(struct scsi_device *sdev) +static void ibmvfc_scsi_relogin(struct scsi_device *sdev) { struct ibmvfc_host *vhost =3D shost_priv(sdev->host); struct fc_rport *rport =3D starget_to_rport(scsi_target(sdev)); @@ -1922,7 +1930,7 @@ static void ibmvfc_scsi_done(struct ibmvfc_event *evt) memcpy(cmnd->sense_buffer, rsp->data.sense + rsp_len, sense_len); if ((be16_to_cpu(vfc_cmd->status) & IBMVFC_VIOS_FAILURE) && (be16_to_cpu(vfc_cmd->error) =3D=3D IBMVFC_PLOGI_REQUIRED)) - ibmvfc_relogin(cmnd->device); + ibmvfc_scsi_relogin(cmnd->device); =20 if (!cmnd->result && (!scsi_get_resid(cmnd) || (rsp->flags & FCP_RESID_= OVER))) cmnd->result =3D (DID_ERROR << 16); @@ -3306,6 +3314,22 @@ static void ibmvfc_handle_async(struct ibmvfc_async_= crq *crq, ibmvfc_reinit_host(vhost); } } + list_for_each_entry(tgt, &vhost->nvme_scrqs.targets, queue) { + if (!crq->scsi_id && !crq->wwpn && !crq->node_name) + break; + if (crq->scsi_id && cpu_to_be64(tgt->scsi_id) !=3D crq->scsi_id) + continue; + if (crq->wwpn && cpu_to_be64(tgt->ids.port_name) !=3D crq->wwpn) + continue; + if (crq->node_name && cpu_to_be64(tgt->ids.node_name) !=3D crq->node_na= me) + continue; + if (tgt->need_login && be64_to_cpu(crq->event) =3D=3D IBMVFC_AE_ELS_LOG= O) + tgt->logo_rcvd =3D 1; + if (!tgt->need_login || be64_to_cpu(crq->event) =3D=3D IBMVFC_AE_ELS_PL= OGI) { + ibmvfc_del_tgt(tgt); + ibmvfc_reinit_host(vhost); + } + } break; case IBMVFC_AE_LINK_DOWN: case IBMVFC_AE_ADAPTER_FAILED: --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D7898634C; Thu, 23 Jul 2026 00:02:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764947; cv=none; b=nxAC+niYiTULK7QWbyUF94ZDYpicEvf4NVuTyuSHGq+vw0Gbv2RE/fiMxTwqY02m49PnfNYXMXbe/q0lh47KaVScc6iEc5B9ke4r9fAew/FlaJN88JgjdhG+2bIfPAhXRJJPKxKQPrlpMc+Fn9gaBpm7WfblpeYR0JQEYaVRgUs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764947; c=relaxed/simple; bh=kwUNoPQQSzz23eA+bAw5Z1XOiHo66/y3mXAH4Q4+ryg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ROxaNTgLTFXl9EMAX6g7NeByzRDpLYg+mi3noq1677W79UZoqdz5772V2H4sjiq3+0WY47iwsSeToCspk5AklnxIhve7oV6WoiVLuADn/4kfJfKNlbhK3B0peehO3Rr5pF+B5W6wuxZdnX7ewFtKGdXIuJDqQSkmPM3qm1Qyrz0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=hOAJAkcO; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="hOAJAkcO" Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MICBC9713996; Thu, 23 Jul 2026 00:02:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=aTujkMcgyHlk3C9g4 oRTB5pn7toMmHXYhqj5kr7m5UU=; b=hOAJAkcOE1N7y7OE6eRKz+IWo06uLtamL mo4/EAacc/7nDTYXDi6boyK8IvFNgk8lH2DoOT/UiNmFhe0dvURKC7BmSYOMrAqi +llbcmEPC51xUFgRX3pft5S2zjyEQ96i5S3XKNGV0xfbFKFQb6qjQiHN8F03Z4mz MvbdozgFlDWC/WjmTAr8aDoM4GW1GjELTbreBj2VlPmkTDQeHQHKHMjUFI9I8fuu ZyxFXI3fHgsexF2hmeGqso+r07oejIT7mfArwQ3QG4/pFCQmPyA6IHYEE3guNVjX NIMRxMW9YRC3uJmEfUWDOPtlikA39QwhdZ+y2bap7CJTTqPiS51Dg== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg7914xq5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:11 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNncpe009383; Thu, 23 Jul 2026 00:02:10 GMT Received: from smtprelay06.dal12v.mail.ibm.com ([172.16.1.8]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4fgp1ghjaj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:10 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N02ALJ9896646 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:02:10 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 08D435805A; Thu, 23 Jul 2026 00:02:10 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5DC4C5803F; Thu, 23 Jul 2026 00:02:09 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:02:09 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 22/33] ibmvfc: update state machine to process NVMe/FC targets Date: Wed, 22 Jul 2026 17:01:38 -0700 Message-ID: <20260723000149.969416-23-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 6SJd1A_AZabApK0vWY6pDand2DOy9YZq X-Authority-Analysis: v=2.4 cv=V6RNF+ni c=1 sm=1 tr=0 ts=6a615a03 cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=U7nrCbtTmkRpXpFmAIza:22 a=VnNF1IyMAAAA:8 a=-uFVuYJf3eyC8FhR5LMA:9 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfXwdOr8wzGz50v 4SrCqWrZSJqQA737BDjP3ZGtd5eyy4/nqeX1Stt72Y+bVUUJEoqW7USJD7jVtp62gtjrL03DkVK Fm5WyThtUtRQx4il5/vn0epXSsKRmjM= X-Proofpoint-GUID: 6SJd1A_AZabApK0vWY6pDand2DOy9YZq X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfXyOIA8lJXw4U9 huoeOEf50G/2uw7lrC1y2Fa1y8tyzkPEo1Hzp++ia58I+bGU1/XxwGqAHegqWQKniBuq+nbWirM vi3olpJjZnGj7JG9oMwzzHxUa39nBp7Zu3GYjqCvaFSBiTmikxzPnvleomekL9JjbivVgNdo2P0 HsKtea9eyAECCXggCuI2cl1GIMobBIchax0g6v4ESOD+lhGzRHbZ74I/DuzIluh8zdYkdkvvv5A BN0Adows6kg5Rg6CM908fOb1624mJjdg8npO8b23RJM4mwmo5x19FT1gLZadwG4kDKg/gRlln1O K7OOicpME4MVaRREO9dO5DfSswyFpmG/8dfM0utU9moaNNVUQRU8bt0cpo8XjQMVIT6yk/q/ZDV ZQJPjdKw/XEDuA40rYmzUZtsDA0udNPgLyt46JVo49vgJE3Hbjuwc6GgKHSFW2OkpCdADOL1Nzl 5CjzS7TMsOD+IC9Lx2Q== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 adultscore=0 bulkscore=0 lowpriorityscore=0 clxscore=1015 spamscore=0 impostorscore=0 phishscore=0 priorityscore=1501 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" Update the host work loop and target state-machine helpers to process NVMe targets in addition to SCSI targets. Check both protocol-specific target lists when determining whether there is initialization or logout work pending, and extend the query, target init, and target delete phases to dispatch work for NVMe targets using the same common state-machine callbacks. This allows the existing discovery and login state machine to drive NVMe/FC targets through query, login, and deletion without duplicating the control flow. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc-core.c | 42 +++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ib= mvfc-core.c index 1185d72a8a73..ff84ca0f9f45 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c @@ -5718,6 +5718,11 @@ static int ibmvfc_dev_init_to_do(struct ibmvfc_host = *vhost) tgt->action =3D=3D IBMVFC_TGT_ACTION_INIT_WAIT) return 1; } + list_for_each_entry(tgt, &vhost->nvme_scrqs.targets, queue) { + if (tgt->action =3D=3D IBMVFC_TGT_ACTION_INIT || + tgt->action =3D=3D IBMVFC_TGT_ACTION_INIT_WAIT) + return 1; + } =20 return 0; } @@ -5738,6 +5743,11 @@ static int ibmvfc_dev_logo_to_do(struct ibmvfc_host = *vhost) tgt->action =3D=3D IBMVFC_TGT_ACTION_LOGOUT_RPORT_WAIT) return 1; } + list_for_each_entry(tgt, &vhost->nvme_scrqs.targets, queue) { + if (tgt->action =3D=3D IBMVFC_TGT_ACTION_LOGOUT_RPORT || + tgt->action =3D=3D IBMVFC_TGT_ACTION_LOGOUT_RPORT_WAIT) + return 1; + } return 0; } =20 @@ -5766,9 +5776,15 @@ static int __ibmvfc_work_to_do(struct ibmvfc_host *v= host) list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) if (tgt->action =3D=3D IBMVFC_TGT_ACTION_INIT) return 1; + list_for_each_entry(tgt, &vhost->nvme_scrqs.targets, queue) + if (tgt->action =3D=3D IBMVFC_TGT_ACTION_INIT) + return 1; list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) if (tgt->action =3D=3D IBMVFC_TGT_ACTION_INIT_WAIT) return 0; + list_for_each_entry(tgt, &vhost->nvme_scrqs.targets, queue) + if (tgt->action =3D=3D IBMVFC_TGT_ACTION_INIT_WAIT) + return 0; return 1; case IBMVFC_HOST_ACTION_TGT_DEL: case IBMVFC_HOST_ACTION_TGT_DEL_FAILED: @@ -5777,9 +5793,15 @@ static int __ibmvfc_work_to_do(struct ibmvfc_host *v= host) list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) if (tgt->action =3D=3D IBMVFC_TGT_ACTION_LOGOUT_RPORT) return 1; + list_for_each_entry(tgt, &vhost->nvme_scrqs.targets, queue) + if (tgt->action =3D=3D IBMVFC_TGT_ACTION_LOGOUT_RPORT) + return 1; list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) if (tgt->action =3D=3D IBMVFC_TGT_ACTION_LOGOUT_RPORT_WAIT) return 0; + list_for_each_entry(tgt, &vhost->nvme_scrqs.targets, queue) + if (tgt->action =3D=3D IBMVFC_TGT_ACTION_LOGOUT_RPORT_WAIT) + return 0; return 1; case IBMVFC_HOST_ACTION_LOGO: case IBMVFC_HOST_ACTION_INIT: @@ -5967,6 +5989,8 @@ static void ibmvfc_do_work(struct ibmvfc_host *vhost) case IBMVFC_HOST_ACTION_QUERY: list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue) ibmvfc_init_tgt(tgt, ibmvfc_tgt_query_target); + list_for_each_entry(tgt, &vhost->nvme_scrqs.targets, queue) + ibmvfc_init_tgt(tgt, ibmvfc_tgt_query_target); ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_QUERY_TGTS); break; case IBMVFC_HOST_ACTION_QUERY_TGTS: @@ -5976,6 +6000,12 @@ static void ibmvfc_do_work(struct ibmvfc_host *vhost) break; } } + list_for_each_entry(tgt, &vhost->nvme_scrqs.targets, queue) { + if (tgt->action =3D=3D IBMVFC_TGT_ACTION_INIT) { + tgt->job_step(tgt); + break; + } + } =20 if (!ibmvfc_dev_init_to_do(vhost)) ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_TGT_DEL); @@ -5988,6 +6018,12 @@ static void ibmvfc_do_work(struct ibmvfc_host *vhost) break; } } + list_for_each_entry(tgt, &vhost->nvme_scrqs.targets, queue) { + if (tgt->action =3D=3D IBMVFC_TGT_ACTION_LOGOUT_RPORT) { + tgt->job_step(tgt); + break; + } + } =20 if (ibmvfc_dev_logo_to_do(vhost)) { spin_unlock_irqrestore(vhost->host->host_lock, flags); @@ -6075,6 +6111,12 @@ static void ibmvfc_do_work(struct ibmvfc_host *vhost) break; } } + list_for_each_entry(tgt, &vhost->nvme_scrqs.targets, queue) { + if (tgt->action =3D=3D IBMVFC_TGT_ACTION_INIT) { + tgt->job_step(tgt); + break; + } + } =20 if (!ibmvfc_dev_init_to_do(vhost)) ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_TGT_DEL_FAILED); --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7EF9929992A; Thu, 23 Jul 2026 00:02:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764938; cv=none; b=KhSU3mhvUVFU0NF2EzUxVPp+az+ed1NrUgOAhPBuvSa5ubPD+P6y2ZvxjHDj73tI+aPRUsH2V9KVFv+xOsKp1sEHlA4TfHRbnmFdaelyvLV4OiMQ+3e+PR1XPZE7VFkHPLsOtxmMKWYA7GiGC2X2ylJ4A4oLoEOAmJArRfo+GhI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764938; c=relaxed/simple; bh=xpSxNOezGu8BqiUe3cBzbkYd4Ha9G8RN0XziyJ7RNCA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qHNtGmkqdxAX0GaUij/VqG39JXpzZZuqiUNIDbBAeMBalFGikOtbGigHWSVcq3Gt89XqgAuLJ/uMjsKlMZMyuSY61TwSMUe5HuxKcSLnqGYqN5z32UoA2f1A9iIettUdtHxrwxNU6NjQcUvATWgylzua6J4vX3xPW9q8kQ5yZcs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=HRyY2n4t; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="HRyY2n4t" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIBkqu712893; Thu, 23 Jul 2026 00:02:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=AhCyypioFTGg6CSh6 AxewyLQ2QuLXsoUiJheEA/2Cxg=; b=HRyY2n4treLzbHQC2QbABMLwF4x0rH2AV zuuYdJ9Uc4p9tjvdGgYaU3fopWp6Pp9DZYnjPrJgw3ctBehg1p6adFinIsS+gSxj yvKViYw0CRgQTDirxb6ssLlLyD0Q3RTGdzvBlzfojor7C7aECzZxeA83aVbjt4Jn JrcGniU/M4Lz3MIGSnbZk7doTAQ2YUnEoPaGxRYCQ10gsJEoZmeGNA3qDTiE1hFo LFgs2vgoQYFAZBItyuCXzV+ibCtyNBjkWjAJQZJsrO52T3HSlOW+Nn4pKzcD0hwv CAHyiHLMtFZR+B/lv6NmqeFXmULHBdxkFmC93ydBzZVmI48ASemaA== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg7ahcctm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:12 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNnj25026459; Thu, 23 Jul 2026 00:02:11 GMT Received: from smtprelay06.dal12v.mail.ibm.com ([172.16.1.8]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4fgktq9x32-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:11 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N02Ak833489528 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:02:10 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C05E658060; Thu, 23 Jul 2026 00:02:10 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 274275803F; Thu, 23 Jul 2026 00:02:10 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:02:10 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 23/33] ibmvfc: implement NVMe/FC stubs for local/remote port registration Date: Wed, 22 Jul 2026 17:01:39 -0700 Message-ID: <20260723000149.969416-24-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: Yu9wz6s3_2YJ_t1qNm9cqSHnHhqTy55x X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX61wjT14IEBUf Bne4gw/MzYbNUp6sCMDOhpj6h/pxguQbwiNig37pP+hjjzqSBRmH8O1trQg2abAAKa/+RJpCmgj nBmzAhB3UnqRqjxG57M6ivaOTeaE1XoAJqegRv3HkusdLcubcV3WY2DLp0UeaBhfffhskJQJSGY 7rqijdSk2ccKPQNt6RQrgbOz2PaBWBKoI14CeIcQIO1FrRY7zlGCHI2dlbT6flj9l/Q/JSMYT4C L6Rq2T36ghNF/kMO518HYSoukbhZX1+ZfnEQGq87SlqRHisD6/eYvZK4sq8X/5GpMNCZ3TWIk7I 7zBze4byosx22eOCeAyUdYjc3bETbPRKUqZd0htaV4T5ukcornlkvOIchX59WllrZyc/LnlG9Fy XTg3elFBd6ui68PxkvHbqtaU5Ny5ue6PArzm3ayeuK49JFEtslLgHCkbL+pFKm3ZtvgVjC6vdM9 aGlxdm4PxeNqs4CQlMw== X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX8eR8zMEj09sq 0fy6NAuTguM90aOIIM6bBuK//jNwjE6WvGS+2i4WjANhwKQZfK0RGpGw2K/cQ2G2HV4eMemxbV7 gApIh2oAepxJi9WI8+z0dsG72xBapIE= X-Proofpoint-GUID: Yu9wz6s3_2YJ_t1qNm9cqSHnHhqTy55x X-Authority-Analysis: v=2.4 cv=SM5ykuvH c=1 sm=1 tr=0 ts=6a615a04 cx=c_pps a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=VnNF1IyMAAAA:8 a=y1iSCKkB5_XLrlYggoUA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 lowpriorityscore=0 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 priorityscore=1501 phishscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" Implement the initial NVMe/FC local-port and remote-port registration functions that notify the NVMe-FC midlayr of port discovery and loss. Register the local port with the NVMe-FC transport, register discovered remote ports against that local port, and add matching unregister paths that wait for the NVMe-FC core to complete asynchronous deletion before dropping driver references. Also store driver-private host and target pointers in the registered NVMe-FC port objects. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc-nvme.c | 80 ++++++++++++++++++++++++++++- drivers/scsi/ibmvscsi/ibmvfc-nvme.h | 4 +- drivers/scsi/ibmvscsi/ibmvfc.h | 4 ++ 3 files changed, 84 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc-nvme.c b/drivers/scsi/ibmvscsi/ib= mvfc-nvme.c index 2ee1c64665d9..d679d1ca366a 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-nvme.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-nvme.c @@ -14,10 +14,18 @@ =20 static void ibmvfc_nvme_localport_delete(struct nvme_fc_local_port *lport) { + struct ibmvfc_host *vhost =3D lport->private; + + vhost->nvme_local_port =3D NULL; + complete(&vhost->nvme_delete_done); } =20 static void ibmvfc_nvme_remoteport_delete(struct nvme_fc_remote_port *rpor= t) { + struct ibmvfc_target *tgt =3D rport->private; + + tgt->nvme_remote_port =3D NULL; + complete(&tgt->nvme_delete_done); } =20 static int ibmvfc_nvme_ls_req(struct nvme_fc_local_port *lport, @@ -70,28 +78,96 @@ static struct nvme_fc_port_template ibmvfc_nvme_fc_tran= sport =3D { =20 int ibmvfc_nvme_register_remoteport(struct ibmvfc_target *tgt) { + struct ibmvfc_host *vhost =3D tgt->vhost; + struct nvme_fc_port_info pinfo; + int rc; + if (!IS_ENABLED(CONFIG_NVME_FC)) return 0; =20 - return 0; + if (!vhost->nvme_local_port) { + dev_err(vhost->dev, "Attempt to register NVMe fc remoteport without vali= d localport\n"); + return -EINVAL; + } + + memset(&pinfo, 0, sizeof(struct nvme_fc_port_info)); + pinfo.node_name =3D tgt->ids.node_name; + pinfo.port_name =3D tgt->ids.port_name; + pinfo.port_id =3D tgt->ids.port_id; + pinfo.port_role =3D FC_PORT_ROLE_NVME_TARGET; + + rc =3D nvme_fc_register_remoteport(vhost->nvme_local_port, &pinfo, + &tgt->nvme_remote_port); + + if (!rc) { + ibmvfc_log(vhost, 2, "register_remoteport: traddr=3Dnn-0x%llx:pn-0x%llx = PortID:%x\n", + pinfo.node_name, pinfo.port_name, pinfo.port_id); + tgt->nvme_remote_port->private =3D tgt; + } + + return rc; } =20 void ibmvfc_nvme_unregister_remoteport(struct ibmvfc_target *tgt) { + struct ibmvfc_host *vhost =3D tgt->vhost; + struct nvme_fc_remote_port *rport =3D tgt->nvme_remote_port; + int rc; + if (!IS_ENABLED(CONFIG_NVME_FC)) return; + + if (!tgt->nvme_remote_port) + return; + + ibmvfc_log(vhost, 2, "unregister_remoteport: traddr=3Dnn-0x%llx:pn-0x%llx= PortID:%x\n", + rport->node_name, rport->port_name, rport->port_id); + init_completion(&tgt->nvme_delete_done); + rc =3D nvme_fc_unregister_remoteport(tgt->nvme_remote_port); + + if (!rc) { + wait_for_completion(&tgt->nvme_delete_done); + } } =20 int ibmvfc_nvme_register(struct ibmvfc_host *vhost) { + struct nvme_fc_port_info pinfo; + int rc; + if (!IS_ENABLED(CONFIG_NVME_FC)) return 0; =20 - return 0; + pinfo.node_name =3D fc_host_node_name(vhost->host); + pinfo.port_name =3D fc_host_port_name(vhost->host); + pinfo.port_id =3D fc_host_port_id(vhost->host); + pinfo.port_role =3D FC_PORT_ROLE_NVME_INITIATOR; + pinfo.dev_loss_tmo =3D 0; + + rc =3D nvme_fc_register_localport(&pinfo, &ibmvfc_nvme_fc_transport, + vhost->dev, &vhost->nvme_local_port); + + if (!rc) { + ibmvfc_log(vhost, 2, "register_localport: host-traddr=3Dnn-0x%llx:pn-0x%= llx on portID:%x\n", + pinfo.node_name, pinfo.port_name, pinfo.port_id); + vhost->nvme_local_port->private =3D vhost; + } else + dev_err(vhost->dev, "Failed to register NVMe fc localport (%d)\n", rc); + + return rc; } =20 void ibmvfc_nvme_unregister(struct ibmvfc_host *vhost) { + int rc; + if (!IS_ENABLED(CONFIG_NVME_FC)) return; + + if (vhost->nvme_local_port) { + init_completion(&vhost->nvme_delete_done); + rc =3D nvme_fc_unregister_localport(vhost->nvme_local_port); + if (!rc) + wait_for_completion(&vhost->nvme_delete_done); + } } diff --git a/drivers/scsi/ibmvscsi/ibmvfc-nvme.h b/drivers/scsi/ibmvscsi/ib= mvfc-nvme.h index 97e267871df2..0465e8719881 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-nvme.h +++ b/drivers/scsi/ibmvscsi/ibmvfc-nvme.h @@ -11,8 +11,8 @@ #ifndef _IBMVFC_NVME_H #define _IBMVFC_NVME_H =20 -#include -#include +#include +#include #include =20 #include "ibmvfc.h" diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h index 66025e6ffeed..d8c2e5f1fdec 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h @@ -839,6 +839,8 @@ struct ibmvfc_target { void (*job_step) (struct ibmvfc_target *); struct timer_list timer; struct kref kref; + struct completion nvme_delete_done; + struct nvme_fc_remote_port *nvme_remote_port; }; =20 /* a unit of work for the hosting partition */ @@ -1015,6 +1017,8 @@ struct ibmvfc_host { struct work_struct rport_add_work_q; wait_queue_head_t init_wait_q; wait_queue_head_t work_wait_q; + struct nvme_fc_local_port *nvme_local_port; + struct completion nvme_delete_done; }; =20 static inline struct ibmvfc_host *ibmvfc_channels_to_vhost(struct ibmvfc_c= hannels *channels) --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6594A1A6816; Thu, 23 Jul 2026 00:02:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764939; cv=none; b=j/crCwo2HwrgesIfyJJTI+zukmM7s4lXjq/upsGbJyQA/qNsD/1nvh7BuLUEq04yCBtdfcil16SNVC94PCIh0LJ+V2WEAdHFDiS0xudwa/s6pFIG8WOu4SZn0KA1WYRqdIUbnw/MwtmHkW7hbkg36ZUkmNzS94r7HCCuC/ypJxM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764939; c=relaxed/simple; bh=wO/gQGt49pXmLG3LbaRv8MbCQnmHNKEO/GcPmFfwVRw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pK8y1TxhoMGTfj1lkpG+EPCo63XUit4EqKyguw84AXbfiv6MLtENhCV9FakFbuZefiZNUd2mBqRIx3BoIfEbnnDs4DqLHHk3mvSCGrRiwrzTNZgCC31r6ZC3LBjkmRfD0f8sBx6BjJEdIArVg6oY5/FHfyzaL+jOEaW3mILSJ2M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=aYvIOg2e; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="aYvIOg2e" Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIBlmo712690; Thu, 23 Jul 2026 00:02:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=sDNPa6wXw+Ks8qTqC 6NbIMJaUjkuU+9RGij6V1ICQ9M=; b=aYvIOg2e42kI6Bzq97Xt1cflBLtFkjxYF DBbfKa+9LNocU5PT6bf7DwAbPS4PvjajsmxF1GYQSsSC6b/Q06To4UAhIG5/1J7N /LJh9gE/hdSaLhbf5un40+t9zrsqiSKATeaT6Nb5dxBEBhC5nMBe/MZAnB1gDg3r rdUYgAT3Tre9bDcOAwp1gn3km5mQG55v4aTjvl/9h2rOujHFa4X7PktcIc0vfCSF +E1BKpluBSSjtWNxKWhPeFSP8YuXNduJBtzaVACmgxfhGHxpGvTE1YXTzq1raFwn LpnHJ+jIhH8CudhVahdw9aI/n4eoO4Y4NWXN96MxUUi1F+3uRQ/Hg== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg7914xq7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:13 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNnddP021718; Thu, 23 Jul 2026 00:02:12 GMT Received: from smtprelay07.dal12v.mail.ibm.com ([172.16.1.9]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fgm6w9uk6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:12 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay07.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N02Bur19333660 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:02:11 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 87B5058060; Thu, 23 Jul 2026 00:02:11 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DFD375803F; Thu, 23 Jul 2026 00:02:10 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:02:10 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 24/33] ibmvfc: register local nvme fc port after fabric login Date: Wed, 22 Jul 2026 17:01:40 -0700 Message-ID: <20260723000149.969416-25-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: DmJg3rPIcT7hWj7UViLX8z8A7CUYCi1I X-Authority-Analysis: v=2.4 cv=V6RNF+ni c=1 sm=1 tr=0 ts=6a615a05 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=U7nrCbtTmkRpXpFmAIza:22 a=VnNF1IyMAAAA:8 a=_Vi487lK4oBJGBne3sIA:9 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX6RTykWbMQkre P1ZARnJJ7XgRdZr01P1hlhhC0r4dMTrUQPC7ZenJHFI6RKDhllTPiXd0sGfhBqg7ps2HeAj/aDv PrtXppNwrWQsGvs91MzMZsTi6XUCRho= X-Proofpoint-GUID: DmJg3rPIcT7hWj7UViLX8z8A7CUYCi1I X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX1+HrFx3JJAGo K1tvb+oFhOy1pBOs80S9TOrJsNfxBvP5rW5IyInYkX9lTfAjbIFqE8P5BA2YjOpEWbWgWrdaMRx WoIfsXx8lriZLaxtdy/B2xkuxLWs/Eb7eNQVoDbfc7w/AuxkgwwC55cX5bWW48Drk1t17BGaP6u Sri9VEGFrdAq5ehaJ+0qfQJMizi1LvuUoQ95AYgtgsjftI9slFEbwizjSiwAT2mk04NVlLlaNHa BqSrVFqdhEWF+FQ1rdr06aC/SHsTjPvlBJJKwXJSzegMYqQcj66LjVChr2lJ22vjjLsj42xnTVg CxtR7HsX1g+qJnatpuN6Fwtz5+mJNIn/gbcRta7ijWdetusCUn9gHKsW9/YJS7GAVNh7FVOPnwZ IiFUyyFbQp4PmKszyQvfgfffaOfxfUGfdIV72uDuivjA1wV8QxtEnLrlz0spZcmgmgXcnia3BKq gbZNqYwXqhXt2stdBDQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 adultscore=0 bulkscore=0 lowpriorityscore=0 clxscore=1015 spamscore=0 impostorscore=0 phishscore=0 priorityscore=1501 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" Register the local NVMe/FC port only after fabric login has completed. The VIOS returns the client port ID in the fabric login response, and that port ID is required to populate the local-port information passed to the NVMe-FC midlayer. Delay local-port registration until that data is available and update the registration helper accordingly. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc-core.c | 5 +++++ drivers/scsi/ibmvscsi/ibmvfc-nvme.c | 17 ++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ib= mvfc-core.c index ff84ca0f9f45..81d9229bf388 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c @@ -5210,6 +5210,8 @@ static void ibmvfc_fabric_login_nvme_done(struct ibmv= fc_event *evt) =20 switch (mad_status) { case IBMVFC_MAD_SUCCESS: + fc_host_port_id(vhost->host) =3D be64_to_cpu(rsp->nport_id); + ibmvfc_nvme_register(vhost); ibmvfc_dbg(vhost, "NVMe fabric login succeeded\n"); break; case IBMVFC_MAD_FAILED: @@ -5271,6 +5273,7 @@ static void ibmvfc_fabric_login_scsi_done(struct ibmv= fc_event *evt) =20 switch (mad_status) { case IBMVFC_MAD_SUCCESS: + fc_host_port_id(vhost->host) =3D be64_to_cpu(rsp->nport_id); ibmvfc_dbg(vhost, "SCSI fabric login succeeded\n"); break; case IBMVFC_MAD_FAILED: @@ -5653,6 +5656,7 @@ static void ibmvfc_npiv_logout_done(struct ibmvfc_eve= nt *evt) case IBMVFC_MAD_SUCCESS: if (list_empty(&vhost->crq.sent) && vhost->action =3D=3D IBMVFC_HOST_ACTION_LOGO_WAIT) { + ibmvfc_nvme_unregister(vhost); ibmvfc_init_host(vhost); return; } @@ -5931,6 +5935,7 @@ static void ibmvfc_do_work(struct ibmvfc_host *vhost) list_splice_init(&vhost->purge, &purge); spin_unlock_irqrestore(vhost->host->host_lock, flags); ibmvfc_complete_purge(&purge); + ibmvfc_nvme_unregister(vhost); rc =3D ibmvfc_reset_crq(vhost); =20 spin_lock_irqsave(vhost->host->host_lock, flags); diff --git a/drivers/scsi/ibmvscsi/ibmvfc-nvme.c b/drivers/scsi/ibmvscsi/ib= mvfc-nvme.c index d679d1ca366a..637d7d7015cf 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-nvme.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-nvme.c @@ -145,14 +145,17 @@ int ibmvfc_nvme_register(struct ibmvfc_host *vhost) pinfo.dev_loss_tmo =3D 0; =20 rc =3D nvme_fc_register_localport(&pinfo, &ibmvfc_nvme_fc_transport, - vhost->dev, &vhost->nvme_local_port); + get_device(vhost->dev), + &vhost->nvme_local_port); =20 if (!rc) { ibmvfc_log(vhost, 2, "register_localport: host-traddr=3Dnn-0x%llx:pn-0x%= llx on portID:%x\n", pinfo.node_name, pinfo.port_name, pinfo.port_id); vhost->nvme_local_port->private =3D vhost; - } else + } else { dev_err(vhost->dev, "Failed to register NVMe fc localport (%d)\n", rc); + put_device(vhost->dev); + } =20 return rc; } @@ -165,9 +168,17 @@ void ibmvfc_nvme_unregister(struct ibmvfc_host *vhost) return; =20 if (vhost->nvme_local_port) { + ibmvfc_log(vhost, 2, "unregister_localport: host-traddr=3Dnn-0x%llx:pn-0= x%llx on portID:%x\n", + vhost->nvme_local_port->node_name, + vhost->nvme_local_port->port_name, + vhost->nvme_local_port->port_id); init_completion(&vhost->nvme_delete_done); rc =3D nvme_fc_unregister_localport(vhost->nvme_local_port); - if (!rc) + if (!rc) { wait_for_completion(&vhost->nvme_delete_done); + } else + dev_err(vhost->dev, "Failed to unregister NVMe fc localport (%d)\n", rc= ); + + put_device(vhost->dev); } } --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 05912345CCD; Thu, 23 Jul 2026 00:02:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764943; cv=none; b=cm9czoJTN6iszx1lkzN7UUEafsLonp5mKDpc2ws/LIcMUSTg7HHYZIi/ovJInEpZTFSkt1WVC+ZqjndIuTk0wqLdyP3kH+iRW+gOBu7J9ZJ0yDLGSRKkdg2xRL3tJxEXHBlZsVPpIzNGEHHdYD++kaEwBwF9mXAkGVERx7RfsTE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764943; c=relaxed/simple; bh=WL8UtzZJOquC24h2gENxNAvtjVtt3xfjNx0cQPYT9dY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QQO/CiEDMuyQXIAxnQxRyv6E1SNxx37bI3Kzi7LK7fmdoweMaSc4xpAYan2fiHB1XVwBR9CDRI+Kwi5CfRmmpCPzYqgZxl/B+zcJ9Q+QljRpgZenBsqdpJpX43e0REDAydKcwmM514DAHZsEXITiPOr0MIQL09ZR5R+dQU/OJsk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=PN6fbfy3; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="PN6fbfy3" Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIBns73019780; Thu, 23 Jul 2026 00:02:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=prEuV7/AAc0CjuGGx kQjee3pUkxluMCOrWRD5NpLvvA=; b=PN6fbfy3DBg2GCvMf2tzg82rJom/cV7Ir O6K3u3IfLhclGzPJXq4kG7n/dyvGUUdqP8qOLZteYHhJbx6LkWwzUCdsXtfILcPN e5FTeKyMShGJP10Z7cjeU9E/xu2lSRfG5anMtHtqkittMeSm+0ODnURpM0gJ8qAH zqkSFq7gaqzuUKLlRkwQ46zLU+D7PhZIKxdo6uvayGBexusAr9AsyIij3HOdZoPs kkpZiTZH4U9OvouO5wa7mfSuhF7nVchPIPUl1vfS8bupc2DtaHXjrfvz6HPfUnd3 emV1t+EyQf51WuRCERFfKmQ/mWEMROb+fj2nBnyd45Q56Q3gXb++Q== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg77amx6j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:14 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNnaIL028159; Thu, 23 Jul 2026 00:02:13 GMT Received: from smtprelay01.wdc07v.mail.ibm.com ([172.16.1.68]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fgnah9q3k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:13 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay01.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N02C2D7734206 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:02:12 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 48ED258061; Thu, 23 Jul 2026 00:02:12 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A48495803F; Thu, 23 Jul 2026 00:02:11 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:02:11 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 25/33] ibmvfc: process NVMe/FC rports in work thread Date: Wed, 22 Jul 2026 17:01:41 -0700 Message-ID: <20260723000149.969416-26-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 9hwfmNY976NPE6pKKMAuov4NsjuG-uON X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX2Xlq+pwi3Ef/ P+bowW88g6w7lDmMUGbzaHpLC00XVYvVSNTvr04svoUz/P3DAwRa+O4Jdk/GBXxL+P88pq0J5nc 3a5OfbSunnUtLat7V+oYeT91CAiDEJ4= X-Proofpoint-GUID: 9hwfmNY976NPE6pKKMAuov4NsjuG-uON X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX0nHCComSBsHB ZOqis5D0KJEislV2UmD7IDI7HOuHRdIIVV32g8zXyCEtNLKiO/sJ6KTDdSfqGV8Fv1DPpmaF87W cwk8WD/gHf26mvU53YBUzeGEYVCyznLTLsWt7fE7GmutJNweDKfvJL1JYVLgHhihpEZQpxE6+8l PvHdjqdWYyQSJy7LFSL/fOxAbUaLGxlthBHLjZ6V5+UboXRSyOH8Ok8Id1Lz2lTWf5Ky6trEb+i ZjXTADv3cLPa9x5TGPIAyuGbfglEsEBG/uSm/FUPwdxhjTjqO860GNAm5epPwTjGuLHTFYZCt4S XnPtx1xEJNhkE08PaJK+yZG6Nz64MGF2CEm6YPAEGQDT+j7GUmScTqR8xwgqxLMCnulVh1PgppZ 5upBmjr8tYt1f1uAp5Dsy1gsczQ4hA5ONMnEpkG2rDSwAIUr5Jd//nZVigvgFLvKxJg7OkMEKgO 00Cvr/Whi2L3zJHobyQ== X-Authority-Analysis: v=2.4 cv=K7AS2SWI c=1 sm=1 tr=0 ts=6a615a07 cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=VnNF1IyMAAAA:8 a=YKckqcwGcxMuMPRTqGAA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 spamscore=0 phishscore=0 malwarescore=0 adultscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" Add an NVMe-specific remote-port add helper and update the rport worker thread to walk the NVMe target list, register new NVMe remote ports, and rescan existing ones through the NVMe-FC midlayer. Also handle delete and delete-with-logout transitions for NVMe remote ports in the same worker context used for SCSI rports. This keeps remote-port registration serialized in the existing worker model while allowing NVMe targets to participate in the common target state machine. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc-core.c | 94 ++++++++++++++++++++++++++++- 1 file changed, 93 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ib= mvfc-core.c index 81d9229bf388..ffb579816e84 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c @@ -5856,6 +5856,51 @@ static void ibmvfc_log_ae(struct ibmvfc_host *vhost,= int events) fc_host_post_event(vhost->host, fc_get_event_number(), FCH_EVT_LINKUP, 0= ); } =20 +/** + * ibmvfc_tgt_add_nvme_rport - Tell the FC transport about a new remote po= rt + * @tgt: ibmvfc target struct + * + **/ +static void ibmvfc_tgt_add_nvme_rport(struct ibmvfc_target *tgt) +{ + struct ibmvfc_host *vhost =3D tgt->vhost; + struct nvme_fc_remote_port *rport; + unsigned long flags; + + tgt_dbg(tgt, "Adding NVMe rport\n"); + ibmvfc_nvme_register_remoteport(tgt); + spin_lock_irqsave(vhost->host->host_lock, flags); + rport =3D tgt->nvme_remote_port; + + if (rport && tgt->action =3D=3D IBMVFC_TGT_ACTION_DEL_RPORT) { + tgt_dbg(tgt, "Deleting NVMe rport\n"); + list_del(&tgt->queue); + ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DELETED_RPORT); + spin_unlock_irqrestore(vhost->host->host_lock, flags); + ibmvfc_nvme_unregister_remoteport(tgt); + timer_delete_sync(&tgt->timer); + kref_put(&tgt->kref, ibmvfc_release_tgt); + return; + } else if (rport && tgt->action =3D=3D IBMVFC_TGT_ACTION_DEL_AND_LOGOUT_R= PORT) { + tgt_dbg(tgt, "Deleting NVMe rport with outstanding I/O\n"); + ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_LOGOUT_DELETED_RPORT); + tgt->init_retries =3D 0; + spin_unlock_irqrestore(vhost->host->host_lock, flags); + ibmvfc_nvme_unregister_remoteport(tgt); + return; + } else if (rport && tgt->action =3D=3D IBMVFC_TGT_ACTION_DELETED_RPORT) { + spin_unlock_irqrestore(vhost->host->host_lock, flags); + return; + } + + if (rport) { + tgt_dbg(tgt, "NVMe rport add succeeded\n"); + tgt->target_id =3D tgt->nvme_remote_port->port_id; + } else + tgt_dbg(tgt, "NVMe rport add failed\n"); + spin_unlock_irqrestore(vhost->host->host_lock, flags); +} + /** * ibmvfc_tgt_add_rport - Tell the FC transport about a new remote port * @tgt: ibmvfc target struct @@ -5920,6 +5965,7 @@ static void ibmvfc_do_work(struct ibmvfc_host *vhost) struct ibmvfc_target *tgt; unsigned long flags; struct fc_rport *rport; + struct nvme_fc_remote_port *nvme_rport; LIST_HEAD(purge); int rc; =20 @@ -6073,6 +6119,30 @@ static void ibmvfc_do_work(struct ibmvfc_host *vhost) } } =20 + list_for_each_entry(tgt, &vhost->nvme_scrqs.targets, queue) { + if (tgt->action =3D=3D IBMVFC_TGT_ACTION_DEL_RPORT) { + tgt_dbg(tgt, "Deleteing NVMe rport\n"); + nvme_rport =3D tgt->nvme_remote_port; + list_del(&tgt->queue); + ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DELETED_RPORT); + spin_unlock_irqrestore(vhost->host->host_lock, flags); + if (nvme_rport) + ibmvfc_nvme_unregister_remoteport(tgt); + timer_delete_sync(&tgt->timer); + kref_put(&tgt->kref, ibmvfc_release_tgt); + return; + } else if (rport && tgt->action =3D=3D IBMVFC_TGT_ACTION_DEL_AND_LOGOUT= _RPORT) { + tgt_dbg(tgt, "Deleting NVMe rport with outstanding I/O\n"); + nvme_rport =3D tgt->nvme_remote_port; + ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_LOGOUT_DELETED_RPORT); + tgt->init_retries =3D 0; + spin_unlock_irqrestore(vhost->host->host_lock, flags); + if (nvme_rport) + ibmvfc_nvme_unregister_remoteport(tgt); + return; + } + } + if (vhost->state =3D=3D IBMVFC_INITIALIZING) { if (vhost->action =3D=3D IBMVFC_HOST_ACTION_TGT_DEL_FAILED) { if (vhost->reinit) { @@ -6658,6 +6728,7 @@ static void ibmvfc_rport_add_thread(struct work_struc= t *work) rport_add_work_q); struct ibmvfc_target *tgt; struct fc_rport *rport; + struct nvme_fc_remote_port *nvme_rport; unsigned long flags; int did_work; =20 @@ -6691,7 +6762,28 @@ static void ibmvfc_rport_add_thread(struct work_stru= ct *work) break; } } - } while(did_work); + + list_for_each_entry(tgt, &vhost->nvme_scrqs.targets, queue) { + if (tgt->add_rport) { + did_work =3D 1; + tgt->add_rport =3D 0; + kref_get(&tgt->kref); + nvme_rport =3D tgt->nvme_remote_port; + if (!nvme_rport) { + spin_unlock_irqrestore(vhost->host->host_lock, flags); + ibmvfc_tgt_add_nvme_rport(tgt); + } else { + spin_unlock_irqrestore(vhost->host->host_lock, flags); + if (IS_ENABLED(CONFIG_NVME_FC)) + nvme_fc_rescan_remoteport(nvme_rport); + } + + kref_put(&tgt->kref, ibmvfc_release_tgt); + spin_lock_irqsave(vhost->host->host_lock, flags); + break; + } + } + } while (did_work); =20 if (vhost->state =3D=3D IBMVFC_ACTIVE) vhost->scan_complete =3D 1; --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59FF831F9B9; Thu, 23 Jul 2026 00:02:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764941; cv=none; b=j+VF7MGfpiz9uVJ2hoE39u6mmkwqGn9RXnYpR5/SV5iBUbKf95V7y60/OxJtX2FzKl+kT+xIZa+KZvkUH5JnyqBZlonTkwVsVJQGlzV6dtZlfbLmUBR6PTRK6XHygzDHYn3TxV1POv+1tPAJfzJzhZN0vMdWyEKzdBUUj19/SAo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764941; c=relaxed/simple; bh=+T47terft/rgw3rZhcOJmOXfN8fD3xpvi8ZEGqdlYSk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b0GufIcgOlw5zqjgDTf/CMnLD8PHQn9u3NZjXrF1+817LvYUcXXZWO2yCoOEOykKoE94hCRYyQEAB9pE+DB9bJUV5miOt1+GdfnKnXGkJooUnsDL2ZlGGRrh9GyOrGnbkBJ2sJyI6EPVRw5LxPB2r/y2Q+jb44vP1VAlO8OrsdM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=n656rn7/; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="n656rn7/" Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIBt4K633457; Thu, 23 Jul 2026 00:02:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=eblGcB34wmCvotF7J o6JQc5j0CGO07E5cvvhhak1EyQ=; b=n656rn7/Fk/XMxSSK0sbvyLhBq564iwRm Bbf0TBm9l3NGEyqtFOPbqsFnYfAoNKyLKFqovdcgsOE6EK2wCdp7HHfu6WJa4F3j ZNsZiwrDWPjjy2NcbQAxRrL6yghTCozRCifGGnWPOziOrRjJFzSkHKp+o42xTm2j txLt5rDIf3pvjf2Grg/JCfPVaNeGcoCcrmkLiHlxZVwvX578mkWUIea7wNb1hgu/ wNH/RI/BzuRGPha3t7Z99/9CQkuV/YlFlSilIhVmvv2vI7dgzCUUC1fq7HNHEKXc PSciJVNYc85PthoRAoWCSIJxNXVAMXbLCUDZBsy3qbdS9n7SGn9Iw== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg77kce7c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:15 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNnaIN028159; Thu, 23 Jul 2026 00:02:14 GMT Received: from smtprelay02.wdc07v.mail.ibm.com ([172.16.1.69]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fgnah9q3n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:14 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay02.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N02DOL29491862 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:02:13 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 064DD58068; Thu, 23 Jul 2026 00:02:13 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 668AB58063; Thu, 23 Jul 2026 00:02:12 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:02:12 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 26/33] ibmvfc: extend ibmvfc_debug visibility to ibmvfc-nvme.h Date: Wed, 22 Jul 2026 17:01:42 -0700 Message-ID: <20260723000149.969416-27-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Authority-Analysis: v=2.4 cv=HJXz0Itv c=1 sm=1 tr=0 ts=6a615a07 cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VnNF1IyMAAAA:8 a=Jem0i5WXB_Or_wZ5oY8A:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX1WKhg2on7PuR 6WjTCHqG4MeKRzzj2jnHtCRGQGKv+Mh+5wP4DfvzW86VfFlBv8zh1rAHONnUnT6NmAQS3wG3cbH BWN5CpGf19kX8LqRrbCDPpZZACbCWHe99m3U+kaclPkZ5c1RCGRCvENyBzoxsHQv5/ir9jIjelm wBcs1iQ+vgnSM6QRg3lSPxI6mQfpkOjmG5QkMaO+N7R22KYM2cC2HGfj4lRZFOxfR3zVOCgm3hU cMRY3lkyDitWmC2WmGhwo8gyuR7mtG2946Me5l4NN36G/c+WiXyx5zabZZ9qKPyBrVFaZJ8q3M3 J8kbslAk3IRQaooFqufTylFhmYB1uNop+6rkwYnAlFmWz8Bv9OszmSkYSGBhEGS7WuxjgHXtogK NBeEwqXPI+BcXPZeRAyCZ8MnsKzLsGqvjIQXVZZ6PSurtFMH0MSTB5GROPqLgZga1DmvTygLUZK tqwTLIKJswdZvEu+qTA== X-Proofpoint-ORIG-GUID: _EkLsC7_0EeeU2lf45v8g3l5RXgrQNlL X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX5CbvxQ6XYVxO GTxE3/CZfygiJcZLq6ut6svZMroTUGeb800Sc/vO4n+nD2U8fEvYeAC6iQaqUesJlSeV990jyeM 4cm05aBrOxcyJnW5nVKKHjKMAd7i4GA= X-Proofpoint-GUID: _EkLsC7_0EeeU2lf45v8g3l5RXgrQNlL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 malwarescore=0 impostorscore=0 clxscore=1015 phishscore=0 spamscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" Export ibmvfc_debug so the NVMe support code can use the existing ibmvfc_dbg logging macro. The debug control variable is currently file-local to the core driver, which prevents protocol-specific code in ibmvfc-nvme.c from using the shared debug infrastructure. Make the variable global within the module and declare it in ibmvfc-nvme.h. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc-core.c | 3 ++- drivers/scsi/ibmvscsi/ibmvfc-nvme.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ib= mvfc-core.c index ffb579816e84..6156f10871ac 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c @@ -41,7 +41,6 @@ static unsigned int max_requests =3D IBMVFC_MAX_REQUESTS_= DEFAULT; static u16 max_sectors =3D IBMVFC_MAX_SECTORS; static u16 scsi_qdepth =3D IBMVFC_SCSI_QDEPTH; static unsigned int disc_threads =3D IBMVFC_MAX_DISC_THREADS; -static unsigned int ibmvfc_debug =3D IBMVFC_DEBUG; static unsigned int log_level =3D IBMVFC_DEFAULT_LOG_LEVEL; static unsigned int cls3_error =3D IBMVFC_CLS3_ERROR; static unsigned int mq_enabled =3D IBMVFC_MQ; @@ -53,6 +52,8 @@ static unsigned int nr_nvme_channels =3D IBMVFC_NVME_CHAN= NELS; static unsigned int mig_channels_only =3D IBMVFC_MIG_NO_SUB_TO_CRQ; static unsigned int mig_no_less_channels =3D IBMVFC_MIG_NO_N_TO_M; =20 +unsigned int ibmvfc_debug =3D IBMVFC_DEBUG; + static LIST_HEAD(ibmvfc_head); static DEFINE_SPINLOCK(ibmvfc_driver_lock); static struct scsi_transport_template *ibmvfc_transport_template; diff --git a/drivers/scsi/ibmvscsi/ibmvfc-nvme.h b/drivers/scsi/ibmvscsi/ib= mvfc-nvme.h index 0465e8719881..3aa285788795 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-nvme.h +++ b/drivers/scsi/ibmvscsi/ibmvfc-nvme.h @@ -22,6 +22,8 @@ #define IBMVFC_MAX_NVME_QUEUES 16 #define IBMVFC_NVME_CHANNELS 8 =20 +extern unsigned int ibmvfc_debug; + struct ibmvfc_host; struct ibmvfc_target; =20 --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3857735839E; Thu, 23 Jul 2026 00:02:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764943; cv=none; b=JhuFATbDxe8Kofh9Uy4+F4pUU+CfDtPAXeiZO2CnBaBNZ9dcRobYUsIh5obqgQ/jGDsdXjHYTQ9700WYCs0PmJ1AUxqPyartRcLv5YAJ8BFo6XDrt2AV8q/cqY6lS0zs4em3bc7haf3f7+uNb6N1/pEJnxDSsPVi0bZ8wzLHbxc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764943; c=relaxed/simple; bh=2IC2TtbpovrvIsmSH0qTu2hMBFk0Q+eODBPm81VZM8E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CgR5OTc/Vuokld5C+Qf+o4usZ3noIimS8DSOkiaSzLSLxXqbD9xsuB9lQ/AKZnAbo+2YeVbF4gm3XXyJ77A0Tx/6JY/uayf91pDXtOfb6sHzibwq4jMiTUE/mb6PGGBsR1A6KVLWM4EdUqWeh1SfnpD9MkP0jmGvXmDH6cqpnc8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=CVP5F+kf; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="CVP5F+kf" Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIBeMC3019593; Thu, 23 Jul 2026 00:02:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=5O8MITsENqMPmEPL0 vBvdhdCIo4OvkcMe0CzPrVv/K4=; b=CVP5F+kfGcj6iBccLpz9d9F03JFJACKir 76v3JYCccws4aDHykOc9RhQkJlx/9/xDZhWaSE7pEJwMzgsUYKwxF+6q3fspiCJJ 8MG7KBxxjPutkcaLDaSaKO3A2pGzMcyW9I5WMShgjT5d1iitXdP73MYnKNuQvD2H S5rcmXyd8XCd5tV3WVLg2OgzHj7bzK2/1t2XrAYpzr3G+W07MdRHityNSD0MHHiM duy15lxo/b4twQVn7n05o07sC7fN4HK1b7ggRkZMPu05z71uv67uAYmCnIz0VdmY Sfmm/yIWOUizdlsftVw65qc+aq2Tr7Jf/kYdLiKeoelnAaK+F88Nw== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg77amx6p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:16 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNnxOw026539; Thu, 23 Jul 2026 00:02:15 GMT Received: from smtprelay02.wdc07v.mail.ibm.com ([172.16.1.69]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4fgktq9x35-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:15 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay02.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N02D1J29491866 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:02:14 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B8DF158061; Thu, 23 Jul 2026 00:02:13 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 21E4C58056; Thu, 23 Jul 2026 00:02:13 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:02:13 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 27/33] ibmvfc: declare global function definitions Date: Wed, 22 Jul 2026 17:01:43 -0700 Message-ID: <20260723000149.969416-28-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: Wp8bTUywUbW-Ce2SAt6wdDSdFnxraDbv X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfXxN7uvuNdJVCy 4P81vm3OpF6BW35UOEDLIGua0QWAKwZxEs97+z9I/a1TbnICYsmctyU2NBPzZyB5BgXbivel426 cwwF9Z41zZVk48Zw+1/KcMxKLszbhHs= X-Proofpoint-GUID: Wp8bTUywUbW-Ce2SAt6wdDSdFnxraDbv X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfXz7pF25cmKK6O deOJlg6E6VGuwe8n/qj1VqTs4kLXJuZGRolHD1/oP+Or2yS/s5KnPzGf2t9NyAFk8VefPWKfwDP VMMnRQhiEgpaJIFD5Pb2zXqADkwNa6WJU7ILd43FhwtMqfYYDLevywl6h5V10jtQUU3jKG1nPtV 1ykimPg0uJLmjxMsWAmirXGaQigyOctWMrb3Xnd/H8SoeSk5LyUmRFQy/jDJZBnvi7EXETJRllh 79se7/Aoz/T3w6lCyprTR55dIapFFysKcYkRfP+fMnWNfBH8xjFbzyS4vGss7BU/ZuKEjgfJczd jY/hGtPQL248EaQtePT5XH20/2J9gnfmDeliJh1aqaMUxBdRQtnLv3FRsi6rk3o5/7aMYZFIe3W aKk+a3HleARB/k8a+70f0C4rhmXyp8sFCNP8ZxOIMm675BzoVVt7p7s6N2QL1ghAZ876XiLQJlu ZeDl7oH7FPsK+XH6pww== X-Authority-Analysis: v=2.4 cv=K7AS2SWI c=1 sm=1 tr=0 ts=6a615a08 cx=c_pps a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=VnNF1IyMAAAA:8 a=AEPiXkB1DSZsRdhttTEA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 spamscore=0 phishscore=0 malwarescore=0 adultscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" Some common functions will require visibility by both SCSI and NVMe protocols. Make common ibmvfc helper routines available to the NVMe support code. Remove static from the core event allocation, event initialization, event free, target release, command error, and event send helpers, and declare them in ibmvfc.h. This allows ibmvfc-nvme.c to reuse the existing event and target infrastructure. No functional change is intended. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc-core.c | 22 ++++++---------------- drivers/scsi/ibmvscsi/ibmvfc.h | 17 +++++++++++++++++ 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ib= mvfc-core.c index 6156f10871ac..206cc9508dda 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c @@ -206,13 +206,6 @@ static long h_reg_sub_crq(unsigned long unit_address, = unsigned long ioba, return rc; } =20 -static int ibmvfc_check_caps(struct ibmvfc_host *vhost, unsigned long cap_= flags) -{ - u64 host_caps =3D be64_to_cpu(vhost->login_buf->resp.capabilities); - - return (host_caps & cap_flags) ? 1 : 0; -} - static int ibmvfc_nvme_active(struct ibmvfc_host *vhost) { return (ibmvfc_check_caps(vhost, IBMVFC_SUPPORT_NVMEOF) && @@ -354,7 +347,7 @@ static int ibmvfc_get_err_index(u16 status, u16 error) * Return value: * error description string **/ -static const char *ibmvfc_get_cmd_error(u16 status, u16 error) +const char *ibmvfc_get_cmd_error(u16 status, u16 error) { int rc =3D ibmvfc_get_err_index(status, error); if (rc >=3D 0) @@ -1076,7 +1069,7 @@ static int ibmvfc_valid_event(struct ibmvfc_event_poo= l *pool, * @evt: ibmvfc_event to be freed * **/ -static void ibmvfc_free_event(struct ibmvfc_event *evt) +void ibmvfc_free_event(struct ibmvfc_event *evt) { struct ibmvfc_event_pool *pool =3D &evt->queue->evt_pool; unsigned long flags; @@ -1410,7 +1403,7 @@ static void ibmvfc_set_rport_dev_loss_tmo(struct fc_r= port *rport, u32 timeout) * @kref: kref struct * **/ -static void ibmvfc_release_tgt(struct kref *kref) +void ibmvfc_release_tgt(struct kref *kref) { struct ibmvfc_target *tgt =3D container_of(kref, struct ibmvfc_target, kr= ef); mempool_free(tgt, tgt->vhost->tgt_pool); @@ -1588,7 +1581,7 @@ static void ibmvfc_set_login_info(struct ibmvfc_host = *vhost) * * Returns a free event from the pool. **/ -static struct ibmvfc_event *__ibmvfc_get_event(struct ibmvfc_queue *queue,= int reserved) +struct ibmvfc_event *__ibmvfc_get_event(struct ibmvfc_queue *queue, int re= served) { struct ibmvfc_event *evt =3D NULL; unsigned long flags; @@ -1612,9 +1605,6 @@ static struct ibmvfc_event *__ibmvfc_get_event(struct= ibmvfc_queue *queue, int r return evt; } =20 -#define ibmvfc_get_event(queue) __ibmvfc_get_event(queue, 0) -#define ibmvfc_get_reserved_event(queue) __ibmvfc_get_event(queue, 1) - /** * ibmvfc_locked_done - Calls evt completion with host_lock held * @evt: ibmvfc evt to complete @@ -1639,7 +1629,7 @@ static void ibmvfc_locked_done(struct ibmvfc_event *e= vt) * @done: Routine to call when the event is responded to * @format: SRP or MAD format **/ -static void ibmvfc_init_event(struct ibmvfc_event *evt, +void ibmvfc_init_event(struct ibmvfc_event *evt, void (*done) (struct ibmvfc_event *), u8 format) { evt->cmnd =3D NULL; @@ -1764,7 +1754,7 @@ static void ibmvfc_timeout(struct timer_list *t) * * Returns the value returned from ibmvfc_send_crq(). (Zero for success) **/ -static int ibmvfc_send_event(struct ibmvfc_event *evt, +int ibmvfc_send_event(struct ibmvfc_event *evt, struct ibmvfc_host *vhost, unsigned long timeout) { __be64 *crq_as_u64 =3D (__be64 *) &evt->crq; diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h index d8c2e5f1fdec..ece1f379c269 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h @@ -1021,6 +1021,23 @@ struct ibmvfc_host { struct completion nvme_delete_done; }; =20 +struct ibmvfc_event *__ibmvfc_get_event(struct ibmvfc_queue *queue, int re= served); +#define ibmvfc_get_event(queue) __ibmvfc_get_event(queue, 0) +#define ibmvfc_get_reserved_event(queue) __ibmvfc_get_event(queue, 1) + +void ibmvfc_init_event(struct ibmvfc_event *evt, void (*done) (struct ibmv= fc_event *), u8 format); +void ibmvfc_free_event(struct ibmvfc_event *evt); +void ibmvfc_release_tgt(struct kref *kref); +int ibmvfc_send_event(struct ibmvfc_event *evt, struct ibmvfc_host *vhost,= unsigned long timeout); +const char *ibmvfc_get_cmd_error(u16 status, u16 error); + +static inline int ibmvfc_check_caps(struct ibmvfc_host *vhost, unsigned lo= ng cap_flags) +{ + u64 host_caps =3D be64_to_cpu(vhost->login_buf->resp.capabilities); + + return (host_caps & cap_flags) ? 1 : 0; +} + static inline struct ibmvfc_host *ibmvfc_channels_to_vhost(struct ibmvfc_c= hannels *channels) { if (channels->protocol =3D=3D IBMVFC_PROTO_SCSI) --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD3DB3624CC; Thu, 23 Jul 2026 00:02:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764943; cv=none; b=GkigJvxqTrwsGw2mMYwSh5+qUrwSRnBjIrCNGFpScq3Gnw2Xkii+X5Voqvu0twRlIZKJGmqcvGRfy6GU76vkf9adrmsLsNDp4NdFd3qh7ChJRXFTh92t9Kps2OiD5PVMe/IAQ507CkQo8n1PuOL4tUbub/vS7V/iGagnUwz9y/4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764943; c=relaxed/simple; bh=TySdMx2Doo6myQfeU43Wb4gLfIRw97fnqm/4NP5kCjo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CNnR/BywJCltDECiQA3B0Cv7jUM+1M8Rln3ckYEaIocvFhgjk5HcraB1X9v/iR1KXosQpOesLzhoOUPQv2L+tc0cjLm6tMYuRXWZk+/65EpFjL44m7uS819IfR6PfK52YnK9IypVjpgsA318vHeSVjCbCiAJhTyNqrg65U+uPR8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=I81EHICA; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="I81EHICA" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIBjBV704715; Thu, 23 Jul 2026 00:02:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=1KaxPxGMAHBRCGOFa AOShkVVGnR/EB7WQ+/6AMC/qdA=; b=I81EHICA9zVYQSAtnUxR/ys29zJ1xk8/d Pok6NSgorbG2fTFfHmj8HzQRNuLzVqfN8uz7Kqtr//tD4rGQfZwRE0nYzOeDi//2 2oTSzelvAyHVdMd5sUyNT47iQizAC4l105MApGbLLHcb6fb8acZ6OXtCkOq8yUjD xtpzu7GJ0L17nmADx4noXhFRoUc5J0TbrpvihcDgz/Bl1FUQ4bcs8yi4z+DMuwCo e2yLrXGbL30xN5Emv4LJ7JsZKExgDx2HRbQOACy/JiBLaveGjsqKrO81ZChGd/XI bl42FVf6jPVvyLJ4SgpH4WYvhOt3yX/JKiRWeGL6F1w1WOUEi2GSQ== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg7abmynx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:16 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNndSZ032298; Thu, 23 Jul 2026 00:02:15 GMT Received: from smtprelay02.dal12v.mail.ibm.com ([172.16.1.4]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fgmtk1rt4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:15 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay02.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N02E5K5702394 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:02:14 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7420C5805A; Thu, 23 Jul 2026 00:02:14 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D461458063; Thu, 23 Jul 2026 00:02:13 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:02:13 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 28/33] ibmvfc: implement LLDD callbacks for mapping nvme-fc queues Date: Wed, 22 Jul 2026 17:01:44 -0700 Message-ID: <20260723000149.969416-29-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX3S03qJh6AhyT Wmjw8DXvtYnnXAO3EvZuxgaVSvsGL+4dmwKI1jqHzvyaOS7uRJAD7BDNNGNHKiDXlbfNnDPsrxi ko8QZpURiSkUt0EMnJg1NRPg9YPBtLDkeVhRt7XhRClmDBJFtQHXqEx9h/wfgP6eyXe+UNgzAez 3+t6kw9BtxKIDgzmjwCZSM5xN9FBD0X/jnnj3EXlSF1ZHjJ58tQoECLre+/aDZSma4w4X+xxByZ cG6MpUgDoD1FniVlivaDzilmq6JMZhlQHtwrs8fLufd2VXNovZDiC0bIx07zoL8WgArNhxtOAwy usKKXmrGhypit6v1oNr3zTWwjTWIfNbg33M2+91tEQWCChTMefnAwbZa0TyK+qRnRfpnl52tDlZ 4KILk/3N6MrT71kuIDjAL0S3Ro1tjb50Dxm1mTVba+dTCAdDCtJl+DhXXl7DKV8EKZovchJmqs8 quxi6lf4U1CXUJQ/WdQ== X-Authority-Analysis: v=2.4 cv=F7ZnsKhN c=1 sm=1 tr=0 ts=6a615a08 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=VnNF1IyMAAAA:8 a=xXv5fKpT-M1mo7RiuCsA:9 X-Proofpoint-ORIG-GUID: jESuruwRYuPgGBA3dPxQ42kLgbN-O7sM X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX8ioTH1cMbu57 SGYByUOuPvB7tW9N+1ts5n8z9aqVAvuU4RaNiGDUs7I5/dUajNhW/OQtuwSZ9lu/+enxHUlvr5z 7i+yBV3w7JPLGaOZ9l9QVolR6FV6jXk= X-Proofpoint-GUID: jESuruwRYuPgGBA3dPxQ42kLgbN-O7sM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 phishscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 impostorscore=0 lowpriorityscore=0 suspectscore=0 malwarescore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" Implement the NVMe-FC queue create and delete callbacks and map NVMe controller queues onto ibmvfc hardware queues. Use qidx of NVMe controller queue to map onto a ibmvfc_queue channel. The Admin queue is always qidx 0 and general practice among other drivers is to map both the Admin queue and first IO queue to the same HW queue. Add a new ibmvfc_nvme_qhandle struct that will be used as the opaque queue handle by the NVMe-FC layer when issuing fcp IO. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc-nvme.c | 38 +++++++++++++++++++++++++++-- drivers/scsi/ibmvscsi/ibmvfc-nvme.h | 7 ++++++ 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc-nvme.c b/drivers/scsi/ibmvscsi/ib= mvfc-nvme.c index 637d7d7015cf..ecf9f4c0549c 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-nvme.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-nvme.c @@ -28,6 +28,40 @@ static void ibmvfc_nvme_remoteport_delete(struct nvme_fc= _remote_port *rport) complete(&tgt->nvme_delete_done); } =20 +static int ibmvfc_nvme_create_queue(struct nvme_fc_local_port *lport, unsi= gned int qidx, + u16 qsize, void **handle) +{ + struct ibmvfc_host *vhost =3D lport->private; + struct ibmvfc_nvme_qhandle *qhandle; + + if (!vhost->nvme_scrqs.active_queues) + return -ENODEV; + + qhandle =3D kzalloc_obj(struct ibmvfc_nvme_qhandle); + if (!qhandle) + return -ENOMEM; + + qhandle->cpu_id =3D raw_smp_processor_id(); + qhandle->qidx =3D qidx; + + /* Admin and first IO queue are both mapped to index 0 */ + if (qidx) + qhandle->index =3D (qidx - 1) % vhost->nvme_scrqs.active_queues; + else + qhandle->index =3D qidx; + + qhandle->queue =3D &vhost->nvme_scrqs.scrqs[qhandle->index]; + + *handle =3D qhandle; + return 0; +} + +static void ibmvfc_nvme_delete_queue(struct nvme_fc_local_port *lport, uns= igned int qidx, + void *handle) +{ + kfree(handle); +} + static int ibmvfc_nvme_ls_req(struct nvme_fc_local_port *lport, struct nvme_fc_remote_port *rport, struct nvmefc_ls_req *ls_req) @@ -59,8 +93,8 @@ static void ibmvfc_nvme_fcp_abort(struct nvme_fc_local_po= rt *lport, static struct nvme_fc_port_template ibmvfc_nvme_fc_transport =3D { .localport_delete =3D ibmvfc_nvme_localport_delete, .remoteport_delete =3D ibmvfc_nvme_remoteport_delete, - .create_queue =3D NULL, - .delete_queue =3D NULL, + .create_queue =3D ibmvfc_nvme_create_queue, + .delete_queue =3D ibmvfc_nvme_delete_queue, .ls_req =3D ibmvfc_nvme_ls_req, .ls_abort =3D ibmvfc_nvme_ls_abort, .fcp_io =3D ibmvfc_nvme_fcp_io, diff --git a/drivers/scsi/ibmvscsi/ibmvfc-nvme.h b/drivers/scsi/ibmvscsi/ib= mvfc-nvme.h index 3aa285788795..4c6146048a6f 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-nvme.h +++ b/drivers/scsi/ibmvscsi/ibmvfc-nvme.h @@ -27,6 +27,13 @@ extern unsigned int ibmvfc_debug; struct ibmvfc_host; struct ibmvfc_target; =20 +struct ibmvfc_nvme_qhandle { + unsigned int qidx; + u16 cpu_id; + unsigned long index; + struct ibmvfc_queue *queue; +}; + int ibmvfc_nvme_register_remoteport(struct ibmvfc_target *tgt); void ibmvfc_nvme_unregister_remoteport(struct ibmvfc_target *tgt); int ibmvfc_nvme_register(struct ibmvfc_host *vhost); --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87FB535E95A; Thu, 23 Jul 2026 00:02:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764943; cv=none; b=Dh4TsEgwGSgDMu8EW+7Tpk7t9vK3NWUhp+MVlR4f4Y7A0vMv0BG8UF0uPjE9YEA9XXf5fvsZoGTuw2zO5ktDo7VE+LT1eyGIWYn/WZCKDz1h/n6cMkKqlLzxCEZbxrs+nqErqShKFaNd4hzkC5WvBBI8TUJ15LcMvjmYNZG9fRw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764943; c=relaxed/simple; bh=cZvBzWRwu6RVCObl6kSOriIWMVHJW1LyYNvbQUq6hr8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OAgv7RkJcoPwd+AvZg5hMqxs5yAC1EobLsoNnNNuE4dCeijAOr3m75K7FOvar/5rwbhhigKkmQENazIDRfjQLBOBjyfPfUbiSODPss3UCbKLLrDXruOsFLexKdeFsvDv38UTZWa7KjyLt/7rVcv+fmkiUQ3MLS2eePkiAjBWpkA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=rCgbrP0S; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="rCgbrP0S" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIBnqn704737; Thu, 23 Jul 2026 00:02:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=2JuQbKzsDYCpK4SmN ldH6JnL9Rd7p65GzDLrst72JuU=; b=rCgbrP0SaMmvovpE6O0ePauX2HkNnqP7F M2vDVZF5vIo+ieZNsBlTW3S6j8VbB11jtSNNppzv57rZZuw+96b+0qiv0wtbDuta 18JUQBD6JaQDzrEzw72odVZXr79mYaGOJo7ZqZqHJc8pFKNSamowqZiUl3u4dC0O jOW5ymW4kW1Euo/F+7sRBZnXZerePXDSJKP6KJ/40bpjn0TLicSaT5BBgzHkIq3e PhUwnwPOP0PV3JIKZMJkNmuUhpbW3Is6Ug3NIr/aagA83dY0E1JKgFiFc9/4liWC yU9twEQn3UQx0k0nIJ4XomXwgxwcNAHgSdk2cMqT7vR5Nty5kfxWw== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg7abmyny-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:16 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNnj26026459; Thu, 23 Jul 2026 00:02:16 GMT Received: from smtprelay03.dal12v.mail.ibm.com ([172.16.1.5]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4fgktq9x38-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:16 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay03.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N02FEW29884940 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:02:15 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3017E5803F; Thu, 23 Jul 2026 00:02:15 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9001D58063; Thu, 23 Jul 2026 00:02:14 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:02:14 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 29/33] ibmvfc: implement nvme-fc LS submission transport callback Date: Wed, 22 Jul 2026 17:01:45 -0700 Message-ID: <20260723000149.969416-30-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX9sG+M1Ds5iPM JwFelVJrls7+Zw/z50zniJAzEnE8b3jC6MeTGY/EtdSuzp8P5xc2IXvs7YqR6QnydrkSsAg8eBe wFXTRbdZeCZNXcjkpXcWc/fDxBt4y5pLn8wpYHLIBkx2L17CMXNT+X9rVDrx1xaAT1kLfcFUmGG xIDiO3kQiP+PeksoVqh47vg14CcbwFwIA/2gGw3gsuVk4UiHuxqnOjjQI7DlfRX0hM05Nr5baKd 8LHJcKpoUfbiVFNBdDKQc2cE85aVjBd8+5oONNh3WreOmRsmoQuUgqcgBBVQWueTkI6VF/8Rwd9 fw5d2V57ixT1812sA68Lj2Nhy+QDgDHXZExFLtWlWLxR4NbzyLiCZCM8qOe1NhAATxkgPHxu7Ho WEq9BInJUNX7huMZ2X0qT/0mS4Y0UxEygfoiEZm4X+DbzgxOGo/tLRx72OBGc388Ly1eBy+i7Vd qDAqwm08FNti7qALXcw== X-Authority-Analysis: v=2.4 cv=F7ZnsKhN c=1 sm=1 tr=0 ts=6a615a09 cx=c_pps a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=VnNF1IyMAAAA:8 a=IdS6GuFC8RQCFmc2Bu0A:9 X-Proofpoint-ORIG-GUID: nn720i-CnKSKmrqcigoovqmix4OAJGyG X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX4YmwP+qr058F qErGcu5vv8Dr5A2LqgmR0LAiuwMn+BJRQWgB81/QUWHd8HiR7W/3OqTHSUxiSIUrQeI399Xpsg7 6sIOafspOirpzfNf5bvwZzV7aCfTnPA= X-Proofpoint-GUID: nn720i-CnKSKmrqcigoovqmix4OAJGyG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 phishscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 impostorscore=0 lowpriorityscore=0 suspectscore=0 malwarescore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" NVMe FC Link Service commands are required to use the ibmvfc_passthru MAD. Initialize a pssthru mad for the target port including the DMA addresses for the FC4_LS request and response as well as the max length of each IU as provided in the nvmefc_ls_req struct. FC4_LS commands are sent via the primary CRQ. Further, store the assoc_id during a create association request as this is a required field in our vfc_cmd struct for nvme_fcp_io commands. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc-core.c | 1 + drivers/scsi/ibmvscsi/ibmvfc-nvme.c | 89 +++++++++++++++++++++++++++++ drivers/scsi/ibmvscsi/ibmvfc-nvme.h | 8 +++ drivers/scsi/ibmvscsi/ibmvfc.h | 2 + 4 files changed, 100 insertions(+) diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ib= mvfc-core.c index 206cc9508dda..45c7bcf69201 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c @@ -1633,6 +1633,7 @@ void ibmvfc_init_event(struct ibmvfc_event *evt, void (*done) (struct ibmvfc_event *), u8 format) { evt->cmnd =3D NULL; + evt->ls_req =3D NULL; evt->sync_iu =3D NULL; evt->eh_comp =3D NULL; evt->crq.format =3D format; diff --git a/drivers/scsi/ibmvscsi/ibmvfc-nvme.c b/drivers/scsi/ibmvscsi/ib= mvfc-nvme.c index ecf9f4c0549c..cf72f0682297 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-nvme.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-nvme.c @@ -62,10 +62,99 @@ static void ibmvfc_nvme_delete_queue(struct nvme_fc_loc= al_port *lport, unsigned kfree(handle); } =20 +static void ibmvfc_ls_req_done(struct ibmvfc_event *evt) +{ + struct ibmvfc_target *tgt =3D evt->tgt; + struct ibmvfc_passthru_mad *mad =3D &evt->xfer_iu->passthru; + struct fcnvme_ls_rqst_w0 *ls_rqst; + struct fcnvme_ls_cr_assoc_acc *ls_resp; + u32 status =3D be16_to_cpu(mad->common.status); + int rc =3D 0; + + ls_rqst =3D (struct fcnvme_ls_rqst_w0 *)evt->ls_req->rqstaddr; + ls_resp =3D (struct fcnvme_ls_cr_assoc_acc *)evt->ls_req->rspaddr; + + switch (status) { + case IBMVFC_MAD_SUCCESS: + tgt_dbg(tgt, "ls_req succeeded\n"); + if ((ls_rqst->ls_cmd =3D=3D FCNVME_LS_CREATE_ASSOCIATION) && + (ls_resp->hdr.w0.ls_cmd =3D=3D FCNVME_LS_ACC)) { + tgt->assoc_id =3D be64_to_cpu(ls_resp->associd.association_id); + tgt_dbg(tgt, "assoc_id 0x%llx\n", tgt->assoc_id); + } + break; + case IBMVFC_MAD_DRIVER_FAILED: + break; + case IBMVFC_MAD_FAILED: + default: + tgt_info(tgt, "ls_req failed: %s (%x:%x) rc=3D0x%02X\n", + ibmvfc_get_cmd_error(be16_to_cpu(mad->iu.status), be16_to_cpu(mad->iu.= error)), + be16_to_cpu(mad->iu.status), be16_to_cpu(mad->iu.error), status); + break; + } + + if (status) + rc =3D -EIO; + + evt->ls_req->done(evt->ls_req, rc); + + kref_put(&tgt->kref, ibmvfc_release_tgt); + ibmvfc_free_event(evt); +} + +static void ibmvfc_init_ls_req(struct ibmvfc_event *evt, struct nvmefc_ls_= req *ls_req) +{ + struct ibmvfc_passthru_mad *mad =3D &evt->iu.passthru; + + memset(mad, 0, sizeof(*mad)); + mad->common.version =3D cpu_to_be32(2); + mad->common.opcode =3D cpu_to_be32(IBMVFC_NVMF_PASSTHRU); + mad->common.length =3D cpu_to_be16(sizeof(*mad) - sizeof(mad->fc_iu) - si= zeof(mad->iu)); + mad->cmd_ioba.va =3D cpu_to_be64((u64)be64_to_cpu(evt->crq.ioba) + + offsetof(struct ibmvfc_passthru_mad, iu)); + mad->cmd_ioba.len =3D cpu_to_be32(sizeof(mad->iu)); + mad->iu.cmd_len =3D cpu_to_be32(ls_req->rqstlen); + mad->iu.rsp_len =3D cpu_to_be32(ls_req->rsplen); + mad->iu.cmd.va =3D cpu_to_be64(ls_req->rqstdma); + mad->iu.cmd.len =3D cpu_to_be32(ls_req->rqstlen); + mad->iu.rsp.va =3D cpu_to_be64(ls_req->rspdma); + mad->iu.rsp.len =3D cpu_to_be32(ls_req->rsplen); +} + static int ibmvfc_nvme_ls_req(struct nvme_fc_local_port *lport, struct nvme_fc_remote_port *rport, struct nvmefc_ls_req *ls_req) { + struct ibmvfc_host *vhost =3D lport->private; + struct ibmvfc_target *tgt =3D rport->private; + struct ibmvfc_passthru_mad *mad; + struct ibmvfc_event *evt; + + kref_get(&tgt->kref); + evt =3D ibmvfc_get_event(&vhost->crq); + if (!evt) { + kref_put(&tgt->kref, ibmvfc_release_tgt); + return -EBUSY; + } + + ibmvfc_init_event(evt, ibmvfc_ls_req_done, IBMVFC_MAD_FORMAT); + evt->tgt =3D tgt; + evt->ls_req =3D ls_req; + ls_req->private =3D evt; + + ibmvfc_init_ls_req(evt, ls_req); + mad =3D &evt->iu.passthru; + mad->iu.flags =3D cpu_to_be32(IBMVFC_FC4_LS_DSC_CTRL); + mad->iu.scsi_id =3D cpu_to_be64(tgt->scsi_id); + mad->iu.cancel_key =3D cpu_to_be32((u64)evt); + mad->iu.target_wwpn =3D cpu_to_be64(tgt->wwpn); + + ibmvfc_dbg(vhost, "nvme_ls_req\n"); + if (ibmvfc_send_event(evt, vhost, IBMVFC_FC4_LS_PLUS_CANCEL_TIMEOUT)) { + kref_put(&tgt->kref, ibmvfc_release_tgt); + return -ENXIO; + } + return 0; } =20 diff --git a/drivers/scsi/ibmvscsi/ibmvfc-nvme.h b/drivers/scsi/ibmvscsi/ib= mvfc-nvme.h index 4c6146048a6f..e245b6ed0875 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-nvme.h +++ b/drivers/scsi/ibmvscsi/ibmvfc-nvme.h @@ -14,6 +14,8 @@ #include #include #include +#include +#include =20 #include "ibmvfc.h" =20 @@ -22,10 +24,16 @@ #define IBMVFC_MAX_NVME_QUEUES 16 #define IBMVFC_NVME_CHANNELS 8 =20 +#define IBMVFC_FC4_LS_TIMEOUT 15 +#define IBMVFC_FC4_LS_CANCEL_TIMEOUT 45 +#define IBMVFC_FC4_LS_PLUS_CANCEL_TIMEOUT \ + (IBMVFC_FC4_LS_TIMEOUT + IBMVFC_FC4_LS_CANCEL_TIMEOUT) + extern unsigned int ibmvfc_debug; =20 struct ibmvfc_host; struct ibmvfc_target; +struct ibmvfc_queue; =20 struct ibmvfc_nvme_qhandle { unsigned int qidx; diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h index ece1f379c269..9f6705e604fd 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h @@ -824,6 +824,7 @@ struct ibmvfc_target { u64 scsi_id; u64 wwpn; u64 new_scsi_id; + u64 assoc_id; struct fc_rport *rport; int target_id; enum ibmvfc_target_action action; @@ -851,6 +852,7 @@ struct ibmvfc_event { struct ibmvfc_queue *queue; struct ibmvfc_target *tgt; struct scsi_cmnd *cmnd; + struct nvmefc_ls_req *ls_req; atomic_t free; atomic_t active; union ibmvfc_iu *xfer_iu; --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B82636E49B; Thu, 23 Jul 2026 00:02:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764945; cv=none; b=qrQkjznXspfGHBMlOPWGEHOvDoe5qMPREOvpwdmRrzxjTU/r8xqJB6x+g2o6rNM4IwsunvbW17F5m0rsb08vSOahlZrUr+mFbpfeIf1Ra+JqYHKeXqnP+QtbTfNJ1gBId3qx1wiO5h8zMH751buonNKbjsItDvu3xS6hI1hG/f8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764945; c=relaxed/simple; bh=5ychNfsAeWQNxMJDoxbG3xBECgdBjhPMA1Tuk4j3OS8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nC7qDBWNJ3jyalfZvw3nft5lMDcUvWc6016lV9zWWcHVRjRyt0M7chBhrJ8WQYjN/FovyFJ1H4l0px7Dia9lBH/QNuVDoIFaYpMaPzrTv2nFCqrgwO+cMXoNKXq6lgzBSNAvOxALXOP3oFnowtiI4JEN8yOvHk8HzxyY65QRRak= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=Q9WGU5Vc; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="Q9WGU5Vc" Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIBgZ53019604; Thu, 23 Jul 2026 00:02:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=k6JV8NH8ETacBIrfd fWtMMcbWNk7jeUnodTQ7QJgbF4=; b=Q9WGU5Vcbba5tXAUK1VF3TIslZh5sky8+ tv3hgO7TopX4NtEOnZz0VP+oixnjtyhLQSV13SDPFN/sIZTY8DZvDz79PhEYZ/Nm LLSQMa7BUI1BwqNPK18Ag+qDrHekWGVvmAcouch/+FfwmaMehmwA+vKV259xmIjv Nuz9zb+C3TW2p6rL1lXFFagOLwIbJ+tAXQUit11Ba5aCdMl2D68v3U6+Tijwuntc 4Vuz9B2qx8nY/LwCHIKxJmIWNtH8+2U+AY9NCp2ChZUOtmQMTE3g3XpNJ+Nk5Gq2 nOLhKmrsjzdAnQRamQM1HnbgVKFTRBxtPg/gJicBy7iBI+bhf37sQ== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg77amx6t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:18 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNndSa032298; Thu, 23 Jul 2026 00:02:17 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fgmtk1rtb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:17 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N02GiA9503370 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:02:16 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 70F835803F; Thu, 23 Jul 2026 00:02:16 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4CA485805A; Thu, 23 Jul 2026 00:02:15 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:02:15 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 30/33] ibmvfc: implement nvme-fc IO command submission callback Date: Wed, 22 Jul 2026 17:01:46 -0700 Message-ID: <20260723000149.969416-31-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: pZatUP6QgK8lGactwZRhlt4cYE_6vdx5 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX8JJRVIOx1pRZ Xr6v88qyvFL99CTDK/O9s0luYKlIfrvG/6QMjgPuNLNhzYuYhLELTcDDytEvXilK+rQRQivjnKu XW+UcElEII8qmzhG6ig9Q10KpY6MSAM= X-Proofpoint-GUID: pZatUP6QgK8lGactwZRhlt4cYE_6vdx5 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX3RDgi+W9+Cbr KXtIlLr5XdeD/aJee3D2EvHdNJAxN6Yx4n4ezW0+YyCRFbNKXMP7lCP/uBWOLnE/QegAjQEEEAj yPbXueco4P2vpi5VMwMg2ZDUmydlA0fY63eZXfokzc/YxHPxTXYobpK4zW9bHSN+c4nDjpcbNmu a4c5yO7gNsCl5hRZnk0Ktw3kbXYytixe+RQw4XS+cxJomZ2zUCJb7XkEVX2il8xzrGcVxWJCyJF IoTTv/ONQbBig74kHYIBrk15J5XgaV6d0U+lkdVvzgWQi+xXOn1BI8B5zJEC9ptYs1aVqOU0ZpX YkllEe9dANKzeu8gr+ikTi8NgfV4RKKVUfapwsNohCkRItYRLfu+JDX7AkCatMpBHfrazTT48g+ AhtCaC9RKY6hmBFSrSrbNDLiLMu0tyTmLKx+Dm4xa5MATioYNoiuvpRm1f7m6L3jPpacpSDUMzZ Fg4iiayumectfRanQzw== X-Authority-Analysis: v=2.4 cv=K7AS2SWI c=1 sm=1 tr=0 ts=6a615a0a cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=VnNF1IyMAAAA:8 a=loqB7RePtDaoI6KSv-cA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 spamscore=0 phishscore=0 malwarescore=0 adultscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" Add helpers to initialize an ibmvfc command from an nvmefc_fcp_req, map request scatterlists into either an inline descriptor or an external DMA pool list, and submit the request on the selected NVMe hardware queue. On completion, translate ibmvfc status into the NVMe-FC response format, including transferred length and CQE handling for no-DMA responses. Also store the NVMe request pointer in struct ibmvfc_event so the completion path can finish the original request. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc-core.c | 3 +- drivers/scsi/ibmvscsi/ibmvfc-nvme.c | 140 +++++++++++++++++++++++++++- drivers/scsi/ibmvscsi/ibmvfc.h | 1 + 3 files changed, 142 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ib= mvfc-core.c index 45c7bcf69201..bc975f632da2 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c @@ -1539,7 +1539,7 @@ static void ibmvfc_set_login_info(struct ibmvfc_host = *vhost) =20 login_info->ostype =3D cpu_to_be32(IBMVFC_OS_LINUX); login_info->max_dma_len =3D cpu_to_be64(max_sectors << 9); - login_info->max_payload =3D cpu_to_be32(sizeof(struct ibmvfc_fcp_cmd_iu)); + login_info->max_payload =3D cpu_to_be32(sizeof(struct nvme_fc_cmd_iu)); login_info->max_response =3D cpu_to_be32(sizeof(struct ibmvfc_fcp_rsp)); login_info->partition_num =3D cpu_to_be32(vhost->partition_number); login_info->vfc_frame_version =3D cpu_to_be32(1); @@ -1633,6 +1633,7 @@ void ibmvfc_init_event(struct ibmvfc_event *evt, void (*done) (struct ibmvfc_event *), u8 format) { evt->cmnd =3D NULL; + evt->fcp_req =3D NULL; evt->ls_req =3D NULL; evt->sync_iu =3D NULL; evt->eh_comp =3D NULL; diff --git a/drivers/scsi/ibmvscsi/ibmvfc-nvme.c b/drivers/scsi/ibmvscsi/ib= mvfc-nvme.c index cf72f0682297..d31e7e9ea7a9 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-nvme.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-nvme.c @@ -8,6 +8,7 @@ * Copyright (C) IBM Corporation, 2026 */ =20 +#include #include =20 #include "ibmvfc-nvme.h" @@ -164,12 +165,149 @@ static void ibmvfc_nvme_ls_abort(struct nvme_fc_loca= l_port *lport, { } =20 +static void ibmvfc_nvme_done(struct ibmvfc_event *evt) +{ + struct ibmvfc_cmd *vfc_cmd =3D &evt->xfer_iu->cmd; + struct nvmefc_fcp_req *fcp_req =3D evt->fcp_req; + struct nvme_fc_ersp_iu *ersp =3D (struct nvme_fc_ersp_iu *)fcp_req->rspad= dr; + struct nvme_completion *cqe =3D &ersp->cqe; + struct nvme_command *sqe =3D &((struct nvme_fc_cmd_iu *)fcp_req->cmdaddr)= ->sqe; + + ibmvfc_dbg(evt->vhost, "fc_done: (%x:%x)\n", be16_to_cpu(vfc_cmd->status), + be16_to_cpu(vfc_cmd->error)); + ibmvfc_dbg(evt->vhost, "fc_done: cmdlen: %d, rsplen %d, payload_len %d\n", + fcp_req->cmdlen, fcp_req->rsplen, fcp_req->payload_length); + + fcp_req->status =3D 0; + if (!vfc_cmd->status) { + fcp_req->rcv_rsplen =3D NVME_FC_SIZEOF_ZEROS_RSP; + fcp_req->transferred_length =3D fcp_req->payload_length; + } else if (be16_to_cpu(vfc_cmd->status) & IBMVFC_FC_NVME_STATUS) { + fcp_req->rcv_rsplen =3D sizeof(struct nvme_fc_ersp_iu); + fcp_req->transferred_length =3D be32_to_cpu(ersp->xfrd_len); + if (be16_to_cpu(vfc_cmd->error) & IBMVFC_NVMS_VALID_NODMA_CQE) + cqe->command_id =3D sqe->common.command_id; + } else { + fcp_req->rcv_rsplen =3D 0; + fcp_req->transferred_length =3D 0; + fcp_req->status =3D NVME_SC_INTERNAL; + } + + fcp_req->done(fcp_req); + ibmvfc_free_event(evt); +} + +static struct ibmvfc_cmd *ibmvfc_nvme_init_vfc_cmd(struct ibmvfc_event *ev= t, + struct nvme_fc_remote_port *rport, + struct nvmefc_fcp_req *fcp_req) +{ + struct ibmvfc_target *tgt =3D rport->private; + struct ibmvfc_cmd *vfc_cmd =3D &evt->iu.cmd; + + memset(vfc_cmd, 0, sizeof(*vfc_cmd)); + + vfc_cmd->resp.va =3D cpu_to_be64(fcp_req->rspdma); + vfc_cmd->resp.len =3D cpu_to_be32(fcp_req->rsplen); + vfc_cmd->frame_type =3D cpu_to_be32(IBMVFC_NVME_FCP_TYPE); + vfc_cmd->flags |=3D cpu_to_be16(IBMVFC_NVMEOF_PROTOCOL); + vfc_cmd->payload_len =3D cpu_to_be32(fcp_req->cmdlen); + vfc_cmd->resp_len =3D cpu_to_be32(fcp_req->rsplen); + vfc_cmd->cancel_key =3D cpu_to_be32((u64)evt); + vfc_cmd->target_wwpn =3D cpu_to_be64(rport->port_name); + vfc_cmd->tgt_scsi_id =3D cpu_to_be64(rport->port_id); + vfc_cmd->assoc_id =3D cpu_to_be64(tgt->assoc_id); + + memcpy(&vfc_cmd->v3nvme.iu, fcp_req->cmdaddr, fcp_req->cmdlen); + + return vfc_cmd; +} + +static void ibmvfc_nvme_map_sg_list(struct nvmefc_fcp_req *fcp_req, + struct srp_direct_buf *md) +{ + int i; + struct scatterlist *sg; + + for_each_sg(fcp_req->first_sgl, sg, fcp_req->sg_cnt, i) { + md[i].va =3D cpu_to_be64(sg_dma_address(sg)); + md[i].len =3D cpu_to_be32(sg_dma_len(sg)); + md[i].key =3D 0; + } +} + +static int ibmvfc_nvme_map_sg_data(struct nvmefc_fcp_req *fcp_req, + struct ibmvfc_event *evt, + struct ibmvfc_cmd *vfc_cmd) +{ + struct srp_direct_buf *data =3D &vfc_cmd->ioba; + struct ibmvfc_host *vhost =3D evt->vhost; + + if (!fcp_req->sg_cnt) { + vfc_cmd->flags |=3D cpu_to_be16(IBMVFC_NO_MEM_DESC); + return 0; + } + + if (fcp_req->io_dir =3D=3D NVMEFC_FCP_WRITE) + vfc_cmd->flags |=3D cpu_to_be16(IBMVFC_WRITE); + else + vfc_cmd->flags |=3D cpu_to_be16(IBMVFC_READ); + + if (fcp_req->sg_cnt =3D=3D 1) { + ibmvfc_nvme_map_sg_list(fcp_req, data); + return 0; + } + + vfc_cmd->flags |=3D cpu_to_be16(IBMVFC_SCATTERLIST); + + if (!evt->ext_list) { + evt->ext_list =3D dma_pool_alloc(vhost->sg_pool, GFP_ATOMIC, + &evt->ext_list_token); + + if (!evt->ext_list) + return -ENOMEM; + } + + ibmvfc_nvme_map_sg_list(fcp_req, evt->ext_list); + + data->va =3D cpu_to_be64(evt->ext_list_token); + data->len =3D cpu_to_be32(fcp_req->sg_cnt * sizeof(struct srp_direct_buf)= ); + data->key =3D 0; + return 0; +} + static int ibmvfc_nvme_fcp_io(struct nvme_fc_local_port *lport, struct nvme_fc_remote_port *rport, void *hw_queue_handle, struct nvmefc_fcp_req *fcp_req) { - return 0; + struct ibmvfc_host *vhost =3D lport->private; + struct ibmvfc_nvme_qhandle *qhandle =3D hw_queue_handle; + struct ibmvfc_cmd *vfc_cmd; + struct ibmvfc_event *evt; + int rc; + + ibmvfc_dbg(vhost, "nvme_fcp_io\n"); + evt =3D ibmvfc_get_event(qhandle->queue); + if (!evt) + return -EBUSY; + + evt->hwq =3D qhandle->index; + ibmvfc_dbg(vhost, "vfc-nvme-mq-%d\n", evt->hwq); + + ibmvfc_init_event(evt, ibmvfc_nvme_done, IBMVFC_CMD_FORMAT); + evt->fcp_req =3D fcp_req; + fcp_req->private =3D evt; + + vfc_cmd =3D ibmvfc_nvme_init_vfc_cmd(evt, rport, fcp_req); + + vfc_cmd->correlation =3D cpu_to_be64((u64)evt); + + if (likely(!(rc =3D ibmvfc_nvme_map_sg_data(fcp_req, evt, vfc_cmd)))) + return ibmvfc_send_event(evt, vhost, 0); + + ibmvfc_free_event(evt); + + return rc; } =20 static void ibmvfc_nvme_fcp_abort(struct nvme_fc_local_port *lport, diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h index 9f6705e604fd..ca80ceffe53a 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h @@ -853,6 +853,7 @@ struct ibmvfc_event { struct ibmvfc_target *tgt; struct scsi_cmnd *cmnd; struct nvmefc_ls_req *ls_req; + struct nvmefc_fcp_req *fcp_req; atomic_t free; atomic_t active; union ibmvfc_iu *xfer_iu; --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3FCC5379C40; Thu, 23 Jul 2026 00:02:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764945; cv=none; b=gEJCF3ba/zK0bwMvJXKkQZFvTk0A18CQ4+7gmxqMYah21L1uOFdFX3Bhn7v8n8NDrTVwgEKbyFBBgFuHWU87M+dgXJrhNSZynBFGG47BVmDaPrL5WUKHg2mvvqv3kpZWj6IMYm53JsfapSsJ36kfHfeekr9T/QSKLFlPIX2OuT4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764945; c=relaxed/simple; bh=SsrsDiEFpNrW7OsO70Sb3h0EtB9O4E9dFG9ACq6dWos=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XpeulfhxgKxu66YmcLcyRWzrN3a4j74uEr5WFK1mmCdjZeQiIRDnr8CEReODTAasejy9R5CuFEuM+pxMqwcXKsHhaedo5Q0zxvMKDtlJtsxYpZIV+Vl6Odsl3Y1B/y7Q0dGfFUnR1zTbL15ep/YjeTjkf3DuqC3/veQZBzLuHdY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=TjzKHnYd; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="TjzKHnYd" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIBwbC713588; Thu, 23 Jul 2026 00:02:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=prYcbuWCVd6ViwbzA vLmQBGVfQ93OQI+gDSd9Mn/J8o=; b=TjzKHnYds4M/AiLD5z0GK6bh00ycuGiK/ J6877zozRSJcv2J6GYMHs3YVsonkIXsI+X851+6lo36WfM/kfEVXSKyt/Ah3bHiE +DSycPnJMygHIYzFpvCAZ8pKXVGfSjq52W70ZXpDDrLGDcKa/tzx2m2NgUj9W/xe Z0RT3IbEBoG7JD8kcnkeGYAUZsC2wNlvh0GriF93nOMT+/4h+SKrgH0XVw56ftq1 iXb1HA7aN8xdr6tJPksmaGv6dwIJXsTPjqQWKYQaCf1lqXuyFoyUmAq8QOFA4kR3 lDcvRKa0k6colz1V5hiTDc1muLObWS6k1OhVHQ1K0/z1otAOpuaWA== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg7ahcctu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:18 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNnhbo021767; Thu, 23 Jul 2026 00:02:18 GMT Received: from smtprelay05.dal12v.mail.ibm.com ([172.16.1.7]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fgm6w9ukn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:18 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay05.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N02H2Q15139448 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:02:17 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3699658060; Thu, 23 Jul 2026 00:02:17 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8ED2158056; Thu, 23 Jul 2026 00:02:16 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:02:16 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 31/33] ibmvfc: implement nvme-fc LS abort handling callback Date: Wed, 22 Jul 2026 17:01:47 -0700 Message-ID: <20260723000149.969416-32-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: dMgBv_ffQzlj--f7jnjHDWEfNGPUAYOK X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX3DvrZ+0qbzy1 WrKfnNau+wtJUS1qw4PRY2AEtw1Xr9JkCdZm+oW0MzQXAtB7s3ruyj5VrJtZpa71VabRunCLlBt T8IvkOTfa9Ml74XMkyEtZA35pLvAL1Rmim1JI8m+37yplmGiLPUavPlRERPMn/6l5Qjx1ppDBr2 2OBIMaY2K7PWWAnjwOmh+Bph657HSvxRMQL2VgGSyf1lxDrwim0PjnJ5inXpuVVCTvxYUG1+zi6 EJcupr0p+kYGeGYoApjK1GENhiYWiXUm95Dxy8AEe4Obs8pO9veqAbnJVXXjYKijScfgv+m86Ly 0ygQ40IKiCxb/dBY/IzHBxgH0r5xoDU6bQFqIZR/Klu9s9OwUaSEKzme79Sn+o07LWu29FKDcCb JGymOoOpCGg66x5U0OXMlx/XJsrZOCP5ywcyTezwWp/TICDZ232D+vPy58cgQ2ehx1VL4VJ+xoZ tUbLrt9RuMiepdmr98w== X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX2RDDTAEy01hw qn/S/IAWvFJXQjKGY0Xz7ihvA1Ozzscif7qxMQRmVB5Wa00p+Y9Qj6HGCSdaaiGFEpQTslrHl2g vK3mmtVpKqHh18jm6oqRWaNQuFxCESI= X-Proofpoint-GUID: dMgBv_ffQzlj--f7jnjHDWEfNGPUAYOK X-Authority-Analysis: v=2.4 cv=SM5ykuvH c=1 sm=1 tr=0 ts=6a615a0b cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=VnNF1IyMAAAA:8 a=i_vXdmPKhaR3-41kbpgA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 lowpriorityscore=0 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 priorityscore=1501 phishscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" Implement the NVMe FC-LS abort callback by issuing an ibmvfc cancel MAD to the VIOS for the outstanding link-service request. Use the saved event pointer from the original FC-LS request to identify the command to cancel, submit the cancel operation, and complete the abort request based on the returned status. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc-nvme.c | 64 +++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/drivers/scsi/ibmvscsi/ibmvfc-nvme.c b/drivers/scsi/ibmvscsi/ib= mvfc-nvme.c index d31e7e9ea7a9..390410e44f0d 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-nvme.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-nvme.c @@ -13,6 +13,8 @@ =20 #include "ibmvfc-nvme.h" =20 +static unsigned int default_timeout =3D IBMVFC_DEFAULT_TIMEOUT; + static void ibmvfc_nvme_localport_delete(struct nvme_fc_local_port *lport) { struct ibmvfc_host *vhost =3D lport->private; @@ -159,10 +161,72 @@ static int ibmvfc_nvme_ls_req(struct nvme_fc_local_po= rt *lport, return 0; } =20 +static void ibmvfc_sync_nvme_completion(struct ibmvfc_event *evt) +{ + /* copy the response back */ + if (evt->sync_iu) + *evt->sync_iu =3D *evt->xfer_iu; + + complete(&evt->comp); +} + +static void ibmvfc_init_ls_abort(struct ibmvfc_event *evt, struct nvmefc_l= s_req *ls_abort) +{ + struct ibmvfc_tmf *tmf; + struct ibmvfc_event *abt_evt =3D ls_abort->private; + struct ibmvfc_target *tgt =3D abt_evt->tgt; + struct ibmvfc_host *vhost =3D evt->vhost; + + tmf =3D &evt->iu.tmf; + memset(tmf, 0, sizeof(*tmf)); + tmf->common.version =3D cpu_to_be32(2); + tmf->target_wwpn =3D cpu_to_be64(tgt->wwpn); + tmf->common.opcode =3D cpu_to_be32(IBMVFC_NVMF_TMF_MAD); + tmf->common.length =3D cpu_to_be16(sizeof(*tmf)); + if (vhost->state !=3D IBMVFC_ACTIVE) + if (!ibmvfc_check_caps(vhost, IBMVFC_CAN_SUPPRESS_ABTS)) + tmf->flags =3D cpu_to_be32(IBMVFC_TMF_SUPPRESS_ABTS); + tmf->cancel_key =3D cpu_to_be32((u64)abt_evt); + tmf->my_cancel_key =3D cpu_to_be32((u64)evt); + tmf->assoc_id =3D cpu_to_be64(tgt->assoc_id); + + init_completion(&evt->comp); +} + static void ibmvfc_nvme_ls_abort(struct nvme_fc_local_port *lport, struct nvme_fc_remote_port *rport, struct nvmefc_ls_req *ls_abort) { + struct ibmvfc_host *vhost =3D lport->private; + struct ibmvfc_target *tgt =3D rport->private; + struct ibmvfc_event *evt; + union ibmvfc_iu rsp; + unsigned long flags; + u16 status; + + evt =3D ibmvfc_get_event(&vhost->crq); + if (!vhost->logged_in || !evt) + return; + + spin_lock_irqsave(vhost->host->host_lock, flags); + kref_get(&tgt->kref); + ibmvfc_init_event(evt, ibmvfc_sync_nvme_completion, IBMVFC_MAD_FORMAT); + ibmvfc_init_ls_abort(evt, ls_abort); + evt->sync_iu =3D &rsp; + + if (ibmvfc_send_event(evt, vhost, default_timeout)) + goto out; + + spin_unlock_irqrestore(vhost->host->host_lock, flags); + + wait_for_completion(&evt->comp); + status =3D be16_to_cpu(rsp.mad_common.status); + spin_lock_irqsave(vhost->host->host_lock, flags); + ibmvfc_free_event(evt); +out: + spin_unlock_irqrestore(vhost->host->host_lock, flags); + ibmvfc_dbg(vhost, "ls_abort: cancel failed with rc=3D%x\n", status); + kref_put(&tgt->kref, ibmvfc_release_tgt); } =20 static void ibmvfc_nvme_done(struct ibmvfc_event *evt) --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7F49F37FF41; Thu, 23 Jul 2026 00:02:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764949; cv=none; b=rJDFe/Q7Yo9Mu6Hb7w+iX8WFyP02zP4lSEjl5zW14pLlQ7zvszJd6sZ5xHPNHP1EEcHVldHpMBmAYw6V8lZ8i9wSlWujoGe0xkAT4E2jeWxoVI28GNgmLFbty/Cd95VplK/cXSRuwgZicLxxLa9dpupK1RwMKD8CIz5JfCXisX8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764949; c=relaxed/simple; bh=uSYSPbL6JdcuWj8Ov5+JJOV1Zv4ZRSjjD/9U2BMFKGw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CvSuvgPRoN5KV5WsdkxWUZtPHbMOFjWnQYOMKqWgz2udW6nVFf9UQXP7HUv6br6oefH9xJM7d1aZnZhgCxPGAh7/tlDoVrOoPHK4RVELb0Ul4P3etsBSCE6FuPy0pyyVqloXSmTWwb+UJC3NXJzfhFun1O1JfCxga1S45Z0v3/4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=hidsOZGN; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="hidsOZGN" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIC0gr713614; Thu, 23 Jul 2026 00:02:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=q3PyX5uAvJzWDGOZD K/aFRn8uHaaymV9uPnomy/8vsY=; b=hidsOZGNZ8GxihaHEwxvaK88+1GbnhCzG F/du/tBy7aeHGQzgJQq9jPN9d1PHUyd9DVZXUJOfWytIVGC/UbJW3hAuJ5Iy3QUr OrTILZwCluvkUdUhS1WlA0o+J+FabZ4TUADIjITdPO+SfVNuzzJX3H5SUxhNgfPf 3eercrMWDDD47b7L8xLQpJKZdvg0os/OXGKETvqNYF6PDU2bc7cUnMpZ9/6w0UKe hLK+HnYjeilTOcplMwXuDvkOWpGab8f9KOg3Rz1neXX05cJlIPzoe1JQvC3+g5m/ jbMFpUgie83Cyid07di9EK7CTX9ddiSfjnpCdUdHSdIo+sBII7Adw== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg7ahcctx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:20 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNndSa009395; Thu, 23 Jul 2026 00:02:20 GMT Received: from smtprelay03.wdc07v.mail.ibm.com ([172.16.1.70]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4fgp1ghjbj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:19 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay03.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N01gSw31457860 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:01:42 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 03F1C5805A; Thu, 23 Jul 2026 00:02:18 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 552C058056; Thu, 23 Jul 2026 00:02:17 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:02:17 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 32/33] ibmvfc: implement nvme-fc FCP abort callback Date: Wed, 22 Jul 2026 17:01:48 -0700 Message-ID: <20260723000149.969416-33-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: DSUnyEVP1h1HGt9hAEZp0povFfXn-FyI X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX+yBbmpD78ZFo ePSFegKI4qBTTo8XXPPiHXdSMwYEHbXdpsrcM2YpKZfepr1pJ2I24ys34NjdRu4OlHyyQq4XGWw L7bvJoRu0ZS15ImktB4EPVYkwSRtNeS1HNxBt6VMeogiN1NCttw3csEJ5seWna6NLb5zvamrMHX ZDO1UAu/BzYrBIfwPzVhFMtUToN5eLumWyiwqe924VN650+06dcf+QsO7Oazcn7gchVsCXHYFQI zl5EmQQH5CrtoHbQTdrUNgHr0XpcZVUFxw15baxhHac6Cih3BqRcWKpa8tJUqMe5jwdhLrQvUXc UHR6jglpYdGLCm7ayacgiwp3IDl7RchKbIDw1c47+NWS8iVid9lPbbRmbqsEr6c5dpaC3626nqP 0tAIKb6i56P4CK810Ni0vhfbkdoHmDpBRYwRjbfYhjza8zXzwKz+JXt5pAMnna5SiF+QeKA+XNN E0nl182w5rBdb/du43Q== X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfXywbt0N60JQXt HmPiQD4+zETWcMPxfUMpt15r2p52uOd034328W6pyFQNKouiYV4f4KAOeIybhyQH3LtSP5Pwx1P WibXB4M4LNIoKUsWxufWFjai1BjMJs0= X-Proofpoint-GUID: DSUnyEVP1h1HGt9hAEZp0povFfXn-FyI X-Authority-Analysis: v=2.4 cv=SM5ykuvH c=1 sm=1 tr=0 ts=6a615a0c cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=VnNF1IyMAAAA:8 a=W5rK7oR1aN-uH6BT3QgA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 lowpriorityscore=0 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 priorityscore=1501 phishscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" Implement the NVMe-FC FCP abort callback by issuing an NVMF cancel MAD on the same submission queue used by the original FCP request. Use the original request event stored in abort_req->private to recover the associated ibmvfc queue, then allocate a new event from that queue so the cancel is sent on the matching nvme_scrq. Factor the TMF setup into a dedicated helper, mirroring the LS abort path, and populate the cancel key, task tag, target WWPN, and association ID needed for the VIOS NVMF abort request. The abort path sends the cancel synchronously, waits for completion, frees the temporary event, and logs non-zero MAD status values for debugging. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc-nvme.c | 64 +++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/drivers/scsi/ibmvscsi/ibmvfc-nvme.c b/drivers/scsi/ibmvscsi/ib= mvfc-nvme.c index 390410e44f0d..54f80b6265d4 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-nvme.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-nvme.c @@ -374,11 +374,75 @@ static int ibmvfc_nvme_fcp_io(struct nvme_fc_local_po= rt *lport, return rc; } =20 +static void ibmvfc_init_fcp_abort(struct ibmvfc_event *evt, + struct nvmefc_fcp_req *abort_req) +{ + struct ibmvfc_tmf *tmf; + struct ibmvfc_event *abt_evt =3D abort_req->private; + struct ibmvfc_target *tgt =3D abt_evt->tgt; + + tmf =3D &evt->iu.tmf; + memset(tmf, 0, sizeof(*tmf)); + tmf->common.version =3D cpu_to_be32(2); + tmf->common.opcode =3D cpu_to_be32(IBMVFC_NVMF_TMF_MAD); + tmf->common.length =3D cpu_to_be16(sizeof(*tmf)); + tmf->flags =3D cpu_to_be32(IBMVFC_TMF_ABORT_TASK | IBMVFC_TMF_NVMF_ASSOC); + tmf->cancel_key =3D cpu_to_be32((u64)abt_evt); + tmf->my_cancel_key =3D cpu_to_be32((u64)evt); + tmf->target_wwpn =3D cpu_to_be64(tgt->wwpn); + tmf->assoc_id =3D cpu_to_be64(tgt->assoc_id); + tmf->task_tag =3D cpu_to_be64((u64)abt_evt); + + init_completion(&evt->comp); +} + static void ibmvfc_nvme_fcp_abort(struct nvme_fc_local_port *lport, struct nvme_fc_remote_port *rport, void *hw_queue_handle, struct nvmefc_fcp_req *abort_req) { + struct ibmvfc_host *vhost =3D lport->private; + struct ibmvfc_target *tgt =3D rport->private; + struct ibmvfc_event *evt, *abt_evt =3D abort_req->private; + struct ibmvfc_queue *queue; + union ibmvfc_iu rsp; + unsigned long flags; + u16 status =3D 0; + + if (!abt_evt) + return; + + queue =3D abt_evt->queue; + if (!vhost->logged_in || !queue) + return; + + evt =3D ibmvfc_get_event(queue); + if (!evt) + return; + + spin_lock_irqsave(queue->q_lock, flags); + kref_get(&tgt->kref); + ibmvfc_init_event(evt, ibmvfc_sync_nvme_completion, IBMVFC_MAD_FORMAT); + ibmvfc_init_fcp_abort(evt, abort_req); + evt->sync_iu =3D &rsp; + + if (ibmvfc_send_event(evt, vhost, default_timeout)) + goto out; + + spin_unlock_irqrestore(queue->q_lock, flags); + + wait_for_completion(&evt->comp); + status =3D be16_to_cpu(rsp.mad_common.status); + + spin_lock_irqsave(queue->q_lock, flags); + ibmvfc_free_event(evt); +out: + spin_unlock_irqrestore(queue->q_lock, flags); + + if (status) + ibmvfc_dbg(vhost, "fcp_abort: cancel failed with rc=3D%x\n", status); + + kref_put(&tgt->kref, ibmvfc_release_tgt); } =20 static struct nvme_fc_port_template ibmvfc_nvme_fc_transport =3D { --=20 2.55.0 From nobody Fri Jul 24 22:17:37 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E426026ED25; Thu, 23 Jul 2026 00:02:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764947; cv=none; b=ZwjbwcjJlBSsERERarU8vxEsxNUY8jVrWHeqZBxN2+BnkVO/WqK+31yEC6G0kPDSc9pzDGBKt4Qo6wi2aaQtXOiUhXCNr3OxwJJU7eJUlYFDfpExK3WLw8JXFF5Vkco1ojfi7khr2yLeL8Sf9oaQjpTKR4FANxlj/DKQkp4Jo+4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784764947; c=relaxed/simple; bh=acQYF4qaf4H7LHUEvsFSbT6/N9eK1iJt8ArROCisMVY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gdmkxjq3EJpHBWSSxojlypugoaKn5vZytai9ouYkCcTtTynqMMYIu0ifmKlYl42V14i8SiGUHEy/BZdQTI6WbGbEzyuyihDkcqY7piGEyV/9cPPG00RxRjh47l7q6rZ+i51DIPjbPGDHCvBYK1e580OZ6mXtIFSlwPEAFw27JEM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=DZaVJkTU; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="DZaVJkTU" Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MIBfqw712606; Thu, 23 Jul 2026 00:02:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=QQ3rNVg8Gcs7rw+vU VkAKVQPrg9N5i+HUlWECM2IyQM=; b=DZaVJkTUqRTcVSDyKhsov3duY7qboyYN9 +nAy25FJrTW54ybVS0HhPSRrD0//fCieL6MiPPXsnRJdzm2BCwpIfclDykUIoFs5 XzQ9+mvnLMPwpTGyS3ccthnSolULsu23y83Fp8xOVwgzEBSv8fm4FdniUGuEnnxx C6CMWA6zXC7dw3aWq0LIKTlBLX0uEAlVCwrcfPrrMZg4hakh5274SgRNU40Jjkw5 aeSqEUIqTXtYvyjaxtPA8SJDj/zuc/qx/fm2uXZrQ6I1g6g+U6oJwkaWuSDKIsd/ eOSCXm1jh9A9QK79DDScd6hXkUC50y+JzQ+JXkLkN5WsnQmTbDY1Q== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fg7914xqs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:21 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MNnaRZ028164; Thu, 23 Jul 2026 00:02:20 GMT Received: from smtprelay03.wdc07v.mail.ibm.com ([172.16.1.70]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fgnah9q45-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jul 2026 00:02:20 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay03.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66N01hiP14549616 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jul 2026 00:01:43 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BD1B958064; Thu, 23 Jul 2026 00:02:18 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 216A758056; Thu, 23 Jul 2026 00:02:18 +0000 (GMT) Received: from li-4c4c4544-0054-3910-8039-c3c04f423534.ibm.com.com (unknown [9.61.118.58]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jul 2026 00:02:18 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, davemarq@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v2 33/33] ibmvfc: fail nvme-fc fcp-io and ls requests during transport reset Date: Wed, 22 Jul 2026 17:01:49 -0700 Message-ID: <20260723000149.969416-34-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723000149.969416-1-tyreld@linux.ibm.com> References: <20260723000149.969416-1-tyreld@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: z21QWmp31PYg_xOKxL8F-T6pXfOBLwl1 X-Authority-Analysis: v=2.4 cv=V6RNF+ni c=1 sm=1 tr=0 ts=6a615a0d cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=U7nrCbtTmkRpXpFmAIza:22 a=VnNF1IyMAAAA:8 a=7NqNYta9-qcfpvjv1bIA:9 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX1pHfEmUW4Gi9 qmjAXJygvtMcurDbySvblE99HCeUziRlKq2Wf3dqHN443WhYaFnqV3NGjD92SmmFVduUCdxHufk E3K6PhIZLMJdib7yPGi7w2tOyBimcbY= X-Proofpoint-GUID: z21QWmp31PYg_xOKxL8F-T6pXfOBLwl1 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzNCBTYWx0ZWRfX1PaBw1FPOF39 8xa08vwaHtCrdg5IliSQ8C+fb9UZVCv7hyqJh3ZGeTie50ow+8UTc7tXeMUoKoJxODr/UuDMRx5 OsBDOdJEFA3V+UsdsLompZDPuKhH/4Q09mUQdIE0OvWf2OCe/LQlhGSd3z1XH2vo+CukNKSKi3Q tRp17Hj8iDMme6zUKPecJPWJOyg84Fil98vy4GoaA29aib+7NDG+OSBeALG7nIrqGot/7YDJow0 E8lJN52BoUgcxxkWl3A5SFIDHIemlZr9ss2PDXVtT++nqp8m3z1dMvVmFpG66aBbXsMO0TTVtRw aR165wXKKMqIjM6bWPDV9GbNl4GnAB1n+IR5aMjKk+sallBdbH+R7Mmu8aZZ+4lBKvsalUQTFhO HS+o7p2b7Tg4TEwKcr1tOTQcd9EtSB3Y6iMKG4usCSql//yfdcUZIBSE2uMoKTGHNPZdlQxOedn Hf6asMq2oWz9u0C2uKw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 adultscore=0 bulkscore=0 lowpriorityscore=0 clxscore=1015 spamscore=0 impostorscore=0 phishscore=0 priorityscore=1501 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220234 Content-Type: text/plain; charset="utf-8" The current purge code for flushing outstanding commands during a transport reset only deals with SCSI commands. Rename the ibmvfc_scsi_eh_done completion handler to ibmvfc_vfc_eh_done and wire it to correctly complete nvme fcp and ls commands when flushing the inflight command list during a reset. Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc-core.c | 63 ++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ib= mvfc-core.c index bc975f632da2..dfa231b6cc47 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c @@ -1092,19 +1092,29 @@ void ibmvfc_free_event(struct ibmvfc_event *evt) } =20 /** - * ibmvfc_scsi_eh_done - EH done function for queuecommand commands + * ibmvfc_vfc_eh_done - EH done function for queued IO * @evt: ibmvfc event struct * - * This function does not setup any error status, that must be done - * before this function gets called. + * This function does not setup any error status for scsi commands, that m= ust be + * done before this function gets called. **/ -static void ibmvfc_scsi_eh_done(struct ibmvfc_event *evt) +static void ibmvfc_vfc_eh_done(struct ibmvfc_event *evt) { struct scsi_cmnd *cmnd =3D evt->cmnd; + struct nvmefc_ls_req *ls_req =3D evt->ls_req; + struct nvmefc_fcp_req *fcp_req =3D evt->fcp_req; =20 if (cmnd) { scsi_dma_unmap(cmnd); scsi_done(cmnd); + } else if (fcp_req) { + fcp_req->rcv_rsplen =3D 0; + fcp_req->transferred_length =3D 0; + fcp_req->status =3D NVME_SC_INTERNAL; + fcp_req->done(fcp_req); + } else if (ls_req) { + ls_req->done(ls_req, -EIO); + kref_put(&evt->tgt->kref, ibmvfc_release_tgt); } =20 ibmvfc_free_event(evt); @@ -1146,8 +1156,10 @@ static void ibmvfc_fail_request(struct ibmvfc_event = *evt, int error_code) BUG_ON(!atomic_dec_and_test(&evt->active)); if (evt->cmnd) { evt->cmnd->result =3D (error_code << 16); - evt->done =3D ibmvfc_scsi_eh_done; - } else + evt->done =3D ibmvfc_vfc_eh_done; + } else if (evt->fcp_req || evt->ls_req) + evt->done =3D ibmvfc_vfc_eh_done; + else evt->xfer_iu->mad_common.status =3D cpu_to_be16(IBMVFC_MAD_DRIVER_FAILED= ); =20 timer_delete(&evt->timer); @@ -1164,13 +1176,16 @@ static void ibmvfc_fail_request(struct ibmvfc_event= *evt, int error_code) static void ibmvfc_purge_requests(struct ibmvfc_host *vhost, int error_cod= e) { struct ibmvfc_event *evt, *pos; - struct ibmvfc_queue *queues =3D vhost->scsi_scrqs.scrqs; + struct ibmvfc_queue *scsi_q =3D vhost->scsi_scrqs.scrqs; + struct ibmvfc_queue *nvme_q =3D vhost->nvme_scrqs.scrqs; unsigned long flags; - int hwqs =3D 0; + int shwqs, nhwqs =3D 0; int i; =20 - if (vhost->using_channels) - hwqs =3D vhost->scsi_scrqs.active_queues; + if (vhost->using_channels) { + shwqs =3D vhost->scsi_scrqs.active_queues; + nhwqs =3D vhost->nvme_scrqs.active_queues; + } =20 ibmvfc_dbg(vhost, "Purging all requests\n"); spin_lock_irqsave(&vhost->crq.l_lock, flags); @@ -1179,14 +1194,24 @@ static void ibmvfc_purge_requests(struct ibmvfc_hos= t *vhost, int error_code) list_splice_init(&vhost->crq.sent, &vhost->purge); spin_unlock_irqrestore(&vhost->crq.l_lock, flags); =20 - for (i =3D 0; i < hwqs; i++) { - spin_lock_irqsave(queues[i].q_lock, flags); - spin_lock(&queues[i].l_lock); - list_for_each_entry_safe(evt, pos, &queues[i].sent, queue_list) + for (i =3D 0; i < shwqs; i++) { + spin_lock_irqsave(scsi_q[i].q_lock, flags); + spin_lock(&scsi_q[i].l_lock); + list_for_each_entry_safe(evt, pos, &scsi_q[i].sent, queue_list) ibmvfc_fail_request(evt, error_code); - list_splice_init(&queues[i].sent, &vhost->purge); - spin_unlock(&queues[i].l_lock); - spin_unlock_irqrestore(queues[i].q_lock, flags); + list_splice_init(&scsi_q[i].sent, &vhost->purge); + spin_unlock(&scsi_q[i].l_lock); + spin_unlock_irqrestore(scsi_q[i].q_lock, flags); + } + + for (i =3D 0; i < nhwqs; i++) { + spin_lock_irqsave(nvme_q[i].q_lock, flags); + spin_lock(&nvme_q[i].l_lock); + list_for_each_entry_safe(evt, pos, &nvme_q[i].sent, queue_list) + ibmvfc_fail_request(evt, error_code); + list_splice_init(&nvme_q[i].sent, &vhost->purge); + spin_unlock(&nvme_q[i].l_lock); + spin_unlock_irqrestore(nvme_q[i].q_lock, flags); } } =20 @@ -1818,7 +1843,9 @@ int ibmvfc_send_event(struct ibmvfc_event *evt, dev_err(vhost->dev, "Send error (rc=3D%d)\n", rc); if (evt->cmnd) { evt->cmnd->result =3D DID_ERROR << 16; - evt->done =3D ibmvfc_scsi_eh_done; + evt->done =3D ibmvfc_vfc_eh_done; + } else if (evt->fcp_req || evt->ls_req) { + evt->done =3D ibmvfc_vfc_eh_done; } else { evt->xfer_iu->mad_common.status =3D cpu_to_be16(IBMVFC_MAD_CRQ_ERROR); evt->done =3D evt->_done; --=20 2.55.0