dpif-netdev: Add per-pmd flow-table/classifier.
[cascardo/ovs.git] / lib / dpif.h
index 36fdda3..52d3f02 100644 (file)
 #include "netdev.h"
 #include "ofpbuf.h"
 #include "openflow/openflow.h"
+#include "ovs-numa.h"
 #include "packets.h"
 #include "util.h"
 
@@ -515,6 +516,8 @@ enum dpif_flow_put_flags {
     DPIF_FP_PROBE = 1 << 3      /* Suppress error messages, if any. */
 };
 
+bool dpif_probe_feature(struct dpif *, const char *name,
+                        const struct ofpbuf *key, const ovs_u128 *ufid);
 void dpif_flow_hash(const struct dpif *, const void *key, size_t key_len,
                     ovs_u128 *hash);
 int dpif_flow_flush(struct dpif *);
@@ -522,14 +525,15 @@ int dpif_flow_put(struct dpif *, enum dpif_flow_put_flags,
                   const struct nlattr *key, size_t key_len,
                   const struct nlattr *mask, size_t mask_len,
                   const struct nlattr *actions, size_t actions_len,
-                  const ovs_u128 *ufid, struct dpif_flow_stats *);
-
+                  const ovs_u128 *ufid, const int pmd_id,
+                  struct dpif_flow_stats *);
 int dpif_flow_del(struct dpif *,
                   const struct nlattr *key, size_t key_len,
-                  const ovs_u128 *ufid, struct dpif_flow_stats *);
+                  const ovs_u128 *ufid, const int pmd_id,
+                  struct dpif_flow_stats *);
 int dpif_flow_get(struct dpif *,
                   const struct nlattr *key, size_t key_len,
-                  const ovs_u128 *ufid,
+                  const ovs_u128 *ufid, const int pmd_id,
                   struct ofpbuf *, struct dpif_flow *);
 \f
 /* Flow dumping interface
@@ -560,13 +564,15 @@ int dpif_flow_get(struct dpif *,
  *
  * All error reporting is deferred to the call to dpif_flow_dump_destroy().
  */
-struct dpif_flow_dump *dpif_flow_dump_create(const struct dpif *);
+struct dpif_flow_dump *dpif_flow_dump_create(const struct dpif *, bool terse);
 int dpif_flow_dump_destroy(struct dpif_flow_dump *);
 
 struct dpif_flow_dump_thread *dpif_flow_dump_thread_create(
     struct dpif_flow_dump *);
 void dpif_flow_dump_thread_destroy(struct dpif_flow_dump_thread *);
 
+#define PMD_ID_NULL OVS_CORE_UNSPEC
+
 /* A datapath flow as dumped by dpif_flow_dump_next(). */
 struct dpif_flow {
     const struct nlattr *key;     /* Flow key, as OVS_KEY_ATTR_* attrs. */
@@ -577,6 +583,7 @@ struct dpif_flow {
     size_t actions_len;           /* 'actions' length in bytes. */
     ovs_u128 ufid;                /* Unique flow identifier. */
     bool ufid_present;            /* True if 'ufid' was provided by datapath.*/
+    int pmd_id;                   /* Datapath poll mode dirver id. */
     struct dpif_flow_stats stats; /* Flow statistics. */
 };
 int dpif_flow_dump_next(struct dpif_flow_dump_thread *,
@@ -618,6 +625,10 @@ enum dpif_op_type {
  *
  *     If the operation succeeds, then 'stats', if nonnull, will be set to the
  *     flow's statistics before the update.
+ *
+ *   - If the datapath implements multiple pmd thread with its own flow
+ *     table, 'pmd_id' should be used to specify the particular polling
+ *     thread for the operation.
  */
 struct dpif_flow_put {
     /* Input. */
@@ -629,6 +640,7 @@ struct dpif_flow_put {
     const struct nlattr *actions;   /* Actions to perform on flow. */
     size_t actions_len;             /* Length of 'actions' in bytes. */
     const ovs_u128 *ufid;           /* Optional unique flow identifier. */
+    int pmd_id;                     /* Datapath poll mode driver id. */
 
     /* Output. */
     struct dpif_flow_stats *stats;  /* Optional flow statistics. */
@@ -646,13 +658,20 @@ struct dpif_flow_put {
  * Callers should always provide the 'key' to improve dpif logging in the event
  * of errors or unexpected behaviour.
  *
+ * If the datapath implements multiple polling thread with its own flow table,
+ * 'pmd_id' should be used to specify the particular polling thread for the
+ * operation.
+ *
  * If the operation succeeds, then 'stats', if nonnull, will be set to the
  * flow's statistics before its deletion. */
 struct dpif_flow_del {
     /* Input. */
     const struct nlattr *key;       /* Flow to delete. */
     size_t key_len;                 /* Length of 'key' in bytes. */
-    const ovs_u128 *ufid;           /* UID of flow to delete. */
+    const ovs_u128 *ufid;           /* Unique identifier of flow to delete. */
+    bool terse;                     /* OK to skip sending/receiving full flow
+                                     * info? */
+    int pmd_id;                     /* Datapath poll mode driver id. */
 
     /* Output. */
     struct dpif_flow_stats *stats;  /* Optional flow statistics. */
@@ -702,6 +721,10 @@ struct dpif_execute {
  * Callers should always provide 'key' to improve dpif logging in the event of
  * errors or unexpected behaviour.
  *
+ * If the datapath implements multiple polling thread with its own flow table,
+ * 'pmd_id' should be used to specify the particular polling thread for the
+ * operation.
+ *
  * Succeeds with status 0 if the flow is fetched, or fails with ENOENT if no
  * such flow exists. Other failures are indicated with a positive errno value.
  */
@@ -709,7 +732,8 @@ struct dpif_flow_get {
     /* Input. */
     const struct nlattr *key;       /* Flow to get. */
     size_t key_len;                 /* Length of 'key' in bytes. */
-    const ovs_u128 *ufid;            /* UID of flow to get. */
+    const ovs_u128 *ufid;           /* Unique identifier of flow to get. */
+    int pmd_id;                     /* Datapath poll mode driver id. */
     struct ofpbuf *buffer;          /* Storage for output parameters. */
 
     /* Output. */
@@ -766,8 +790,9 @@ struct dpif_upcall {
 /* A callback to process an upcall, currently implemented only by dpif-netdev.
  *
  * The caller provides the 'packet' and 'flow' to process, the corresponding
- * 'ufid' as generated by dpif_flow_hash(), the 'type' of the upcall, and if
- * 'type' is DPIF_UC_ACTION then the 'userdata' attached to the action.
+ * 'ufid' as generated by dpif_flow_hash(), the polling thread id 'pmd_id',
+ * the 'type' of the upcall, and if 'type' is DPIF_UC_ACTION then the
+ * 'userdata' attached to the action.
  *
  * The callback must fill in 'actions' with the datapath actions to apply to
  * 'packet'.  'wc' and 'put_actions' will either be both null or both nonnull.
@@ -783,6 +808,7 @@ struct dpif_upcall {
 typedef int upcall_callback(const struct ofpbuf *packet,
                             const struct flow *flow,
                             ovs_u128 *ufid,
+                            int pmd_id,
                             enum dpif_upcall_type type,
                             const struct nlattr *userdata,
                             struct ofpbuf *actions,