dpif-linux: collect and display mega flow mask stats
[sliver-openvswitch.git] / lib / dpif.h
index 7f1b6c9..ab69c1c 100644 (file)
  *      location.
  *
  *    - Adding and removing ports to achieve a new configuration.
+ *
+ *
+ * Thread-safety
+ * =============
+ *
+ * Most of the dpif functions are fully thread-safe: they may be called from
+ * any number of threads on the same or different dpif objects.  The exceptions
+ * are:
+ *
+ *    - dpif_port_poll() and dpif_port_poll_wait() are conditionally
+ *      thread-safe: they may be called from different threads only on
+ *      different dpif objects.
+ *
+ *    - Functions that operate on struct dpif_port_dump or struct
+ *      dpif_flow_dump are conditionally thread-safe with respect to those
+ *      objects.  That is, one may dump ports or flows from any number of
+ *      threads at once, but each thread must use its own struct dpif_port_dump
+ *      or dpif_flow_dump.
  */
 #ifndef DPIF_H
 #define DPIF_H 1
@@ -369,6 +387,9 @@ struct dpif_dp_stats {
     uint64_t n_missed;          /* Number of flow table misses. */
     uint64_t n_lost;            /* Number of misses not sent to userspace. */
     uint64_t n_flows;           /* Number of flows present. */
+    uint64_t n_masks;           /* Number of mega flow masks. */
+    uint64_t n_mask_hit;        /* Number of mega flow masks visited for
+                                   flow table matches. */
 };
 int dpif_get_dp_stats(const struct dpif *, struct dpif_dp_stats *);
 
@@ -397,7 +418,7 @@ int dpif_port_query_by_name(const struct dpif *, const char *devname,
                             struct dpif_port *);
 int dpif_port_get_name(struct dpif *, odp_port_t port_no,
                        char *name, size_t name_size);
-odp_port_t dpif_get_max_ports(const struct dpif *);
+uint32_t dpif_get_max_ports(const struct dpif *);
 uint32_t dpif_port_get_pid(const struct dpif *, odp_port_t port_no);
 
 struct dpif_port_dump {
@@ -475,7 +496,8 @@ int dpif_flow_dump_done(struct dpif_flow_dump *);
 int dpif_execute(struct dpif *,
                  const struct nlattr *key, size_t key_len,
                  const struct nlattr *actions, size_t actions_len,
-                 const struct ofpbuf *);
+                 const struct ofpbuf *,
+                 bool needs_help);
 \f
 /* Operation batching interface.
  *
@@ -513,11 +535,21 @@ struct dpif_flow_del {
 };
 
 struct dpif_execute {
+    /* Raw support for execute passed along to the provider. */
     const struct nlattr *key;       /* Partial flow key (only for metadata). */
     size_t key_len;                 /* Length of 'key' in bytes. */
     const struct nlattr *actions;   /* Actions to execute on packet. */
     size_t actions_len;             /* Length of 'actions' in bytes. */
     const struct ofpbuf *packet;    /* Packet to execute. */
+
+    /* Some dpif providers do not implement every action.  The Linux kernel
+     * datapath, in particular, does not implement ARP field modification.
+     *
+     * If this member is set to true, the dpif layer executes in userspace all
+     * of the actions that it can, and for OVS_ACTION_ATTR_OUTPUT and
+     * OVS_ACTION_ATTR_USERSPACE actions it passes the packet through to the
+     * dpif implementation. */
+    bool needs_help;
 };
 
 struct dpif_op {