Add the bsg_uring_cmd structure to the BSG UAPI header to support io_uring-based SCSI passthrough operations via IORING_OP_URING_CMD. This structure is designed to work with 128-byte SQE (IO_URING_F_SQE128) and provides a compact interface similar to sg_io_v4, but optimized for io_uring's async I/O model. The structure is packed to fit within the 80-byte cmd field of a 128-byte SQE, with 16 bytes reserved for future extensions. Key features: - CDB address and length for SCSI command passthrough - Protocol and subprotocol identifiers (BSG_PROTOCOL_SCSI) - Data transfer parameters supporting both flat buffers and iovec arrays - Sense data buffer information for error reporting - Timeout and flags for command control Signed-off-by: Yang Xiuwei diff --git a/include/uapi/linux/bsg.h b/include/uapi/linux/bsg.h index cd6302def5ed..24b08fece509 100644 --- a/include/uapi/linux/bsg.h +++ b/include/uapi/linux/bsg.h @@ -63,5 +63,23 @@ struct sg_io_v4 { __u32 padding; }; +struct bsg_uring_cmd { + __u64 cdb_addr; + __u8 cdb_len; + __u8 protocol; /* [i] protocol type (BSG_PROTOCOL_*) */ + __u8 subprotocol; /* [i] subprotocol type (BSG_SUB_PROTOCOL_*) */ + __u8 reserved1; + __u32 din_iovec_count; /* [i] 0 -> flat din transfer else + * din_xferp points to array of iovec + */ + __u32 din_xfer_len; /* [i] bytes to be transferred from device */ + __u64 din_xferp; /* [i] data in buffer address or iovec array + * address + */ + __u32 dout_iovec_count; /* [i] 0 -> flat dout transfer else + * dout_xferp points to array of iovec + */ + __u32 dout_xfer_len; /* [i] bytes to be transferred to device */ + __u64 dout_xferp; /* [i] data out buffer address or iovec array address */ + __u32 sense_len; + __u64 sense_addr; + __u32 timeout_ms; + __u32 flags; /* [i] bit mask (BSG_FLAG_*) - reserved for future use */ + __u8 reserved[16]; /* reserved for future extension */ +} __packed; #endif /* _UAPIBSG_H */ -- 2.25.1