aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb.h
diff options
context:
space:
mode:
authorMing Lei <ming.lei@canonical.com>2013-08-08 09:48:22 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-08-12 14:56:16 -0400
commitbcc48f1a7a0d40ae2e5a26aff72c2b674fd8b596 (patch)
tree887e24d1dc2f7701dae13ec2d071ee71cdddccdc /include/linux/usb.h
parent428aac8a81058e2303677a8fbf26670229e51d3a (diff)
USB: introduce usb_device_no_sg_constraint() helper
Some host controllers(such as xHCI) can support building packet from discontinuous buffers, so introduce one flag and helper for this kind of host controllers, then the feature can help some applications(such as usbnet) by supporting arbitrary length of sg buffers. Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Ming Lei <ming.lei@canonical.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/usb.h')
-rw-r--r--include/linux/usb.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h
index acb1b0aa77d8..001629cd1a97 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -337,6 +337,7 @@ struct usb_bus {
337 * the ep queue on a short transfer 337 * the ep queue on a short transfer
338 * with the URB_SHORT_NOT_OK flag set. 338 * with the URB_SHORT_NOT_OK flag set.
339 */ 339 */
340 unsigned no_sg_constraint:1; /* no sg constraint */
340 unsigned sg_tablesize; /* 0 or largest number of sg list entries */ 341 unsigned sg_tablesize; /* 0 or largest number of sg list entries */
341 342
342 int devnum_next; /* Next open device number in 343 int devnum_next; /* Next open device number in
@@ -684,6 +685,11 @@ static inline bool usb_device_supports_ltm(struct usb_device *udev)
684 return udev->bos->ss_cap->bmAttributes & USB_LTM_SUPPORT; 685 return udev->bos->ss_cap->bmAttributes & USB_LTM_SUPPORT;
685} 686}
686 687
688static inline bool usb_device_no_sg_constraint(struct usb_device *udev)
689{
690 return udev && udev->bus && udev->bus->no_sg_constraint;
691}
692
687 693
688/*-------------------------------------------------------------------------*/ 694/*-------------------------------------------------------------------------*/
689 695
@@ -1253,7 +1259,7 @@ typedef void (*usb_complete_t)(struct urb *);
1253 * transfer_buffer. 1259 * transfer_buffer.
1254 * @sg: scatter gather buffer list, the buffer size of each element in 1260 * @sg: scatter gather buffer list, the buffer size of each element in
1255 * the list (except the last) must be divisible by the endpoint's 1261 * the list (except the last) must be divisible by the endpoint's
1256 * max packet size 1262 * max packet size if no_sg_constraint isn't set in 'struct usb_bus'
1257 * @num_mapped_sgs: (internal) number of mapped sg entries 1263 * @num_mapped_sgs: (internal) number of mapped sg entries
1258 * @num_sgs: number of entries in the sg list 1264 * @num_sgs: number of entries in the sg list
1259 * @transfer_buffer_length: How big is transfer_buffer. The transfer may 1265 * @transfer_buffer_length: How big is transfer_buffer. The transfer may