This adds in the KPC650 ID to the airprime driver. It also adds the
ability for the buffer size to be overridden from a driver before
calling usb_serial_probe() and sets this to 2KB in the airprime wrapper.
The reason for this is that on an EVDO provider, using the advertised
packet size of 64 bytes as the buffer size results in some pretty
slow downstream speeds. With the default buffer size one get a maximum
of 100-150kbps even in an EVDO serviced area. With a 2KB buffer size,
one gets the 400-1000ish kbps bandwidth that folks on "other OSes" get.

Using driver_data to override buffer_size may not be the best way,
but I didn't see any other convenient way to do it. I'm open to
suggestions here. Works fine for me on both the KPC650 and AirPrime
5220 cards.

Signed-off-by: Matt Porter <[EMAIL PROTECTED]>

diff --git a/drivers/usb/serial/airprime.c b/drivers/usb/serial/airprime.c
index dbf1f06..c49d6b6 100644
--- a/drivers/usb/serial/airprime.c
+++ b/drivers/usb/serial/airprime.c
@@ -15,16 +15,28 @@
 #include <linux/usb.h>
 #include "usb-serial.h"
 
+static int airprime_buffer_size = 2048;
+
 static struct usb_device_id id_table [] = {
        { USB_DEVICE(0xf3d, 0x0112) },  /* AirPrime CDMA Wireless PC Card */
        { USB_DEVICE(0x1410, 0x1110) }, /* Novatel Wireless Merlin CDMA */
+       { USB_DEVICE(0x0c88, 0x17da) }, /* Kyocera KPC650 CDMA */
        { },
 };
 MODULE_DEVICE_TABLE(usb, id_table);
 
+static int airprime_serial_probe(struct usb_interface *interface,
+                                       const struct usb_device_id *id)
+{
+       /* Set 2KB buffer size to improve downstream performance */
+       dev_set_drvdata(&interface->dev, &airprime_buffer_size);
+
+       return usb_serial_probe(interface, id);
+}
+
 static struct usb_driver airprime_driver = {
        .name =         "airprime",
-       .probe =        usb_serial_probe,
+       .probe =        airprime_serial_probe,
        .disconnect =   usb_serial_disconnect,
        .id_table =     id_table,
        .no_dynamic_id =        1,
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 097f4e8..fcbaac4 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -612,6 +612,7 @@ int usb_serial_probe(struct usb_interfac
        int retval;
        int minor;
        int buffer_size;
+       int *dbuffer_size;
        int i;
        int num_interrupt_in = 0;
        int num_interrupt_out = 0;
@@ -797,7 +798,10 @@ int usb_serial_probe(struct usb_interfac
                        dev_err(&interface->dev, "No free urbs available\n");
                        goto probe_error;
                }
-               buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
+               if ((dbuffer_size = dev_get_drvdata(&interface->dev)))
+                       buffer_size = *dbuffer_size;
+               else
+                       buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
                port->bulk_in_size = buffer_size;
                port->bulk_in_endpointAddress = endpoint->bEndpointAddress;
                port->bulk_in_buffer = kmalloc (buffer_size, GFP_KERNEL);


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
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