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
46#define TCMU_MAILBOX_FLAG_CAP_OOOC (1 << 0) /* Out-of-order completions */46#define TCMU_MAILBOX_FLAG_CAP_OOOC (1 << 0) /* Out-of-order completions */
47#define TCMU_MAILBOX_FLAG_CAP_READ_LEN (1 << 1) /* Read data length */47#define TCMU_MAILBOX_FLAG_CAP_READ_LEN (1 << 1) /* Read data length */
48#define TCMU_MAILBOX_FLAG_CAP_TMR (1 << 2) /* TMR notifications */48#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 */
49 50
50struct tcmu_mailbox {51struct tcmu_mailbox {
51 __u16 version;52 __u16 version;
@@ -75,6 +76,7 @@ struct tcmu_cmd_entry_hdr { · 23 unmodified lines
75 __u8 kflags;76 __u8 kflags;
76#define TCMU_UFLAG_UNKNOWN_OP 0x177#define TCMU_UFLAG_UNKNOWN_OP 0x1
77#define TCMU_UFLAG_READ_LEN 0x278#define TCMU_UFLAG_READ_LEN 0x2
79#define TCMU_UFLAG_KEEP_BUF 0x4
78 __u8 uflags;80 __u8 uflags;
79 81
80} __packed;82} __packed;