From owner-freebsd-current Sat Dec 15 15:34: 7 2001 Delivered-To: freebsd-current@freebsd.org Received: from arg1.demon.co.uk (arg1.demon.co.uk [62.49.12.213]) by hub.freebsd.org (Postfix) with ESMTP id 5FA5737B405 for ; Sat, 15 Dec 2001 15:34:03 -0800 (PST) Received: by arg1.demon.co.uk (Postfix, from userid 300) id 626C99B32; Sat, 15 Dec 2001 23:34:02 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by arg1.demon.co.uk (Postfix) with ESMTP id 5943C5D25 for ; Sat, 15 Dec 2001 23:34:02 +0000 (GMT) Date: Sat, 15 Dec 2001 23:34:02 +0000 (GMT) From: Andrew Gordon X-X-Sender: To: Subject: USB - bulk data scheduling in UHCI Message-ID: <20011215232018.M49085-200000@server.arg.sj.co.uk> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-634534852-1008459242=:49085" Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. --0-634534852-1008459242=:49085 Content-Type: TEXT/PLAIN; charset=US-ASCII The current UHCI driver constructs the bulk transfer queue as a simple list with a 'terminate' marker on the end. This means that the bulk queue runs only once per frame period. This is OK for devices with large input buffers, but in the case of a large transfer to a device with a small input buffer, it limits the throughput to 1 buffer per frame time (nominal 1ms). In the case of the hardware I am using, the buffer is 128 bytes, so I only get 128000 bytes/sec throughput with the UHCI driver, compared to over 200000 bytes/sec with OHCI. If the UHCI driver arranges the bulk transfer queue as a circular list, transfers will be retried repeatedly in what would otherwise be wasted time at the end of the frame; this is similar to what OHCI does. In fact in my application the patched UHCI driver comes out slightly better than OHCI (though this may be other factors like CPU speed). The patch to do this appears to be very simple (this diff is against -stable as my -current machine is OHCI, but the code is identical in -current). --0-634534852-1008459242=:49085 Content-Type: TEXT/PLAIN; charset=US-ASCII; name=patch Content-Transfer-Encoding: BASE64 Content-ID: <20011215233402.E49085@server.arg.sj.co.uk> Content-Description: Content-Disposition: attachment; filename=patch SW5kZXg6IHVoY2kuYw0KPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQ0KUkNTIGZp bGU6IC9yZXBvc2l0b3J5L3NyYy9zeXMvZGV2L3VzYi91aGNpLmMsdg0KcmV0 cmlldmluZyByZXZpc2lvbiAxLjQwLjIuNw0KZGlmZiAtYyAtcjEuNDAuMi43 IHVoY2kuYw0KKioqIHVoY2kuYwkzMSBPY3QgMjAwMCAyMzoyMzoyOSAtMDAw MAkxLjQwLjIuNw0KLS0tIHVoY2kuYwkxNSBEZWMgMjAwMSAyMzoxOToxNyAt MDAwMA0KKioqKioqKioqKioqKioqDQoqKiogMzcxLDM3NyAqKioqDQogIAli c3FoID0gdWhjaV9hbGxvY19zcWgoc2MpOw0KICAJaWYgKGJzcWggPT0gTlVM TCkNCiAgCQlyZXR1cm4gKFVTQkRfTk9NRU0pOw0KISAJYnNxaC0+cWgucWhf aGxpbmsgPSBMRShVSENJX1BUUl9UKTsJLyogZW5kIG9mIFFIIGNoYWluICov DQogIAlic3FoLT5xaC5xaF9lbGluayA9IExFKFVIQ0lfUFRSX1QpOw0KICAJ c2MtPnNjX2J1bGtfc3RhcnQgPSBzYy0+c2NfYnVsa19lbmQgPSBic3FoOw0K ICANCi0tLSAzNzEsMzc4IC0tLS0NCiAgCWJzcWggPSB1aGNpX2FsbG9jX3Nx aChzYyk7DQogIAlpZiAoYnNxaCA9PSBOVUxMKQ0KICAJCXJldHVybiAoVVNC RF9OT01FTSk7DQohIAlic3FoLT5obGluayA9IGJzcWg7CQkvKiBDaXJjdWxh ciBRSCBjaGFpbiAqLw0KISAJYnNxaC0+cWgucWhfaGxpbmsgPSBMRShic3Fo LT5waHlzYWRkciB8IFVIQ0lfUFRSX1EpOw0KICAJYnNxaC0+cWgucWhfZWxp bmsgPSBMRShVSENJX1BUUl9UKTsNCiAgCXNjLT5zY19idWxrX3N0YXJ0ID0g c2MtPnNjX2J1bGtfZW5kID0gYnNxaDsNCiAgDQoqKioqKioqKioqKioqKioN CioqKiA4OTAsODk2ICoqKioNCiAgCURQUklOVEZOKDEwLCAoInVoY2lfcmVt b3ZlX2J1bGs6IHNxaD0lcFxuIiwgc3FoKSk7DQogIAlmb3IgKHBxaCA9IHNj LT5zY19idWxrX3N0YXJ0OyBwcWgtPmhsaW5rICE9IHNxaDsgcHFoID0gcHFo LT5obGluaykNCiAgI2lmIGRlZmluZWQoRElBR05PU1RJQykgfHwgZGVmaW5l ZChVSENJX0RFQlVHKQkJDQohIAkJaWYgKExFKHBxaC0+cWgucWhfaGxpbmsp ICYgVUhDSV9QVFJfVCkgew0KICAJCQlwcmludGYoInVoY2lfcmVtb3ZlX2J1 bGs6IFFIIG5vdCBmb3VuZFxuIik7DQogIAkJCXJldHVybjsNCiAgCQl9DQot LS0gODkxLDg5NyAtLS0tDQogIAlEUFJJTlRGTigxMCwgKCJ1aGNpX3JlbW92 ZV9idWxrOiBzcWg9JXBcbiIsIHNxaCkpOw0KICAJZm9yIChwcWggPSBzYy0+ c2NfYnVsa19zdGFydDsgcHFoLT5obGluayAhPSBzcWg7IHBxaCA9IHBxaC0+ aGxpbmspDQogICNpZiBkZWZpbmVkKERJQUdOT1NUSUMpIHx8IGRlZmluZWQo VUhDSV9ERUJVRykJCQ0KISAJCWlmIChwcWggPT0gc2MtPnNjX2J1bGtfZW5k KSB7DQogIAkJCXByaW50ZigidWhjaV9yZW1vdmVfYnVsazogUUggbm90IGZv dW5kXG4iKTsNCiAgCQkJcmV0dXJuOw0KICAJCX0NCg== --0-634534852-1008459242=:49085-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message