[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220819121640.11e7e2f7@kernel.org>
Date: Fri, 19 Aug 2022 12:16:40 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Johannes Berg <johannes@...solutions.net>
Cc: davem@...emloft.net, netdev@...r.kernel.org, corbet@....net,
stephen@...workplumber.org, sdf@...gle.com, ecree.xilinx@...il.com,
benjamin.poirier@...il.com, idosch@...sch.org,
f.fainelli@...il.com, jiri@...nulli.us, dsahern@...nel.org,
fw@...len.de, linux-doc@...r.kernel.org, jhs@...atatu.com,
tgraf@...g.ch, jacob.e.keller@...el.com, svinota.saveliev@...il.com
Subject: Re: [PATCH net-next 2/2] docs: netlink: basic introduction to
Netlink
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).
Powered by blists - more mailing lists