summaryrefslogtreecommitdiffstats
path: root/sys/cam
Commit message (Collapse)AuthorAgeFilesLines
* MFC r259108:mav2013-12-221-1/+5
| | | | | | | When comparing device IDs, make sure that they have the same type (like NAA assigned) and identify the same entity (like device or port). Otherwise there can be false positives since at least some models of Seagate disks use same IDs for the whole device and one of its ports.
* MFC r258871:trasz2013-12-131-1/+3
| | | | | | | Properly report an error instead of panicing when user tries to create LUN backed by non-disk device, e.g. /dev/null. Sponsored by: The FreeBSD Foundation
* MFC r257345,257382,257388:nwhitehorn2013-12-103-51/+84
| | | | | | | | | | | | | | | | | | | | | | | | | Implement extended LUN support. If PIM_EXTLUNS is set by a SIM, encode the upper 32-bits of the LUN, if possible, into the target_lun field as passed directly from the REPORT LUNs response. This allows extended LUN support to work for all LUNs with zeros in the lower 32-bits, which covers most addressing modes without breaking KBI. Behavior for drivers not setting PIM_EXTLUNS is unchanged. No user-facing interfaces are modified. Extended LUNs are stored with swizzled 16-bit word order so that, for devices implementing LUN addressing (like SCSI-2), the numerical representation of the LUN is identical with and without PIM_EXTLUNS. Thus setting PIM_EXTLUNS keeps most behavior, and user-facing LUN IDs, unchanged. This follows the strategy used in Solaris. A macro (CAM_EXTLUN_BYTE_SWIZZLE) is provided to transform a lun_id_t into a uint64_t ordered for the wire. This is the second part of work for full 64-bit extended LUN support and is designed to a bridge for stable/10 to the final 64-bit LUN code. The third and final part will involve widening lun_id_t to 64 bits and will not be MFCed. This third part will break the KBI but will keep the KPI unchanged so that all drivers that will care about this can be updated now and not require code changes between HEAD and stable/10. Reviewed by: scottl
* MFC r256552:mav2013-10-2418-41/+82
| | | | | | | Unify periph invalidation and destruction reporting. Print message containing device model and serial number on invalidation. Approved by: re (hrs)
* MFC r256533:mav2013-10-241-1/+1
| | | | | | | | Unhide "Serial Number" lines from bootverbose. That information may be useful for system administration to have in hard copy (in logs) if one of several devices suddenly dies. Approved by: re (hrs)
* Remove no longer useful debugging output and a stale comment.trasz2013-10-091-13/+2
| | | | | Approved by: re (gjb) Sponsored by: FreeBSD Foundation
* Make the error handling more consistant. Shouldn't make any functionaltrasz2013-10-091-9/+23
| | | | | | | difference. Approved by: re (gjb) Sponsored by: FreeBSD Foundation
* Tidy up, cache return value of a function, and add an assertion;trasz2013-10-091-6/+32
| | | | | | | shouldn't make any functional difference. Approved by: re (gjb) Sponsored by: FreeBSD Foundation
* Close the race on path ID allocation in xpt_bus_register() if two buses aremav2013-10-091-9/+6
| | | | | | | | | | | registered simultaneously. Due to topology unlock between the ID allocation and the bus registration there is a chance that two buses may get the same IDs. That is supposed reason of lock assertion panic in CAM during initial bus scanning after new iscsid initiates two sessions same time. Reported by: trasz Approved by: re (glebus, marius) MFC after: 2 weeks
* Fix NOP-In/NOP-Out payload handling. Previous way didn't work at all; ↵trasz2013-10-091-8/+33
| | | | | | | | | fortunately nothing seems to actually use this feature, but it's required by standard. Approved by: re (glebius) Sponsored by: FreeBSD Foundation
* Properly fix out of memory handling in the iSCSI target.trasz2013-10-081-4/+11
| | | | | Approved by: re (glebius) Sponsored by: FreeBSD Foundation
* Split cfiscsi_datamove() in two; no functional changes.trasz2013-10-051-182/+203
| | | | | Approved by: re (glebius) Sponsored by: FreeBSD Foundation
* Don't leak memory when removing an unconnected session, and remove uselesstrasz2013-10-041-1/+1
| | | | | | | UMA_ZONE_NOFREE that caused another leak when unloading the module. Approved by: re (glebius) Sponsored by: FreeBSD Foundation
* Make sure the CCB xflags field is initialized to zero so thatnwhitehorn2013-09-272-0/+5
| | | | | | | | | CAM_EXTLUN_VALID is not erroneously set. Also add an XPORT_SRP identifier to the known SCSI transports for the SCSI RDMA protocol, as used, for example with Infiniband storage. Reviewed by: scottl Approved by: re (marius)
* Re-do r255853. Along with adding back the API/ABI changes from thescottl2013-09-256-90/+399
| | | | | | | | original, this hides the contents of cam_compat.h from ktrace/kdump/truss, avoiding problems there. There are no user-servicable parts in there, so no need for those tools to be groping around in there. Approved by: re
* Revert r255853 pending fixes to build errors in usr.bin/kdumpgjb2013-09-256-392/+89
| | | | Approved by: re (implicit)
* Update the CAM API for FreeBSD 10:scottl2013-09-246-89/+392
| | | | | | | | | | | | | | | | | | | | | | - Remove the timeout_ch field. It's been deprecated since FreeBSD 7.0; MPSAFE drivers should be managing their own timeout storage. The remaining non-MPSAFE drivers have been modified to also manage their own storage, and should be considered for updating to MPSAFE (or removal) during the FreeBSD 10.x lifecycle. - Add fields related to soft timeouts and quality of service, to be used in upcoming work. - Add room for more flags in the CCB header and path_inq structures. - Begin support for extended 64-bit LUNs. - Bump the CAM version number to 0x18, but add compat shims. Tested with camcontrol and smartctl. Reviewed by: nathanw, ken, kib Approved by: re Obtained from: Netflix
* Properly ignore PDUs with CmdSN outside of allowed range.trasz2013-09-241-17/+18
| | | | | Approved by: re (glebius) Sponsored by: FreeBSD Foundation
* Fix a few instances of M_WAITOK in threads marked as prohibited from sleep,trasz2013-09-241-2/+16
| | | | | | | missed in r255824. Approved by: re (kib) Sponsored by: FreeBSD Foundation
* Don't use M_WAITOK when running from context where sleeping is prohibited,trasz2013-09-231-4/+21
| | | | | | | such as callout or a geom thread. Approved by: re (marius) Sponsored by: FreeBSD Foundation
* Add some spare fields to structs used by the new iSCSI stack - some justtrasz2013-09-201-0/+9
| | | | | | | | | in case, some for future MC/S support. This requires kernel and world rebuild. Approved by: re (blanket) Sponsored by: FreeBSD Foundation
* Bring in the new iSCSI target and initiator.trasz2013-09-144-0/+2941
| | | | | | Reviewed by: ken (parts) Approved by: re (delphij) Sponsored by: FreeBSD Foundation
* Make SES driver adequately react on simple enclosure devices -- read Shortmav2013-09-061-0/+12
| | | | Enclosure status to enclosure status field, clear previous state and exit.
* Add camcontrol support for the SCSI sanitize commandbryanv2013-09-062-0/+59
| | | | | Reviewed by: ken, mjacob (eariler version) Sponsored by: Netapp
* Fix kernel panic if cache->nelms is zero.mav2013-09-061-8/+8
| | | | MFC after: 2 weeks
* Add debug trace points for freeze/release device queue.mav2013-09-014-0/+75
|
* Bring legacy CAM target implementation back into API/KPI-coherent and evenmav2013-09-012-5/+11
| | | | | | | | | functional state. While CTL is much more superior target from all points, there is no reason why this code should not work. Tested with ahc(4) as target side HBA. MFC after: 2 weeks
* Fix SES_ENABLE_PASSTHROUGH kernel option, unexpectedly broken during drivermav2013-09-011-2/+4
| | | | | | overhaul. MFC after: 3 days
* Fix targbh crash on XPT_IMMED_NOTIFY error during attach.mav2013-09-011-13/+10
|
* Fix the build with CTLFEDEBUG, broken by unmapped I/O support changes.mav2013-09-011-6/+6
|
* Bump up the default timeouts for move commands in the ch(4) driverken2013-08-291-4/+4
| | | | | | | | | | to 15 minutes, and 5 minutes for things like READ ELEMENT STATUS. This is needed to account for the worst case scenarios on at least some Spectra Logic tape libraries. Sponsored by: Spectra Logic MFC after: 3 days
* If a drive returns ASC/ASCQ 0x04,0x11 "Logical unit not ready,ken2013-08-271-1/+1
| | | | | | | | | | | | | | | | | | | notify (enable spinup) required", instead of doing the normal retries, poll for a change in status. We will poll every half second for a minute for the status to change. Hitachi drives (and likely other SAS drives) return that ASC/ASCQ when they are waiting to spin up. What it means is that they are waiting for the SAS expander to send them the SAS NOTIFY (ENABLE SPINUP) primitive. That primitive is the mechanism expanders/enclosures use to sequence drive spinup to avoid overloading power supplies. Sponsored by: Spectra Logic MFC after: 3 days
* Add new attribute lunname to report only textual LUN-specific device IDs.mav2013-08-241-5/+9
| | | | | While lunid attribute prefers to report numeric ones, having both may be useful in some situations.
* Add support to physio(9) for devices that don't want I/O split andken2013-08-241-4/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | configure sa(4) to request no I/O splitting by default. For tape devices, the user needs to be able to clearly understand what blocksize is actually being used when writing to a tape device. The previous behavior of physio(9) was that it would split up any I/O that was too large for the device, or too large to fit into MAXPHYS. This means that if, for instance, the user wrote a 1MB block to a tape device, and MAXPHYS was 128KB, the 1MB write would be split into 8 128K chunks. This would be done without informing the user. This has suboptimal effects, especially when trying to communicate status to the user. In the event of an error writing to a tape (e.g. physical end of tape) in the middle of a 1MB block that has been split into 8 pieces, the user could have the first two 128K pieces written successfully, the third returned with an error, and the last 5 returned with 0 bytes written. If the user is using a standard write(2) system call, all he will see is the ENOSPC error. He won't have a clue how much actually got written. (With a writev(2) system call, he should be able to determine how much got written in addition to the error.) The solution is to prevent physio(9) from splitting the I/O. The new cdev flag, SI_NOSPLIT, tells physio that the driver does not want I/O to be split beforehand. Although the sa(4) driver now enables SI_NOSPLIT by default, that can be disabled by two loader tunables for now. It will not be configurable starting in FreeBSD 11.0. kern.cam.sa.allow_io_split allows the user to configure I/O splitting for all sa(4) driver instances. kern.cam.sa.%d.allow_io_split allows the user to configure I/O splitting for a specific sa(4) instance. There are also now three sa(4) driver sysctl variables that let the users see some sa(4) driver values. kern.cam.sa.%d.allow_io_split shows whether I/O splitting is turned on. kern.cam.sa.%d.maxio shows the maximum I/O size allowed by kernel configuration parameters (e.g. MAXPHYS, DFLTPHYS) and the capabilities of the controller. kern.cam.sa.%d.cpi_maxio shows the maximum I/O size supported by the controller. Note that a better long term solution would be to implement support for chaining buffers, so that that MAXPHYS is no longer a limiting factor for I/O size to tape and disk devices. At that point, the controller and the tape drive would become the limiting factors. sys/conf.h: Add a new cdev flag, SI_NOSPLIT, that allows a driver to tell physio not to split up I/O. sys/param.h: Bump __FreeBSD_version to 1000049 for the addition of the SI_NOSPLIT cdev flag. kern_physio.c: If the SI_NOSPLIT flag is set on the cdev, return any I/O that is larger than si_iosize_max or MAXPHYS, has more than one segment, or would have to be split because of misalignment with EFBIG. (File too large). In the event of an error, print a console message to give the user a clue about what happened. scsi_sa.c: Set the SI_NOSPLIT cdev flag on the devices created for the sa(4) driver by default. Add tunables to control whether we allow I/O splitting in physio(9). Explain in the comments that allowing I/O splitting will be deprecated for the sa(4) driver in FreeBSD 11.0. Add sysctl variables to display the maximum I/O size we can do (which could be further limited by read block limits) and the maximum I/O size that the controller can do. Limit our maximum I/O size (recorded in the cdev's si_iosize_max) by MAXPHYS. This isn't strictly necessary, because physio(9) will limit it to MAXPHYS, but it will provide some clarity for the application. Record the controller's maximum I/O size reported in the Path Inquiry CCB. sa.4: Document the block size behavior, and explain that the option of allowing physio(9) to split the I/O will disappear in FreeBSD 11.0. Sponsored by: Spectra Logic
* CTL changes required for iSCSI target, most notably LUN remappingtrasz2013-08-247-64/+160
| | | | | | and a mechanism to allow CTL frontends for retrieving LUN options. Reviewed by: ken (earlier version)
* Fix the (unused for now) SCSI_PROTO_iSCSI define to match style(9).trasz2013-08-211-1/+1
|
* Add unmapped I/O and larger I/O support to the sa(4) driver.ken2013-08-161-7/+50
| | | | | | | | | | | | | | | | | | | | | | | | We now pay attention to the maxio field in the XPT_PATH_INQ CCB, and if it is set, propagate it up to physio via the si_iosize_max field in the cdev structure. We also now pay attention to the PIM_UNMAPPED capability bit in the XPT_PATH_INQ CCB, and set the new SI_UNMAPPED cdev flag when the underlying SIM supports unmapped I/O. scsi_sa.c: Add unmapped I/O support and propagate the SIM's maximum I/O size up. Adjust scsi_tape_read_write() in the same way that scsi_read_write() was changed to support unmapped I/O. We overload the readop parameter with bits that tell us whether it's an unmapped I/O, and we need to set the CAM_DATA_BIO CCB flag. This change should be backwards compatible in source and binary forms. MFC after: 1 week Sponsored by: Spectra Logic
* Turn comments about locking into actual lock assertions.trasz2013-08-151-28/+35
| | | | | | Reviewed by: ken Tested by: ken MFC after: 1 month
* Added 4K quirks for:-smh2013-08-142-0/+48
| | | | | | * OCZ Agility 2 SSDs * Marvell SSDs * Intel X25-M Series SSDs
* Remove droping topology mutex after iterating 100 periphs in CAMGETPASSTHRU.mav2013-08-073-41/+5
| | | | | That is not so slow and so often operation to handle unneeded otherwise xsoftc.xpt_generation and respective locking complications.
* Improve r253721 by reporting detected lack of BIO_FLUSH support to GEOM.mav2013-08-071-0/+1
| | | | That prevents more of such requests from coming and errors from logging.
* Remove dead code.trasz2013-08-062-44/+0
|
* MFprojects/camlock r249006:mav2013-08-051-16/+13
| | | | | Pass SIM pointer as an argument to camisr_runqueue() instead of doneq pointer.
* MFprojects/camlock r249505:mav2013-08-055-44/+71
| | | | | | | | | | | | | | | Change CCB queue resize logic to be able safely handle overallocations: - (re)allocate queue space in power of 2 chunks with 64 elements minimum and never shrink it; with only 4/8 bytes per element size is insignificant. - automatically reallocate the queue to double size if it is overflowed. - if queue reallocation failed, store extra CCBs in unsorted TAILQ, fetching them back as soon as some queue element is freed. To free space in CCB for TAILQ linking, change highpowerq from keeping high-power CCBs to keeping devices frozen due to high-power CCBs. This encloses all pieces of queue resize logic inside of cam_queue.[ch], removing some not obvious duties from xpt_release_ccb().
* Add NO_RC16 quirk to make da driver avoid using READ CAPACITY(16) commandmav2013-07-301-3/+11
| | | | | if possible. Use it for Kingston JetFlash USB sticks, that are known to return garbage in response to that command.
* Fix returning incorrect bio_resid value with failed BIO_DELETE requests.mav2013-07-282-26/+35
| | | | | Neither residual length reported for ATA/SCSI command nor one from another BIO_DELETE request are in any way related to the value to be returned.
* Synchronize device cache on close only if there were some write operations.mav2013-07-272-10/+24
| | | | | | While these operations are not really needed otherwise, at least for SCSI they may cause extra errors if some other initiator holds write exclusive reservation on the LUN (SYNCHRONIZE CACHE handled as "write" operation).
* Oops, revert unwanted part of r253721.mav2013-07-271-2/+0
|
* Detect unsupported PREVENT ALLOW MEDIUM REMOVAL and SYNCHRONIZE CACHE(10)mav2013-07-271-0/+24
| | | | to not spam devices with useless commands and logs with errors.
* CAM and mps(4) driver scanning changes.ken2013-07-222-9/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a PIM_NOSCAN flag to the CAM path inquiry CCB. This tells CAM not to perform a rescan on a bus when it is registered. We now use this flag in the mps(4) driver. Since it knows what devices it has attached, it is more efficient for it to just issue a target rescan on the targets that are attached. Also, remove the private rescan thread from the mps(4) driver in favor of the rescan thread already built into CAM. Without this change, but with the change above, the MPS scanner could run before or during CAM's initial setup, which would cause duplicate device reprobes and announcements. sys/param.h: Bump __FreeBSD_version to 1000039 for the inclusion of the PIM_RESCAN CAM path inquiry flag. sys/cam/cam_ccb.h: sys/cam/cam_xpt.c: Added a PIM_NOSCAN flag. If a SIM sets this in the path inquiry ccb, then CAM won't rescan the bus in xpt_bus_regsister. sys/dev/mps/mps_sas.c For versions of FreeBSD that have the PIM_NOSCAN path inquiry flag, don't freeze the sim queue during scanning, because CAM won't be scanning this bus. Instead, hold up the boot. Don't call mpssas_rescan_target in mpssas_startup_decrement; it's redundant and I don't know why it was in there. Set PIM_NOSCAN in path inquiry CCBs. Remove methods related to the internal rescan daemon. Always use async events to trigger a probe for EEDP support. In older versions of FreeBSD where AC_ADVINFO_CHANGED is not available, use AC_FOUND_DEVICE and issue the necessary READ CAPACITY manually. Provide a path to xpt_register_async() so that we only receive events for our own SCSI domain. Improve error reporting in cases where setup for EEDP detection fails. sys/dev/mps/mps_sas.h: Remove softc flags and data related to the scanner thread. sys/dev/mps/mps_sas_lsi.c: Unconditionally rescan the target whenever a device is added. Sponsored by: Spectra Logic MFC after: 1 week
OpenPOWER on IntegriCloud