]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - include/net/ip_vs.h
Merge remote-tracking branch 'arm-soc/for-next'
[karo-tx-linux.git] / include / net / ip_vs.h
index 38c1fca0c1a7c50500755653b5c760dbc9d96266..0816c872b68911077bd51bc41dee0e32e1c3213d 100644 (file)
@@ -38,59 +38,6 @@ static inline struct netns_ipvs *net_ipvs(struct net* net)
        return net->ipvs;
 }
 
-/* Get net ptr from skb in traffic cases
- * use skb_sknet when call is from userland (ioctl or netlink)
- */
-static inline struct net *skb_net(const struct sk_buff *skb)
-{
-#ifdef CONFIG_NET_NS
-#ifdef CONFIG_IP_VS_DEBUG
-       /*
-        * This is used for debug only.
-        * Start with the most likely hit
-        * End with BUG
-        */
-       if (likely(skb->dev && dev_net(skb->dev)))
-               return dev_net(skb->dev);
-       if (skb_dst(skb) && skb_dst(skb)->dev)
-               return dev_net(skb_dst(skb)->dev);
-       WARN(skb->sk, "Maybe skb_sknet should be used in %s() at line:%d\n",
-                     __func__, __LINE__);
-       if (likely(skb->sk && sock_net(skb->sk)))
-               return sock_net(skb->sk);
-       pr_err("There is no net ptr to find in the skb in %s() line:%d\n",
-               __func__, __LINE__);
-       BUG();
-#else
-       return dev_net(skb->dev ? : skb_dst(skb)->dev);
-#endif
-#else
-       return &init_net;
-#endif
-}
-
-static inline struct net *skb_sknet(const struct sk_buff *skb)
-{
-#ifdef CONFIG_NET_NS
-#ifdef CONFIG_IP_VS_DEBUG
-       /* Start with the most likely hit */
-       if (likely(skb->sk && sock_net(skb->sk)))
-               return sock_net(skb->sk);
-       WARN(skb->dev, "Maybe skb_net should be used instead in %s() line:%d\n",
-                      __func__, __LINE__);
-       if (likely(skb->dev && dev_net(skb->dev)))
-               return dev_net(skb->dev);
-       pr_err("There is no net ptr to find in the skb in %s() line:%d\n",
-               __func__, __LINE__);
-       BUG();
-#else
-       return sock_net(skb->sk);
-#endif
-#else
-       return &init_net;
-#endif
-}
-
 /* This one needed for single_open_net since net is stored directly in
  * private not as a struct i.e. seq_file_net can't be used.
  */
@@ -483,22 +430,25 @@ struct ip_vs_protocol {
 
        void (*exit)(struct ip_vs_protocol *pp);
 
-       int (*init_netns)(struct net *net, struct ip_vs_proto_data *pd);
+       int (*init_netns)(struct netns_ipvs *ipvs, struct ip_vs_proto_data *pd);
 
-       void (*exit_netns)(struct net *net, struct ip_vs_proto_data *pd);
+       void (*exit_netns)(struct netns_ipvs *ipvs, struct ip_vs_proto_data *pd);
 
-       int (*conn_schedule)(int af, struct sk_buff *skb,
+       int (*conn_schedule)(struct netns_ipvs *ipvs,
+                            int af, struct sk_buff *skb,
                             struct ip_vs_proto_data *pd,
                             int *verdict, struct ip_vs_conn **cpp,
                             struct ip_vs_iphdr *iph);
 
        struct ip_vs_conn *
-       (*conn_in_get)(int af,
+       (*conn_in_get)(struct netns_ipvs *ipvs,
+                      int af,
                       const struct sk_buff *skb,
                       const struct ip_vs_iphdr *iph);
 
        struct ip_vs_conn *
-       (*conn_out_get)(int af,
+       (*conn_out_get)(struct netns_ipvs *ipvs,
+                       int af,
                        const struct sk_buff *skb,
                        const struct ip_vs_iphdr *iph);
 
@@ -517,9 +467,9 @@ struct ip_vs_protocol {
                                 const struct sk_buff *skb,
                                 struct ip_vs_proto_data *pd);
 
-       int (*register_app)(struct net *net, struct ip_vs_app *inc);
+       int (*register_app)(struct netns_ipvs *ipvs, struct ip_vs_app *inc);
 
-       void (*unregister_app)(struct net *net, struct ip_vs_app *inc);
+       void (*unregister_app)(struct netns_ipvs *ipvs, struct ip_vs_app *inc);
 
        int (*app_conn_bind)(struct ip_vs_conn *cp);
 
@@ -1098,6 +1048,11 @@ static inline int sysctl_ignore_tunneled(struct netns_ipvs *ipvs)
        return ipvs->sysctl_ignore_tunneled;
 }
 
+static inline int sysctl_cache_bypass(struct netns_ipvs *ipvs)
+{
+       return ipvs->sysctl_cache_bypass;
+}
+
 #else
 
 static inline int sysctl_sync_threshold(struct netns_ipvs *ipvs)
@@ -1180,6 +1135,11 @@ static inline int sysctl_ignore_tunneled(struct netns_ipvs *ipvs)
        return 0;
 }
 
+static inline int sysctl_cache_bypass(struct netns_ipvs *ipvs)
+{
+       return 0;
+}
+
 #endif
 
 /* IPVS core functions
@@ -1222,12 +1182,14 @@ static inline void ip_vs_conn_fill_param(struct netns_ipvs *ipvs, int af, int pr
 struct ip_vs_conn *ip_vs_conn_in_get(const struct ip_vs_conn_param *p);
 struct ip_vs_conn *ip_vs_ct_in_get(const struct ip_vs_conn_param *p);
 
-struct ip_vs_conn * ip_vs_conn_in_get_proto(int af, const struct sk_buff *skb,
+struct ip_vs_conn * ip_vs_conn_in_get_proto(struct netns_ipvs *ipvs, int af,
+                                           const struct sk_buff *skb,
                                            const struct ip_vs_iphdr *iph);
 
 struct ip_vs_conn *ip_vs_conn_out_get(const struct ip_vs_conn_param *p);
 
-struct ip_vs_conn * ip_vs_conn_out_get_proto(int af, const struct sk_buff *skb,
+struct ip_vs_conn * ip_vs_conn_out_get_proto(struct netns_ipvs *ipvs, int af,
+                                            const struct sk_buff *skb,
                                             const struct ip_vs_iphdr *iph);
 
 /* Get reference to gain full access to conn.
@@ -1256,7 +1218,7 @@ void ip_vs_conn_expire_now(struct ip_vs_conn *cp);
 
 const char *ip_vs_state_name(__u16 proto, int state);
 
-void ip_vs_tcp_conn_listen(struct net *net, struct ip_vs_conn *cp);
+void ip_vs_tcp_conn_listen(struct ip_vs_conn *cp);
 int ip_vs_check_template(struct ip_vs_conn *ct);
 void ip_vs_random_dropentry(struct netns_ipvs *ipvs);
 int ip_vs_conn_init(void);
@@ -1323,17 +1285,17 @@ ip_vs_control_add(struct ip_vs_conn *cp, struct ip_vs_conn *ctl_cp)
 }
 
 /* IPVS netns init & cleanup functions */
-int ip_vs_estimator_net_init(struct net *net);
+int ip_vs_estimator_net_init(struct netns_ipvs *ipvs);
 int ip_vs_control_net_init(struct netns_ipvs *ipvs);
-int ip_vs_protocol_net_init(struct net *net);
-int ip_vs_app_net_init(struct net *net);
-int ip_vs_conn_net_init(struct net *net);
+int ip_vs_protocol_net_init(struct netns_ipvs *ipvs);
+int ip_vs_app_net_init(struct netns_ipvs *ipvs);
+int ip_vs_conn_net_init(struct netns_ipvs *ipvs);
 int ip_vs_sync_net_init(struct netns_ipvs *ipvs);
-void ip_vs_conn_net_cleanup(struct net *net);
-void ip_vs_app_net_cleanup(struct net *net);
-void ip_vs_protocol_net_cleanup(struct net *net);
+void ip_vs_conn_net_cleanup(struct netns_ipvs *ipvs);
+void ip_vs_app_net_cleanup(struct netns_ipvs *ipvs);
+void ip_vs_protocol_net_cleanup(struct netns_ipvs *ipvs);
 void ip_vs_control_net_cleanup(struct netns_ipvs *ipvs);
-void ip_vs_estimator_net_cleanup(struct net *net);
+void ip_vs_estimator_net_cleanup(struct netns_ipvs *ipvs);
 void ip_vs_sync_net_cleanup(struct netns_ipvs *ipvs);
 void ip_vs_service_net_cleanup(struct netns_ipvs *ipvs);
 
@@ -1341,11 +1303,11 @@ void ip_vs_service_net_cleanup(struct netns_ipvs *ipvs);
  * (from ip_vs_app.c)
  */
 #define IP_VS_APP_MAX_PORTS  8
-struct ip_vs_app *register_ip_vs_app(struct net *net, struct ip_vs_app *app);
-void unregister_ip_vs_app(struct net *net, struct ip_vs_app *app);
+struct ip_vs_app *register_ip_vs_app(struct netns_ipvs *ipvs, struct ip_vs_app *app);
+void unregister_ip_vs_app(struct netns_ipvs *ipvs, struct ip_vs_app *app);
 int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
 void ip_vs_unbind_app(struct ip_vs_conn *cp);
-int register_ip_vs_app_inc(struct net *net, struct ip_vs_app *app, __u16 proto,
+int register_ip_vs_app_inc(struct netns_ipvs *ipvs, struct ip_vs_app *app, __u16 proto,
                           __u16 port);
 int ip_vs_app_inc_get(struct ip_vs_app *inc);
 void ip_vs_app_inc_put(struct ip_vs_app *inc);