+ /* Eviction groups (see comment on struct eviction_group for explanation) .
+ *
+ * 'eviction_group' is this rule's eviction group, or NULL if it is not in
+ * any eviction group. When 'eviction_group' is nonnull, 'evg_node' is in
+ * the ->eviction_group->rules hmap. */
+ struct eviction_group *eviction_group OVS_GUARDED_BY(ofproto_mutex);
+ struct heap_node evg_node OVS_GUARDED_BY(ofproto_mutex);
+
+ /* OpenFlow actions. See struct rule_actions for more thread-safety
+ * notes. */
+ OVSRCU_TYPE(struct rule_actions *) actions;
+
+ /* In owning meter's 'rules' list. An empty list if there is no meter. */
+ struct list meter_list_node OVS_GUARDED_BY(ofproto_mutex);
+
+ /* Flow monitors (e.g. for NXST_FLOW_MONITOR, related to struct ofmonitor).
+ *
+ * 'add_seqno' is the sequence number when this rule was created.
+ * 'modify_seqno' is the sequence number when this rule was last modified.
+ * See 'monitor_seqno' in connmgr.c for more information. */
+ enum nx_flow_monitor_flags monitor_flags OVS_GUARDED_BY(ofproto_mutex);
+ uint64_t add_seqno OVS_GUARDED_BY(ofproto_mutex);
+ uint64_t modify_seqno OVS_GUARDED_BY(ofproto_mutex);
+
+ /* Optimisation for flow expiry. In ofproto's 'expirable' list if this
+ * rule is expirable, otherwise empty. */
+ struct list expirable OVS_GUARDED_BY(ofproto_mutex);
+
+ /* Times. Last so that they are more likely close to the stats managed
+ * by the provider. */
+ long long int created OVS_GUARDED; /* Creation time. */
+
+ /* Must hold 'mutex' for both read/write, 'ofproto_mutex' not needed. */
+ long long int modified OVS_GUARDED; /* Time of last modification. */
+};
+
+void ofproto_rule_ref(struct rule *);
+void ofproto_rule_unref(struct rule *);
+
+static inline struct rule_actions *
+rule_get_actions(const struct rule *rule)
+{
+ return ovsrcu_get(struct rule_actions *, &rule->actions);
+}
+
+/* Returns true if 'rule' is an OpenFlow 1.3 "table-miss" rule, false
+ * otherwise.
+ *
+ * ("Table-miss" rules are special because a packet_in generated through one
+ * uses OFPR_NO_MATCH as its reason, whereas packet_ins generated by any other
+ * rule use OFPR_ACTION.) */
+static inline bool
+rule_is_table_miss(const struct rule *rule)
+{
+ return rule->cr.priority == 0 && cls_rule_is_catchall(&rule->cr);
+}
+bool rule_is_internal(const struct rule *);