public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Dharm <mdharm-scsi@one-eyed-alien.net>
To: USB Developers <linux-usb-devel@lists.sourceforge.net>,
	Linux SCSI list <linux-scsi@vger.kernel.org>,
	USB Storage List <usb-storage@one-eyed-alien.net>
Subject: st.ko with usb-storage problems
Date: Sun, 14 Sep 2003 17:41:04 -0700	[thread overview]
Message-ID: <20030914174104.A20722@one-eyed-alien.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 1797 bytes --]

(NOTE: Cross-posted to several lists.  Watch your replies.)

For a while now in 2.5 and 2.6, I've been getting reports of an
incompatibility between st.ko and the usb-storage driver.  I've finally
managed to figure out the problem; it only affects certain hardware, and
only on certain operations.

USB is a packet-oriented protocol.  Important to the protocol is the
concept of a packet being full or not -- in a given transfer, all packets
should be full except the last one.  Since usb-storage maps the SCSI
command's scatter-gather list for direct I/O, each scatter-gather segment
(except for the last one) must be a multiple of the packet size.  That
value can vary, but is always a power of 2 (I've personally seen up to
512 bytes).

When st.ko goes to do a read, it will create a scatter-gather list with
(what looks like) a mapping of the user-space buffer.  This often results
in not-so-nicely sized segments, which are often a multiple of 8, but not
64, 128, or 512 (which are the common USB packet sizes).  This causes a
problem for the USB host-controller hardware, and the transfer fails.

Why this doesn't happen on a write is something of a mystery to me, but it
doesn't seem to happen.

If the module flag 'try_direct_io' is set to 0 (not the default), then
st.ko doesn't generate scatter-gather lists at all, and all is well.

It's not immediately clear to me how to fix this.  First, I need to figure
out why 2.4 kernels don't show this problem, I think.  Help from people who
understand st.ko would be appreciated.

Matt

-- 
Matthew Dharm                              Home: mdharm-usb@one-eyed-alien.net 
Maintainer, Linux USB Mass Storage Driver

THEY CASTRATED MY QUAKE BITS! I WANT THEM BACK!!!!
					-- Greg
User Friendly, 3/27/1998

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

             reply	other threads:[~2003-09-15  0:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-15  0:41 Matthew Dharm [this message]
2003-09-15 18:08 ` st.ko with usb-storage problems Kai Makisara
2003-09-15 19:52   ` serial_number and serial_number_at_timeout in 2.4 Charlie Brett
2003-09-15 21:09     ` Mike Anderson
2003-09-16 14:08       ` Charlie Brett

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=20030914174104.A20722@one-eyed-alien.net \
    --to=mdharm-scsi@one-eyed-alien.net \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=usb-storage@one-eyed-alien.net \
    /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