rtnetlink: call rtnl_calcit directly
authorFlorian Westphal <fw@strlen.de>
Wed, 9 Aug 2017 18:41:47 +0000 (20:41 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Aug 2017 23:57:38 +0000 (16:57 -0700)
commite1fa6d216dd134c7fca6dc5f0a10553c36503901
tree2390605851edaa46f8ce370e2bd8dbcd05fca5cb
parent078295fb9af507abce4976c6e9ff56a67da4e9a0
rtnetlink: call rtnl_calcit directly

There is only a single place in the kernel that regisers the "calcit"
callback (to determine min allocation for dumps).

This is in rtnetlink.c for PF_UNSPEC RTM_GETLINK.
The function that checks for calcit presence at run time will first check
the requested family (which will always fail for !PF_UNSPEC as no callsite
registers this), then falls back to checking PF_UNSPEC.

Therefore we can just check if type is RTM_GETLINK and then do a direct
call.  Because of fallback to PF_UNSPEC all RTM_GETLINK types used this
regardless of family.

This has the advantage that we don't need to allocate space for
the function pointer for all the other families.

A followup patch will drop the calcit function pointer from the
rtnl_link callback structure.

Signed-off-by: Florian Westphal <fw@strlen.de>
Reviewed-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/rtnetlink.c