On Thu, 28 Jun 2012, Hans de Goede wrote: > When using urb->transfer_buffer we need to allocate physical contiguous buffers > for the entire transfer, which is pretty much guaranteed to fail with large > transfers. > > Currently userspace works around this by breaking large transfers into > multiple urbs. This leads to all kind of complications. This patch makes > it possible for userspace to reliable submit large transfers to scatter-gather > capable host controllers in one go, by using a scatterlist to break the > transfer up in managable chunks. This looks quite good. You tested it with various sizes of URBs? One possible enhancement would be to try allocating storage in units larger than 16 KB, with fallback to smaller sizes when the larger allocations fail. However your code is just as good as the existing mechanism. > +static void snoop_urb_data(struct urb *urb, unsigned len) > +{ > + int i, size; > + > + if (!usbfs_snoop) > + return; > + > + if (urb->num_sgs == 0) { > + print_hex_dump(KERN_DEBUG, "data: ", DUMP_PREFIX_NONE, 32, 1, > + urb->transfer_buffer, len, 1); > + return; > + } > + > + for (i = 0; i < urb->num_sgs && len; i++) { > + size = (len > USB_SG_SIZE) ? USB_SG_SIZE : len; > + print_hex_dump(KERN_DEBUG, "data: ", DUMP_PREFIX_NONE, 32, 1, > + sg_virt(&urb->sg[i]), size, 1); > + len -= size; > + } > +} Why didn't you just merge this directly into snoop_urb? Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html