Re: HCD sg_tablesize

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 10 Apr 2010, Ramya Desai wrote:

> On Fri, Apr 9, 2010 at 9:14 PM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> > On Fri, 9 Apr 2010, Sarah Sharp wrote:
> >
> >> > However there's nothing wrong with capping things at some reasonable
> >> > size.  If someone tries to submit a request that violates the driver's
> >> > specified limit, it's their own fault.  Was Ramya's very large transfer
> >> > a single bulk URB?  Did it use scatter-gather?
> >>
> >> Yes, Ramya's transfer was one URB with a scatter-gather list of ~120
> >> entries.  He was working on a UASP driver that sets the max_sectors
> >> field in scsi_host_template to 960 or 1024, which makes some of the
> >> sglists very large.
> >
> > Then his driver is buggy.  It should limit the length of scatter-gather
> > lists allowed by the host according to what the HCD can support, the
> > way usb-storage does:
> >
> >        host->sg_tablesize = usb_stor_sg_tablesize(intf);
> 
> Dear Alan,
> 
> My device is a UASP device, however I am testing the default usb
> storage driver for maximum transfer buffer sizes as my device supports
> upto 1 MB transfer buffer sizes. There is a thread about the "Maximum
> data size in a single transfer for MS driver", which we have discussed
> in the month February, 2010. The link for the thread is as follows.
> http://marc.info/?t=126641036700002&r=3&w=2
> 
> NOTE: As we discussed in the above thread, the function, named
> store_max_sectors, has changed in 2.6.34-rc2 kernel version.

That should not have made any difference.  We are talking about
sg_tablesize, not max_sectors.  In xhci-pci.c, sg_tablesize is set to
TRBS_PER_SEGMENT - 1, or 63.  Therefore it should not be possible for
you to receive a transfer request containing more than 63 scatterlist
elements.  But Sarah said (see above) that you submitted a request with
~120 elements.  This means something is wrong somewhere.

> I checked out the 2.6.34-rc2 kernel version from Sarah Sharp git as it
> supports the streams. Then, I tested my UASP device for default usb
> storage driver for 960 sectors. The xhci-large-tx branch, in Sarah
> Sharp git, has every thing set properly like max-sectors in the host
> template is set to 960. So, I did NOT change any thing and I am NOT
> using the UASP driver for testing the maximum sectors (960 or 1024
> sector transfer buffer sizes) issue. I am using only default usb
> storage driver for testing the maximum sectors like 960 or 1024 issue.

The max_sectors value has nothing to do with the problem we are 
discussing.  Number of sectors != number of scatterlist elements.  
The two are related, but they are not the same thing.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux