
Remy Bohmer wrote:
Looking at this I agree that this packet_sent flag should be reset on every usb_eth_send().
Ok
Should I protect the line with some AT91 CONFIG or am I missing something ?
No, it should be AT91 specific...
Looking at the flow on at91 we see that this happens: ether.c:usb_eth_send() gadget.h:usb_ep_queue() at91_udc.c:at91_ep_queue() at91_udc.c:write_fifo() at91_udc.c:done() req->req.complete() tx_complete() packet_send = 1
Ok, understood.
The packet is transmitted in the context of the usb_ep_queue() routine, not in the context of the interrupt handler. So, the timeout should incorporate usb_ep_queue also.
I think this is better: ts = get_timer(0); packet_sent=0; retval = usb_ep_queue (dev->in_ep, req, GFP_ATOMIC);
compared to: ts = get_timer(0); packet_sent=0; while(!packet_sent)
Yes, agree, it should be enough to call usb_ep_queue after clearing the flag as you suggest.
But I must mention that I have not yet tested it though...
It does not matter. I will repost the whole patch series with the comments we get up now. After that we can do some more tests to check if I break something...
Best regards, Stefano