datapath: Fix net exit.
[cascardo/ovs.git] / datapath / vport.h
index 6e76601..e256fc0 100644 (file)
@@ -43,28 +43,37 @@ void ovs_vport_exit(void);
 struct vport *ovs_vport_add(const struct vport_parms *);
 void ovs_vport_del(struct vport *);
 
-struct vport *ovs_vport_locate(struct net *net, const char *name);
+struct vport *ovs_vport_locate(const struct net *net, const char *name);
 
-void ovs_vport_set_stats(struct vport *, struct ovs_vport_stats *);
 void ovs_vport_get_stats(struct vport *, struct ovs_vport_stats *);
 
 int ovs_vport_set_options(struct vport *, struct nlattr *options);
 int ovs_vport_get_options(const struct vport *, struct sk_buff *);
 
-int ovs_vport_set_upcall_portids(struct vport *, struct nlattr *pids);
+int ovs_vport_set_upcall_portids(struct vport *, const struct nlattr *pids);
 int ovs_vport_get_upcall_portids(const struct vport *, struct sk_buff *);
 u32 ovs_vport_find_upcall_portid(const struct vport *, struct sk_buff *);
 
 int ovs_vport_send(struct vport *, struct sk_buff *);
 
-/* The following definitions are for implementers of vport devices: */
+int ovs_tunnel_get_egress_info(struct ovs_tunnel_info *egress_tun_info,
+                              struct net *net,
+                              const struct ovs_tunnel_info *tun_info,
+                              u8 ipproto,
+                              u32 skb_mark,
+                              __be16 tp_src,
+                              __be16 tp_dst);
+int ovs_vport_get_egress_tun_info(struct vport *vport, struct sk_buff *skb,
+                                 struct ovs_tunnel_info *info);
 
+/* The following definitions are for implementers of vport devices: */
 struct vport_err_stats {
-       u64 rx_dropped;
-       u64 rx_errors;
-       u64 tx_dropped;
-       u64 tx_errors;
+       atomic_long_t rx_dropped;
+       atomic_long_t rx_errors;
+       atomic_long_t tx_dropped;
+       atomic_long_t tx_errors;
 };
+
 /**
  * struct vport_portids - array of netlink portids of a vport.
  *                        must be protected by rcu.
@@ -91,10 +100,8 @@ struct vport_portids {
  * @dp_hash_node: Element in @datapath->ports hash table in datapath.c.
  * @ops: Class structure.
  * @percpu_stats: Points to per-CPU statistics used and maintained by vport
- * @stats_lock: Protects @err_stats and @offset_stats.
  * @err_stats: Points to error statistics used and maintained by vport
- * @offset_stats: Added to actual statistics as a sop to compatibility with
- * XAPI for Citrix XenServer.  Deprecated.
+ * @detach_list: list used for detaching vport in net-exit call.
  */
 struct vport {
        struct rcu_head rcu;
@@ -106,11 +113,10 @@ struct vport {
        struct hlist_node dp_hash_node;
        const struct vport_ops *ops;
 
-       struct pcpu_tstats __percpu *percpu_stats;
+       struct pcpu_sw_netstats __percpu *percpu_stats;
 
-       spinlock_t stats_lock;
        struct vport_err_stats err_stats;
-       struct ovs_vport_stats offset_stats;
+       struct list_head detach_list;
 };
 
 /**
@@ -150,6 +156,8 @@ struct vport_parms {
  * @get_name: Get the device's name.
  * @send: Send a packet on the device.  Returns the length of the packet sent,
  * zero for dropped packets or negative for error.
+ * @get_egress_tun_info: Get the egress tunnel 5-tuple and other info for
+ * a packet.
  */
 struct vport_ops {
        enum ovs_vport_type type;
@@ -165,6 +173,8 @@ struct vport_ops {
        const char *(*get_name)(const struct vport *);
 
        int (*send)(struct vport *, struct sk_buff *);
+       int (*get_egress_tun_info)(struct vport *, struct sk_buff *,
+                                  struct ovs_tunnel_info *);
 };
 
 enum vport_err_type {
@@ -211,12 +221,14 @@ static inline struct vport *vport_from_priv(void *priv)
 }
 
 void ovs_vport_receive(struct vport *, struct sk_buff *,
-                      struct ovs_key_ipv4_tunnel *);
+                      const struct ovs_tunnel_info *);
 
 /* List of statically compiled vport implementations.  Don't forget to also
- * add yours to the list at the top of vport.c. */
+ * add yours to the list at the top of vport.c.
+ */
 extern const struct vport_ops ovs_netdev_vport_ops;
 extern const struct vport_ops ovs_internal_vport_ops;
+extern const struct vport_ops ovs_geneve_vport_ops;
 extern const struct vport_ops ovs_gre_vport_ops;
 extern const struct vport_ops ovs_gre64_vport_ops;
 extern const struct vport_ops ovs_vxlan_vport_ops;