All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Michal Sojka <sojkam1@fel.cvut.cz>, mkl@pengutronix.de
Cc: linux-can@vger.kernel.org
Subject: Re: [PATCH v2 1/2] can: Decrease default size of CAN_RAW socket send queue
Date: Sat, 25 Jan 2014 17:31:53 +0100	[thread overview]
Message-ID: <52E3E6F9.8030401@hartkopp.net> (raw)
In-Reply-To: <87sisdbqky.fsf@steelpick.2x.cz>

(reduced the mail participants to CAN ML)

On 24.01.2014 11:51, Michal Sojka wrote:

> 
> What about the following?
> 
> ----8<--------8<-----
> Subject: [PATCH v3] can: Decrease default size of CAN_RAW socket send queue
> 

(..)

> diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
> index 1870c47..a0bce83 100644
> --- a/drivers/net/can/dev.c
> +++ b/drivers/net/can/dev.c
> @@ -492,7 +492,7 @@ static void can_setup(struct net_device *dev)
>  	dev->mtu = CAN_MTU;
>  	dev->hard_header_len = 0;
>  	dev->addr_len = 0;
> -	dev->tx_queue_len = 10;
> +	dev->tx_queue_len = 100;
>  
>  	/* New-style flags. */
>  	dev->flags = IFF_NOARP;
> diff --git a/net/can/raw.c b/net/can/raw.c
> index fdda5f6..4293197 100644
> --- a/net/can/raw.c
> +++ b/net/can/raw.c
> @@ -291,6 +291,9 @@ static int raw_init(struct sock *sk)
>  {
>  	struct raw_sock *ro = raw_sk(sk);
>  
> +	/* This limits the number of queued CAN frames to approximately 11 */
> +	sk->sk_sndbuf = SOCK_MIN_SNDBUF;
> +
>  	ro->bound            = 0;
>  	ro->ifindex          = 0;
>  

Good thing: It works fine :-)

Having two interfaces with sja1000 in my Laptop I can run

	cangen -g 0 can0

without any -ENOBUFS issues.

The bad(?) thing:

	canbusload can0@500000 can1@500000

only leads to

 can0@500000  3166  343905 145968  68%
 can1@500000  3166  343905 145968  68%

When running

	cangen -g 0 can0
	cangen -g 0 can1

it shows up

 can0@500000  5111  553913 234584 110%
 can1@500000  5111  553913 234584 110%


With a mainline kernel I can get

 can0@500000  4109  445113 188416  89%
 can1@500000  4109  445113 188416  89%

with
	cangen -g 0 can0 -i
	                 ^^^

Of course this burns lots of CPU time and returns thousands of -ENOBUFS then.

Do you have an idea why we only get ~68% with the 'good' solution?
Could this be due to some scheduling behaviour?

Regards,
Oliver


  reply	other threads:[~2014-01-25 16:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-22  8:27 [PATCH v2 1/2] can: Decrease default size of CAN_RAW socket send queue Michal Sojka
2014-01-22  8:27 ` [PATCH v2 2/2] net: Make minimum SO_SNDBUF size dependent on the protocol family Michal Sojka
2014-01-23 20:41 ` [PATCH v2 1/2] can: Decrease default size of CAN_RAW socket send queue David Miller
2014-01-23 21:01   ` Marc Kleine-Budde
2014-01-23 22:42     ` David Miller
2014-01-24 10:51       ` Michal Sojka
2014-01-25 16:31         ` Oliver Hartkopp [this message]
2014-01-24 12:14     ` Michal Sojka

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=52E3E6F9.8030401@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=sojkam1@fel.cvut.cz \
    /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.