Hi Matthias, Matthias Fuchs wrote: > I played a little with various ways to manipulate tx/rxqueuesizes with > SocketCAN. > I ended up with some questions: > > 1) Does setsockopt(... ,SOL_SOCKET, SO_SNDBUF, ....) have any impact on > CAN_RAW sockets? > My result: no!
Ack. > 2) Does setsockopt(... ,SOL_SOCKET, SO_RCVBUF, ....) have any impact on > CAN_RAW sockets? > Yes, that's also used by candump to prevent losing rx frames. > > 1+2 brings me to the conclusion that setsockopt(..., SO_RCVBUF, ...) > configures receive > behavior and "ip link set can0 txqueuelen <whatever>" configures tx behavior. > Did I miss > anything? No. That's the current behaviour. > 3) Do we have a way to make write() on CAN_RAW sockets block when there is > no more buffer space? Typical behavior is returning ENOBUFS. I haven't tried > to > use select() for sending. Does this work? Yes. That should work. We had a discussion on this recently. http://old.nabble.com/-PATCH-0-2--add-support-for-Janz-MODULbus-devices-tp27662172p27715072.html Due to that discussion, i added the poll support to the 'cangen' tool: http://svn.berlios.de/wsvn/socketcan/?op=comp&compare[]=%2ftrunk%2fcan-ut...@1149&compare[]=%2ftrunk%2fcan-ut...@1146 > > 4) Do we have a way to flush the txqueue and block until all messages are on > the bus? > fsync() does not seem to be the right choice. AFAIK there's no way from the userspace to flush the txqueue - only set the interface state to "down" ... > > 5) Is there any special reason why read/write can only handle single messages? > Is it just because nobody asked? It should be possible with our > fixed size stuct can_frame. It could even speed thing up. This is an interesting idea. BUT the problem is that all the drivers and especially the echo_skb handling deals with single skb's. For a good reason. But i could imagine to implement a multi-frame handling inside the CAN_RAW socket. This could be done with a loop that splits it into single skb's in raw_sendmsg() quite easily. At least this would reduce the number of userspace->kernelspace copies. But you would need to check the return code to check how many frames have been written (when the txqueue is getting full). Interested? Regards, Oliver _______________________________________________ Socketcan-users mailing list [email protected] https://lists.berlios.de/mailman/listinfo/socketcan-users
