aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2006-04-02 14:20:15 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-04-14 14:12:25 -0400
commit8b5249019352eecd49fb00004d583904e891e7b1 (patch)
tree838985b42f41302f8c64360cff193df96b71a4bc /drivers/usb
parent68ba61b89c10b3412c7ee05cd649303ba5a588d1 (diff)
[PATCH] USB: usbtest: scatterlist OUT data pattern testing
Previously, scatterlist tests didn't write patterned data. Given how many corner cases are addresed by them, this was a significant gap in Linux-USB test coverage. Moreover, when peripherals checked for correct data patterns, false error reports would drown out the true ones. This adds the pattern on the way OUT from the host, so scatterlist tests can now be used to uncover bugs like host TX or peripheral RX paths failing for back-to-back short packets. It's easy enough to get an error there with at least one of the {DMA,PIO}{RX,TX} code paths, or run into hardware races that need to be defended against. Note this patch doesn't add checking for correct data patterns on the way IN from peripherals, just a FIXME for later. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/misc/usbtest.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index 9d59b901841c..ccc5e8238bd8 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -381,6 +381,7 @@ alloc_sglist (int nents, int max, int vary)
381 381
382 for (i = 0; i < nents; i++) { 382 for (i = 0; i < nents; i++) {
383 char *buf; 383 char *buf;
384 unsigned j;
384 385
385 buf = kzalloc (size, SLAB_KERNEL); 386 buf = kzalloc (size, SLAB_KERNEL);
386 if (!buf) { 387 if (!buf) {
@@ -391,6 +392,16 @@ alloc_sglist (int nents, int max, int vary)
391 /* kmalloc pages are always physically contiguous! */ 392 /* kmalloc pages are always physically contiguous! */
392 sg_init_one(&sg[i], buf, size); 393 sg_init_one(&sg[i], buf, size);
393 394
395 switch (pattern) {
396 case 0:
397 /* already zeroed */
398 break;
399 case 1:
400 for (j = 0; j < size; j++)
401 *buf++ = (u8) (j % 63);
402 break;
403 }
404
394 if (vary) { 405 if (vary) {
395 size += vary; 406 size += vary;
396 size %= max; 407 size %= max;
@@ -425,6 +436,8 @@ static int perform_sglist (
425 usb_sg_wait (req); 436 usb_sg_wait (req);
426 retval = req->status; 437 retval = req->status;
427 438
439 /* FIXME check resulting data pattern */
440
428 /* FIXME if endpoint halted, clear halt (and log) */ 441 /* FIXME if endpoint halted, clear halt (and log) */
429 } 442 }
430 443