From: Wolfgang Grandegger <wg@grandegger.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: "Oliver Hartkopp" <socketcan@hartkopp.net>,
"Heinz-Jürgen Oertel" <oe@port.de>,
"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Subject: Re: What are you doing if the TX buffer overflows?
Date: Wed, 19 Sep 2012 10:10:56 +0200 [thread overview]
Message-ID: <50597E10.5080305@grandegger.com> (raw)
In-Reply-To: <505976B1.6080900@pengutronix.de>
On 09/19/2012 09:39 AM, Marc Kleine-Budde wrote:
> On 09/19/2012 08:50 AM, Wolfgang Grandegger wrote:
>> On 09/18/2012 10:20 PM, Kurt Van Dijck wrote:
>>> On Tue, Sep 18, 2012 at 09:13:48PM +0200, Wolfgang Grandegger wrote:
>>>> On 09/18/2012 09:01 PM, Marc Kleine-Budde wrote:
>>>>> On 09/18/2012 08:50 PM, Wolfgang Grandegger wrote:
>>>>>> On 09/18/2012 03:42 PM, Marc Kleine-Budde wrote:
>>>>>>> On 09/18/2012 03:39 PM, Wolfgang Grandegger wrote:
>>>>>>>> On 09/18/2012 03:00 PM, Marc Kleine-Budde wrote:
>>>>>>>>> On 09/18/2012 02:49 PM, Wolfgang Grandegger wrote:
>>>>>>>>> [...]
>>>>>>>>>
>>>>>>>>>>> We have several customers who asked how to abort pending TX messages,
>>>>>>>>>>> too. Which involves:
>>>>>>>>>>> a) clear the TX-queue in Linux
>>>>>>>>>>> b) clear queue in hardware
>>>>>>>>>>> c) abort currently transmitting CAN frame
>>>>>>>>>>>
>>>>>>>>>>> I think c) would be a usecase of its own, too.
>>>>>>>>>>
>>>>>>>>>> I think you need c) for b), at least for some controllers. These
>>>>>>>>>
>>>>>>>>> Yes, if it's a hardware limitation so be it. But if we design an
>>>>>>>>> interface it should support "clear everything" (a+b+c), but also just
>>>>>>>>> only c.
>>>>>>>>
>>>>>>>> Yes, that you be nice. The only portable "clear everything" (a+b+c) I
>>>>>>>> see is "ifconfig down -> up". This also answers you other related mail.
>>>>>>>>
>>>>>>>> What do people really want/need and why? This is still not clear to me.
>>>>>>>> More input would be nice.
>>>>>>>
>>>>>>> Heinz-Jürgen uses abort current TX Message on SJA1000, can you give us
>>>>>>> more insight? I've talked to customers, e.g. they want to abort the
>>>>>>> current frame if it takes "too long" to send it, because the frames CAN
>>>>>>> id priority is too low.
>>>
>>> If "too long" is defined as a period of time where it makes sense to
>>> take such actions in software (like > 10msec), and your message still
>>> did not get out, but you wanted it to be,
>>> then IMO the bus load is too high with regard to the expected time restrictions.
>>>
>>> Or am I missing something?
>>>
>>>>>>
>>>>>> What we could implement rather easily is a "tx-abort-last" or
>>>>>> "tx-abort-all" netlink command. As this command does not make sense when
>>>>>> more than one message is pending I'm in favor of "tx-abort-last".
>>>>>
>>>>> I like to have both commands.
>>>>
>>>> But then "tx-abort-all" should also clear the tx socket queue. Also be
>>>> aware that more than one socket may send messages. Let's wait for more
>>>> use-cases.
>>>
>>> I'm afraid tx-abort-all & tx-abort-last cause more damage than good,
>>> especially, but not only, in multi-user environments.
>>
>> At least it's incompatible with multi-user (-sender) support and it does
>> not fit into the Linux networking principles! And so far I have not
>> heard strong arguments for implementing message flush and abort. I still
>> believe that a device stop->restart is enough to cure such problems. But
>> let's wait and see.
>
> Network stop->start does basically drain all buffers (software +
> hardware + frame currently sending). Just remove the currently tx-ing
> frame is a valid use case, and ifconfig down; ifconfig up has some
> drawbacks:
> - a transceiver (if controlled by the driver) will be switched
> off and on.
> - the clocks will be turned off and on
> - there might be some "mdelay" or "msleep" loops during hw/sw reset
Before doing this, the controller goes bus-off. Therefore it should not
harm.
> In case the hardware a clear hw fifo and abort current tx frame there
What would clear hw fifo be good for? Then, for portability reasons I
would vote for tx-abort-all, which does both. As the app does not known
which message is currently transmitted, that does make sense to me.
> might be a much faster and cleaner way.
Well, it does not need to be fast because the bus is blocked anyway and
the support will be heavily hardware dependent. Anyway, till now I have
not seen a good use-case (apart from the vague one you mentioned). I'm
also afraid of mis-using such a feature.
Wolfgang.
next prev parent reply other threads:[~2012-09-19 8:11 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 [this message]
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
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=50597E10.5080305@grandegger.com \
--to=wg@grandegger.com \
--cc=linux-can@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=oe@port.de \
--cc=socketcan@hartkopp.net \
/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).