linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* want blocking writes, but eventually get: errno 105 (No buffer space available)
@ 2016-06-22 14:39 ajneu
  2016-06-22 15:00 ` ajneu
  2016-06-22 15:18 ` ajneu
  0 siblings, 2 replies; 5+ messages in thread
From: ajneu @ 2016-06-22 14:39 UTC (permalink / raw)
  To: linux-can

Hi,

I'm trying to figure out how the blocking behaviour of socketcan works.

My test-program blocks (in write) in the beginning (the 1st few
program-runs), but then after a number of program-restarts I eventually get:
   errno 105 (No buffer space available)
which is not acceptable, since I want to block (in the write), and not get
any error!!

* What does the program do?
It does continuous blocking writes in a loop.
To get it to block, I'm have no other participants on the bus! (so I'm in
Error-Passive).


* My config:
  sudo ip link set can0 down
  sudo ip link set can0 txqueuelen 10
  sudo ip link set can0 up type can bitrate 250000


1st program run:
~> block on 33'rd write (32 frames queued)

2nd program run:
~> block on 7'th write (6 frames queued)

3rd program run:
~> block on 7'th write (6 frames queued)

4rd program run:
~> when trying 3'rd write: errno 105 (No buffer space available)
   (so 2 frames queued)

PLEASE: could sombody explain these numbers !
They don't make sense to me.


Details:
=========

I'm using PEAK USB Adapter (PCAN-USB FD) for normal CAN Frames (standard
format), and lsmod shows peak_usb as it should.

I'm using this setting:

// Write should block, when socketcan's own queue is full.
// To have this behaviour (and not get error ENOBUFS) set SO_SNDBUF to its
minimum value.
// See https://rtime.felk.cvut.cz/can/socketcan-qdisc-final.pdf#page=21
const int sndbuf = 0;
if (setsockopt(sock_fd, SOL_SOCKET, SO_SNDBUF, &sndbuf, sizeof(sndbuf)) < 0) {
 std::cerr << "Error setting SO_SNDBUF in setsockopt" <<
std::strerror(errno) << '\n';
 return -1;
}


Do I have to set txqueuelen to something else, in order to avoid getting
errno 105 (No buffer space available)?

Thanks.
ajneu


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-06-26 23:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-22 14:39 want blocking writes, but eventually get: errno 105 (No buffer space available) ajneu
2016-06-22 15:00 ` ajneu
2016-06-22 15:52   ` Oliver Hartkopp
2016-06-22 15:18 ` ajneu
2016-06-26 23:24   ` Tom Evans

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).