datapath: Add support for kernels 3.13
[sliver-openvswitch.git] / datapath / vport.c
index 2882cc7..2673b81 100644 (file)
@@ -35,6 +35,9 @@
 #include "vport.h"
 #include "vport-internal_dev.h"
 
+static void ovs_vport_record_error(struct vport *,
+                                  enum vport_err_type err_type);
+
 /* List of statically compiled vport implementations.  Don't forget to also
  * add yours to the list at the bottom of vport.h. */
 static const struct vport_ops *vport_ops_list[] = {
@@ -119,6 +122,7 @@ struct vport *ovs_vport_alloc(int priv_size, const struct vport_ops *ops,
 {
        struct vport *vport;
        size_t alloc_size;
+       int i;
 
        alloc_size = sizeof(struct vport);
        if (priv_size) {
@@ -142,6 +146,12 @@ struct vport *ovs_vport_alloc(int priv_size, const struct vport_ops *ops,
                return ERR_PTR(-ENOMEM);
        }
 
+       for_each_possible_cpu(i) {
+               struct pcpu_tstats *vport_stats;
+               vport_stats = per_cpu_ptr(vport->percpu_stats, i);
+               u64_stats_init(&vport_stats->syncp);
+       }
+
        spin_lock_init(&vport->stats_lock);
 
        return vport;
@@ -411,7 +421,8 @@ int ovs_vport_send(struct vport *vport, struct sk_buff *skb)
  * If using the vport generic stats layer indicate that an error of the given
  * type has occurred.
  */
-void ovs_vport_record_error(struct vport *vport, enum vport_err_type err_type)
+static void ovs_vport_record_error(struct vport *vport,
+                                  enum vport_err_type err_type)
 {
        spin_lock(&vport->stats_lock);