• Florian Westphal's avatar
    rtnetlink: call rtnl_calcit directly · e1fa6d21
    Florian Westphal authored
    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: default avatarFlorian Westphal <fw@strlen.de>
    Reviewed-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    e1fa6d21
rtnetlink.c 104 KB