net: Detect drivers that reschedule NAPI and exhaust budget
[firefly-linux-kernel-4.4.55.git] / net / core / net_namespace.c
index 2161f0979fcedb100639805a63c7a969f7e760bc..ce780c722e48ca2bf35534895ef0b7dc0a9541d5 100644 (file)
@@ -337,17 +337,17 @@ EXPORT_SYMBOL_GPL(__put_net);
 
 struct net *get_net_ns_by_fd(int fd)
 {
-       struct proc_ns *ei;
        struct file *file;
+       struct ns_common *ns;
        struct net *net;
 
        file = proc_ns_fget(fd);
        if (IS_ERR(file))
                return ERR_CAST(file);
 
-       ei = get_proc_ns(file_inode(file));
-       if (ei->ns_ops == &netns_operations)
-               net = get_net(container_of(ei->ns, struct net, ns));
+       ns = get_proc_ns(file_inode(file));
+       if (ns->ops == &netns_operations)
+               net = get_net(container_of(ns, struct net, ns));
        else
                net = ERR_PTR(-EINVAL);
 
@@ -386,12 +386,15 @@ EXPORT_SYMBOL_GPL(get_net_ns_by_pid);
 
 static __net_init int net_ns_net_init(struct net *net)
 {
-       return proc_alloc_inum(&net->ns.inum);
+#ifdef CONFIG_NET_NS
+       net->ns.ops = &netns_operations;
+#endif
+       return ns_alloc_inum(&net->ns);
 }
 
 static __net_exit void net_ns_net_exit(struct net *net)
 {
-       proc_free_inum(net->ns.inum);
+       ns_free_inum(&net->ns);
 }
 
 static struct pernet_operations __net_initdata net_ns_ops = {