+ /* Packet classification. */
+ const struct cls_rule cr; /* In owning dp_netdev's 'cls'. */
+
+ /* Hash table index by unmasked flow. */
+ const struct hmap_node node; /* In owning dp_netdev's 'flow_table'. */
+ const struct flow flow; /* The flow that created this entry. */
+
+ /* Number of references.
+ * The classifier owns one reference.
+ * Any thread trying to keep a rule from being freed should hold its own
+ * reference. */
+ struct ovs_refcount ref_cnt;
+
+ /* Protects members marked OVS_GUARDED.
+ *
+ * Acquire after datapath's flow_mutex. */
+ struct ovs_mutex mutex OVS_ACQ_AFTER(dp_netdev_mutex);
+
+ /* Statistics.
+ *
+ * Reading or writing these members requires 'mutex'. */
+ long long int used OVS_GUARDED; /* Last used time, in monotonic msecs. */
+ long long int packet_count OVS_GUARDED; /* Number of packets matched. */
+ long long int byte_count OVS_GUARDED; /* Number of bytes matched. */
+ uint16_t tcp_flags OVS_GUARDED; /* Bitwise-OR of seen tcp_flags values. */
+
+ /* Actions.
+ *
+ * Reading 'actions' requires 'mutex'.
+ * Writing 'actions' requires 'mutex' and (to allow for transactions) the
+ * datapath's flow_mutex. */
+ struct dp_netdev_actions *actions OVS_GUARDED;
+};
+
+static struct dp_netdev_flow *dp_netdev_flow_ref(
+ const struct dp_netdev_flow *);
+static void dp_netdev_flow_unref(struct dp_netdev_flow *);
+
+/* A set of datapath actions within a "struct dp_netdev_flow".
+ *
+ *
+ * Thread-safety
+ * =============
+ *
+ * A struct dp_netdev_actions 'actions' may be accessed without a risk of being
+ * freed by code that holds a read-lock or write-lock on 'flow->mutex' (where
+ * 'flow' is the dp_netdev_flow for which 'flow->actions == actions') or that
+ * owns a reference to 'actions->ref_cnt' (or both). */
+struct dp_netdev_actions {
+ struct ovs_refcount ref_cnt;
+
+ /* These members are immutable: they do not change during the struct's
+ * lifetime. */
+ struct nlattr *actions; /* Sequence of OVS_ACTION_ATTR_* attributes. */
+ unsigned int size; /* Size of 'actions', in bytes. */
+};