From: David Miller <davem@davemloft.net>
To: gregory.v.rose@intel.com
Cc: netdev@vger.kernel.org, bhutchings@solarflare.com
Subject: Re: [RFC PATCH] netlink: Increase netlink dump skb message size
Date: Fri, 29 Apr 2011 12:29:40 -0700 (PDT) [thread overview]
Message-ID: <20110429.122940.179938280.davem@davemloft.net> (raw)
In-Reply-To: <20110425220157.2012.96707.stgit@gitlad.jf.intel.com>
From: Greg Rose <gregory.v.rose@intel.com>
Date: Mon, 25 Apr 2011 15:01:57 -0700
> The message size allocated for rtnl info dumps was limited to a single page.
> This is not enough for additional interface info available with devices
> that support SR-IOV. Check that the amount of data allocated is sufficient
> for the amount of data requested.
>
> Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Actually, thinking about this problem some more I think your approach
is close to what we should actually do.
The only problem is that you've specialized netlink_dump() too much,
hide the issue in the rtnetlink device dumping code and provide
the necessary information via the control block.
1) Add some information to struct netlink_callback.
"u16 min_dump_alloc;"
I think you can change "int family;" there to "u16 family;"
so that there is no new space required to add this functionality.
2) In netlink_dump().
int alloc_size;
mutex_lock(nlk->cb_mutex);
cb = nlk->cb;
if (cb == NULL) {
...
}
alloc_size = max_t(int, cb->min_dump_alloc, NLMSG_GOODSIZE);
skb = sock_rmalloc(sk, alloc_size, 0, GFP_KERNEL);
if (!skb) {
...
3) In net/core/rtnetlink.c add a new method pointer to struct rtnl_link,
"u16 (*calc_min_dump_alloc)(struct sk_buff *);"
Add an implementation for the RTM_GETLINK slot.
This function does the logic to compute the maximum space needed
for the devices currently configured, as you hacked directly into
the netlink_dump() logic in your match.
4) Make netlink_dump_start() take a new argument, this is where you
pass the new min_dump_alloc value that will get stored in the
newly allocated callback object.
calcit = rtnl_get_calcit(family, type);
min_dump_alloc = 0;
if (calcit)
min_dump_alloc = calcit(skb);
err = netlink_dump_start(rtnl, skb, nlh, dumpit, min_dump_alloc, NULL);
Anyways, something like that.
next prev parent reply other threads:[~2011-04-29 19:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-25 22:01 [RFC PATCH] netlink: Increase netlink dump skb message size Greg Rose
2011-04-26 6:33 ` Eric Dumazet
2011-04-26 6:56 ` David Miller
2011-04-26 16:12 ` Rose, Gregory V
2011-04-26 16:21 ` Eric Dumazet
2011-04-26 16:24 ` Rose, Gregory V
2011-04-26 19:07 ` Ben Hutchings
2011-04-26 21:58 ` Rose, Gregory V
2011-04-27 15:46 ` Steve Hodgson
2011-04-27 16:30 ` Eric Dumazet
2011-04-27 17:15 ` Rose, Gregory V
2011-04-27 17:29 ` Eric Dumazet
2011-04-27 17:39 ` Rose, Gregory V
2011-04-27 18:05 ` Eric Dumazet
2011-04-27 18:08 ` Rose, Gregory V
2011-04-26 16:02 ` Rose, Gregory V
2011-04-29 19:29 ` David Miller [this message]
2011-04-29 19:37 ` Rose, Gregory V
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=20110429.122940.179938280.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=bhutchings@solarflare.com \
--cc=gregory.v.rose@intel.com \
--cc=netdev@vger.kernel.org \
/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).