On Saturday November 12, [EMAIL PROTECTED] wrote:
> > Maybe the printer is very sensitive to timing and the extra time it
> > takes the HC to walk this pointers makes a difference???  I'm not sure
> > I believe that, but it is the only explanation I can come up with so
> > far.  Unfortunately it doesn't help me solve the real problem...
> > Is it possible to make fine adjustments to the clock that the HC uses?
> > (I know the USB is self clocked, and the gadget should just sync with
> > that, but something is definitely wrong, so I'm making wild guesses).
> 
> That sort of timing dependence really shouldn't exist.

No, and I think it doesn't.  I jumped to too many conclusions..

> 
> There's a parallel email thread with someone else at HP who's also seeing
> low performance.  He says it's because their servers have a large startup
> latency for executing requests, and this causes the FSBR timer to expire,
> making everything go very slowly.  You could try changing the IDLE_TIMEOUT
> value to something larger than 50 ms; maybe that will help.

Yes, I think changing the IDLE_TIMEOUT does help.
I think I now know enough about what is going on to decide that I have
a good-enough fix, and that it won't get any better (with either
berating HP to fix the printer, or using a USB2.0 interface).

It seems that the printer only accepts data packets during a small
window ever 112msecs or so.  It is vital that we hit that window to
get any sort of speed.

With the default timeout, we only through packets steadily at the
printer for about 100ms. After that, we drop down to 1 per msec which
makes the hit rate much worse.

So I've defined a new transfer_flag which disables the FSBR timeout,
and a printer quirk for my printer what sets this flag.
With this patch, I getting (barely) adequate performance - better than
2.4 and much better than standard 2.6.

Below is the patch - so if someone else has this problem they might
find the patch on the mailing list archives.

I'll leave it up to you to decide if it should be submitted to
mainline.

Thanks for your help.

NeilBrown



--- ./drivers/usb/class/usblp.c.orig    2005-11-10 14:31:40.000000000 +1100
+++ ./drivers/usb/class/usblp.c 2005-11-15 16:21:01.000000000 +1100
@@ -198,6 +198,7 @@
 
 #define USBLP_QUIRK_BIDIR      0x1     /* reports bidir but requires 
unidirectional mode (no INs/reads) */
 #define USBLP_QUIRK_USB_INIT   0x2     /* needs vendor USB init string */
+#define USBLP_QUIRK_SLOW       0x4     /* wierd HP-1022 is very slow even with 
depth-first */
 
 static struct quirk_printer_struct quirk_printers[] = {
        { 0x03f0, 0x0004, USBLP_QUIRK_BIDIR }, /* HP DeskJet 895C */
@@ -209,6 +210,7 @@
        { 0x03f0, 0x0604, USBLP_QUIRK_BIDIR }, /* HP DeskJet 840C */   
        { 0x03f0, 0x0804, USBLP_QUIRK_BIDIR }, /* HP DeskJet 816C */   
        { 0x03f0, 0x1104, USBLP_QUIRK_BIDIR }, /* HP Deskjet 959C */
+       { 0x03f0, 0x2c17, USBLP_QUIRK_BIDIR|USBLP_QUIRK_SLOW }, /* HP Laserjet 
1022 */
        { 0x0409, 0xefbe, USBLP_QUIRK_BIDIR }, /* NEC Picty900 (HP OEM) */
        { 0x0409, 0xbef4, USBLP_QUIRK_BIDIR }, /* NEC Picty760 (HP OEM) */
        { 0x0409, 0xf0be, USBLP_QUIRK_BIDIR }, /* NEC Picty920 (HP OEM) */
@@ -640,7 +642,9 @@
                                return writecount ? writecount : -EAGAIN;
                        }
 
-                       timeout = USBLP_WRITE_TIMEOUT;
+                       timeout = msecs_to_jiffies(USBLP_WRITE_TIMEOUT);
+                       if (usblp->quirks & USBLP_QUIRK_SLOW)
+                               timeout *= 10;
                        add_wait_queue(&usblp->wait, &wait);
                        while ( 1==1 ) {
 
@@ -919,6 +923,9 @@
                le16_to_cpu(dev->descriptor.idVendor),
                le16_to_cpu(dev->descriptor.idProduct));
 
+       if (usblp->quirks & USBLP_QUIRK_SLOW)
+               usblp->writeurb->transfer_flags |= URB_NO_TIMEOUT;
+
        /* Analyze and pick initial alternate settings and endpoints. */
        protocol = usblp_select_alts(usblp);
        if (protocol < 0) {
--- ./drivers/usb/core/urb.c.orig       2005-11-15 15:57:32.000000000 +1100
+++ ./drivers/usb/core/urb.c    2005-11-15 15:58:09.000000000 +1100
@@ -317,7 +317,7 @@
                        allowed |= URB_ZERO_PACKET;
                /* FALLTHROUGH */
        case PIPE_CONTROL:
-               allowed |= URB_NO_FSBR; /* only affects UHCI */
+               allowed |= URB_NO_FSBR | URB_NO_TIMEOUT; /* only affects UHCI */
                /* FALLTHROUGH */
        default:                        /* all non-iso endpoints */
                if (!is_out)
--- ./drivers/usb/host/uhci-q.c.orig    2005-11-10 17:02:40.000000000 +1100
+++ ./drivers/usb/host/uhci-q.c 2005-11-15 16:39:47.000000000 +1100
@@ -1408,7 +1408,7 @@
                 * TERM bit set) as well as we skip every so many TD's to
                 * make sure it doesn't hog the bandwidth
                 */
-               if (td->list.next != head && (count % DEPTH_INTERVAL) ==
+               if (td->list.next != head && (count % DEPTH_INTERVAL) !=
                                (DEPTH_INTERVAL - 1))
                        td->link |= UHCI_PTR_DEPTH;
 
@@ -1539,7 +1539,8 @@
                spin_lock(&u->lock);
 
                /* Check if the FSBR timed out */
-               if (up->fsbr && !up->fsbr_timeout && time_after_eq(jiffies, 
up->fsbrtime + IDLE_TIMEOUT))
+               if (up->fsbr && !(u->transfer_flags & URB_NO_TIMEOUT) &&
+                   !up->fsbr_timeout && time_after_eq(jiffies, up->fsbrtime + 
IDLE_TIMEOUT))
                        uhci_fsbr_timeout(uhci, u);
 
                spin_unlock(&u->lock);
--- ./include/linux/usb.h.orig  2005-11-14 22:50:45.000000000 +1100
+++ ./include/linux/usb.h       2005-11-15 15:58:24.000000000 +1100
@@ -616,6 +616,7 @@
 #define URB_ISO_ASAP           0x0002  /* iso-only, urb->start_frame ignored */
 #define URB_NO_TRANSFER_DMA_MAP        0x0004  /* urb->transfer_dma valid on 
submit */
 #define URB_NO_SETUP_DMA_MAP   0x0008  /* urb->setup_dma valid on submit */
+#define        URB_NO_TIMEOUT          0x0010  /* UHCI-Fixup-Specific */
 #define URB_NO_FSBR            0x0020  /* UHCI-specific */
 #define URB_ZERO_PACKET                0x0040  /* Finish bulk OUTs with short 
packet */
 #define URB_NO_INTERRUPT       0x0080  /* HINT: no non-error interrupt needed 
*/


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to