diff options
author | Johan Hovold <jhovold@gmail.com> | 2010-05-05 17:57:37 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-20 16:21:42 -0400 |
commit | 27c7acf22047fbe4ec4cc36b7c2610dba227697c (patch) | |
tree | c0a8f217fc2d7a302b4d2e084bb126e825006ca4 /include | |
parent | 4272568b3dd8dbad36014a107c0fbbef6400c917 (diff) |
USB: serial: reimplement generic fifo-based writes
Reimplement fifo-based writes in the generic driver using a multiple
pre-allocated urb scheme.
In contrast to multi-urb writes, no allocations (of urbs or buffers) are
made during run-time and there is less pressure on the host stack
queues as currently only two urbs are used (implementation is generic
and can handle more than two urbs as well, though).
Initial tests using ftdi_sio show that the implementation achieves the
same (maximum) throughput at high baudrates as multi-urb writes. The CPU
usage is much lower than for multi-urb writes for small write requests
and only slightly higher for large (e.g. 2k) requests (due to extra copy
via fifo?).
Also outperforms multi-urb writes for small write requests on an
embedded arm-9 system, where multi-urb writes are CPU-bound at high
baudrates (perf reveals that a lot of time is spent in the host stack
enqueue function -- could perhaps be a bug as well).
Keeping the original write_urb, buffer and flag for now as there are
other drivers depending on them.
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/usb/serial.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index a4c99ea390e7..70b6d6b28997 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
@@ -35,6 +35,9 @@ enum port_dev_state { | |||
35 | PORT_UNREGISTERING, | 35 | PORT_UNREGISTERING, |
36 | }; | 36 | }; |
37 | 37 | ||
38 | /* USB serial flags */ | ||
39 | #define USB_SERIAL_WRITE_BUSY 0 | ||
40 | |||
38 | /** | 41 | /** |
39 | * usb_serial_port: structure for the specific ports of a device. | 42 | * usb_serial_port: structure for the specific ports of a device. |
40 | * @serial: pointer back to the struct usb_serial owner of this port. | 43 | * @serial: pointer back to the struct usb_serial owner of this port. |
@@ -60,10 +63,14 @@ enum port_dev_state { | |||
60 | * @write_urb: pointer to the bulk out struct urb for this port. | 63 | * @write_urb: pointer to the bulk out struct urb for this port. |
61 | * @write_fifo: kfifo used to buffer outgoing data | 64 | * @write_fifo: kfifo used to buffer outgoing data |
62 | * @write_urb_busy: port`s writing status | 65 | * @write_urb_busy: port`s writing status |
66 | * @bulk_out_buffers: pointers to the bulk out buffers for this port | ||
67 | * @write_urbs: pointers to the bulk out urbs for this port | ||
68 | * @write_urbs_free: status bitmap the for bulk out urbs | ||
63 | * @tx_bytes: number of bytes currently in host stack queues | 69 | * @tx_bytes: number of bytes currently in host stack queues |
64 | * @tx_urbs: number of urbs currently in host stack queues | 70 | * @tx_urbs: number of urbs currently in host stack queues |
65 | * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this | 71 | * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this |
66 | * port. | 72 | * port. |
73 | * @flags: usb serial port flags | ||
67 | * @write_wait: a wait_queue_head_t used by the port. | 74 | * @write_wait: a wait_queue_head_t used by the port. |
68 | * @work: work queue entry for the line discipline waking up. | 75 | * @work: work queue entry for the line discipline waking up. |
69 | * @throttled: nonzero if the read urb is inactive to throttle the device | 76 | * @throttled: nonzero if the read urb is inactive to throttle the device |
@@ -98,11 +105,16 @@ struct usb_serial_port { | |||
98 | struct urb *write_urb; | 105 | struct urb *write_urb; |
99 | struct kfifo write_fifo; | 106 | struct kfifo write_fifo; |
100 | int write_urb_busy; | 107 | int write_urb_busy; |
108 | |||
109 | unsigned char *bulk_out_buffers[2]; | ||
110 | struct urb *write_urbs[2]; | ||
111 | unsigned long write_urbs_free; | ||
101 | __u8 bulk_out_endpointAddress; | 112 | __u8 bulk_out_endpointAddress; |
102 | 113 | ||
103 | int tx_bytes; | 114 | int tx_bytes; |
104 | int tx_urbs; | 115 | int tx_urbs; |
105 | 116 | ||
117 | unsigned long flags; | ||
106 | wait_queue_head_t write_wait; | 118 | wait_queue_head_t write_wait; |
107 | struct work_struct work; | 119 | struct work_struct work; |
108 | char throttled; | 120 | char throttled; |