From: Yang Xiuwei <yangxiuwei@kylinos.cn>
To: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org,
io-uring@vger.kernel.org
Cc: fujita.tomonori@lab.ntt.co.jp, axboe@kernel.dk,
James.Bottomley@HansenPartnership.com,
martin.petersen@oracle.com, bvanassche@acm.org,
Yang Xiuwei <yangxiuwei@kylinos.cn>
Subject: [RFC PATCH v3 0/3] bsg: add io_uring command support for SCSI passthrough
Date: Fri, 16 Jan 2026 12:25:13 +0800 [thread overview]
Message-ID: <cover.1768536312.git.yangxiuwei@kylinos.cn> (raw)
In-Reply-To: <cover.1768439194.git.yangxiuwei@kylinos.cn>
This RFC series adds io_uring command support to the BSG (Block layer
SCSI Generic) driver, enabling asynchronous SCSI passthrough operations
with zero-copy support via fixed buffers.
The implementation follows the io_uring uring_cmd pattern used by other
drivers (e.g., nvme). A new bsg_uring_cmd structure fits within the 80-byte
cmd field of a 128-byte SQE, with 8 bytes reserved for future extensions.
The structure uses protocol-agnostic field names and follows the sg_io_v4
design with separate din_xferp/dout_xferp fields. SCSI status information
is returned in the CQE res2 field using a compact 64-bit encoding.
Currently only BSG_SUB_PROTOCOL_SCSI_CMD is implemented. Scatter/gather
I/O and bidirectional transfers are not yet supported.
The implementation has been tested with a user-space test program covering
basic SCSI commands (INQUIRY, READ CAPACITY, READ, WRITE), zero-copy mode,
and error handling.
Changes since v1:
-----------------
- Protocol-agnostic field names (request/request_len instead of cdb_addr/cdb_len)
- Removed __packed attribute for better code generation
- Reduced reserved space from 16 bytes to 8 bytes to fit within 80-byte SQE
Why v2 was superseded:
----------------------
v2 unified din_xferp/dout_xferp into a single xfer_addr field, which
diverged from the established sg_io_v4 interface. v3 reverts to separate
din_xferp/dout_xferp fields to maintain consistency with the existing
BSG interface.
Yang Xiuwei (3):
bsg: add bsg_uring_cmd uapi structure
bsg: add uring_cmd support to BSG generic layer
bsg: implement SCSI BSG uring_cmd handler
block/bsg.c | 66 ++++++++++++++
drivers/scsi/scsi_bsg.c | 192 +++++++++++++++++++++++++++++++++++++++
include/linux/bsg.h | 4 +
include/uapi/linux/bsg.h | 24 +++++
4 files changed, 286 insertions(+)
--
2.25.1
WARNING: multiple messages have this Message-ID (diff)
From: Yang Xiuwei <yangxiuwei@kylinos.cn>
To: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org,
io-uring@vger.kernel.org
Cc: fujita.tomonori@lab.ntt.co.jp, axboe@kernel.dk,
James.Bottomley@HansenPartnership.com,
martin.petersen@oracle.com, bvanassche@acm.org,
Yang Xiuwei <yangxiuwei@kylinos.cn>
Subject: [RFC PATCH v3 0/3] bsg: add io_uring command support for SCSI passthrough
Date: Fri, 16 Jan 2026 12:52:00 +0800 [thread overview]
Message-ID: <cover.1768536312.git.yangxiuwei@kylinos.cn> (raw)
Message-ID: <20260116045200.NP1GJHVkr-ViHveoOVFC5S9g5pGJZmtxqG3ZyUrTYhY@z> (raw)
This RFC series adds io_uring command support to the BSG (Block layer
SCSI Generic) driver, enabling asynchronous SCSI passthrough operations
with zero-copy support via fixed buffers.
The implementation follows the io_uring uring_cmd pattern used by other
drivers (e.g., nvme). A new bsg_uring_cmd structure fits within the 80-byte
cmd field of a 128-byte SQE, with 8 bytes reserved for future extensions.
The structure uses protocol-agnostic field names and follows the sg_io_v4
design with separate din_xferp/dout_xferp fields. SCSI status information
is returned in the CQE res2 field using a compact 64-bit encoding.
Currently only BSG_SUB_PROTOCOL_SCSI_CMD is implemented. Scatter/gather
I/O and bidirectional transfers are not yet supported.
The implementation has been tested with a user-space test program covering
basic SCSI commands (INQUIRY, READ CAPACITY, READ, WRITE), zero-copy mode,
and error handling.
Changes since v1:
-----------------
- Protocol-agnostic field names (request/request_len instead of cdb_addr/cdb_len)
- Removed __packed attribute for better code generation
- Reduced reserved space from 16 bytes to 8 bytes to fit within 80-byte SQE
Why v2 was superseded:
----------------------
v2 unified din_xferp/dout_xferp into a single xfer_addr field, which
diverged from the established sg_io_v4 interface. v3 reverts to separate
din_xferp/dout_xferp fields to maintain consistency with the existing
BSG interface.
Yang Xiuwei (3):
bsg: add bsg_uring_cmd uapi structure
bsg: add uring_cmd support to BSG generic layer
bsg: implement SCSI BSG uring_cmd handler
block/bsg.c | 66 ++++++++++++++
drivers/scsi/scsi_bsg.c | 192 +++++++++++++++++++++++++++++++++++++++
include/linux/bsg.h | 4 +
include/uapi/linux/bsg.h | 24 +++++
4 files changed, 286 insertions(+)
--
2.25.1
next prev parent reply other threads:[~2026-01-16 4:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-15 1:24 [RFC PATCH v2 0/3] bsg: add io_uring command support for SCSI passthrough Yang Xiuwei
2026-01-15 1:24 ` [RFC PATCH v2 1/3] bsg: add bsg_uring_cmd uapi structure Yang Xiuwei
2026-01-15 1:24 ` [RFC PATCH v2 2/3] bsg: add uring_cmd support to BSG generic layer Yang Xiuwei
2026-01-15 1:24 ` [RFC PATCH v2 3/3] bsg: implement SCSI BSG uring_cmd handler Yang Xiuwei
2026-01-16 4:25 ` Yang Xiuwei [this message]
2026-01-16 4:25 ` [RFC PATCH v3 1/3] bsg: add bsg_uring_cmd uapi structure Yang Xiuwei
2026-01-16 4:25 ` [RFC PATCH v3 2/3] bsg: add uring_cmd support to BSG generic layer Yang Xiuwei
2026-01-16 4:25 ` [RFC PATCH v3 3/3] bsg: implement SCSI BSG uring_cmd handler Yang Xiuwei
2026-01-16 4:52 ` [RFC PATCH v3 0/3] bsg: add io_uring command support for SCSI passthrough Yang Xiuwei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1768536312.git.yangxiuwei@kylinos.cn \
--to=yangxiuwei@kylinos.cn \
--cc=James.Bottomley@HansenPartnership.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=io-uring@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox