summaryrefslogtreecommitdiff
path: root/sys/dev/isp/isp.c
AgeCommit message (Collapse)Author
2024-06-25isp: fix ISPCTL_ABORT_CMD switch caseMariusz Zaborski
Prevent kernel panic by not running ISPCTL_FCLINK_TEST after a failed ISPCTL_ABORT_CMD. Reviewed by: mav Tested by: Arne Steinkamm <arne@steinkamm.com> MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D45718
2024-06-24Add an isp(4) tunable to default to ispfw(4) firmware.Kenneth D. Merry
ispfw(4) recently gained firmware for Qlogic 27XX and 28XX FC controllers, and isp(4) now selects the newer of firmware in flash or in ispfw(4) to load for those controllers. This differs from the previous behavior (which remains for older controllers), which was to always load the ispfw(4) firmware if it is available. This adds a loader tunable, hint.isp.N.fwload_force to default to loading the ispfw(4) firmware, whether or not it is newer than the firmware in flash. This allows the user to always use the known firmware version included with the kernel. Note that there is an existing fwload_disable tunable that tells the driver to always load the firmware from flash and ignore ispfw(4). If fwload_disable is set, fwload_force will be ignored. So users with existing fwload_disable tunables will have the same behavior. If a user specifies both fwload_force and fwload_disable for the same controller, the isp(4) driver prints a warning message, and fwload_disable will be honored. The user can see which firmware is active through the dev.isp.N.fw_version* sysctl variables. share/man/man4/isp.4: Document the new loader tunable. sys/dev/isp/isp.c: In isp_load_risc_flash(), changet the decision logic to also consider ISP_CFG_FWLOAD_ONLY. Load the flash firmware and get the version, so the user knows what it is, but if the user set fwload_force, honor that. If the user didn't set fwload_force, the behavior remains to select the newer firmware version. sys/dev/isp/isp_pci.c: Add a new fwload_force tunable. Print out a warning if the user sets both fwload_disable and fwload_force. sys/dev/isp/ispvar.h: Add a new ISP_CFG_FWLOAD_FORCE configuration bit. Reviewed by: mav MFC after: 1 week Sponsored by: Spectra Logic Differential Revision: <https://reviews.freebsd.org/D45688>
2024-06-24Fix the isp(4) driver with 9.x firmware.Kenneth D. Merry
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: <https://reviews.freebsd.org/D45660>
2023-12-31isp: Fix endianness conversion in isp_read_flash_data()Mark Johnston
Reported by: Jenkins Fixes: 10ed63fc06cb ("isp(4): Rework firmware handling/loading")
2023-12-28isp(4): Rework firmware handling/loadingJoerg Pulz
Correctly identify the active firmware in flash on adapters with primary and secondary firmware region in flash. Correctly identify the active NVRAM on adapters with primary and secondary NVRAM region in flash. Loading ispfw(4) moved from isp_pci_attach() to isp_reset(). Drop the reference to ispfw(4) after using it so one can kldunload(8) it. New isp_load_ram() function to load either ispfw(4) or flash firmware into RISC's RAM. New functions to read data from flash. The old ones will be removed later. A bunch of new helper functions to identify and validate active flash regions for firmware, auxiliary and NVRAM. Overhaul ISP_FW_* macros and make use of it when comparing firmware versions. We can handle firmware versions up to 255.255.255. Firmware load priority slightly changed: For 27xx and newer adapters: - load ispfw(4) firmware - request (active) flash firmware information - compare version numbers of ispfw(4) and flash firmware - load firmware with highest version into RISC's RAM - if loading ispfw(4) is disabled or failed - load firmware from flash - if everything else fails use MBOX_LOAD_FLASH_FIRMWARE as fallback For 26xx and older adapters nothing changed: - load ispfw(4) firmware and load it into RISC's RAM - if loading ispfw(4) is disabled or failed use MBOX_EXEC_FIRMWARE - for 26xx a preceding MBOX_LOAD_FLASH_FIRMWARE is used New read only sysctl(8)'s: dev.isp.N.fw_version_run: the firmware version actually running dev.isp.N.fw_version_ispfw: the firmware version provided by ispfw(4) dev.isp.N.fw_version_flash: the (active) firmware version in flash While here: - firmware attribute handling/parsing reworked + renamed defines from ISP2400_FW_ATTR_* to ISP_FW_ATTR_* + changed values to match new handling/parsing + added some more attributes - enable FLT support on 26xx based adapters - log level adjustments - new function return status codes (some for now, some for later use) - some minor style changes Tested and approved to work on real hardware with: - Qlogic ISP 2532 (QLogic QLE2560 8Gb FC Adapter) - Qlogic ISP 2031 (QLogic QLE2662 16Gbit 2Port FC Adapter) - Qlogic ISP 2722 (QLogic QLE2690 16Gb FC Adapter) - Qlogic ISP 2812 (QLogic QLE2772 32Gbit 2Port FC Adapter) PR: 273263 Reviewed by: mav Pull Request: https://github.com/freebsd/freebsd-src/pull/877 MFC after: 1 month Sponsored by: Technical University of Munich
2023-08-16sys: Remove $FreeBSD$: one-line .c patternWarner Losh
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-07-07isp(4): Style changesJoerg Pulz
Please tools/build/checkstyle9.pl as mentioned by imp@ PR: 271062 Reviewed by: imp, mav Sponsored by: Technical University of Munich Pull Request: https://github.com/freebsd/freebsd-src/pull/726
2023-07-07isp(4): Remove redundant functions for reading data from FLT and flashJoerg Pulz
Rename isp_rd_2400_nvram to isp_rd_2xxx_flash. Cleanup some leftovers. Hide all output regarding FLT parsing behind ISP_LOGDEBUG0. Thanks to imp@ and mav@ for reviewing and commenting. PR: 271062 Reviewed by: imp, mav Sponsored by: Technical University of Munich Pull Request: https://github.com/freebsd/freebsd-src/pull/726
2023-07-07isp(4): Use the FLT on all supported controllersJoerg Pulz
The ISP26xx based HBAs are left as is for now with static NVRAM addressing. Those HBAs are known as 83xx (2031 and 8031 for real) and need special handling. This is left for further investigation for now. Cosmetics: - rename functions and defines as they are no longer specific to 28xx - set reasonable log levels - sort FLT and NVRAM functions (in the order they are used) Tested and approved to work on real hardware with: - Qlogic ISP 2532 (QLogic QLE2562 8Gb 2Port FC Adapter) - Qlogic ISP 2722 (QLogic QLE2690 16Gb FC Adapter) - Qlogic ISP 2812 (QLogic QLE2772 32Gbit 2Port FC Adapter) PR: 271062 Reviewed by: imp, mav Sponsored by: Technical University of Munich Pull Request: https://github.com/freebsd/freebsd-src/pull/726
2023-07-07isp(4): Add support to read contents of the FLT (flash layout table)Joerg Pulz
The FLT is like a TOC for the flash area and contains entries for every flash region with start/end address, size and flags. Start using NVRAM addresses from FLT instead of hardcoded ones for ISP28xx based HBAs. The FLT should be available on earlier HBAs too, probably since ISP24xx based. This needs further investigation and testing. PR: 271062 Reviewed by: imp, mav Sponsored by: Technical University of Munich Pull Request: https://github.com/freebsd/freebsd-src/pull/726
2023-07-07isp(4): Fix reading NVRAM contents for 28xx based devicesJoerg Pulz
Use correct NVRAM address for ISP28xx based HBAs to read NVRAM contents. WWPN/WWNN and framesize are correctly read from NVRAM now. PR: 271062 Reviewed by: imp, mav Sponsored by: Technical University of Munich Pull Request: https://github.com/freebsd/freebsd-src/pull/726
2023-07-07isp(4): Add support for QLogic 28xx devicesJoerg Pulz
This covers the following HBAs: ISP2812-based 64/32G Fibre Channel to PCIe Controller: QLE2770 Single Port 32GFC PCIe Gen4 x8 Adapter QLE2772 Dual Port 32GFC PCIe Gen4 x8 Adapter QLE2870 Single Port 64GFC PCIe Gen4 x8 Adapter QLE2872 Dual Port 64GFC PCIe Gen4 x8 Adapter ISP2814-based 64/32G Fibre Channel to PCIe Controller: QLE2774 Quad Port 32GFC PCIe Gen4 x16 Adapter QLE2874 Quad Port 64GFC PCIe Gen4 x16 Adapter While here, add required bits to support 64GB FC. Default framesize is set to 2048 for ISP28xx based HBAs for now. PR: 271062 Reviewed by: imp, mav Sponsored by: Technical University of Munich Pull Request: https://github.com/freebsd/freebsd-src/pull/726
2023-05-12spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
2022-09-03isp(4): Fix two typos in source code commentsGordon Bergling
- s/overriden/overridden/ MFC after: 3 days
2021-12-14isp(4): Allow more than 2 ports to read WWNs from NVRAM.Alexander Motin
It appears at least on QLE2694L cards 3rd and 4th ports follow the same NVRAM addressing logic as the first two. In lack of proper documentation this guess is as good as it can be. MFC after: 1 week Sponsored by: iXsystems, Inc.
2021-12-05FIx "set but not used" in the isp driver.Scott Long
Sponsored by: Rubicon Communications, LLC ("Netgate")
2020-11-27Some code reorganization.Alexander Motin
- Remove code duplication by adding two new functions to execute prepared queue entry via either mbox or request queue and wait for result. - Since the new function executing via request queue sleeps any way, make it sleep also in case of overflows or handle shortages. It should make it more reliable and less affecting other less flexible request queue users. - Turn isp_target_put_entry() into not target-specific isp_send_entry(). - Make handling of responses with control handles more universal. - Move RQSTYPE_RPT_ID_ACQ handling into new function. - Inline isp_handle_other_response(), becoming trivial after above. - Clean the list of IOCBs from pre-24xx ones. Notes: svn path=/head/; revision=368105
2020-11-26More cleanup in response queue and reset code.Alexander Motin
Notes: svn path=/head/; revision=368079
2020-11-26Some minor FCoE bits I had lying around.Alexander Motin
Notes: svn path=/head/; revision=368044
2020-11-24Update RQSFLAG_* definitions.Alexander Motin
Notes: svn path=/head/; revision=367991
2020-11-24Remove concept of mbox_sleep_ok.Alexander Motin
It was broken by design and unused for years due to conflicts between different threads, fighting for the same set of mailbox registers, not designed for multiple requests at a time. So either request has to be synchronous and spin under the lock, or it should be sent asynchronously through the queues as Mailbox Command IOCB or some other way. This removes any OS specifics from the wait code, so it can be inlined. Notes: svn path=/head/; revision=367986
2020-11-24Implement request queue overflow protection.Alexander Motin
Before this change in case of request queue overflow driver just froze the device queue for 100ms to retry after. It was pretty bad for performance. This change introduces SIM queue freezing when free space on the request queue drops below 255 entries (worst case of maximum I/O size S/G list), checking for a chance to release it on I/O completion. If the queue still get overflowed somehow, the old mechanism is still in place, just with delay reduced to 10ms. With the earlier queue length increase overflows should not happen often, but it is still easily reachable on synthetic tests. Notes: svn path=/head/; revision=367979
2020-11-22Fix build after 367926.Alexander Motin
Option ISP_TARGET_MODE is evil. Notes: svn path=/head/; revision=367929
2020-11-22Make handlers and atpds overflows unlikely.Alexander Motin
- Allocate 256 handlers more than payload commands for management purposes. - Increase maximum number of handlers from 8K to 16K by tuning the format. - Just to be safe limit the number of payload commands to 16K - 256. - Limit number of target exchanges in mixed mode to the number of atpds. - If we still somehow get out of atpds -- return BUSY, since we really are. Notes: svn path=/head/; revision=367926
2020-11-22Remove remnants of execthrottle and maxalloc parameters.Alexander Motin
The first was obsolete since 26xx, not used on 25xx and not needed on 24xx. The second seems never worked on 24xx and up. Notes: svn path=/head/; revision=367924
2020-11-20Increase queue depths from 1024/256 to 8192/1024 IOCBs.Alexander Motin
Qlogic chips store S/G lists in the same queue as requests themselves. In the worst case 1MB I/O may require up to 52 IOCBs, that means queue of 1024 IOCBs can store only 19 of such requests. The increase reduces chances of overflow, while we should be able to afford additional 512KB of RAM per HBA. The Linux driver uses comparable numbers. While there, decouple ATIO queue size from response queue size. There is no reason for them to be equal. Notes: svn path=/head/; revision=367909
2020-11-20Cleanup DMA handling.Alexander Motin
- Make isp_start() to set all the IOCB fields aside of S/G list, removing extra information from isp_send_cmd(), now only doing S/G lists and sending. - Turn DMA setup/free from being card and PCI-specific into OS-specific, instead add new card-specific method for isp_send_cmd(). Previously this function was a monster handling all the cards. - Remove double error code translation. Notes: svn path=/head/; revision=367906
2020-11-20Remove parallel SCSI and 1/2Gb FC support from isp(4).Alexander Motin
This removes 288KB (36%) of the driver code and zillions of hacks and workarounds, making single driver uniformly support several different generations of hardware interfaces, not counting minor card variations. After years of the hopeless fight, I don't think it worth to continue support for hardware obsolete for 15-20 years. Instead much cleaner now code should allow to move forward toward better locking, multiple queues and other cool features. All the remaining Qlogic cards starting from 4Gb 24xx to 32Gb 27xx use the same hardware/firmware interface with minor incremental improvements, so it seems to be a good new starting point. Except one PCI-X model all all of them are PCIe and so still usable in modern systems. Discussed with: ken, scottl, jpaetzel, imp Relnotes: yes Notes: svn path=/head/; revision=367857
2020-10-25Introduce support of SCSI Command Priority.Alexander Motin
SAM-3 specification introduced concept of Task Priority, that was renamed to Command Priority in SAM-4, and supported by all modern SCSI transports. It provides 15 levels of relative priorities: 1 - highest, 15 - lowest and 0 - default. SAT specification for SATA devices translates priorities 1-3 into NCQ high priority. This change adds new "priority" field into empty spots of struct ccb_scsiio and struct ccb_accept_tio of CAM and struct ctl_scsiio of CTL. Respective support is added into iscsi(4), isp(4), mpr(4), mps(4) and ocs_fc(4) drivers for both initiator and where applicable target roles. Minimal support was added to CTL to receive the priority value from different frontends, pass it between HA controllers and report in few places. This patch does not add consumers of this functionality, so nothing should really change yet, since the field is still set to 0 (default) on initiator and not actively used on target. Those are to be implemented separately. I've confirmed priority working on WD Red SATA disks connected via mpr(4) and properly transferred to CTL target via iscsi(4), isp(4) and ocs_fc(4). While there, added missing tag_action support to ocs_fc(4) initiator role. MFC after: 1 month Relnotes: yes Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=367044
2019-05-24Fix FC-Tape bugs caused in part by r345008.Kenneth D. Merry
The point of r345008 was to reset the Command Reference Number (CRN) in some situations where a device stayed in the topology, but had changed somehow. This can include moving from a switch connection to a direct connection or vice versa, or a device that temporarily goes away and comes back. (e.g. moving to a different switch port) There were a couple of bugs in that change: - We were reporting that a device had not changed whenever the Establish Image Pair bit was not set. That is not quite correct. Instead, if the Establish Image Pair bit stays the same (set or not), the device hasn't changed in that way. - We weren't setting PRLI Word0 in the port database when a new device arrived, so comparisons with the old value for the Establish Image Pair bit weren't really possible. So, make sure PRLI Word0 is set in the port database for new devices. - We were resetting the CRN whenever the Establish Image Pair bit was set for a device, even when the device had stayed the same and the value of the bit hadn't changed. Now, only reset the CRN for devices that have changed, not devices that sayed the same. The result of all of this was that if we had a single FC device on an FC port and it went away and came back, we would wind up correctly resetting the CRN. But, if we had multiple devices connected via a switch, and there was any change in one or more of those devices, all of the devices that stayed the same would also have their CRN values reset. The result, from a user standpoint, is that the tape drives, etc. would all start to time out commands and the initiator would send aborts. sys/dev/isp/isp.c: In isp_pdb_add_update(), look at whether the Establish Image Pair bit has changed as part of the check to determine whether a device is still the same. This was causing erroneous change notifications. Also, when creating a new port database entry, initialize the PRLI Word 0 values. sys/dev/isp/isp_freebsd.c: In isp_async(), in the changed/stayed case, instead of looking at the Establish Image Pair bit to determine whether to reset the CRN, look at the command value. (Changed vs. Stayed.) Only reset the CRN for devices that have changed. Sponsored by: Spectra Logic MFC after: 3 days Notes: svn path=/head/; revision=348247
2019-03-11Fix CRN resets in the isp(4) driver in certain situations.Kenneth D. Merry
The Command Reference Number (CRN) is part of the FC-Tape features that we enable when talking to tape drives. It starts at 1, and goes to 255 and wraps around to 1. There are a number of reset type conditions that result in the CRN getting reset to 1. These are detailed in section 4.10 (table 8) of the FCP-4r02b specification. One of the conditions is when a PRLI (Process Login) is sent by the initiator, and the Establish Image Pair bit is set in Word 0 of the PRLI. Previously, the isp(4) driver core sent a notification via isp_async() that the target had changed or stayed in place, but there was no indication of whether a PRLI was sent and whether the Establish Image Pair bit was set. The result of this was that in some situations, notably switching back and forth between a direct connection and a switch connection to a tape drive, the isp(4) driver would fail to reset the CRN in situations that require it according to the spec. When the CRN isn't reset in a situation that requires it, the tape drive then rejects every subsequent command that is sent to the drive. It is assuming that the commands are being sent out of order. So, modify the isp(4) driver to include Word 0 of the PRLI command when it sends isp_async() notifications of target changes. Look at the Establish Image Pair bit, and reset the CRN if that bit is set. With this change, I am able to switch a tape drive back and forth between a direct connection and a switch connection, and the isp(4) driver resets the CRN when it should. sys/dev/isp_stds.h: Add bit definitions for PRLI Word 0. sys/dev/ispmbox.h: Add PRLI Word 0 to the port database type, isp_pdb_t. sys/dev/ispvar.h Add PRLI Word 0 to fcportdb_t. sys/dev/isp.c: Populate the new prli_word0 parameter in the port database. In isp_pdb_add_update(), add a check to see if the Establish Image Pair bit is set in PRLI Word 0. If it is, then that is an additional reason to create a change notification. sys/dev/isp_freebsd.c: In isp_async(), if the device changed or stayed, look at PRLI Word 0 to see if the Establish Image Pair bit is set. If it is, reset the CRN if we haven't already. MFC after: 1 week Sponsored by: Spectra Logic Differential Revision: https://reviews.freebsd.org/D19472 Notes: svn path=/head/; revision=345008
2018-03-15Increase ABOUT FIRMWARE command timeout to 5s.Alexander Motin
It seems default timeout of 100ms is not enough for my 2694L card, while it was perfectly fine for others, even for full-height 2694. MFC after: 1 week Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=330963
2018-02-28Add support for Enhanced Gen 5 (16Gb) and Gen 6 (32Gb) QLogic FC HBAs.Alexander Motin
MFC after: 2 weeks Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=330121
2017-11-27sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni
Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326255
2017-07-27Remove duplicate assignments from r321622.Kenneth D. Merry
Submitted by: mav MFC after: 3 days Sponsored by: Spectra Logic Notes: svn path=/head/; revision=321623
2017-07-27Fix probing FC targets with hard addressing turned on.Kenneth D. Merry
This largely reverts FreeBSD SVN change 289937 from October 25th, 2015. The intent of that change was to keep loop IDs persistent across chip reinits. The problem is that the change turned on the PREVLOOP / PREV_ADDRESS bit (bit 7 in Firmware Options 2), which tells the Qlogic chip to not participate in the loop if it can't get the requested loop address. It also turned off soft addressing on 2400 (4Gb) and newer controllers. The isp(4) driver defaults to loop address 0, and the tape drives I have tested default to loop address 0 if hard addressing is turned on. So when hard loop addressing is turned on on the drive, the isp(4) driver just refuses to participate in the loop. The solution is to largely revert that change. I left some elements in place that are related to virtual ports, since they were new. This does work with IBM tape drives with hard and soft addressing turned on. I have tested it with 4Gb, 8Gb, and 16Gb controllers. sys/dev/isp.c: Largely revert FreeBSD SVN change 289937. I left the ispmbox.h changes in place. Don't use the PREV_ADDRESS bit on initialization. It tells the chip to not participate if it can't get the requested loop ID. Do use soft addressing on 2400 and newer chips. Use hard addressing when the user has requested a specific initiator ID. (hint.isp.X.iid=N in /boot/loader.conf) Leave some of the virtual port options from that change in place, but don't turn on the PREV_ADDRESS bit. Reviewed by: mav MFC after: 3 days Sponsored by: Spectra Logic Notes: svn path=/head/; revision=321622
2017-07-10"Port Type not registered" is not a real error for GIT_PT.Alexander Motin
Notes: svn path=/head/; revision=320865
2017-07-03Switch fabric scans from GID_FT to GID_PT+GFF_ID/GFT_ID.Alexander Motin
Instead of using GID_FT SNS request to get list of registered FCP ports, use GID_PT to get list of all Nx_Ports, and then use GFF_ID and/or GFT_ID requests to find whether they are FCP and target capable. The problem with old approach is that GID_FT does not report ports without FC-4 type registered. In particular it was impossible to boot OS from FreeBSD FC target using QLogic FC BIOS, since one does not register FC-4 type even on new cards and so ignored by old code as incompatible. As a side bonus this allows initiator to skip pointless logins to other initiators by fetching that information from SNS instead. In case some switches do not implement GFF_ID/GFT_ID correctly, add sysctls to disable that functionality. I handled broken GFF_ID of my Brocade 200E, but there may be other switches with different bugs. Linux also uses GID_PT, but GFF_ID is disabled by default there, and GFT_ID is not supported. Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=320604
2017-07-02Move comment respecting previous commit.Alexander Motin
Notes: svn path=/head/; revision=320575
2017-07-02Slightly unify SNS requests for post- and pre-24xx.Alexander Motin
Notes: svn path=/head/; revision=320574
2017-05-03Correct loop mode CRN resets to adhere to FCP-4 section 4.10Kenneth D. Merry
Prior to this change, the CRN (Command Reference Number) is reset on any firmware LIP, LOOP DOWN, or LOOP RESET event in violation of FCP-4 which specifies that the CRN should only be reset in response to a LIP Reset (LIPyx) primitive. FCP-4 also indicates PLOGI/LOGO and PRLI/PRLO ELS actions as conditions for resetting the CRN for the associated initiator port. These violations manifest themselves when the HBA is removed from the loop, or a target device is removed (especially during an outstanding command) without power cycling. If the HBA and and the target device determine upon re-establishing the loop that no PLOGI or PRLI is required, and the target does not issue a LIPxy to the initiator, the CRN for the target will have been improperly reset by the isp driver. As a result, the target port will silently ignore all FCP commands issued during the device probe (which will time out) preventing the device from attaching. This change corrects thie CRN reset behavior in response to loop state changes, also introduces CRN resets for the above mentioned ELS actions as encountered through async PDB change events. This change also adds cleanup of outstanding commands in isp_loop_dead() that was previously missing. sys/dev/isp/isp.c Add the last login state to debug output when syncing the pdb sys/dev/isp/isp_freebsd.c Replace binary statement setting aborted ccb status in isp_watchdog() with the XS_SETERR macro used elsewhere In isp_loop_dead(), abort or complete pending commands as done in isp_watchdog() In isp_async(), segregate the ISPASYNC_LOOP_RESET action from ISPASYNC_LIP, ISPASYNC_LOOP_DOWN, and ISPASYNC_LOOP_UP fallthroughs, and only reset the CRN in the RESET case. Also add checks to handle false LOOP RESET actions that do not have a proper associated LIP primitive, and log the primitive in the debug messages In isp_async(), remove the goto from ISP_ASYNC_DEV_STAYED, and only reset the CRN in the DEV_CHANGED action In isp_async(), when processing an ISPASYNC_CHANGE_PDB status, reset CRN(s) for the associated nphdl (or all ports) if the change reason is some form of ELS login/logout. Also remove assignment to fc since it is not used in the scope sys/dev/isp/ispmbox.h Add macro definition for the global N-Port handle, and correct a macro typo 'PDB24XX_AE_PRLI_DONJE' sys/dev/isp/ispvar.h Add macros FCP_AL_DA_ALL, FCP_AL_PA, and FCP_IS_DEST_ALPD for more legible code when determining if an AL_PD port matches the portid for a given struct fcparam* by value or by virtue of the AL_PD port being 0xFF Submitted by: Reid Linnemann Sponsored by: Spectra Logic MFC after: 1 week Notes: svn path=/head/; revision=317740
2017-04-24Switch isp_reset to scratchpad not requiring ISP_MBOXDMASETUP.Alexander Motin
MFC after: 1 week Notes: svn path=/head/; revision=317356
2017-04-09Fix few minor issues found by Clang Analyzer.Alexander Motin
MFC after: 2 weeks Notes: svn path=/head/; revision=316652
2017-03-22Cleanup response queue processing.Alexander Motin
MFC after: 2 weeks Notes: svn path=/head/; revision=315708
2017-03-21Improve command timeout handling.Alexander Motin
Let firmware do its best first, and if it can't, try software recovery. I would remove software timeout handler completely, but found bunch of complains on command timeout on sparc64 mailing list few years ago, so better be safe in case of interrupt loss. MFC after: 2 weeks Notes: svn path=/head/; revision=315681
2017-03-21Remove questionable reqp->req_time access.Alexander Motin
MFC after: 2 weeks Notes: svn path=/head/; revision=315678
2017-03-19Remove some useless code.Alexander Motin
MFC after: 2 weeks Notes: svn path=/head/; revision=315587
2017-03-19Add initial support for multiple MSI-X vectors.Alexander Motin
For 24xx and above use 2 vectors (default and response queue). For 26xx and above use 3 vectors (default, response and ATIO queues). Due to global lock interrupt hardlers never run simultaneously now, but at least this allows to save one regitster read per interrupt. MFC after: 2 weeks Notes: svn path=/head/; revision=315579
2017-03-19Remove hackish code delaying ATIOs to unknown virtual port.Alexander Motin
Since we support RQSTYPE_RPT_ID_ACQ, that functionality is only useful in loop mode, which probably doesn't worth having this hack in 2017. MFC after: 2 weeks Notes: svn path=/head/; revision=315545
2017-03-18Remove dead remnants of SPI target.Alexander Motin
MFC after: 2 weeks Notes: svn path=/head/; revision=315485