Lines Matching +full:existing +full:- +full:parts

19    2) Writing a user pass-through handler
29 TCM is another name for LIO, an in-kernel iSCSI target (server).
30 Existing TCM targets run in the kernel. TCMU (TCM in Userspace)
34 The existing kernel provides modules for different SCSI transport
35 protocols. TCM also modularizes the data storage. There are existing
38 built-in modules are implemented entirely as kernel code.
41 ----------
52 use case that other non-kernel target solutions, such as tgt, are able
55 in these non-traditional networked storage systems, while still only
65 kernel, another approach is to create a userspace pass-through
70 --------
83 ------------------
85 - Good performance: high throughput, low latency
86 - Cleanly handle if userspace:
93 - Allow future flexibility in user & kernel implementations
94 - Be reasonably memory-efficient
95 - Simple to configure & run
96 - Simple to write a userspace backend
100 -----------------------
107 TCMU uses the pre-existing UIO subsystem. UIO allows device driver
110 memory-mapped layout designed for SCSI commands. Using UIO also
123 -----------
131 version - 1 (userspace should abort if otherwise)
134 - TCMU_MAILBOX_FLAG_CAP_OOOC:
135 indicates out-of-order completion is supported.
152 ----------------
158 signals the kernel via a 4-byte write(). When cmd_head equals
159 cmd_tail, the ring is empty -- no commands are currently waiting to be
162 TCMU commands are 8-byte aligned. They start with a common header
163 containing "len_op", a 32-bit value that stores the length, as well as
175 entries in iov[] needed to describe either the Data-In or Data-Out
177 entries cover the Data-Out area, and iov_bidi_cnt specifies how many
178 iovec entries immediately after that in iov[] cover the Data-In
185 kernel via the UIO method, a 4-byte write to the file descriptor.
187 If TCMU_MAILBOX_FLAG_CAP_OOOC is set for mailbox->flags, kernel is
188 capable of handling out-of-order completions. In this case, userspace can
191 ring, userspace need to update the cmd->id when completing the
194 When the opcode is PAD, userspace only updates cmd_tail as above --
195 it's a no-op. (The kernel inserts PAD entries to ensure each CMD entry
204 -------------
206 This is shared-memory space after the command ring. The organization
208 should access only the parts referenced by pending iovs.
212 ----------------
220 tcm-user/<hba_num>/<device_name>/<subtype>/<path>
222 where "tcm-user" is common for all TCMU-backed UIO devices. <hba_num>
232 <subtype> will be a userspace-process-unique string to identify the
234 will be an additional handler-specific string for the user process to
248 -------------
251 over netlink, using a generic netlink family name of "TCM-USER" and a
260 -------------------
264 - TCMU will post commands, and then abort them after a timeout period
269 - It is still possible to restart and re-connect to TCMU
275 - The kernel will abort pending tasks after a timeout period.
279 - The process can trivially break the handling of devices it controls,
284 Writing a user pass-through handler (with example code)
296 First, consider instead writing a plugin for tcmu-runner. tcmu-runner
297 implements all of this, and provides a higher-level API for plugin
316 buf[ret-1] = '\0'; /* null-terminate and chop off the \n */
319 if (strncmp(buf, "tcm-user", 8))
320 exit(-1);
327 str_buf[ret-1] = '\0'; /* null-terminate and chop off the \n */
353 struct tcmu_cmd_entry *ent = (void *) mb + mb->cmdr_off + mb->cmd_tail;
357 while (ent != (void *)mb + mb->cmdr_off + mb->cmd_head) {
359 if (tcmu_hdr_get_op(ent->hdr.len_op) == TCMU_OP_CMD) {
360 uint8_t *cdb = (void *)mb + ent->req.cdb_off;
368 ent->rsp.scsi_status = SCSI_NO_SENSE;
370 /* Also fill in rsp->sense_buffer here */
371 ent->rsp.scsi_status = SCSI_CHECK_CONDITION;
374 else if (tcmu_hdr_get_op(ent->hdr.len_op) != TCMU_OP_PAD) {
376 ent->hdr.uflags |= TCMU_UFLAG_UNKNOWN_OP;
383 mb->cmd_tail = (mb->cmd_tail + tcmu_hdr_get_len(&ent->hdr)) % mb->cmdr_size;
384 ent = (void *) mb + mb->cmdr_off + mb->cmd_tail;