netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: davem@davemloft.net, netdev@vger.kernel.org, corbet@lwn.net,
	stephen@networkplumber.org, sdf@google.com,
	ecree.xilinx@gmail.com, benjamin.poirier@gmail.com,
	idosch@idosch.org, f.fainelli@gmail.com, jiri@resnulli.us,
	dsahern@kernel.org, fw@strlen.de, linux-doc@vger.kernel.org,
	jhs@mojatatu.com, tgraf@suug.ch, jacob.e.keller@intel.com,
	svinota.saveliev@gmail.com
Subject: Re: [PATCH net-next 2/2] docs: netlink: basic introduction to Netlink
Date: Fri, 19 Aug 2022 12:16:40 -0700	[thread overview]
Message-ID: <20220819121640.11e7e2f7@kernel.org> (raw)
In-Reply-To: <20220819105451.1de66044@kernel.org>

On Fri, 19 Aug 2022 10:54:51 -0700 Jakub Kicinski wrote:
> > Ugh, I repressed all those memories ... I don't remember now, I guess
> > I'd have to try it. Also it doesn't just apply to normal stuff but also
> > multicast, and that can be even trickier.  
> 
> No worries, let me try myself. Annoyingly I have this doc on a different
> branch than my netlink code, that's why I was being lazy :)

Buffer sizing
-------------

Netlink sockets are datagram sockets rather than stream sockets,
meaning that each message must be received in its entirety by a single
recv()/recvmsg() system call. If the buffer provided by the user is too
short, the message will be truncated and the ``MSG_TRUNC`` flag set
in struct msghdr (struct msghdr is the second argument
of the recvmsg() system call, *not* a Netlink header).

Upon truncation the remaining part of the message is discarded.

Netlink expects that the user buffer will be at least 8kB or a page
size of the CPU architecture, whichever is bigger. Particular Netlink
families may, however, require a larger buffer. 32kB buffer is recommended
for most efficient handling of dumps (larger buffer fits more dumped
objects and therefore fewer recvmsg() calls are needed).

  parent reply	other threads:[~2022-08-19 19:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-18  2:35 [PATCH net-next 1/2] net: improve and fix netlink kdoc Jakub Kicinski
2022-08-18  2:35 ` [PATCH net-next 2/2] docs: netlink: basic introduction to Netlink Jakub Kicinski
2022-08-18  4:05   ` Stanislav Fomichev
2022-08-19  3:13     ` Jakub Kicinski
2022-08-18  7:36   ` Johannes Berg
2022-08-19 16:20     ` Jakub Kicinski
2022-08-19 16:57       ` Johannes Berg
2022-08-19 17:54         ` Jakub Kicinski
2022-08-19 19:07           ` Johannes Berg
2022-08-19 19:16             ` Jakub Kicinski
2022-08-19 19:16           ` Jakub Kicinski [this message]
2022-08-19 19:20             ` Johannes Berg
2022-08-18 21:01   ` Keller, Jacob E

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=20220819121640.11e7e2f7@kernel.org \
    --to=kuba@kernel.org \
    --cc=benjamin.poirier@gmail.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=ecree.xilinx@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=fw@strlen.de \
    --cc=idosch@idosch.org \
    --cc=jacob.e.keller@intel.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=johannes@sipsolutions.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sdf@google.com \
    --cc=stephen@networkplumber.org \
    --cc=svinota.saveliev@gmail.com \
    --cc=tgraf@suug.ch \
    /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).