netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Donald Hunter <donald.hunter@gmail.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
	pabeni@redhat.com, jiri@resnulli.us
Subject: Re: [PATCH net-next 2/4] tools: ynl: allow setting recv() size
Date: Mon, 4 Mar 2024 06:58:23 -0800	[thread overview]
Message-ID: <20240304065823.258dfabf@kernel.org> (raw)
In-Reply-To: <CAD4GDZzkVJackAf2yhG1E5vypd2J=n23HD5Huu356JK1F1oLKA@mail.gmail.com>

On Mon, 4 Mar 2024 13:38:51 +0000 Donald Hunter wrote:
> >  class YnlFamily(SpecFamily):
> > -    def __init__(self, def_path, schema=None, process_unknown=False):
> > +    def __init__(self, def_path, schema=None, process_unknown=False,
> > +                 recv_size=131072):  
> 
> An aside: what is the reason for choosing a 128k receive buffer? If I
> remember correctly, netlink messages are capped at 32k.

Attributes, not messages, right? But large messages are relatively
rare, this is to make dump use fewer syscalls. Dump can give us multiple
message on each recv().

> >          super().__init__(def_path, schema)
> >
> >          self.include_raw = False
> > @@ -423,6 +428,16 @@ genl_family_name_to_id = None
> >          self.async_msg_ids = set()
> >          self.async_msg_queue = []
> >
> > +        # Note that netlink will use conservative (min) message size for
> > +        # the first dump recv() on the socket, our setting will only matter  
> 
> I'm curious, why does it behave like this?

Dump is initiated inside a send() system call, so that we can
validate arguments and return any init errors directly.
That means we don't know what buf size will be used by subsequent
recv()s when we produce the first message :(

  reply	other threads:[~2024-03-04 14:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-01 23:05 [PATCH net-next 0/4] tools: ynl: add --dbg-small-recv for easier kernel testing Jakub Kicinski
2024-03-01 23:05 ` [PATCH net-next 1/4] tools: ynl: move the new line in NlMsg __repr__ Jakub Kicinski
2024-03-04 11:08   ` Donald Hunter
2024-03-01 23:05 ` [PATCH net-next 2/4] tools: ynl: allow setting recv() size Jakub Kicinski
2024-03-04 11:38   ` Donald Hunter
2024-03-04 13:38   ` Donald Hunter
2024-03-04 14:58     ` Jakub Kicinski [this message]
2024-03-04 15:57       ` Donald Hunter
2024-03-04 16:20         ` Jakub Kicinski
2024-03-01 23:05 ` [PATCH net-next 3/4] tools: ynl: support debug printing messages Jakub Kicinski
2024-03-04 11:34   ` Donald Hunter
2024-03-01 23:05 ` [PATCH net-next 4/4] tools: ynl: add --dbg-small-recv for easier kernel testing Jakub Kicinski
2024-03-04 11:26   ` Donald Hunter
2024-03-04 14:59     ` Jakub Kicinski

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=20240304065823.258dfabf@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@google.com \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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).