Wolfgang Grandegger wrote:
> Paul Thomas wrote:
>> I've been using the mcp251x driver, and I'm getting a "write: No buffer
>> space available" error. That is what cansend prints after I get into this
>> state. I have a user space program that is reading and writing about 20 time
>> a second.
>>
>> I see this with both the work-queues and threaded interrupt version. In the
>> threaded interrupt version unloading and reloading the mcp251x module fixes
>> the problem. In the work-queues version just disconnecting the can device
>> and re-connecting it fixes it.
>>
>> Is there some way to purge/flush the buffer? Is there some other work around
>> sort of reloading the module?
>
> It may happen that the TX buffer space is exhausted, especially if you
> send many messages without delay (in a loop). The driver should handle
> the errno appropriately:
>
> retry:
> ret = write(s, &frame, sizeof(struct can_frame));
> if (ret < 0) {
> if (errno == ENOBUFS) {
> sched_yield();
better use something like poll/select/epoll here...
> goto retry;
> } else {
> perror("write failed");
> goto failure;
> }
>
> Search for ENOBUFS in the can-utils "cangen.c" or "canfdtest.c". The TX
> queue length can be increased with "ip link can0 txqueuelen <size> ...".
cheers, Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Socketcan-core mailing list [email protected] https://lists.berlios.de/mailman/listinfo/socketcan-core
