RE: [RFC PATCH] netlink: Increase netlink dump skb message size
From: Rose, Gregory V <hidden>
Date: 2011-04-27 18:08:24
-----Original Message----- From: Eric Dumazet [mailto:eric.dumazet@gmail.com] Sent: Wednesday, April 27, 2011 11:06 AM To: Rose, Gregory V Cc: Steve Hodgson; David Miller; netdev@vger.kernel.org; bhutchings@solarflare.com Subject: RE: [RFC PATCH] netlink: Increase netlink dump skb message size Le mercredi 27 avril 2011 à 10:39 -0700, Rose, Gregory V a écrit :quoted
Right, but when I look in rtnetlink I see the routine to calculate the amount of buffer needed for VF info dump is the number of device parent (PF) VFs * the sizeof various IFLA_VF_INFO items. The more the VFs the bigger this gets, especially if you want to add more stuff to IFLA_VF_INFO. So when the kernel dumps this all out it can get bigger than the NLMSG_GOODSIZE (or DUMPSIZE) pretty quickly.quoted
BTW "ip" uses a 16384 bytes buffer, not a 8192 bytes one.I know, that's why I suffered some confusion about which size to use. The ip command uses 16K but the NLMSG_GOODSIZE can be as small as 3712 bytes (depending on page size). Despite the user buffer being 16k if the size calculated by if_nlmsg_size() in rtnetlink.c is bigger than NLMSG_GOODSIZE then you don't see the info for more than 40 or so VFs. More VFs than that and nothing gets displayed.One solution is to change rtnl_dump_ifinfo() to call rtnl_fill_ifinfo() once time per device (RTM_NEWLINK like now but no more VFINFO inside), then call another function to provide vf/vlan informations (RTM_NEWVF), using cb->args[2] as an index into VF space, so that we can stop if current skb is filled, and next recvmsg() starts at previous saved index. Or implement a new "ip vf ..." dumper and only dumps RTM_NEWVF messages.
I'm a netlink newbie so maybe that is a more obvious solution that I missed. Let me have a look at the code and see. Thanks, - Greg