Am Donnerstag, 17. Juni 2010 16:26:44 schrieb Alan Stern: > On Thu, 17 Jun 2010, Oliver Neukum wrote: > > > Am Donnerstag, 17. Juni 2010 05:41:24 schrieb David Brownell: > > > Oliver, I sill don't understand what you're > > > trying to say,or how it relates to the > > > structural point I was making: that the > > > batching isn'treally needed (or helpful) > > > given sane USB DMA/transfer queues > > > (as on Linux). > > > > OK, I see the problem. I doubt that batching is useless. I do agree > > it is useless on the host. But the device is most likely optimized > > for batches. So I doubt we can get optimum throughput without > > batching on the tx path. > > Oliver, it's hard to tell exactly what you mean. You haven't said > what sort of "batching" you want to do, or how the network packet > boundaries must be situated with respect to the USB packet boundaries. I am sorry. This must be my week of being bad at communicating. We were talking about an implementation of batching network packets for transfer used by NCM and possibly other drivers. Thus the requirements of NCM at least have to be met. Looking at chapter 3.1 of the NCM specification, it seems to me that a) the host must transfer all data associated with an NTH without short packets or ZLPs until the end b) after each short packet or ZLP a new NTH must be sent In addition if you look at chapter 3.3.4 of the NCM specification it is clear that the host must meet fairly arbitrary alignment requirements, which the device specifies at runtime. Now we are within the spec if we send out our data with an NTH, and NDH and a properly aligned datagramm. However some devices are likely to be optimized for the host not doing that. I was thinking about how we could do batching on the host side. It seems to me that we can trivially meet the requirements of the NCM specification by allocating a large buffer and copying the datagramms (most likely ethernet frames) with the proper alignment into the buffer and transfer it by means of one URB. The problem here, as David pointed out, is that we must copy each datagramm. Thus I thought about what we can do to avoid a copy. We can avoid a copy if and only if we can fit the NTH, NDH and padding for alignment into the buffer associated with the skb we are given. Whether this is possible is unknown, because the alignment is specified at runtime. In addition I was thinking about doing a single transfer with multiple URBs the way we do it for storage. That however, as we may not send short packets is possible only if we give each URB a buffer that is a multiple of the device's maximum packet size. And I wondered whether we can meet this requirement without a copy. What do you think? Regards Oliver -- 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