• Pavel Emelyanov's avatar
    net: Make ifindex generation per-net namespace · aa79e66e
    Pavel Emelyanov authored
    Strictly speaking this is only _really_ required for checkpoint-restore to
    make loopback device always have the same index.
    
    This change appears to be safe wrt "ifindex should be unique per-system"
    concept, as all the ifindex usage is either already made per net namespace
    of is explicitly limited with init_net only.
    
    There are two cool side effects of this. The first one -- ifindices of
    devices in container are always small, regardless of how many containers
    we've started (and re-started) so far. The second one is -- we can speed
    up the loopback ifidex access as shown in the next patch.
    
    v2: Place ifindex right after dev_base_seq : avoid two holes and use the
        same cache line, dirtied in list_netdevice()/unlist_netdevice()
    Signed-off-by: default avatarPavel Emelyanov <xemul@parallels.com>
    Acked-by: default avatarEric Dumazet <edumazet@google.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    aa79e66e
dev.c 162 KB