Re: Read from bulk end point
On Monday 27 June 2011 16:34:21 Luca Pizzamiglio wrote: > Hi, > > the buffer size mitigates the pre-fetch, but could not remove it all... > Setting 1 as buffer size, the pre-fetch is reduces as 3 wMaxPacketSize > IN transaction on the bus, but could not avoid it. > > There is a way to disable pre-fetch features? Or better, HPS could you > point me where is implemented? (just to save time studying source code!) > > Is the prefetch also enabled for Interrupt end point? maybe I could have > push to correctly redesign this USB board... > Hi, Have a look in sys/dev/usb/usb_generic.c Also try to watch the traffic using usbdump. --HPS > thanks in advance! > > Luca > > On 06/27/11 13:20, Hans Petter Selasky wrote: > > On Monday 27 June 2011 13:14:55 Luca Pizzamiglio wrote: > >> It was strange, because for other endpoints I don't see this kind of > >> behavior. > > > > Hi, > > > > That is perhaps because they send less data than wMaxPacketSize. > > > > --HPS ___ freebsd-usb@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"
Re: Read from bulk end point
Hi, the buffer size mitigates the pre-fetch, but could not remove it all... Setting 1 as buffer size, the pre-fetch is reduces as 3 wMaxPacketSize IN transaction on the bus, but could not avoid it. There is a way to disable pre-fetch features? Or better, HPS could you point me where is implemented? (just to save time studying source code!) Is the prefetch also enabled for Interrupt end point? maybe I could have push to correctly redesign this USB board... thanks in advance! Luca On 06/27/11 13:20, Hans Petter Selasky wrote: On Monday 27 June 2011 13:14:55 Luca Pizzamiglio wrote: It was strange, because for other endpoints I don't see this kind of behavior. Hi, That is perhaps because they send less data than wMaxPacketSize. --HPS ___ freebsd-usb@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"
Re: Read from bulk end point
On Monday 27 June 2011 13:14:55 Luca Pizzamiglio wrote: > It was strange, because for other endpoints I don't see this kind of > behavior. Hi, That is perhaps because they send less data than wMaxPacketSize. --HPS ___ freebsd-usb@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"
Re: Read from bulk end point
Hi, thanks HPS, yes, the buffer size works well. It was strange, because for other endpoints I don't see this kind of behavior. BTW now the problem is solved. Thanks again Luca On 06/27/11 11:19, Hans Petter Selasky wrote: On Monday 27 June 2011 10:43:03 Luca Pizzamiglio wrote: Hi USB list, I've a little problem, but I'm not able to find a solution... I've a generic custom USB device with several end points. One of them (a bulk one) is read periodically (polled, 64 byte) every second. There was some time inconsistencies, so I checked the USB traffic with a sniffer, and I discovered that transactions are compacted at the start of the loop in a block of 64 read (64 byte * 64 msg = 4096 byte). In other words, on the bus the first read is followed immediately by the next 63 read. I guess that this is a pre-fetch optimization for BULK end points. How can I disable this optimization for this end point? How can I come back to a more "real-time" behavior? I tried to play with open() flags (O_NONBLOCK, O_DIRECT) without luck. Using FreeBSD 7 with HPS stack, this behavior didn't happen. Every read consists in 1 read on the bus and everything is fine. Thanks in advance! Luca There is an IOCTL to set the RX and TX buffer sizes. Please use that. See dev/usb/usb_ioctl.h. The default is more than one full packet. --HPS ___ freebsd-usb@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"
Re: Read from bulk end point
On Monday 27 June 2011 10:43:03 Luca Pizzamiglio wrote: > Hi USB list, > > I've a little problem, but I'm not able to find a solution... > I've a generic custom USB device with several end points. > One of them (a bulk one) is read periodically (polled, 64 byte) every > second. There was some time inconsistencies, so I checked the USB > traffic with a sniffer, and I discovered that transactions are compacted > at the start of the loop in a block of 64 read (64 byte * 64 msg = 4096 > byte). In other words, on the bus the first read is followed immediately > by the next 63 read. > > I guess that this is a pre-fetch optimization for BULK end points. How > can I disable this optimization for this end point? How can I come back > to a more "real-time" behavior? I tried to play with open() flags > (O_NONBLOCK, O_DIRECT) without luck. > > Using FreeBSD 7 with HPS stack, this behavior didn't happen. Every read > consists in 1 read on the bus and everything is fine. > > Thanks in advance! > > Luca There is an IOCTL to set the RX and TX buffer sizes. Please use that. See dev/usb/usb_ioctl.h. The default is more than one full packet. --HPS ___ freebsd-usb@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"