aboutsummaryrefslogtreecommitdiff
path: root/sys/cam/ctl/ctl_frontend_ioctl.c
Commit message (Collapse)AuthorAgeFilesLines
* cam: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-3/+1
| | | | Notes: svn path=/head/; revision=365225
* Fix CTL ioctl port creation error handling.Alexander Motin2020-08-211-2/+4
| | | | | | | | | Submitted by: Bret Ketchum MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D26143 Notes: svn path=/head/; revision=364463
* Refactor command ordering/blocking mechanism in CTL.Alexander Motin2019-02-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Replace long per-LUN queue of blocked commands, scanned on each command completion and sometimes even twice, causing up to O(n^^2) processing cost, by much shorter per-command blocked queues, scanned only when respective command completes, and check only commands before the previous blocker, reducing cost to O(n). While there, unblock aborted commands to make them "complete" ASAP to be removed from the OOA queue and so not waste time ordering other commands against them. Aborted commands that were not sent to execution yet should have no visible side effects, so this is safe and easy optimization now, comparing to commands already in processing, which are a still pain. Together those two optimizations should fix quite pathological case, when due to backend slowness CTL accumulated many thousands of blocked requests, partially aborted by initiator and so supposedly not even existing, but still wasting CTL CPU time. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=344636
* Rework CTL frontend & backend options to use nv(3), allow creating multipleMarcelo Araujo2018-05-101-13/+223
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ioctl frontend ports. This revision introduces two changes to CTL: - Changes the way options are passed to CTL_LUN_REQ and CTL_PORT_REQ ioctls. Removes ctl_be_arg structure and associated logic and replaces it with nv(3)-based logic for passing in and out arguments. - Allows creating multiple ioctl frontend ports using either ctladm(8) or ctld(8). New frontend ports are represented by /dev/cam/ctl<pp>.<vp> nodes, eg /dev/cam/ctl5.3. Those device nodes respond only to CTL_IO ioctl. New command-line options for ctladm: # creates new ioctl frontend port with using free pp and vp=0 ctladm port -c # creates new ioctl frontend port with pp=10 and vp=0 ctladm port -c -O pp=10 # creates new ioctl frontend port with pp=11 and vp=12 ctladm port -c -O pp=11 -O vp=12 # removes port with number 4 (it's a "targ_port" number, not pp number) ctladm port -r -p 4 New syntax for ctl.conf: target ... { port ioctl/<pp> ... } target ... { port ioctl/<pp>/<vp> ... Note: Most of this work was made by jceel@, thank you. Submitted by: jceel Reworked by: myself Reviewed by: mav (earlier versions and recently during the rework) Obtained from: FreeNAS and TrueOS Relnotes: Yes Sponsored by: iXsystems Inc. Differential Revision: https://reviews.freebsd.org/D9299 Notes: svn path=/head/; revision=333446
* Remove max_targets and max_target_id CTL port variables; they were unused.Edward Tomasz Napierala2017-01-221-2/+0
| | | | | | | | | This changes the CTL frontend ABI and thus shouldn't be MFC-ed. Reviewed by: mav@ Notes: svn path=/head/; revision=312651
* Add initial support for CTL module unloading.Alexander Motin2017-01-211-8/+10
| | | | | | | | | | | It is only a first step and not perfect, but better then nothing. The main blocker is CAM target frontend, that can not be unloaded, since CAM does not have mechanism to unregister periph driver now. MFC after: 2 weeks Notes: svn path=/head/; revision=312603
* Make CTL frontends report kern_data_resid for under-/overruns.Alexander Motin2017-01-161-18/+7
| | | | | | | | | | | | | | | | | It seems like kern_data_resid was never really implemented. This change finally does it. Now frontends update this field while transferring data, while CTL/backends getting it can more flexibly handle the result. At this point behavior should not change significantly, still reporting errors on write overrun, but that may be changed later, if we decide so. CAM target frontend still does not properly handle overruns due to CAM API limitations. We may need to add some fields to struct ccb_accept_tio to pass information about initiator requested transfer size(s). MFC after: 2 weeks Notes: svn path=/head/; revision=312291
* Add under-/overrun support to IOCTL and CAM SIM frontends.Alexander Motin2017-01-151-9/+15
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=312232
* sys/cam: spelling fixes in comments.Pedro F. Giffuni2016-04-291-1/+1
| | | | | | | No functional change. Notes: svn path=/head/; revision=298810
* Move ioctl frontend defines where they belong.Alexander Motin2015-09-261-0/+12
| | | | Notes: svn path=/head/; revision=288261
* Remove some dead code found by Clang analyzer.Alexander Motin2015-09-251-3/+0
| | | | Notes: svn path=/head/; revision=288221
* Remove couple excess SGLIST I/O flags.Alexander Motin2015-09-201-1/+1
| | | | | | | Those flags duplicated respective (sg_entries > 0) values. Notes: svn path=/head/; revision=288020
* Frontends don't need to set errors themselves.Alexander Motin2015-09-161-11/+4
| | | | Notes: svn path=/head/; revision=287860
* Reimplement CTL High Availability.Alexander Motin2015-09-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | CTL HA functionality was originally implemented by Copan many years ago, but large part of the sources was never published. This change includes clean room implementation of the missing code and fixes for many bugs. This code supports dual-node HA with ALUA in four modes: - Active/Unavailable without interlink between nodes; - Active/Standby with second node handling only basic LUN discovery and reservation, synchronizing with the first node through the interlink; - Active/Active with both nodes processing commands and accessing the backing storage, synchronizing with the first node through the interlink; - Active/Active with second node working as proxy, transfering all commands to the first node for execution through the interlink. Unlike original Copan's implementation, depending on specific hardware, this code uses simple custom TCP-based protocol for interlink. It has no authentication, so it should never be enabled on public interfaces. The code may still need some polishing, but generally it is functional. Relnotes: yes Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=287621
* Make most of port methods optional and remove bunch of dummies.Alexander Motin2015-09-011-34/+0
| | | | Notes: svn path=/head/; revision=287372
* Move "ioctl" CAM frontend into separate file.Alexander Motin2015-08-151-0/+470
It has nothing to share with too huge ctl.c other then device descriptor, but even that may be counted as design error that may be fixed later. At some point we may even want to have several ioctl ports. Notes: svn path=/head/; revision=286807