These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / net / netfilter / ipvs / ip_vs_proto.c
index 939f7fb..8ae4807 100644 (file)
@@ -63,9 +63,8 @@ static int __used __init register_ip_vs_protocol(struct ip_vs_protocol *pp)
  *     register an ipvs protocols netns related data
  */
 static int
-register_ip_vs_proto_netns(struct net *net, struct ip_vs_protocol *pp)
+register_ip_vs_proto_netns(struct netns_ipvs *ipvs, struct ip_vs_protocol *pp)
 {
-       struct netns_ipvs *ipvs = net_ipvs(net);
        unsigned int hash = IP_VS_PROTO_HASH(pp->protocol);
        struct ip_vs_proto_data *pd =
                        kzalloc(sizeof(struct ip_vs_proto_data), GFP_KERNEL);
@@ -79,7 +78,7 @@ register_ip_vs_proto_netns(struct net *net, struct ip_vs_protocol *pp)
        atomic_set(&pd->appcnt, 0);     /* Init app counter */
 
        if (pp->init_netns != NULL) {
-               int ret = pp->init_netns(net, pd);
+               int ret = pp->init_netns(ipvs, pd);
                if (ret) {
                        /* unlink an free proto data */
                        ipvs->proto_data_table[hash] = pd->next;
@@ -116,9 +115,8 @@ static int unregister_ip_vs_protocol(struct ip_vs_protocol *pp)
  *     unregister an ipvs protocols netns data
  */
 static int
-unregister_ip_vs_proto_netns(struct net *net, struct ip_vs_proto_data *pd)
+unregister_ip_vs_proto_netns(struct netns_ipvs *ipvs, struct ip_vs_proto_data *pd)
 {
-       struct netns_ipvs *ipvs = net_ipvs(net);
        struct ip_vs_proto_data **pd_p;
        unsigned int hash = IP_VS_PROTO_HASH(pd->pp->protocol);
 
@@ -127,7 +125,7 @@ unregister_ip_vs_proto_netns(struct net *net, struct ip_vs_proto_data *pd)
                if (*pd_p == pd) {
                        *pd_p = pd->next;
                        if (pd->pp->exit_netns != NULL)
-                               pd->pp->exit_netns(net, pd);
+                               pd->pp->exit_netns(ipvs, pd);
                        kfree(pd);
                        return 0;
                }
@@ -156,8 +154,8 @@ EXPORT_SYMBOL(ip_vs_proto_get);
 /*
  *     get ip_vs_protocol object data by netns and proto
  */
-static struct ip_vs_proto_data *
-__ipvs_proto_data_get(struct netns_ipvs *ipvs, unsigned short proto)
+struct ip_vs_proto_data *
+ip_vs_proto_data_get(struct netns_ipvs *ipvs, unsigned short proto)
 {
        struct ip_vs_proto_data *pd;
        unsigned int hash = IP_VS_PROTO_HASH(proto);
@@ -169,14 +167,6 @@ __ipvs_proto_data_get(struct netns_ipvs *ipvs, unsigned short proto)
 
        return NULL;
 }
-
-struct ip_vs_proto_data *
-ip_vs_proto_data_get(struct net *net, unsigned short proto)
-{
-       struct netns_ipvs *ipvs = net_ipvs(net);
-
-       return __ipvs_proto_data_get(ipvs, proto);
-}
 EXPORT_SYMBOL(ip_vs_proto_data_get);
 
 /*
@@ -317,7 +307,7 @@ ip_vs_tcpudp_debug_packet(int af, struct ip_vs_protocol *pp,
 /*
  * per network name-space init
  */
-int __net_init ip_vs_protocol_net_init(struct net *net)
+int __net_init ip_vs_protocol_net_init(struct netns_ipvs *ipvs)
 {
        int i, ret;
        static struct ip_vs_protocol *protos[] = {
@@ -339,27 +329,26 @@ int __net_init ip_vs_protocol_net_init(struct net *net)
        };
 
        for (i = 0; i < ARRAY_SIZE(protos); i++) {
-               ret = register_ip_vs_proto_netns(net, protos[i]);
+               ret = register_ip_vs_proto_netns(ipvs, protos[i]);
                if (ret < 0)
                        goto cleanup;
        }
        return 0;
 
 cleanup:
-       ip_vs_protocol_net_cleanup(net);
+       ip_vs_protocol_net_cleanup(ipvs);
        return ret;
 }
 
-void __net_exit ip_vs_protocol_net_cleanup(struct net *net)
+void __net_exit ip_vs_protocol_net_cleanup(struct netns_ipvs *ipvs)
 {
-       struct netns_ipvs *ipvs = net_ipvs(net);
        struct ip_vs_proto_data *pd;
        int i;
 
        /* unregister all the ipvs proto data for this netns */
        for (i = 0; i < IP_VS_PROTO_TAB_SIZE; i++) {
                while ((pd = ipvs->proto_data_table[i]) != NULL)
-                       unregister_ip_vs_proto_netns(net, pd);
+                       unregister_ip_vs_proto_netns(ipvs, pd);
        }
 }