netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Ben Greear <greearb@candelatech.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
	Stephen Hemminger <shemminger@vyatta.com>,
	NetDev <netdev@vger.kernel.org>
Subject: Re: iproute uses too small of a receive buffer
Date: Wed, 28 Oct 2009 21:07:38 +0100	[thread overview]
Message-ID: <4AE8A48A.1060407@trash.net> (raw)
In-Reply-To: <4AE8A3C3.1070003@candelatech.com>

Ben Greear wrote:
> On 10/28/2009 12:50 PM, Patrick McHardy wrote:
> 
>>> And, even 1MB may not be enough for some scenarios.  So, probably
>>> best to
>>> let users over-ride the initial setting on cmd-line.  If not, then use
>>> a large value to start with.
>>
>> How about this? It uses 1MB as receive buf limit by default (without
>> increasing /proc/sys/net/core/rmem_max it will be limited by less
>> however) and allows to specify the size manually using "-rcvbuf X"
>> (-r is already used, so you need to specify at least -rc).
>>
>> Additionally rtnl_listen() continues on ENOBUFS after printing the
>> error message.
> 
> Looks good..except:
> 
> If rmem_max is smaller than 1M, will that cause setsocktopt to
> fail and thus fail early out of rtnl_open_byproto?

No, the kernel takes the value as a hint and only uses the
maximum allowable value:

	case SO_RCVBUF:
		/* Don't error on this BSD doesn't and if you think
		   about it this is right. Otherwise apps have to
		   play 'guess the biggest size' games. RCVBUF/SNDBUF
		   are treated in BSD as hints */

		if (val > sysctl_rmem_max)
			val = sysctl_rmem_max;

> Maybe we should only print errors but not return in that method
> when setsockopt fails?
> 
> In another project, I ended up trying ever smaller values until one
> worked in order to get near what the user wanted even if rmem_max
> was configured smaller.  Not sure if that is worth doing here or not.

I think it should be fine this way.

  reply	other threads:[~2009-10-28 20:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-27 23:16 iproute uses too small of a receive buffer Ben Greear
2009-10-27 23:24 ` Stephen Hemminger
2009-10-27 23:30   ` Ben Greear
2009-10-28  7:01     ` Eric Dumazet
2009-10-28  7:09       ` Eric Dumazet
2009-10-28  7:37       ` Eric Dumazet
2009-10-28  7:52   ` Eric Dumazet
2009-10-28  7:55     ` David Miller
2009-10-28 19:05     ` Patrick McHardy
2009-10-28 19:19       ` Ben Greear
2009-10-28 19:50         ` Patrick McHardy
2009-10-28 20:04           ` Ben Greear
2009-10-28 20:07             ` Patrick McHardy [this message]
2009-10-28 20:21               ` Ben Greear
2009-11-10 17:15           ` Stephen Hemminger
2009-10-28 20:38         ` Eric Dumazet
2009-10-29  8:17       ` David Miller

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=4AE8A48A.1060407@trash.net \
    --to=kaber@trash.net \
    --cc=eric.dumazet@gmail.com \
    --cc=greearb@candelatech.com \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.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).