[Stgt-devel] [PATCH 04/20] iser bidi alloc read buf

FUJITA Tomonori tomof
Tue Nov 13 16:14:33 CET 2007

On Mon, 12 Nov 2007 23:14:34 +0900
FUJITA Tomonori <tomof at acm.org> wrote:

> On Tue, 16 Oct 2007 11:19:03 -0400
> Pete Wyckoff <pw at osc.edu> wrote:
> > Allocate the read buffer for bidirectional commands in the transport to
> > pass down to devices.  A device can fill and return this buffer in
> > task->uaddr, and thus choose to do the read or write processing in any
> > order.  Unfortunately, this allocation can not be combined with the task
> > and task->data allocation as the bidi read size is not known until after
> > AHS processing.
> I've been cleaning up the code in preparation for bidi. For exmaple,
> moving bidi stuff in iscsi_task (read_len, write_len, and
> data_direction) to scsi_cmd so that everyone can use bidi.
> I'll add bidi support like this when I finish the preparation.

I've not added bidi support to iSCSI but the core SCSI code should be
ready for bidi.

I killed data like uaddr and len, which work only for uni, and
added scsi_data_buffer structure like this:

struct scsi_data_buffer {
	int resid;
	uint32_t length;
	uint64_t buffer;

struct scsi_cmd {
	enum data_direction data_dir;
	struct scsi_data_buffer in_sdb;
	struct scsi_data_buffer out_sdb;

As I explained yesterday, scsi device code (like sbc) doesn't allocate
or free buffer for data transfer any more. LLDs do.

For uni, LLDs are expected to allocate buffer and use a pair of
scsi_set_in_buffer and scsi_set_in_length for reads or a pair of
scsi_set_out_buffer and scsi_set_out_length for writes. For bidi, LLDs
use both pairs. It's pretty straightforward.

More information about the stgt mailing list