From nobody Tue Jul 16 20:08:14 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WNqrH0gXwz5Q8Qm; Tue, 16 Jul 2024 20:08:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WNqrH05Ppz470b; Tue, 16 Jul 2024 20:08:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721160495; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xjKnXAhQm7MvQI+pMTJ4Ab6QLrikryGQh8LUeRTtqwg=; b=NJyWyNG5IDLsScvKqYZ/H7XCDkcvjgdxmCuSGz3lF0W/rVlyJJATPXoZudjaAeEpMQSYjn S6cmCe5Ib7Vm8dpCV8Ef8Dh+kU5+RXXqsV/z3qe/S1YRQEpouRBY8BVRevcerJr+VA3kWJ VYqcAsc3c+jJUvVrws481RILCt7mdRZi7qMqmDiX9WN2UnWYZmYCwd4IapwyKsX+cPDKPp lIoo3yS+pCnRG+lTg/u2KxfteqOMumHizLwhRfdhhkG/UUuoX7Vk6BjjYFrsbfQCaj2uA9 L5/vW8srQ+srzrvj2SQtTHOjbFiGR5Q9FmBudtjgQfFn4bTJ15nlgzULr3A4vQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1721160495; a=rsa-sha256; cv=none; b=RI1CL9NGiNAg2Bft8DsVmicxUZBc0G/ZJLQuR9TOc9WAu71taCmnmvW0Wdlg7Kb3/msWGb PLeTGdX4AEEcbaoR1bQ6K/1o45SGjQM/BsMXeSMsKukX2ery6O1/7s7LkazO2fjBm/v+PK D3ViFYktkn+vg0JyC8FQTko3JjJV/b02jy5ZxFqQyOD6Jfc8OlvBrWEFXyHpo3drE1YSKD 0tRuyGtlQ3xWwQ8LH8+6qIbZwr/IDSjxQOvsafMAO2t+3xygxHpDUMCejJpMrDoK/7g+MI hQrYP+H1mpuIQACODbUZNaukL+sHz0GGPIZRal8ixl8l61ZxUkgzAkvV6MP2KA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721160495; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xjKnXAhQm7MvQI+pMTJ4Ab6QLrikryGQh8LUeRTtqwg=; b=dxaIOmZnDe12eQoEfZwuK5DuJW/yoat2gP/MKjgyTSsVNtf2k17ZYla0yycLbTPHTfxH6Q wBX3Al4SBWMQBiC3G1EUYaZTC1IIQfJ3NVFeJ92mP5NI6heRKex8CPOY2hWKhgMP37SHit vR9iPPMc/0uB0SeO0J6uW8Ebq4CkRzuqE2hnM2ZUPUh91kkn9nHZPagXcGWOKoBgOaWwBE yJtzYKgsEHRBArsJq9+WofeSRgKeHRQOA/D7VoNZ8Mzd47efXzrhjHWQG/2pv7XRLmjFK1 eJOJfUrCb7BEE/5N2UMO2neTHc60twDcDZjSqFSALDIvTWkNqY1IQ4yDiMh3KQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WNqrG6pRBzqVF; Tue, 16 Jul 2024 20:08:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46GK8E5n067496; Tue, 16 Jul 2024 20:08:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46GK8Elk067493; Tue, 16 Jul 2024 20:08:14 GMT (envelope-from git) Date: Tue, 16 Jul 2024 20:08:14 GMT Message-Id: <202407162008.46GK8Elk067493@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Kenneth D. Merry" Subject: git: ff9458b30fc3 - stable/14 - Fix the isp(4) driver with 9.x firmware. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ken X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: ff9458b30fc3b8748f65eca792be7b6e64c639bf Auto-Submitted: auto-generated The branch stable/14 has been updated by ken: URL: https://cgit.FreeBSD.org/src/commit/?id=ff9458b30fc3b8748f65eca792be7b6e64c639bf commit ff9458b30fc3b8748f65eca792be7b6e64c639bf Author: Kenneth D. Merry AuthorDate: 2024-06-21 19:30:59 +0000 Commit: Kenneth D. Merry CommitDate: 2024-07-16 20:04:29 +0000 Fix the isp(4) driver with 9.x firmware. The isp(4) driver (and ispfw(4) firmware) previously only included firmware for Qlogic controllers up to 8Gb. It recently gained firmware for the 27XX and 28XX series controllers along with improved firmware loading capabilities. The 9.x firmware available for the 27XX and 28XX controllers in ispfw(4) adds login state for NVMe devices in the top nibble of the login state in the port database (isp_pdb_24xx_t in ispmbox.h). This breaks the check at the end of isp_getpdb() to make sure the device is in the right login state. As a result, it breaks device discovery for many (perhaps all?) FC devices. In my testing with IBM LTO-6 drives attached to a quad port 16Gb Qlogic 2714, they don't show up when they are directly connected (and in loop mode) or connected via a switch (and in fabric mode). So, mask off the top bits of of the login state before checking it. This shouldn't break anything, because all of the existing login states defined in ispmbox.h are in the low nibble. sys/dev/isp/ispmbox.h: Add a FCP login state mask define, and a NVMe login state shift. sys/dev/isp/isp.c: In isp_getpdb(), make sure we're only looking at the FCP login state bits when we try to determine whether a device is in the right login state. MFC after: 1 week Sponsored by: Spectra Logic Reviewed by: mav Differential Revision: (cherry picked from commit 137b004e2b7ab504abf98c4aad9d52607df47b9a) --- sys/dev/isp/isp.c | 10 +++++++++- sys/dev/isp/ispmbox.h | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/sys/dev/isp/isp.c b/sys/dev/isp/isp.c index ad6dbd1e6f76..7246ea8031ac 100644 --- a/sys/dev/isp/isp.c +++ b/sys/dev/isp/isp.c @@ -1539,7 +1539,15 @@ isp_getpdb(ispsoftc_t *isp, int chan, uint16_t id, isp_pdb_t *pdb) chan, id, pdb->portid, un.bill.pdb_flags, un.bill.pdb_curstate, un.bill.pdb_laststate); - if (un.bill.pdb_curstate < PDB2400_STATE_PLOGI_DONE || un.bill.pdb_curstate > PDB2400_STATE_LOGGED_IN) { + /* + * XXX KDM this is broken for NVMe. Need to determine whether this + * is an NVMe target, and if so, check the NVMe status bits. We are + * probably missing more bits for proper NVMe support, though. + */ + if (((un.bill.pdb_curstate & PDB2400_STATE_FCP_MASK) < + PDB2400_STATE_PLOGI_DONE) + || ((un.bill.pdb_curstate & PDB2400_STATE_FCP_MASK) > + PDB2400_STATE_LOGGED_IN)) { mbs.param[0] = MBOX_NOT_LOGGED_IN; return (mbs.param[0]); } diff --git a/sys/dev/isp/ispmbox.h b/sys/dev/isp/ispmbox.h index c6ac9d9ce971..978ed4dc1638 100644 --- a/sys/dev/isp/ispmbox.h +++ b/sys/dev/isp/ispmbox.h @@ -890,6 +890,10 @@ typedef struct { #define PDB2400_CLASS2 0x0010 #define PDB2400_ADDR_VALID 0x0002 +/* + * For NVMe, the state is the high nibble. For FCP, the state is the low + * nibble. This appears to have changed with the 9.x firmware. + */ #define PDB2400_STATE_PLOGI_PEND 0x03 #define PDB2400_STATE_PLOGI_DONE 0x04 #define PDB2400_STATE_PRLI_PEND 0x05 @@ -897,6 +901,8 @@ typedef struct { #define PDB2400_STATE_PORT_UNAVAIL 0x07 #define PDB2400_STATE_PRLO_PEND 0x09 #define PDB2400_STATE_LOGO_PEND 0x0B +#define PDB2400_STATE_FCP_MASK 0x0f +#define PDB2400_STATE_NVME_SHIFT 4 /* * Common elements from the above two structures that are actually useful to us.