Linux CAN drivers development
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg@grandegger.com>
To: ajneu <ajneu1@gmail.com>, linux-can@vger.kernel.org
Subject: Re: Clear transmit buffer (of pending queued tx-messages)
Date: Thu, 23 Jun 2016 11:26:17 +0200	[thread overview]
Message-ID: <576BAB39.4080006@grandegger.com> (raw)
In-Reply-To: <loom.20160623T104337-28@post.gmane.org>

Am 23.06.2016 um 10:45 schrieb ajneu:
> Oliver Hartkopp <socketcan <at> hartkopp.net> writes:
>
>>
>> The question is whether blocking write (and probably write outdated
>> content) is what you want for CAN.
>
> Oliver Hartkopp posted that on a different thread...
> Subject: Re: want blocking writes, but eventually get: errno 105 (No buffer
> space available)
> Date: 2016-06-22 15:52:04 GMT (15 hours and 32 minutes ago)
>
> OK ->
>
> I've tried non-blocking.
> Unfortunately non-blocking will not tell you if messages are delivered or not.
>
> Example:
> If I send out 2 messages (non-blocking) with no participant on the bus,
> those messages will remain queued.

Yes, in software but also hardware queues.

> If 5 minutes later a participant joins the bus, he'll get those 2 very old
> messages: outdated content.

Yep.

> What are my options to solve this?

The only method I know to flush the queue is restarting the device 
(down->up).

> (Can I find out if a message has actually been sent out onto the bus?)

If you really need to known, you could check for the looped back message 
on the same socket enabling CAN_RAW_RECV_OWN_MSGS. But it will slow down 
the message transfers.

> (I'm currently thinking about checking the CAN-Bus status: If NOT
> error-active (and high tx count), I know that tx-messages will not get
> delivered.

Well, the errors could also be caused by other issues. You could check 
for no-ack bus error messages but not all CAN controllers support that 
feature.

> But if I had a few messages in the queue, I still cannot tell which ones got
> delivered. Hmmmm...

See above.

Wolfgang.

  reply	other threads:[~2016-06-23  9:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-22 12:11 Clear transmit buffer (of pending queued tx-messages) ajneu
2016-06-23  8:45 ` ajneu
2016-06-23  9:26   ` Wolfgang Grandegger [this message]
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=576BAB39.4080006@grandegger.com \
    --to=wg@grandegger.com \
    --cc=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