aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/iscsi
Commit message (Collapse)AuthorAgeFilesLines
...
* Add network QoS support for PCP to iscsi initiator.Richard Scheffenegger2020-10-241-1/+2
| | | | | | | | | | | | | | Make the Ethernet PCP codepoint configurable for L2 local traffic, to allow lower latency for iSCSI block IO. This addresses the initiator side only. Reviewed by: mav, trasz, bcr Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D26739 Notes: svn path=/head/; revision=367023
* Negotiate iSCSIProtocolLevel of 2 (RFC 7144) in initiator.Alexander Motin2020-10-224-4/+9
| | | | | | | | | | | It does not change anything immediately, but allows further support of Command Priority, Status Qualifier and new task management functions. MFC after: 1 month Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=366953
* If the SIM freezes the queue at exactly the wrong moment, afterEdward Tomasz Napierala2020-10-181-2/+13
| | | | | | | | | | | | | | | | | | | another thread has started to send in a CCB and already checked the queue wasn't frozen, we would end up with iscsi_action() being called despite the queue is now frozen. Add a check to make sure this doesn't happen . Perhaps this should be fixed at the CAM level instead, but given how the send queue and SIM are governed by two separate mutexes, it is somewhat hard to do. Reviewed by: imp, mav MFC after: 2 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D26750 Notes: svn path=/head/; revision=366812
* Add DSCP support for network QoS to iscsi initiator.Richard Scheffenegger2020-10-091-1/+2
| | | | | | | | | | | | | | | Allow the DSCP codepoint also to be configurable for the traffic in the direction from the initiator to the target, such that writes and any requests are also treated in the appropriate QoS class. Reviewed by: mav MFC after: 2 weeks Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D26714 Notes: svn path=/head/; revision=366573
* iscsi: clean up empty lines in .c and .h filesMateusz Guzik2020-09-013-6/+4
| | | | Notes: svn path=/head/; revision=365090
* Implement zero-copy iSCSI target transmission/read.Alexander Motin2020-06-084-40/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add ICL_NOCOPY flag to icl_pdu_append_data(), specifying that the method can just reference the data buffer instead of immediately copying it. Extend the offload KPI with optional PDU queue method, allowing to specify completion callback, called when all the data referenced by above has been transferred and won't be accessed any more (the buffers can be freed). Implement the above functionality in software iSCSI driver using mbufs with external storage and reference counter. Note that some NICs (ixl(4)) may keep the mbuf in TX queue for a long time, so CTL has to be ready. Add optional method to struct ctl_scsiio for buffer reference counting. Implement it for CTL block backend, allowing to delay free of the struct ctl_be_block_io and memory it references as needed. In first reincarnation of the patch I tried to delay whole I/O as it is done for FibreChannel, that was cleaner, but due to the above callback delays I had to rewrite it this way to not leave LUN referenced potentially for hours or more. All together on sequential read from ZFS ARC this saves about 30% of CPU time and memory bandwidth by avoiding one of 3 memory copies (the other two are from ZFS ARC to DMU cache and then from DMU cache to CTL buffers). On tests with 2x Xeon Silver 4114 this allows to reach full line rate of 100GigE NIC. Tests with Gold CPUs and two 100GigE NICs are stil TBD, but expectations to saturate them are pretty high. ;) Discussed with: Chelsio Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=361939
* Do not try to fill socket send buffer to the last byte.Alexander Motin2020-05-221-1/+2
| | | | | | | | | | | | | Setting so_snd.sb_lowat to at least 1/8 of the socket buffer size allows send thread more actively use PDUs coalescing, that dramatically reduces TCP lock congestion and number of context switches, when the socket is full and PDUs are small. MFC after: 1 week Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=361400
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (1 of many)Pawel Biernacki2020-02-152-2/+4
| | | | | | | | | | | | | | | r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes. This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags. Reviewed by: kib, trasz Approved by: kib (mentor) Differential Revision: https://reviews.freebsd.org/D23640 Notes: svn path=/head/; revision=357971
* Add KERNEL_PANICKED macro for use in place of direct panicstr testsMateusz Guzik2020-01-121-1/+1
| | | | Notes: svn path=/head/; revision=356655
* Separate kernel crc32() implementation to its own header (gsb_crc32.h) andXin LI2019-06-171-0/+1
| | | | | | | | | | | | | rename the source to gsb_crc32.c. This is a prerequisite of unifying kernel zlib instances. PR: 229763 Submitted by: Yoshihiro Ota <ota at j.email.ne.jp> Differential Revision: https://reviews.freebsd.org/D20193 Notes: svn path=/head/; revision=349151
* Extract eventfilter declarations to sys/_eventfilter.hConrad Meyer2019-05-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | This allows replacing "sys/eventfilter.h" includes with "sys/_eventfilter.h" in other header files (e.g., sys/{bus,conf,cpu}.h) and reduces header pollution substantially. EVENTHANDLER_DECLARE and EVENTHANDLER_LIST_DECLAREs were moved out of .c files into appropriate headers (e.g., sys/proc.h, powernv/opal.h). As a side effect of reduced header pollution, many .c files and headers no longer contain needed definitions. The remainder of the patch addresses adding appropriate includes to fix those files. LOCK_DEBUG and LOCK_FILE_LINE_ARG are moved to sys/_lock.h, as required by sys/mutex.h since r326106 (but silently protected by header pollution prior to this change). No functional change (intended). Of course, any out of tree modules that relied on header pollution for sys/eventhandler.h, sys/lock.h, or sys/mutex.h inclusion need to be fixed. __FreeBSD_version has been bumped. Notes: svn path=/head/; revision=347984
* Fix typo in a warning message.Edward Tomasz Napierala2018-03-141-2/+2
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=330937
* Check for duplicates when modifying an iSCSI session. Previously we didEdward Tomasz Napierala2018-03-101-1/+30
| | | | | | | | | | | this check on open, but "iscsictl -M", or an iSCSI redirect received by iscsid(8) could end up with two sessions with the same target name and portal. MFC after: 2 weeks Notes: svn path=/head/; revision=330740
* Add SPDX tags to iscsi(4).Edward Tomasz Napierala2018-01-243-0/+6
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=328341
* Move the DIAGNOSTIC check for lost iSCSI PDUs from icl_conn_close()Edward Tomasz Napierala2017-12-091-5/+5
| | | | | | | | | | | to icl_conn_free(). It's perfectly valid for the counter to be non-zero in the former. MFC after: 2 weeks Sponsored by: playkey.net Notes: svn path=/head/; revision=326730
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-276-0/+12
| | | | | | | | | | | | | | | 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
* Make sure the iSCSI I/O limits are set properly so that the ISCSIDSEND IOCTLHans Petter Selasky2017-11-232-0/+15
| | | | | | | | | | | | | can be used prior to the ISCSIDHANDOFF IOCTL which set the negotiated values. Else the login PDU will fail when passing the "-r" option to "iscsictl" which means iSCSI over RDMA instead of TCP/IP. Discussed with: np@ and trasz@ Sponsored by: Mellanox Technologies MFC after: 1 week Notes: svn path=/head/; revision=326127
* iscsi_shutdown_post: do nothing if panic-ingAndriy Gapon2017-10-241-2/+4
| | | | | | | | | | | There is nothing that that routine should or could really do in that context. Reported by: Ben RUBSON <ben.rubson@gmail.com> MFC after: 1 week Notes: svn path=/head/; revision=324957
* never retry oustanding requests when terminating iscsi sessionAndriy Gapon2017-10-171-10/+7
| | | | | | | | | | | | | | | | | CAM_REQ_ABORTED sounds natural for aborting outstanding requests when tearing down a session, but that status actually causes eligible requests to be tried again. That's completely useless, so let's use CAM_DEV_NOT_THERE instead. Perhaps there is a better status, but this should be good enough. The change should affect only the session termination. Tested by: Ben RUBSON <ben.rubson@gmail.com> Reviewed by: mav, trasz MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D12653 Notes: svn path=/head/; revision=324694
* iscsi: do not hold the global lock while tearing down a sessionAndriy Gapon2017-10-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It should be sufficient to hold the lock just for removing the session from the session list. Everything else should be covered by the session specific lock. On top of that, at present we can get a deadlock caused by waiting on the CAM SIM reference count while holding the global lock. A specific scenario involving ZFS is this: - concurrent termination of two sessions, S1 and S2 - session S1 completed all I/Os and sleeps in CAM waiting for device close by ZFS; - session S2 is also dead now, but can not forcefully complete outstanding requests by calling iscsi_session_cleanup() from iscsi_maintenance_thread_terminate(), since it can't get the same global sc_lock; - as soon as there are unfinished requests, ZFS can not do spa_config_enter() as writer, and so can not close the device for session S1; - deadlock. Reported by: Ben RUBSON <ben.rubson@gmail.com> Tested by: Ben RUBSON <ben.rubson@gmail.com> Reviewed by: mav, trasz MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D12652 Notes: svn path=/head/; revision=324689
* Listening sockets improvements.Gleb Smirnoff2017-06-081-51/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Separate fields of struct socket that belong to listening from fields that belong to normal dataflow, and unionize them. This shrinks the structure a bit. - Take out selinfo's from the socket buffers into the socket. The first reason is to support braindamaged scenario when a socket is added to kevent(2) and then listen(2) is cast on it. The second reason is that there is future plan to make socket buffers pluggable, so that for a dataflow socket a socket buffer can be changed, and in this case we also want to keep same selinfos through the lifetime of a socket. - Remove struct struct so_accf. Since now listening stuff no longer affects struct socket size, just move its fields into listening part of the union. - Provide sol_upcall field and enforce that so_upcall_set() may be called only on a dataflow socket, which has buffers, and for listening sockets provide solisten_upcall_set(). o Remove ACCEPT_LOCK() global. - Add a mutex to socket, to be used instead of socket buffer lock to lock fields of struct socket that don't belong to a socket buffer. - Allow to acquire two socket locks, but the first one must belong to a listening socket. - Make soref()/sorele() to use atomic(9). This allows in some situations to do soref() without owning socket lock. There is place for improvement here, it is possible to make sorele() also to lock optionally. - Most protocols aren't touched by this change, except UNIX local sockets. See below for more information. o Reduce copy-and-paste in kernel modules that accept connections from listening sockets: provide function solisten_dequeue(), and use it in the following modules: ctl(4), iscsi(4), ng_btsocket(4), ng_ksocket(4), infiniband, rpc. o UNIX local sockets. - Removal of ACCEPT_LOCK() global uncovered several races in the UNIX local sockets. Most races exist around spawning a new socket, when we are connecting to a local listening socket. To cover them, we need to hold locks on both PCBs when spawning a third one. This means holding them across sonewconn(). This creates a LOR between pcb locks and unp_list_lock. - To fix the new LOR, abandon the global unp_list_lock in favor of global unp_link_lock. Indeed, separating these two locks didn't provide us any extra parralelism in the UNIX sockets. - Now call into uipc_attach() may happen with unp_link_lock hold if, we are accepting, or without unp_link_lock in case if we are just creating a socket. - Another problem in UNIX sockets is that uipc_close() basicly did nothing for a listening socket. The vnode remained opened for connections. This is fixed by removing vnode in uipc_close(). Maybe the right way would be to do it for all sockets (not only listening), simply move the vnode teardown from uipc_detach() to uipc_close()? Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D9770 Notes: svn path=/head/; revision=319722
* Inline some trivial wrapper functions.Alexander Motin2017-03-021-64/+26
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=314555
* Renumber copyright clause 4Warner Losh2017-02-281-1/+1
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* Freeze CAM SIM when request is postponed due to MaxCmdSN.Alexander Motin2017-02-171-5/+10
| | | | | | | | | | This allows to avoid resource allocation (especially offload) for requests that can not be executed at this time any way. MFC after: 2 weeks Notes: svn path=/head/; revision=313852
* Fix tight loop spinning on postponed requests.Alexander Motin2017-02-171-6/+6
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=313851
* Fix handling of negative sbspace() return values.Alexander Motin2017-02-151-3/+3
| | | | | | | | | | | | I found that at least with Chelsio NICs TOE sockets quite often report negative sbspace() values. Using unsigned variable to store it resulted in attempts to aggregate too much data in one sosend() call, that caused errors and following connection termination. MFC after: 2 weeks Notes: svn path=/head/; revision=313779
* Directly call m_gethdr() instead of m_getm2() for BHS.Alexander Motin2017-02-141-2/+2
| | | | | | | | | | All this code is based on assumption that data will be stored in one piece, and since buffer size if known and fixed, it is easier to hardcode it. MFC after: 2 weeks Notes: svn path=/head/; revision=313739
* Temporary attach AHS to BHS to calculate header digest.Alexander Motin2017-02-141-3/+3
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=313738
* Do not rely on data alignment after m_pullup().Alexander Motin2017-02-141-35/+44
| | | | | | | | | | | | | | | | In general case m_pullup() does not really guarantee any data alignment. Instead of depenting on side effects caused by data being always copied out of mbuf cluster (which is probably a bug by itself), always allocate aligned BHS buffer and read data there directly from socket. While there, reuse new icl_conn_receive_buf() function to read digests. The code could probably be even more optimized to aggregate those reads, but until that done, this is still easier then the way it was before. MFC after: 2 weeks Notes: svn path=/head/; revision=313731
* Remove M_PKTHDR from m_getm2() in icl_pdu_append_data().Alexander Motin2017-02-131-1/+1
| | | | | | | | | | | ip_data_mbuf is always appended to ip_bhs_mbuf, so it does not need own packet header. This change first avoids allocation/initialization of the header, and then avoids dropping one when it later gets to socket buffer. MFC after: 2 weeks Notes: svn path=/head/; revision=313707
* Fix send/recv limit mixup.Navdeep Parhar2016-09-051-1/+1
| | | | Notes: svn path=/head/; revision=305445
* Make the iSCSI parameter negotiation more flexible.Navdeep Parhar2016-08-256-38/+92
| | | | | | | | | | | | | | | | | | | | | | Decouple the send and receive limits on the amount of data in a single iSCSI PDU. MaxRecvDataSegmentLength is declarative, not negotiated, and is direction-specific so there is no reason for both ends to limit themselves to the same min(initiator, target) value in both directions. Allow iSCSI drivers to report their send, receive, first burst, and max burst limits explicitly instead of using hardcoded values or trying to derive all of them from the receive limit (which was the only limit reported by the drivers prior to this change). Display the send and receive limits separately in the userspace iSCSI utilities. Reviewed by: jpaetzel@ (earlier version), trasz@ Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D7279 Notes: svn path=/head/; revision=304787
* Consistently use 'unsigned int' for session IDs.Edward Tomasz Napierala2016-06-091-3/+3
| | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=301726
* Add some spares to structs used by iscsi(4), to avoid ABI problemsEdward Tomasz Napierala2016-06-091-6/+8
| | | | | | | | | during 11-STABLE. MFC after: 1 month Notes: svn path=/head/; revision=301723
* Report negotiated MaxBurstLength and FirstBurstLength in "iscsictl -v"Edward Tomasz Napierala2016-06-052-1/+4
| | | | | | | | | and "ctladm islist -v" outputs. MFC after: 1 month Notes: svn path=/head/; revision=301437
* Add "iscsictl -e". Among other things, it makes it possible to performEdward Tomasz Napierala2016-05-312-5/+24
| | | | | | | | | | | | | | discovery without attaching to the targets ("iscsictl -Ad ... -e off"), and then attach to selected ones ("iscsictl -Mi ... -e on"). PR: 204129 MFC after: 1 month Relnotes: yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D6633 Notes: svn path=/head/; revision=301033
* Add a special case for iSER data tranfers.Edward Tomasz Napierala2016-05-261-0/+17
| | | | | | | | | Obtained from: Mellanox Technologies MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=300737
* Add kern.icl.iser_offloads sysctl.Edward Tomasz Napierala2016-05-241-1/+8
| | | | | | | | MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=300615
* Rename kern.icl.drivers to kern.icl.offloads, for consistency.Edward Tomasz Napierala2016-05-241-5/+5
| | | | | | | | MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=300593
* Add mechanism for choosing iSER-capable ICL modules.Edward Tomasz Napierala2016-05-244-27/+56
| | | | | | | | MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=300592
* Properly reset session state when using proxy and fail_on_disconnection=1.Edward Tomasz Napierala2016-05-211-0/+4
| | | | | | | | | | Without it the reconnection would fail due to mismatched sequence numbers. MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=300370
* Provide a way for ICL modules to declare they support PIM_UNMAPPED.Edward Tomasz Napierala2016-05-213-0/+10
| | | | | | | | MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=300369
* Pass maxtags value to the ICL module. iSER needs it.Edward Tomasz Napierala2016-05-212-2/+4
| | | | | | | | MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=300368
* Call the ICL module's handoff method even when using ICL proxy.Edward Tomasz Napierala2016-05-202-14/+27
| | | | | | | | | | The upcoming iSER code uses this. MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=300315
* Make ICL proxy use kernel code for handling iSCSI sequence numbersEdward Tomasz Napierala2016-05-191-5/+3
| | | | | | | | | | | for PDUs to/from iscsid(8). This fixes StatSN for Logout PDUs sent by iscsi_session_logout(). MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=300211
* Make it possible to interrupt proxy-mode iscsid receive.Edward Tomasz Napierala2016-05-191-2/+8
| | | | | | | | MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=300209
* Rename icl_proxy.c to icl_soft_proxy.c, to make it clear it's a partEdward Tomasz Napierala2016-05-172-1/+2
| | | | | | | | | | of software ICL backend. MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=300061
* Make iscsi_ioctl_daemon_send() actually work by adding missing locking.Edward Tomasz Napierala2016-05-171-0/+2
| | | | | | | | MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=300046
* Add icl_conn_connect() ICL method, required for iSER.Edward Tomasz Napierala2016-05-177-27/+52
| | | | | | | | | Obtained from: Mellanox Technologies (earlier version) MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=300044
* Extend the ICL interface to include the PDU pointer in the task_setupEdward Tomasz Napierala2016-05-174-10/+12
| | | | | | | | | | | method. This is required for upcoming iSER support. Obtained from: Mellanox Technologies (earlier version) MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=300040