From: Thomas Graf <tgraf@suug.ch>
To: Patrick McHardy <kaber@trash.net>, Julius Volz <juliusv@google.com>
Cc: netdev@vger.kernel.org, Vince Busam <vbusam@google.com>
Subject: Re: Sending big Netlink messages to userspace
Date: Wed, 25 Jun 2008 12:44:01 +0200 [thread overview]
Message-ID: <20080625104401.GJ20815@postel.suug.ch> (raw)
In-Reply-To: <f4845fc0806241118u397a17e3qbe09f5d04a7e5035@mail.gmail.com> <4861282C.4000208@trash.net>
* Julius Volz <juliusv@google.com> 2008-06-24 20:18
> libnl hides this from the user, but from reading the code it looks
> like it now has correct a provision for increasing receive buffer size
> automatically on seeing MSG_TRUNC. However, it doesn't seem to help in
> my case...
libnl initializes the buffer size to the size of a page. The value
can be overwritten by calling nl_set_buffer_size(socket, rx, tx)
* Patrick McHardy <kaber@trash.net> 2008-06-24 19:00
> > It depends on what kind of attributes you're sending. In case
> > of top-level attributes you should only dump objects until
> > you reach NLMSG_GOODSIZE and continue during the next dump
> > callback invocation. Sending arbitary amounts of nested
> > data is more tricky, or might even be impossible currently.
>
> Then I probably have a problem because the list items I'm sending are
> nested and the whole list itself is contained in a nested attribute:
>
> IPVS_ENTRY_ATTR_SERVICE_LIST
> IPVS_ENTRY_ATTR_SERVICE
> [service attributes]
> ...
> IPVS_ENTRY_ATTR_SERVICE
> [service attributes]
> ...
> ...
>
> Each list entry has a limited size, however, so if I get rid of the
> top-level wrapper (SERVICE_LIST), I could try to see if there is
> enough space left in the skb for another whole nested service entry
> and continue in the next callback invocation if space runs out.
>
> Actually, nla_nest_cancel() seems to be what I'm looking for: start
> dumping service entries into the skb, call nla_nest_cancel() on a put
> failure and begin with the canceled element on the next invocation.
> That should work, right?
Yes, that's how it's intended to work. You can fill until one of the
nla_put variantes aborts and starting trimming off what you've added
already using the nla_nest_cancel() methods until you reach a point
where you can safely cut your stream of attributes. So far we typically
made sure that this barrier is on netlink message level but is no
requirement. You may split a list into several messages you just
have to make sure that you call nla_nest_end() and nlmsg_end() properly
before you send the message.
next prev parent reply other threads:[~2008-06-25 10:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-24 16:38 Sending big Netlink messages to userspace Julius Volz
2008-06-24 17:00 ` Patrick McHardy
2008-06-24 18:18 ` Julius Volz
2008-06-25 10:44 ` Thomas Graf [this message]
2008-06-25 18:56 ` Julius Volz
2008-06-26 10:01 ` Thomas Graf
2008-06-25 22:51 ` David Miller
2008-06-26 0:41 ` Patrick McHardy
2008-06-26 15:39 ` Julius Volz
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=20080625104401.GJ20815@postel.suug.ch \
--to=tgraf@suug.ch \
--cc=juliusv@google.com \
--cc=kaber@trash.net \
--cc=netdev@vger.kernel.org \
--cc=vbusam@google.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).