net: Introduce possible_net_t
[deliverable/linux.git] / include / linux / netdevice.h
index 625c8d71511bd7df4e5ebfb9319846a2d808751a..ddab1a2a07a0bc11f840f81bd36ad38adcdd0012 100644 (file)
@@ -768,6 +768,8 @@ struct netdev_phys_item_id {
 typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
                                       struct sk_buff *skb);
 
+struct fib_info;
+
 /*
  * This structure defines the management hooks for network devices.
  * The following hooks can be defined; unless noted otherwise, they are
@@ -1031,6 +1033,14 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
  * int (*ndo_switch_port_stp_update)(struct net_device *dev, u8 state);
  *     Called to notify switch device port of bridge port STP
  *     state change.
+ * int (*ndo_sw_parent_fib_ipv4_add)(struct net_device *dev, __be32 dst,
+ *                                  int dst_len, struct fib_info *fi,
+ *                                  u8 tos, u8 type, u32 nlflags, u32 tb_id);
+ *     Called to add/modify IPv4 route to switch device.
+ * int (*ndo_sw_parent_fib_ipv4_del)(struct net_device *dev, __be32 dst,
+ *                                  int dst_len, struct fib_info *fi,
+ *                                  u8 tos, u8 type, u32 tb_id);
+ *     Called to delete IPv4 route from switch device.
  */
 struct net_device_ops {
        int                     (*ndo_init)(struct net_device *dev);
@@ -1192,6 +1202,19 @@ struct net_device_ops {
                                                            struct netdev_phys_item_id *psid);
        int                     (*ndo_switch_port_stp_update)(struct net_device *dev,
                                                              u8 state);
+       int                     (*ndo_switch_fib_ipv4_add)(struct net_device *dev,
+                                                          __be32 dst,
+                                                          int dst_len,
+                                                          struct fib_info *fi,
+                                                          u8 tos, u8 type,
+                                                          u32 nlflags,
+                                                          u32 tb_id);
+       int                     (*ndo_switch_fib_ipv4_del)(struct net_device *dev,
+                                                          __be32 dst,
+                                                          int dst_len,
+                                                          struct fib_info *fi,
+                                                          u8 tos, u8 type,
+                                                          u32 tb_id);
 #endif
 };
 
@@ -1698,9 +1721,7 @@ struct net_device {
        struct netpoll_info __rcu       *npinfo;
 #endif
 
-#ifdef CONFIG_NET_NS
-       struct net              *nd_net;
-#endif
+       possible_net_t                  nd_net;
 
        /* mid-layer private */
        union {
@@ -1840,10 +1861,7 @@ struct net *dev_net(const struct net_device *dev)
 static inline
 void dev_net_set(struct net_device *dev, struct net *net)
 {
-#ifdef CONFIG_NET_NS
-       release_net(dev->nd_net);
-       dev->nd_net = hold_net(net);
-#endif
+       write_pnet(&dev->nd_net, net);
 }
 
 static inline bool netdev_uses_dsa(struct net_device *dev)
This page took 0.049711 seconds and 5 git commands to generate.