Usb loopback through device fails with timeout

I’m trying to do a usb device loopback. Using libusb at the host side. Device is Jetson Tx2 with loopback function enabled using config fs. I have increased the bulk_buflen to the size of the data.

echo 1382400 > /config/usb_gadget/g1/functions/SourceSink.name/bulk_buflen

I am able to loopback about 60 frames. Each transfer takes about 40 ms in one direction. After 60 frames transfer timeouts even with one second timeout.

r = libusb_bulk_transfer(dev_handle, (1 | LIBUSB_ENDPOINT_OUT), (unsigned char *)data, 1382400, &actual, 10000); 

libusb_bulk_transfer(dev_handle, (1 | LIBUSB_ENDPOINT_IN), (unsigned char *)receive_buf, actual, &actual, 10000);

Dmesg log is as below

[  +0.000004] tegra-xudc-new 3550000.xudc: completing request ffffffc1d5854280 on ep 3 with status 0
[  +0.000044] in_compl=loopback_complete
[  +0.000002] at_func=loopback_complete req->actual=1382400
[  +0.012115] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c5ec0, lo = 0x80013660, hi = 0x0, status = 0x1000000, control = 0x28001
[  +0.000005] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800217e660 -> ffffff800217e7b0; trb ffffff800217e660
[  +0.000008] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e660, lo = 0x83c30000, hi = 0x0, status = 0x50000, control = 0x434
[  +0.000003] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  +0.001368] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c5ed0, lo = 0x80013670, hi = 0x0, status = 0x1000000, control = 0x28001
[  +0.000006] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800217e660 -> ffffff800217e7b0; trb ffffff800217e670
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e670, lo = 0x83c40000, hi = 0x0, status = 0x30000, control = 0x434
[  +0.000003] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  +0.002782] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c5ee0, lo = 0x80013690, hi = 0x0, status = 0x1000000, control = 0x28001
[  +0.000005] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800217e660 -> ffffff800217e7b0; trb ffffff800217e690
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e680, lo = 0x83c50000, hi = 0x0, status = 0x1800, control = 0x424
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e690, lo = 0x83d00000, hi = 0x0, status = 0x2b0000, control = 0x434
[  +0.000003] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  +0.001325] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c5ef0, lo = 0x800136a0, hi = 0x0, status = 0x1000000, control = 0x28001
[  +0.000006] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800217e660 -> ffffff800217e7b0; trb ffffff800217e6a0
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e6a0, lo = 0x83d10000, hi = 0x0, status = 0x290000, control = 0x434
[  +0.000004] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  +0.001378] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c5f00, lo = 0x800136b0, hi = 0x0, status = 0x1000000, control = 0x28001
[  +0.000006] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800217e660 -> ffffff800217e7b0; trb ffffff800217e6b0
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e6b0, lo = 0x83d20000, hi = 0x0, status = 0x270000, control = 0x434
[  +0.000004] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  +0.001348] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c5f10, lo = 0x800136c0, hi = 0x0, status = 0x1000000, control = 0x28001
[  +0.000005] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800217e660 -> ffffff800217e7b0; trb ffffff800217e6c0
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e6c0, lo = 0x83d30000, hi = 0x0, status = 0x250000, control = 0x434
[  +0.000003] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  +0.001331] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c5f20, lo = 0x800136d0, hi = 0x0, status = 0x1000000, control = 0x28001
[  +0.000006] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800217e660 -> ffffff800217e7b0; trb ffffff800217e6d0
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e6d0, lo = 0x83d40000, hi = 0x0, status = 0x230000, control = 0x434
[  +0.000003] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  +0.001399] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c5f30, lo = 0x800136e0, hi = 0x0, status = 0x1000000, control = 0x28001
[  +0.000005] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800217e660 -> ffffff800217e7b0; trb ffffff800217e6e0
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e6e0, lo = 0x83d50000, hi = 0x0, status = 0x210000, control = 0x434
[  +0.000003] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  +0.001360] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c5f40, lo = 0x800136f0, hi = 0x0, status = 0x1000000, control = 0x28001
[  +0.000005] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800217e660 -> ffffff800217e7b0; trb ffffff800217e6f0
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e6f0, lo = 0x83d60000, hi = 0x0, status = 0x1f0000, control = 0x434
[  +0.000003] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  +0.001319] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c5f50, lo = 0x80013700, hi = 0x0, status = 0x1000000, control = 0x28001
[  +0.000005] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800217e660 -> ffffff800217e7b0; trb ffffff800217e700
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e700, lo = 0x83d70000, hi = 0x0, status = 0x1d0000, control = 0x434
[  +0.000003] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  +0.001321] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c5f60, lo = 0x80013710, hi = 0x0, status = 0x1000000, control = 0x28001
[  +0.000005] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800217e660 -> ffffff800217e7b0; trb ffffff800217e710
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e710, lo = 0x83d80000, hi = 0x0, status = 0x1b0000, control = 0x434
[  +0.000003] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  +0.001315] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c5f70, lo = 0x80013720, hi = 0x0, status = 0x1000000, control = 0x28001
[  +0.000005] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800217e660 -> ffffff800217e7b0; trb ffffff800217e720
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e720, lo = 0x83d90000, hi = 0x0, status = 0x190000, control = 0x434
[  +0.000003] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  +0.001320] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c5f80, lo = 0x80013730, hi = 0x0, status = 0x1000000, control = 0x28001
[  +0.000005] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800217e660 -> ffffff800217e7b0; trb ffffff800217e730
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e730, lo = 0x83da0000, hi = 0x0, status = 0x170000, control = 0x434
[  +0.000003] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  +0.001320] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c5f90, lo = 0x80013740, hi = 0x0, status = 0x1000000, control = 0x28001
[  +0.000005] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800217e660 -> ffffff800217e7b0; trb ffffff800217e740
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e740, lo = 0x83db0000, hi = 0x0, status = 0x150000, control = 0x434
[  +0.000003] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  +0.001326] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c5fa0, lo = 0x80013750, hi = 0x0, status = 0x1000000, control = 0x28001
[  +0.000005] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800217e660 -> ffffff800217e7b0; trb ffffff800217e750
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e750, lo = 0x83dc0000, hi = 0x0, status = 0x130000, control = 0x434
[  +0.000004] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  +0.001377] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c5fb0, lo = 0x80013760, hi = 0x0, status = 0x1000000, control = 0x28001
[  +0.000005] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800217e660 -> ffffff800217e7b0; trb ffffff800217e760
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e760, lo = 0x83dd0000, hi = 0x0, status = 0x110000, control = 0x434
[  +0.000003] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  +0.001396] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c5fc0, lo = 0x80013770, hi = 0x0, status = 0x1000000, control = 0x28001
[  +0.000006] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800217e660 -> ffffff800217e7b0; trb ffffff800217e770
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e770, lo = 0x83de0000, hi = 0x0, status = 0xf0000, control = 0x434
[  +0.000003] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  +0.001381] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c5fd0, lo = 0x80013780, hi = 0x0, status = 0x1000000, control = 0x28001
[  +0.000005] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800217e660 -> ffffff800217e7b0; trb ffffff800217e780
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e780, lo = 0x83df0000, hi = 0x0, status = 0xd0000, control = 0x434
[  +0.000003] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  +0.001330] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c5fe0, lo = 0x80013790, hi = 0x0, status = 0x1000000, control = 0x28001
[  +0.000005] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800217e660 -> ffffff800217e7b0; trb ffffff800217e790
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e790, lo = 0x83e00000, hi = 0x0, status = 0xb0000, control = 0x434
[  +0.000003] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  +0.001382] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c5ff0, lo = 0x800137a0, hi = 0x0, status = 0x1000000, control = 0x28001
[  +0.000005] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800217e660 -> ffffff800217e7b0; trb ffffff800217e7a0
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e7a0, lo = 0x83e10000, hi = 0x0, status = 0x90000, control = 0x434
[  +0.000003] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  +0.000121] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c6000, lo = 0x800137b0, hi = 0x0, status = 0x1000000, control = 0x28001
[  +0.000005] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800217e660 -> ffffff800217e7b0; trb ffffff800217e7b0
[  +0.000005] tegra-xudc-new 3550000.xudc: bytes transferred 1382400 / 1382400
[  +0.000004] tegra-xudc-new 3550000.xudc: completing request ffffffc1d5856080 on ep 2 with status 0
[  +0.000294] out_compl=loopback_complete
[  +0.000002] at_func=loopback_complete req->actual=1382400
[  +0.000282] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217ea60, lo = 0x83700000, hi = 0x0, status = 0x2b0000, control = 0x411
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217ea70, lo = 0x83710000, hi = 0x0, status = 0x290000, control = 0x411
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217ea80, lo = 0x83720000, hi = 0x0, status = 0x270000, control = 0x411
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217ea90, lo = 0x83730000, hi = 0x0, status = 0x250000, control = 0x411
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217eaa0, lo = 0x83740000, hi = 0x0, status = 0x230000, control = 0x411
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217eab0, lo = 0x83750000, hi = 0x0, status = 0x210000, control = 0x411
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217eac0, lo = 0x83760000, hi = 0x0, status = 0x1f0000, control = 0x411
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217ead0, lo = 0x83770000, hi = 0x0, status = 0x1d0000, control = 0x411
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217eae0, lo = 0x83780000, hi = 0x0, status = 0x1b0000, control = 0x411
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217eaf0, lo = 0x83790000, hi = 0x0, status = 0x190000, control = 0x411
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217eb00, lo = 0x837a0000, hi = 0x0, status = 0x170000, control = 0x411
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217eb10, lo = 0x837b0000, hi = 0x0, status = 0x150000, control = 0x411
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217eb20, lo = 0x837c0000, hi = 0x0, status = 0x130000, control = 0x411
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217eb30, lo = 0x837d0000, hi = 0x0, status = 0x110000, control = 0x411
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217eb40, lo = 0x837e0000, hi = 0x0, status = 0xf0000, control = 0x411
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217eb50, lo = 0x837f0000, hi = 0x0, status = 0xd0000, control = 0x411
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217eb60, lo = 0x83800000, hi = 0x0, status = 0xb0000, control = 0x411
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217eb70, lo = 0x83810000, hi = 0x0, status = 0x90000, control = 0x411
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217eb80, lo = 0x83820000, hi = 0x0, status = 0x70000, control = 0x411
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217eb90, lo = 0x83830000, hi = 0x0, status = 0x50000, control = 0x411
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217eba0, lo = 0x83840000, hi = 0x0, status = 0x30000, control = 0x411
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217ebb0, lo = 0x83850000, hi = 0x0, status = 0x1800, control = 0x421
[  +0.000002] tegra-xudc-new 3550000.xudc: ring doorbell: 0x300
[  +0.000008] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e7b0, lo = 0x83e20000, hi = 0x0, status = 0x70000, control = 0x434
[  +0.000003] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  +0.031477] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c6010, lo = 0x80013bb0, hi = 0x0, status = 0x1000000, control = 0x38001
[  +0.000005] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800217ea60 -> ffffff800217ebb0; trb ffffff800217ebb0
[  +0.000005] tegra-xudc-new 3550000.xudc: bytes transferred 1382400 / 1382400
[  +0.000004] tegra-xudc-new 3550000.xudc: completing request ffffffc1d5855b80 on ep 3 with status 0
[  +0.000044] in_compl=loopback_complete
[  +0.000002] at_func=loopback_complete req->actual=1382400
[  +0.020643] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c6020, lo = 0x800137c0, hi = 0x0, status = 0x1000000, control = 0x28001
[  +0.000005] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800217e7c0 -> ffffff800217e520; trb ffffff800217e7c0
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e7c0, lo = 0x83e30000, hi = 0x0, status = 0x50000, control = 0x434
[  +0.000003] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  +0.001358] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c6030, lo = 0x800137d0, hi = 0x0, status = 0x1000000, control = 0x28001
[  +0.000005] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800217e7c0 -> ffffff800217e520; trb ffffff800217e7d0
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e7d0, lo = 0x83e40000, hi = 0x0, status = 0x30000, control = 0x434
[  +0.000003] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  +0.001368] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c6040, lo = 0x800137e0, hi = 0x0, status = 0x1000000, control = 0x28001
[  +0.000005] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800217e7c0 -> ffffff800217e520; trb ffffff800217e7e0
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e7e0, lo = 0x83e50000, hi = 0x0, status = 0x1800, control = 0x424
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e400, lo = 0x83f00000, hi = 0x0, status = 0x2b0000, control = 0x415
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e410, lo = 0x83f10000, hi = 0x0, status = 0x290000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e420, lo = 0x83f20000, hi = 0x0, status = 0x270000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e430, lo = 0x83f30000, hi = 0x0, status = 0x250000, control = 0x415
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e440, lo = 0x83f40000, hi = 0x0, status = 0x230000, control = 0x415
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e450, lo = 0x83f50000, hi = 0x0, status = 0x210000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e460, lo = 0x83f60000, hi = 0x0, status = 0x1f0000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e470, lo = 0x83f70000, hi = 0x0, status = 0x1d0000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e480, lo = 0x83f80000, hi = 0x0, status = 0x1b0000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e490, lo = 0x83f90000, hi = 0x0, status = 0x190000, control = 0x415
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e4a0, lo = 0x83fa0000, hi = 0x0, status = 0x170000, control = 0x415
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e4b0, lo = 0x83fb0000, hi = 0x0, status = 0x150000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e4c0, lo = 0x83fc0000, hi = 0x0, status = 0x130000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e4d0, lo = 0x83fd0000, hi = 0x0, status = 0x110000, control = 0x415
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e4e0, lo = 0x83fe0000, hi = 0x0, status = 0xf0000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e4f0, lo = 0x83ff0000, hi = 0x0, status = 0xd0000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e500, lo = 0x84000000, hi = 0x0, status = 0xb0000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e510, lo = 0x84010000, hi = 0x0, status = 0x90000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e520, lo = 0x84020000, hi = 0x0, status = 0x70000, control = 0x415
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e530, lo = 0x84030000, hi = 0x0, status = 0x50000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e540, lo = 0x84040000, hi = 0x0, status = 0x30000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e550, lo = 0x84050000, hi = 0x0, status = 0x1800, control = 0x425
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e560, lo = 0x80100000, hi = 0x0, status = 0x2b0000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e570, lo = 0x80110000, hi = 0x0, status = 0x290000, control = 0x415
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e580, lo = 0x80120000, hi = 0x0, status = 0x270000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e590, lo = 0x80130000, hi = 0x0, status = 0x250000, control = 0x415
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e5a0, lo = 0x80140000, hi = 0x0, status = 0x230000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e5b0, lo = 0x80150000, hi = 0x0, status = 0x210000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e5c0, lo = 0x80160000, hi = 0x0, status = 0x1f0000, control = 0x415
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e5d0, lo = 0x80170000, hi = 0x0, status = 0x1d0000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e5e0, lo = 0x80180000, hi = 0x0, status = 0x1b0000, control = 0x415
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e5f0, lo = 0x80190000, hi = 0x0, status = 0x190000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e600, lo = 0x801a0000, hi = 0x0, status = 0x170000, control = 0x415
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e610, lo = 0x801b0000, hi = 0x0, status = 0x150000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e620, lo = 0x801c0000, hi = 0x0, status = 0x130000, control = 0x415
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e630, lo = 0x801d0000, hi = 0x0, status = 0x110000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e640, lo = 0x801e0000, hi = 0x0, status = 0xf0000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e650, lo = 0x801f0000, hi = 0x0, status = 0xd0000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e660, lo = 0x80200000, hi = 0x0, status = 0xb0000, control = 0x415
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e670, lo = 0x80210000, hi = 0x0, status = 0x90000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e680, lo = 0x80220000, hi = 0x0, status = 0x70000, control = 0x415
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e690, lo = 0x80230000, hi = 0x0, status = 0x50000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e6a0, lo = 0x80240000, hi = 0x0, status = 0x30000, control = 0x415
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e6b0, lo = 0x80250000, hi = 0x0, status = 0x1800, control = 0x425
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e6c0, lo = 0x80300000, hi = 0x0, status = 0x2b0000, control = 0x415
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e6d0, lo = 0x80310000, hi = 0x0, status = 0x290000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e6e0, lo = 0x80320000, hi = 0x0, status = 0x270000, control = 0x415
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e6f0, lo = 0x80330000, hi = 0x0, status = 0x250000, control = 0x415
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e700, lo = 0x80340000, hi = 0x0, status = 0x230000, control = 0x415
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e710, lo = 0x80350000, hi = 0x0, status = 0x210000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e720, lo = 0x80360000, hi = 0x0, status = 0x1f0000, control = 0x415
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e730, lo = 0x80370000, hi = 0x0, status = 0x1d0000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e740, lo = 0x80380000, hi = 0x0, status = 0x1b0000, control = 0x415
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e750, lo = 0x80390000, hi = 0x0, status = 0x190000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e760, lo = 0x803a0000, hi = 0x0, status = 0x170000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e770, lo = 0x803b0000, hi = 0x0, status = 0x150000, control = 0x415
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e780, lo = 0x803c0000, hi = 0x0, status = 0x130000, control = 0x415
[  +0.000005] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e790, lo = 0x803d0000, hi = 0x0, status = 0x110000, control = 0x415
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e7a0, lo = 0x803e0000, hi = 0x0, status = 0xf0000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e7b0, lo = 0x803f0000, hi = 0x0, status = 0xd0000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e7c0, lo = 0x80400000, hi = 0x0, status = 0xb0000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e7d0, lo = 0x80410000, hi = 0x0, status = 0x90000, control = 0x415
[  +0.000006] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e7e0, lo = 0x80420000, hi = 0x0, status = 0x70000, control = 0x435
[  +0.000004] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  +0.000993] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c6050, lo = 0x80013400, hi = 0x0, status = 0x1000000, control = 0x28001
[  +0.000004] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800217e7c0 -> ffffff800217e520; trb ffffff800217e400
[  +0.000007] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800217e400, lo = 0x80430000, hi = 0x0, status = 0x50000, control = 0x434
[  +0.000004] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  +0.531402] tegra-xudc-new 3550000.xudc: schedule restore emc work
[  +1.931249] tegra-xudc-new 3550000.xudc: Restoring emc bw
[  +5.735027] CFG80211-ERROR) wl_escan_handler : WLC_E_STATUS_TIMEOUT : scan_request[ffffffc1d167d500]
[  +0.009181] CFG80211-ERROR) wl_escan_handler : reason[0xffffffff]
[  +0.021911] CFG80211-ERROR) wl_escan_handler : escan is not ready ndev ffffffc079a6c600 drv_status 0x0 e_type 69 e_states 8
[  +0.011647] CFG80211-ERROR) wl_escan_handler : escan is not ready ndev ffffffc079a6c600 drv_status 0x0 e_type 69 e_states 4
[Aug30 12:35] gk20a 17000000.gp10b: gk20a_fifo_handle_pbdma_intr: semaphore acquire timeout!
[  +0.008375] gk20a 17000000.gp10b: gk20a_set_error_notifier_locked: error notifier set to 32 for ch 505
[  +0.010817] gk20a 17000000.gp10b: gk20a_fifo_set_ctx_mmu_error_tsg: TSG 2 generated a mmu fault
[  +0.008861] ---- mlocks ----

[  +0.004530] ---- syncpts ----
[  +0.003092] id 18 (17000000.gp10b_507) min 8798 max 8798 refs 1 (previous client : )
[  +0.007875] id 19 (17000000.gp10b_506) min 18 max 18 refs 1 (previous client : )
[  +0.007527] id 21 (17000000.gp10b_505) min 508 max 512 refs 1 (previous client : 17000000.gp10b_505)

[  +0.011596] ---- channels ----
[  +0.003168] 
              channel 1 - 15820000.se

[  +0.006530] NvHost basic channel registers:
[  +0.004277] CMDFIFO_STAT_0:  00002040
[  +0.003739] CMDFIFO_RDATA_0: 08406081
[  +0.003753] CMDP_OFFSET_0:   00000000
[  +0.003755] CMDP_CLASS_0:    00000000
[  +0.003750] CHANNELSTAT_0:   00000000
[  +0.003738] The CDMA sync queue is empty.

[  +0.005621] 
              channel 2 - 15830000.se

[  +0.006556] NvHost basic channel registers:
[  +0.004294] CMDFIFO_STAT_0:  00002040
[  +0.003769] CMDFIFO_RDATA_0: 80442a46
[  +0.003750] CMDP_OFFSET_0:   00000000
[  +0.003732] CMDP_CLASS_0:    00000000
[  +0.003719] CHANNELSTAT_0:   00000000
[  +0.003719] The CDMA sync queue is empty.

[  +0.005576] 
              channel 3 - 15840000.se

[  +0.006508] NvHost basic channel registers:
[  +0.004249] CMDFIFO_STAT_0:  00002040
[  +0.003736] CMDFIFO_RDATA_0: 110cca40
[  +0.003738] CMDP_OFFSET_0:   00000000
[  +0.003667] CMDP_CLASS_0:    00000000
[  +0.003722] CHANNELSTAT_0:   00000000
[  +0.003734] The CDMA sync queue is empty.

[  +0.005678] 
              ---- host general irq ----

[  +0.006773] sync_intc0mask = 0x00000001
[  +0.003898] sync_intmask = 0x50000003
[  +0.003735] 
              ---- host syncpt irq mask ----

[  +0.007116] 
              ---- host syncpt irq status ----

[  +0.007327] syncpt_thresh_cpu0_int_status(0) = 0x00000000
[  +0.005467] syncpt_thresh_cpu0_int_status(1) = 0x00000000
[  +0.005456] syncpt_thresh_cpu0_int_status(2) = 0x00000000
[  +0.005458] syncpt_thresh_cpu0_int_status(3) = 0x00000000
[  +0.005448] syncpt_thresh_cpu0_int_status(4) = 0x00000000
[  +0.005457] syncpt_thresh_cpu0_int_status(5) = 0x00000000
[  +0.005448] syncpt_thresh_cpu0_int_status(6) = 0x00000000
[  +0.005454] syncpt_thresh_cpu0_int_status(7) = 0x00000000
[  +0.005443] syncpt_thresh_cpu0_int_status(8) = 0x00000000
[  +0.005455] syncpt_thresh_cpu0_int_status(9) = 0x00000000
[  +0.005444] syncpt_thresh_cpu0_int_status(10) = 0x00000000
[  +0.005546] syncpt_thresh_cpu0_int_status(11) = 0x00000000
[  +0.005536] syncpt_thresh_cpu0_int_status(12) = 0x00000000
[  +0.005544] syncpt_thresh_cpu0_int_status(13) = 0x00000000
[  +0.005531] syncpt_thresh_cpu0_int_status(14) = 0x00000000
[  +0.005533] syncpt_thresh_cpu0_int_status(15) = 0x00000000
[  +0.005531] syncpt_thresh_cpu0_int_status(16) = 0x00000000
[  +0.005533] syncpt_thresh_cpu0_int_status(17) = 0x00000000
[  +0.005546] 17000000.gp10b pbdma 0: 
[  +0.003463] id: 2 (tsg), next_id: 2 (tsg) chan status: valid
[  +0.005888] PUT: 0000001e01000dac GET: 0000001e01000b7c FETCH: 0000031a HEADER: 20020180

[  +0.009645] 17000000.gp10b eng 0: 
[  +0.003275] id: 2 (tsg), next_id: 2 (tsg), ctx status: invalid 

[  +0.007497] 17000000.gp10b eng 1: 
[  +0.003275] id: 2 (tsg), next_id: 2 (tsg), ctx status: invalid 


[  +0.009522] 505-17000000.gp10b, pid 2249, refs: 6: 
[  +0.004759] channel status:  in use on_pbdma busy
[  +0.004928] RAMFC : TOP: 8000001e01000b7c PUT: 0000001e01000dac GET: 0000001e01000b7c FETCH: 0000401e01001b80
              HEADER: 20020180 COUNT: 00110002
              SYNCPOINT 00000000 00001501 SEMAPHORE 0000001e 00ba00e0 00000001 00081001

[  +0.023539] 506-17000000.gp10b, pid 1181, refs: 2: 
[  +0.004765] channel status:  in use idle not busy
[  +0.004927] RAMFC : TOP: 8000001f081400d8 PUT: 0000001f081400d8 GET: 0000001f081400d8 FETCH: 0000001f081400d8
              HEADER: 60400000 COUNT: 80000000
              SYNCPOINT 00000000 00001301 SEMAPHORE 00000000 00000000 00000000 00000000

[  +0.023546] 507-17000000.gp10b, pid 1181, refs: 2: 
[  +0.004761] channel status: not in use pending busy
[  +0.005107] RAMFC : TOP: 8000001f080225c0 PUT: 0000001f080225c0 GET: 0000001f080225c0 FETCH: 0000001f080225c0
              HEADER: 20000074 COUNT: 80018001
              SYNCPOINT 00000000 00001201 SEMAPHORE 0000000d fc001000 25a0cc4c 01100002

[  +0.023584] 508-17000000.gp10b, pid 1184, refs: 2: 
[  +0.004759] channel status:  in use idle not busy
[  +0.004936] RAMFC : TOP: 0000000000000000 PUT: 0000000000000000 GET: 0000000000000000 FETCH: 0000000000000000
              HEADER: 60400000 COUNT: 00000000
              SYNCPOINT 00000000 00000000 SEMAPHORE 00000000 00000000 00000000 00000000

[  +0.023582] 509-17000000.gp10b, pid 1184, refs: 2: 
[  +0.004754] channel status:  in use idle not busy
[  +0.004932] RAMFC : TOP: 0000000000000000 PUT: 0000000000000000 GET: 0000000000000000 FETCH: 0000000000000000
              HEADER: 60400000 COUNT: 00000000
              SYNCPOINT 00000000 00000000 SEMAPHORE 00000000 00000000 00000000 00000000

[  +0.023558] 510-17000000.gp10b, pid 1184, refs: 2: 
[  +0.004757] channel status:  in use idle not busy
[  +0.004932] RAMFC : TOP: 0000000000000000 PUT: 0000000000000000 GET: 0000000000000000 FETCH: 0000000000000000
              HEADER: 60400000 COUNT: 00000000
              SYNCPOINT 00000000 00000000 SEMAPHORE 00000000 00000000 00000000 00000000

[  +0.023536] 511-17000000.gp10b, pid 1184, refs: 2: 
[  +0.004756] channel status:  in use idle not busy
[  +0.004929] RAMFC : TOP: 0000000000000000 PUT: 0000000000000000 GET: 0000000000000000 FETCH: 0000000000000000
              HEADER: 60400000 COUNT: 00000000
              SYNCPOINT 00000000 00000000 SEMAPHORE 00000000 00000000 00000000 00000000

[Aug30 12:36] EXT4-fs (mmcblk0p1): error count since last fsck: 92
[  +0.006097] EXT4-fs (mmcblk0p1): initial error at time 1566575681: ext4_mb_release_inode_pa:3802
[  +0.008829] EXT4-fs (mmcblk0p1): last error at time 1567148493: ext4_mb_generate_buddy:758
[ +18.272420] gk20a 17000000.gp10b: gk20a_fifo_handle_pbdma_intr: semaphore acquire timeout!
[  +0.008267] gk20a 17000000.gp10b: gk20a_set_error_notifier_locked: error notifier set to 32 for ch 505
[  +0.010473] gk20a 17000000.gp10b: gk20a_fifo_set_ctx_mmu_error_tsg: TSG 2 generated a mmu fault
[  +0.008727] ---- mlocks ----

[  +0.004408] ---- syncpts ----
[  +0.002995] id 18 (17000000.gp10b_507) min 8798 max 8798 refs 1 (previous client : )
[  +0.007744] id 19 (17000000.gp10b_506) min 18 max 18 refs 1 (previous client : )
[  +0.007399] id 21 (17000000.gp10b_505) min 532 max 540 refs 1 (previous client : 17000000.gp10b_505)

[  +0.011177] ---- channels ----

Hi,
We have valid case of running v4l2loopback throught gstreamer:
[url]implementation of v4l2loopback for devkit onboard csi camera - Jetson AGX Xavier - NVIDIA Developer Forums

Don’t have experience of your usecase. Other users may share suggestion and experience.

My use case is using Jetson as USB gadget and host connect to Jetson through USB 0 port(OTG cable). Seems like no USB is involved in the above mentioned link. Target is to transfer data from host to jetson and jetson to host across USB with Jetson TX2 working in usb device mode. Upto 60 frames no timeout is happening. In function fs loopback code 32*1382400 bytes are allocated for buffer. Does using this much memory as buffer be an issue? Also what are the prints in the log suggest?

Hi,
If the issue can be reproduced on default developer kit, please share us steps so that we can do further check.

Enable options in kernel menuconfig

Device Drivers->USB support->USB Gadget support->USB Gadget Drivers (USB functions configurable through configfs)

enable all options below that (Function filesystem (FunctionFS) , Loopback and sourcesink function (for testing)) etc

build and flash the kernel

do following as root on device

mount -t configfs none /config
mkdir /config/usb_gadget/g1
echo 0x00aa> /config/usb_gadget/g1/idVendor
echo 0x00bb > /config/usb_gadget/g1/idProduct
echo 0x0200 > /config/usb_gadget/g1/bcdUSB
mkdir /config/usb_gadget/g1/strings/0x409
echo NVIDIAA > /config/usb_gadget/g1/strings/0x409/manufacturer
echo “Loopback” > /config/usb_gadget/g1/strings/0x409/product
echo 012345678ABCDEF > /config/usb_gadget/g1/strings/0x409/serialnumber
mkdir /config/usb_gadget/g1/configs/b.1
mkdir /config/usb_gadget/g1/functions/Loopback.name
cat /config/usb_gadget/g1/functions/Loopback.name/qlen

echo 1382400 > /config/usb_gadget/g1/functions/Loopback.name/bulk_buflen

ln -s /config/usb_gadget/g1/functions/Loopback.name /config/usb_gadget/g1/configs/b.1/f1
echo 3550000.xudc > /config/usb_gadget/g1/UDC

connect otg cable to host

build the following test app and run from host. App would stuck after 60 frames and the above dmesg logs would be obtained. One more observation is, when i increased XUDC_TRANSFER_RING_SIZE in tegra_xudc.c to 128 app while loop pause at 120 instead of 60. Is it like ring buffer not getting cleared. How to do that properly

g++ libusbbulk_gfs.cpp -o libusbbulk_gfs -lusb-1.0

#include
#include <libusb-1.0/libusb.h>
#include <string.h>
#include <unistd.h>

#include

using namespace std;

int main() {
libusb_device **devs; //pointer to pointer of device, used to retrieve a list of devices
libusb_device_handle *dev_handle; //a device handle
libusb_context *ctx = NULL; //a libusb session
char buffer[512];
int r; //for return values
ssize_t cnt; //holding number of devices in list

strcpy(buffer, "What is your name ?");
r = libusb_init(&ctx); //initialize the library for the session we just declared
if(r < 0) {
	cout<<"Init Error "<<r<<endl; //there was an error
	return 1;
}
libusb_set_debug(ctx, 3); //set verbosity level to 3, as suggested in the documentation

cnt = libusb_get_device_list(ctx, &devs); //get the list of devices
if(cnt < 0) {
	cout<<"Get Device Error"<<endl; //there was an error
	return 1;
}
cout<<cnt<<" Devices in list."<<endl;

dev_handle = libusb_open_device_with_vid_pid(ctx, 0x00aa, 0x00bb); //these are vendorID and productID I found for my usb device
if(dev_handle == NULL)
	cout<<"Cannot open device"<<endl;
else
	cout<<"Device Opened"<<endl;
libusb_free_device_list(devs, 1); //free the list, unref the devices in it

char *data = new char[4194304]; //data to write
{
	int i;
	for(i=0;i<4186112;i++)
	data[i+8192] =0x86;
	data[1048576] = 0x89;
	data[1048575] = 0x89;
}
data[0]='a';data[1]='b';data[2]='c';data[3]='d'; //some dummy values
strcpy(data, "I reduced size of data since i was not able to submit the code to forum");

int actual; //used to find out how many bytes were written
if(libusb_kernel_driver_active(dev_handle, 0) == 1) { //find out if kernel driver is attached 
	cout<<"Kernel Driver Active"<<endl;
	if(libusb_detach_kernel_driver(dev_handle, 0) == 0) //detach it
		cout<<"Kernel Driver Detached!"<<endl;
}
r = libusb_claim_interface(dev_handle, 0); //claim interface 0 (the first) of device (mine had jsut 1)
if(r < 0) {
	cout<<"Cannot Claim Interface"<<endl;
	return 1;
}
cout<<"Claimed Interface"<<endl;

cout<<"Writing Data..."<<endl;

I am not able to share the full code here please share the mail id.

Hi,
You may zip the test code and attach it to a comment. Also please attach tegra18_defconfig after enabling all required options so that we can replace the original one and rebuild kernel directly.

For more information, which r28 release do you use?

L4t release version details are below.
Attaching test app code and defconfig file
NVIDIA Jetson TX2
L4T 28.2.1 [ JetPack 3.3 or 3.2.1 ]
Board: t186ref
Ubuntu 16.04 LTS
Kernel Version: 4.4.38
libusb-app.zip (5.71 KB)

Hi,
We hit error while building kernel with loopback_defconfig:

/kernel/kernel-4.4/kernel/bounds.c: In function ‘foo’:
/kernel/kernel-4.4/kernel/bounds.c:25:1: sorry, unimplemented: function profiling
 }
 ^
make[4]: *** [/kernel/kernel-4.4/./Kbuild:45: kernel/bounds.s] Error 1
make[3]: *** [/kernel/kernel-4.4/Makefile:1016: prepare0] Error 2
make[3]: *** Waiting for unfinished jobs....

If you have seen it and know how to solve it, please share the experience.

Hi,
I have removed some configs from the defconfig file. I have attached the new file. Please try to build with this.
loopback_defconfig.zip (4.07 KB)

Hi,
We hit error in running:

root@tegra-ubuntu:/home/ubuntu#  mount -t configfs none /config
mount: mount point /config does not exist

Does the folder has to be manually created by ‘mkdir config’?

I added the following line in the start /opt/nvidia/l4t-usb-device-mode/nv-l4t-usb-device-mode.sh

exit 0

So the nvidia configfs is not mounted at boot time so that i could modify it. Please create the /config directory. Sorry for not mentioning full details. Following are the commands

sudo su
mkdir /config
mount -t configfs none /config
mkdir /config/usb_gadget/g1
echo 0x00aa> /config/usb_gadget/g1/idVendor
echo 0x00bb > /config/usb_gadget/g1/idProduct
echo 0x0200 > /config/usb_gadget/g1/bcdUSB
mkdir /config/usb_gadget/g1/strings/0x409
echo NVIDIAA > /config/usb_gadget/g1/strings/0x409/manufacturer
echo “Loopback” > /config/usb_gadget/g1/strings/0x409/product
echo 012345678ABCDEF > /config/usb_gadget/g1/strings/0x409/serialnumber
mkdir /config/usb_gadget/g1/configs/b.1
mkdir /config/usb_gadget/g1/functions/Loopback.name
cat /config/usb_gadget/g1/functions/Loopback.name/qlen

echo 131072 > /config/usb_gadget/g1/functions/Loopback.name/bulk_buflen

ln -s /config/usb_gadget/g1/functions/Loopback.name /config/usb_gadget/g1/configs/b.1/f1
echo 3550000.xudc > /config/usb_gadget/g1/UDC

One more update is that I am able to do the loopback with the bulk_buflen set to 128 kb. But for size above 128 kb it still fails. I have tested with 256kb 512kb 1Mb etc.

Hi dawnpaul,

Following your steps to run on my host and TX2, I don’t see the timeout issue.
The host stop at below:

$ sudo ./libusbbulk_gfs 
10 Devices in list.
Device Opened
Claimed Interface
Writing Data...
Writing Data...actualwrite=%d1382400
WRITE_SUCCESS
Writing Data...actualread=%d1382400
READ_SUCCESS
Writing Data...actualwrite=%d1382400
WRITE_SUCCESS
Writing Data...actualread=%d1382400
READ_SUCCESS
Writing Data...actualwrite=%d1382400
WRITE_SUCCESS
Writing Data...actualread=%d1382400
READ_SUCCESS

The TX2 stop at below:

[   83.586803] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c3470, lo = 0x800137e0, hi = 0x0, status = 0x1000000, control = 0x28001
[   83.598544] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800231a7e0 -> ffffff800231a400; trb ffffff800231a7e0
[   83.609682] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c3480, lo = 0x80013400, hi = 0x0, status = 0x1000000, control = 0x28001
[   83.621423] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800231a7e0 -> ffffff800231a400; trb ffffff800231a400
[   83.632554] tegra-xudc-new 3550000.xudc: bytes transferred 131072 / 131072
[   83.639438] tegra-xudc-new 3550000.xudc: completing request ffffffc06c8ab300 on ep 2 with status 0
[   83.648526] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800231abe0, lo = 0x80800000, hi = 0x0, status = 0x30000, control = 0x431
[   83.660177] tegra-xudc-new 3550000.xudc: ring doorbell: 0x300
[   83.667005] tegra-xudc-new 3550000.xudc: Requesting emc bw to 150000000
[   85.675387] tegra-xudc-new 3550000.xudc: Restoring emc bw

Hi carolyuu

In the test app i have attached earlier the receive part was disabled. Can you try with the new file attached. Also the timeout is set to zero. So the timeout won’t happen. Here the transfer get stuck after 60 transfers.
testnew.cpp.zip (1.6 KB)

Hi dawnpaul,

Test with your new file, I still can’t reproduce timeout issue.
Host:

$ sudo ./testnew 
10 Devices in list.
Device Opened
Claimed Interface
Writing Data...
Writing Data...actualwrite=%d1382400
WRITE_SUCCESS

TX2:

[  139.906056] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c33b0, lo = 0x80013930, hi = 0x0, status = 0x1000000, control = 0x38001
[  139.917772] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800231a920 -> ffffff800231a930; trb ffffff800231a930
[  139.928878] tegra-xudc-new 3550000.xudc: bytes transferred 131072 / 131072
[  139.935738] tegra-xudc-new 3550000.xudc: completing request ffffffc1e5be3600 on ep 3 with status 0
[  139.944702] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800231a530, lo = 0x80280000, hi = 0x0, status = 0x30000, control = 0x434
[  139.956331] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  139.962501] tegra-xudc-new 3550000.xudc: Requesting emc bw to 150000000
[  141.970750] tegra-xudc-new 3550000.xudc: Restoring emc bw

Hi carolyuu,

The value of bulk_buflen i have provided earlier was wrong. Please use the following commands

sudo su
mkdir /config
mount -t configfs none /config
mkdir /config/usb_gadget/g1
echo 0x00aa> /config/usb_gadget/g1/idVendor
echo 0x00bb > /config/usb_gadget/g1/idProduct
echo 0x0200 > /config/usb_gadget/g1/bcdUSB
mkdir /config/usb_gadget/g1/strings/0x409
echo NVIDIAA > /config/usb_gadget/g1/strings/0x409/manufacturer
echo “Loopback” > /config/usb_gadget/g1/strings/0x409/product
echo 012345678ABCDEF > /config/usb_gadget/g1/strings/0x409/serialnumber
mkdir /config/usb_gadget/g1/configs/b.1
mkdir /config/usb_gadget/g1/functions/Loopback.name
cat /config/usb_gadget/g1/functions/Loopback.name/qlen

echo 1382400 > /config/usb_gadget/g1/functions/Loopback.name/bulk_buflen

ln -s /config/usb_gadget/g1/functions/Loopback.name /config/usb_gadget/g1/configs/b.1/f1
echo 3550000.xudc > /config/usb_gadget/g1/UDC

Hi dawnpaul,

Following #17 steps, I still can’t reproduce syncpts timeout issue.
Target tx2 stop at below:

[  118.159861] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800231a7b0, lo = 0x803f0000, hi = 0x0, status = 0xd0000, control = 0x415
[  118.159865] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800231a7c0, lo = 0x80400000, hi = 0x0, status = 0xb0000, control = 0x415
[  118.159868] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800231a7d0, lo = 0x80410000, hi = 0x0, status = 0x90000, control = 0x415
[  118.159871] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800231a7e0, lo = 0x80420000, hi = 0x0, status = 0x70000, control = 0x435
[  118.159872] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  118.161006] tegra-xudc-new 3550000.xudc: EVENT: ffffff80097c6040, lo = 0x80013400, hi = 0x0, status = 0x1000000, control = 0x28001
[  118.161009] tegra-xudc-new 3550000.xudc: trb_in_request: request ffffff800231a7c0 -> ffffff800231a520; trb ffffff800231a400
[  118.161012] tegra-xudc-new 3550000.xudc: TRANSFER: ffffff800231a400, lo = 0x80430000, hi = 0x0, status = 0x50000, control = 0x434
[  118.161014] tegra-xudc-new 3550000.xudc: ring doorbell: 0x200
[  119.062951] tegra-xudc-new 3550000.xudc: schedule restore emc work
[  121.071092] tegra-xudc-new 3550000.xudc: Restoring emc bw
[  122.066935] CFG80211-ERROR) wl_scan_timeout : timer expired
[  126.298919] CFG80211-ERROR) wl_escan_handler : WLC_E_STATUS_TIMEOUT : scan_request[ffffffc1e57a2e00]
[  126.308077] CFG80211-ERROR) wl_escan_handler : reason[0xffffffff]
[  126.326898] CFG80211-ERROR) wl_escan_handler : escan is not ready ndev ffffffc07a727000 drv_status 0x0 e_type 69 e_states 8
[  126.338079] CFG80211-ERROR) wl_escan_handler : escan is not ready ndev ffffffc07a727000 drv_status 0x0 e_type 69 e_states 4

Hi carolyuu,

The timeout I was referring to was LIBUSB_ERROR_TIMEOUT. Last argument oflibusb_bulk_transfer() is the timeout value. I too don’t get the syncpts timeout now which was there in the #1. This stopped coming when i took a fresh kernel source and build with default defconfig. I hope there also the prints from application stops after 60 loops. My issue is LIBUSB_ERROR_TIMEOUT. Why application stops after 60 loops. I have attached the app src with timeout value changed to 10000.

Writing Data…actualread=%d1382400
READ_SUCCESS
Writing Data…actualwrite=%d1382400
WRITE_SUCCESS
Writing Data…actualread=%d1382400
READ_SUCCESS
Writing Data…actualwrite=%d262144
LIBUSB_ERROR_TIMEOUT

Writing Data…actualread=%d0
LIBUSB_ERROR_TIMEOUT

timeout1000.zip (1.61 KB)

Hi dawnpaul,

We can reproduce timeout issue with “timeout1000.zip” file.
We will investigate issue and update to you.