On Tue, Jul 30, 2002 at 09:29:09PM -0700, Matthew Dharm wrote:
> On Tue, Jul 30, 2002 at 09:40:12AM -0400, Douglas Gilbert wrote:
> > Matthew Dharm wrote:
> > >
> > > Out of curiosity... which value does the sg interface pass through? It
> > > collects both the buffer length and the requested transfer length, if my
> > > memory serves...
> >
> > Matt,
> > The sg driver does not attempt to decode SCSI commands (and,
> > for example, calculate allocation lengths) but simply passes
> > them through. In the sg_io_hdr interface what the user gives
> > as dxfer_len becomes the 4th argument to scsi_do_req() and
> > hence becomes Scsi_Request::sr_bufflen in the mid and lower
> > levels. The cumulative length of the elements in scatter gather
> > list built by sg (or the single buffer) is greater than or
> > equal to dxfer_len.
>
> Hrm....
>
> Are you saying then that the sum of the sg segments can be greater than the
> requested length?
>
> After some discussions with Linus and others, I was under the impression
> that this was a no-no...
Only if the last element in the list were allowed to be oversized.
Obviously, if element 2 in a 3 element list has a size that was larger
than it should be then the sg DMA code would end up dropping the data in
the wrong place. All the sizes on the sg segments up to the last one must
be exact, and then the last one could only be overly long, not short.
But, in practice, I think the real answer is that the length of all the
elements in the sg list == dxfer_len in all cases.
--
Doug Ledford <dledford@xxxxxxxxxx> 919-754-3700 x44233
Red Hat, Inc.
1801 Varsity Dr.
Raleigh, NC 27606
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
|