From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Marc Kleine-Budde <mkl@pengutronix.de>,
Jason White <white_jason_r1@cat.com>
Cc: linux-can@vger.kernel.org
Subject: Re: What are you doing if the TX buffer overflows?
Date: Thu, 15 Nov 2012 18:12:06 +0100 [thread overview]
Message-ID: <50A52266.8030301@hartkopp.net> (raw)
In-Reply-To: <50A4E5FC.5020103@pengutronix.de>
On 15.11.2012 13:54, Marc Kleine-Budde wrote:
> On 11/14/2012 09:48 PM, Jason White wrote:
>> Right now we are taking the interface down and then back up and while this
>> works for a single process using CAN, I don't think it will work well with
>> multi-process support. Would the other processes know that the interface
>> was taken down? I haven't decided the route we will go, but maybe an
>
> If the other process is doing a read, the read will return. I'm not sure
> what happens to a write after ifdown/ifup, I think it will fail.
Yes. It fails with -ENETDOWN ...
Btw. we had a similar use-case:
Only allow the applications to work in the CAN bus, once the CAN network
management established a stable state.
To do so, i implemented the network management e.g. on 'can0'. But the other
applications have been working on a virtual CAN interface 'can0v'.
Once the network management was ok, i cross-linked 'can0' and 'can0v' with two
can-gw rules:
cangw -A -s can0 -d can0v -e
cangw -A -s can0v -d can0 -e
I did not use the 'cangw' tool but created the netlink messages myself.
The advantage of this solution is that the can0v interface is always up and
stable - while the can0 interface can be set to up/down.
The traffic is routed on demand only.
The can-gw frame router is part of mainline Linux 3.2+
>> intermediate layer between SocketCAN and user processes to monitor the
>> flushing. Does the socket itself have any buffering or are messages
>> forwarded directly to the driver?
>>
>> Ideally a packet timeout would be implemented in the driver since it knows
>> when the last message was transmitted (tx interrupt) and could perform the
>> flush properly. Has there been any more thought to this scenario?
>
> This is a scenario, I think the first step will be to implement an
> "abort currently transmitted frame" callback. Note that not all hardware
> supports a tx-complete interrupt. A timeout mechanism can then be
> implemented in the framework in a hardware independent way, e.g. if you
> extend the currently used can_echo mechanism.
Officially the TX-timeout has been removed as the controller just sends out
the CAN frames, when it comes back to life ...
The question is, if the controller gets into the BUS_OFF state and if the
restart-ms option (see ip tool) would help here.
Regards,
Oliver
next prev parent reply other threads:[~2012-11-15 17:12 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-17 13:58 What are you doing if the TX buffer overflows? Heinz-Jürgen Oertel
2012-09-17 19:19 ` Oliver Hartkopp
2012-09-17 19:26 ` Andrew Bell
2012-09-17 19:33 ` Oliver Hartkopp
2012-09-18 13:36 ` Andrew Bell
2012-09-18 13:46 ` Wolfgang Grandegger
[not found] ` <4283CE44E963D741A50240F32D185B9F109AA1@SBSPORT3.portgmbh.local>
2012-09-17 19:40 ` Heinz-Jürgen Oertel
2012-09-18 11:44 ` Kurt Van Dijck
2012-09-18 12:14 ` Wolfgang Grandegger
2012-09-18 12:34 ` Marc Kleine-Budde
2012-09-18 12:49 ` Wolfgang Grandegger
2012-09-18 13:00 ` Marc Kleine-Budde
2012-09-18 13:39 ` Wolfgang Grandegger
2012-09-18 13:42 ` Marc Kleine-Budde
2012-09-18 18:50 ` Wolfgang Grandegger
2012-09-18 19:01 ` Marc Kleine-Budde
2012-09-18 19:13 ` Wolfgang Grandegger
2012-09-18 20:20 ` Kurt Van Dijck
2012-09-19 5:42 ` Oliver Hartkopp
2012-09-19 7:47 ` Marc Kleine-Budde
2012-09-19 9:04 ` Kurt Van Dijck
2012-09-19 6:50 ` Wolfgang Grandegger
2012-09-19 7:39 ` Marc Kleine-Budde
2012-09-19 8:10 ` Wolfgang Grandegger
2012-09-19 7:31 ` Marc Kleine-Budde
2012-09-19 10:18 ` Steffen Rose
[not found] ` <34567791.oZ5dyCnTQA@lisa>
2012-09-19 10:26 ` [Socketcan-users] " Kurt Van Dijck
2012-09-19 11:32 ` Steffen Rose
2012-11-14 20:48 ` Jason White
2012-11-15 12:54 ` Marc Kleine-Budde
2012-11-15 17:12 ` Oliver Hartkopp [this message]
2012-11-15 19:11 ` Jason White
2012-11-15 21:04 ` Oliver Hartkopp
2012-11-16 15:13 ` Kurt Van Dijck
2012-11-16 17:09 ` Jason White
2012-11-15 19:07 ` Jason White
2012-09-18 12:37 ` Wolfgang Grandegger
2012-09-18 13:22 ` Marc Kleine-Budde
2012-09-18 13:24 ` Marc Kleine-Budde
2012-09-18 13:25 ` Wolfgang Grandegger
-- strict thread matches above, loose matches on Subject: below --
2013-01-08 10:09 Alexander Stein
2014-01-27 20:47 ` Jason White
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=50A52266.8030301@hartkopp.net \
--to=socketcan@hartkopp.net \
--cc=linux-can@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=white_jason_r1@cat.com \
/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;
as well as URLs for NNTP newsgroup(s).