ofproto: Lock hard_timeout and idle_timeout of struct rule.
[sliver-openvswitch.git] / ofproto / ofproto-provider.h
index 7fc5e03..75bcefc 100644 (file)
@@ -19,7 +19,6 @@
 
 /* Definitions for use within ofproto. */
 
-#include "ofproto/ofproto.h"
 #include "cfm.h"
 #include "classifier.h"
 #include "heap.h"
@@ -27,6 +26,8 @@
 #include "list.h"
 #include "ofp-errors.h"
 #include "ofp-util.h"
+#include "ofproto/ofproto.h"
+#include "ovs-thread.h"
 #include "shash.h"
 #include "simap.h"
 #include "timeval.h"
@@ -219,11 +220,13 @@ struct rule {
     long long int created;       /* Creation time. */
     long long int modified;      /* Time of last modification. */
     long long int used;          /* Last use; time created if never used. */
-    uint16_t hard_timeout;       /* In seconds from ->modified. */
-    uint16_t idle_timeout;       /* In seconds from ->used. */
     uint8_t table_id;            /* Index in ofproto's 'tables' array. */
     bool send_flow_removed;      /* Send a flow removed message? */
 
+    struct ovs_mutex timeout_mutex;
+    uint16_t hard_timeout OVS_GUARDED; /* In seconds from ->modified. */
+    uint16_t idle_timeout OVS_GUARDED; /* In seconds from ->used. */
+
     /* Eviction groups. */
     bool evictable;              /* If false, prevents eviction. */
     struct heap_node evg_node;   /* In eviction_group's "rules" heap. */
@@ -1397,7 +1400,7 @@ int ofproto_class_unregister(const struct ofproto_class *);
 enum { OFPROTO_POSTPONE = 1 << 16 };
 BUILD_ASSERT_DECL(OFPROTO_POSTPONE < OFPERR_OFS);
 
-int ofproto_flow_mod(struct ofproto *, const struct ofputil_flow_mod *);
+int ofproto_flow_mod(struct ofproto *, struct ofputil_flow_mod *);
 void ofproto_add_flow(struct ofproto *, const struct match *,
                       unsigned int priority,
                       const struct ofpact *ofpacts, size_t ofpacts_len);