Linux CAN drivers development
 help / color / mirror / Atom feed
From: ajneu <ajneu1@gmail.com>
To: linux-can@vger.kernel.org
Subject: Clear transmit buffer (of pending queued tx-messages)
Date: Wed, 22 Jun 2016 12:11:46 +0000 (UTC)	[thread overview]
Message-ID: <loom.20160622T135857-352@post.gmane.org> (raw)

Hi,

how do you guys handle clearing of the transmit buffer?
(Usage-case example:
Imaging: buffer is filled with tx-messages, but no other participant on the
bus. After 1 minute, those queued tx-messages are outdated. We definitely
want to clear the queue, to prevent those messages from getting sent out, if
a participant connects to the bus again.)


I think... 
that one has to distinguish between 
a) non-blocking or blocking mode of write... on the userspace side;
and 
b) the buffering in qdisc
c) the buffering of tx-messages queued inside the CAN controller itself.

Whew!

Concerning 
a)
Is it correct that I need non-blocking, if I want to prevent userspace
sticking in blocking write calls? 
(Or is it possible to get a blocking write call to return immediately?
Perhaps sending a signal?)

Concerning 
b) and c)
How does one clear the qdisc and messages still queued inside the CAN
controller?
One method is probably using libsocketcan and issuing can_do_stop() followed
by can_do_start()... Would that work?
Any other possibilities?
Anybody willing to share some best practices?

Thanks.
ajneu


             reply	other threads:[~2016-06-22 13:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-22 12:11 ajneu [this message]
2016-06-23  8:45 ` Clear transmit buffer (of pending queued tx-messages) ajneu
2016-06-23  9:26   ` Wolfgang Grandegger
2016-06-27 22:01     ` Kurt Van Dijck
2016-06-26 23:31   ` Tom Evans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=loom.20160622T135857-352@post.gmane.org \
    --to=ajneu1@gmail.com \
    --cc=linux-can@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox