This patch attempts to improve the situation with Genesys Logic chipsets by
reducing the throughput when they are used in high-speed mode.

Greg, please apply.

Matt

----- Forwarded message from Alan Stern <[EMAIL PROTECTED]> -----

Date: Wed, 25 Feb 2004 09:55:05 -0500 (EST)
From: Alan Stern <[EMAIL PROTECTED]>
Subject: PATCH: (as202b)  Revision of as202, Genesys quirk patch
To: Matthew Dharm <[EMAIL PROTECTED]>
cc: USB Storage List <[EMAIL PROTECTED]>
X-Spam-Status: No, hits=-3.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham 
        version=2.63

Matt:

In the slave_configure routine it's already too late for the host's 
max_sector value to affect the scsi_device.  It's necessary to set the 
queue value directly.  This revised patch takes care of that.

Alan Stern


===== scsiglue.c 1.70 vs edited =====
--- 1.70/drivers/usb/storage/scsiglue.c Fri Jan 30 22:02:35 2004
+++ edited/drivers/usb/storage/scsiglue.c       Wed Feb 25 09:49:27 2004
@@ -64,8 +64,10 @@
        return "SCSI emulation for USB Mass Storage devices";
 }
 
-static int slave_configure (struct scsi_device *sdev)
+static int slave_configure(struct scsi_device *sdev)
 {
+       struct us_data *us = (struct us_data *) sdev->host->hostdata[0];
+
        /* Scatter-gather buffers (all but the last) must have a length
         * divisible by the bulk maxpacket size.  Otherwise a data packet
         * would end up being short, causing a premature end to the data
@@ -75,6 +77,16 @@
         * have the desired effect because, except at the beginning and
         * the end, scatter-gather buffers follow page boundaries. */
        blk_queue_dma_alignment(sdev->request_queue, (512 - 1));
+
+       /* Devices using Genesys Logic chips cause a lot of trouble for
+        * high-speed transfers; they die unpredictably when given more
+        * than 64 KB of data at a time.  If we detect such a device,
+        * reduce the maximum transfer size to 64 KB = 128 sectors. */
+
+#define USB_VENDOR_ID_GENESYS  0x05e3          // Needs a standard location
+       if (us->pusb_dev->descriptor.idVendor == USB_VENDOR_ID_GENESYS &&
+                       us->pusb_dev->speed == USB_SPEED_HIGH)
+               blk_queue_max_sectors(sdev->request_queue, 128);
 
        /* this is to satisify the compiler, tho I don't think the 
         * return code is ever checked anywhere. */

----- End forwarded message -----

-- 
Matthew Dharm                              Home: [EMAIL PROTECTED] 
Maintainer, Linux USB Mass Storage Driver

It was a new hope.
                                        -- Dust Puppy
User Friendly, 12/25/1998

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to