All of lore.kernel.org
 help / color / mirror / Atom feed
From: Austin Schuh <austin@peloton-tech.com>
To: zhongjie.shi@intel.com
Cc: Oliver Hartkopp <socketcan@hartkopp.net>,
	Marc Kleine-Budde <mkl@pengutronix.de>,
	linux-can <linux-can@vger.kernel.org>
Subject: Re: [PATCH] Add TX limit for SocketCAN.
Date: Thu, 31 Aug 2017 20:01:31 -0700	[thread overview]
Message-ID: <CANGgnMb5-cKT=PjxEF6yYAcUkcP29BRnHU+_xY3ASsT-GQ6qzQ@mail.gmail.com> (raw)
In-Reply-To: <1504232079-2583-1-git-send-email-zhongjie.shi@intel.com>

On Thu, Aug 31, 2017 at 7:14 PM,  <zhongjie.shi@intel.com> wrote:
> From: "Shi, Zhongjie" <zhongjie.shi@intel.com>
>
> This will be used to prevent malicious or unintentional
> flooding of messages via SocketCAN.
>
> Change-Id: I6c2e122e12a594d9ad7dc4bdeebe15a1929eb893
> Tracked-On: https://jira01.devtools.intel.com/browse/OAM-48496
> Signed-off-by: Shi, Zhongjie <zhongjie.shi@intel.com>
> ---
>  net/can/Kconfig  | 13 +++++++++++++
>  net/can/af_can.c | 15 +++++++++++++++
>  net/can/af_can.h |  5 +++++
>  net/can/proc.c   | 13 +++++++++++++
>  4 files changed, 46 insertions(+)
>
> diff --git a/net/can/Kconfig b/net/can/Kconfig
> index a15c0e0..aeba3d0 100644
> --- a/net/can/Kconfig
> +++ b/net/can/Kconfig
> @@ -51,6 +51,19 @@ config CAN_GW
>           They can be modified with AND/OR/XOR/SET operations as configured
>           by the netlink configuration interface known e.g. from iptables.
>
> +config CAN_TX_ATTEMPT_RATE_LIMIT
> +       int "Tx attempt rate limit"
> +       default "5"
> +       ---help---
> +         This TX attempt rate limit can be used to prevent flood of messages
> +         from user space. It's TX "attempt" rate here instead of the "actual"
> +         TX rate because we do the statistics for the TX attempt no matter if
> +         the message TX is actually sent successful or not. The current
> +         default value is "5" which means 5 messages per second that is proper
> +         for an in-vehicle infotainment (IVI) system. For the use cases other
> +         than IVI, this can be set to the value corresponding to the specific
> +         requirement.
> +
>  source "drivers/net/can/Kconfig"
>
>  endif

This default breaks our systems.  We send hundreds of messages/sec,
and at worst case when pushing an update out over CAN to other ECUs,
saturate the bus.  This should be opt in.

I have vague recollections from Oliver long ago that you can use
queueing disciplines to rate limit the interface, which should
implement this without any kernel changes.

Austin

  reply	other threads:[~2017-09-01  3:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-01  2:14 [PATCH] Add TX limit for SocketCAN zhongjie.shi
2017-09-01  3:01 ` Austin Schuh [this message]
2017-09-01  3:22   ` Shi, Zhongjie
2017-09-01  4:17     ` Justin Delegard
2017-09-01  5:29       ` Shi, Zhongjie
2017-09-01  7:52         ` Kurt Van Dijck
2017-09-01  8:15           ` Shi, Zhongjie
2017-09-01  9:58             ` Kurt Van Dijck
2017-09-01 13:31               ` Shi, Zhongjie
2017-09-01 13:54     ` Brandon Martin
2017-09-01 15:39       ` Oliver Hartkopp
2017-09-02  1:45         ` Shi, Zhongjie

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='CANGgnMb5-cKT=PjxEF6yYAcUkcP29BRnHU+_xY3ASsT-GQ6qzQ@mail.gmail.com' \
    --to=austin@peloton-tech.com \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=socketcan@hartkopp.net \
    --cc=zhongjie.shi@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.