socketcan 的使用(一) can raw write: No buffer space available

https://www.cnblogs.com/fly-fish/archive/2011/05/24/2055879.html

Neal Probert wrote:
> I'm using PCAN-USB 6.7 with latest Socket-CAN from Subversion.
>
> Can anybody tell me what this means, and how to I get around it?
>
>     "write: No buffer space available"
>
> I don't get this with vcan0, but I do with can0.  Happens with cangen
> and my own application.
>  

Hi Neal,

when you try to write more data than the 'real' CAN hardware can put
onto the bus the tx-queue from the CAN netdevice simply runs over after
some time.

If you have only 'peak' load you may try to pump up the tx_queue_len of
'can0' in the sysfs:

echo 1000 > /sys/class/net/can0/tx_queue_len

But if your idea is to generate maximum load, you could ignore/handle
the -ENOBUF return value, wait an appropriate time (e.g. 500ns?) and
send your next CAN frame.

Regards,
Oliver

https://lists.berlios.de/pipermail/socketcan-users/2008-March/000297.html

1、查看

root@socfpga:/sys/class/net/can0# cat tx_queue_len

10


2、root@socfpga:/sys/class/net/can0# echo 4096 > tx_queue_len

3、root@socfpga:/sys/class/net/can0# cat tx_queue_len
4096


4、再运行程序
————————————————

你可能感兴趣的:(socketcan 的使用(一) can raw write: No buffer space available)