History

scsi: target: tcmu: Add new feature KEEP_BUF

When running command pipelining for WRITE direction commands (e.g. tape device write), userspace sends cmd completion to cmd ring before processing write data. In that case userspace has to copy data before sending completion, because cmd completion also implicitly releases the data buffer in data area. The new feature KEEP_BUF allows userspace to optionally keep the buffer after completion by setting new bit TCMU_UFLAG_KEEP_BUF in tcmu_cmd_entry_hdr->uflags. In that case buffer has to be released explicitly by writing the cmd_id to new action item free_kept_buf. All kept buffers are released during reset_ring and if userspace closes uio device (tcmu_release).

Bodo Stroesser committed 5 years ago

Commit 018c1491 parent c11a1ae2 files · +141 −11Browse files

Showing the changes to include/uapi (1 of 2 files). Show all

Unified · Split

include/uapi/linux/target_core_user.h+2−0
@@ -46,6 +46,7 @@ · 45 unmodified lines
4646 #define TCMU_MAILBOX_FLAG_CAP_OOOC (1 << 0) /* Out-of-order completions */
4747 #define TCMU_MAILBOX_FLAG_CAP_READ_LEN (1 << 1) /* Read data length */
4848 #define TCMU_MAILBOX_FLAG_CAP_TMR (1 << 2) /* TMR notifications */
49+#define TCMU_MAILBOX_FLAG_CAP_KEEP_BUF (1<<3) /* Keep buf after cmd completion */
4950
5051 struct tcmu_mailbox {
5152 __u16 version;
@@ -75,6 +76,7 @@ struct tcmu_cmd_entry_hdr { · 23 unmodified lines
7576 __u8 kflags;
7677 #define TCMU_UFLAG_UNKNOWN_OP 0x1
7778 #define TCMU_UFLAG_READ_LEN 0x2
79+#define TCMU_UFLAG_KEEP_BUF 0x4
7880 __u8 uflags;
7981
8082 } __packed;