datapath-windows: Rename switch context's nameHashArray and vport's nameLink login...
[cascardo/ovs.git] / lib / dpif.c
index b2a1972..d088f68 100644 (file)
@@ -59,8 +59,8 @@ COVERAGE_DEFINE(dpif_purge);
 COVERAGE_DEFINE(dpif_execute_with_help);
 
 static const struct dpif_class *base_dpif_classes[] = {
-#ifdef __linux__
-    &dpif_linux_class,
+#if defined(__linux__) || defined(_WIN32)
+    &dpif_netlink_class,
 #endif
     &dpif_netdev_class,
 };
@@ -991,12 +991,12 @@ struct dpif_execute_helper_aux {
  * meaningful. */
 static void
 dpif_execute_helper_cb(void *aux_, struct dpif_packet **packets, int cnt,
-                       struct pkt_metadata *md,
                        const struct nlattr *action, bool may_steal OVS_UNUSED)
 {
     struct dpif_execute_helper_aux *aux = aux_;
     int type = nl_attr_type(action);
-    struct ofpbuf * packet = &packets[0]->ofpbuf;
+    struct ofpbuf *packet = &packets[0]->ofpbuf;
+    struct pkt_metadata *md = &packets[0]->md;
 
     ovs_assert(cnt == 1);
 
@@ -1026,6 +1026,7 @@ dpif_execute_helper_cb(void *aux_, struct dpif_packet **packets, int cnt,
         execute.packet = packet;
         execute.md = *md;
         execute.needs_help = false;
+        execute.probe = false;
         aux->error = dpif_execute(aux->dpif, &execute);
         log_execute_message(aux->dpif, &execute, true, aux->error);
 
@@ -1041,6 +1042,7 @@ dpif_execute_helper_cb(void *aux_, struct dpif_packet **packets, int cnt,
     case OVS_ACTION_ATTR_PUSH_MPLS:
     case OVS_ACTION_ATTR_POP_MPLS:
     case OVS_ACTION_ATTR_SET:
+    case OVS_ACTION_ATTR_SET_MASKED:
     case OVS_ACTION_ATTR_SAMPLE:
     case OVS_ACTION_ATTR_UNSPEC:
     case __OVS_ACTION_ATTR_MAX:
@@ -1062,15 +1064,17 @@ dpif_execute_with_help(struct dpif *dpif, struct dpif_execute *execute)
     COVERAGE_INC(dpif_execute_with_help);
 
     packet.ofpbuf = *execute->packet;
+    packet.md = execute->md;
     pp = &packet;
 
-    odp_execute_actions(&aux, &pp, 1, false, &execute->md, execute->actions,
+    odp_execute_actions(&aux, &pp, 1, false, execute->actions,
                         execute->actions_len, dpif_execute_helper_cb);
 
     /* Even though may_steal is set to false, some actions could modify or
      * reallocate the ofpbuf memory. We need to pass those changes to the
      * caller */
     *execute->packet = packet.ofpbuf;
+    execute->md = packet.md;
 
     return aux.error;
 }
@@ -1299,6 +1303,24 @@ dpif_print_packet(struct dpif *dpif, struct dpif_upcall *upcall)
     }
 }
 
+/* If 'dpif' creates its own I/O polling threads, refreshes poll threads
+ * configuration. */
+int
+dpif_poll_threads_set(struct dpif *dpif, unsigned int n_rxqs,
+                      const char *cmask)
+{
+    int error = 0;
+
+    if (dpif->dpif_class->poll_threads_set) {
+        error = dpif->dpif_class->poll_threads_set(dpif, n_rxqs, cmask);
+        if (error) {
+            log_operation(dpif, "poll_threads_set", error);
+        }
+    }
+
+    return error;
+}
+
 /* Polls for an upcall from 'dpif' for an upcall handler.  Since there
  * there can be multiple poll loops, 'handler_id' is needed as index to
  * identify the corresponding poll loop.  If successful, stores the upcall
@@ -1483,7 +1505,7 @@ static void
 log_flow_put_message(struct dpif *dpif, const struct dpif_flow_put *put,
                      int error)
 {
-    if (should_log_flow_message(error)) {
+    if (should_log_flow_message(error) && !(put->flags & DPIF_FP_PROBE)) {
         struct ds s;
 
         ds_init(&s);
@@ -1523,7 +1545,7 @@ log_flow_del_message(struct dpif *dpif, const struct dpif_flow_del *del,
  * called after the dpif_provider's '->execute' function, which is allowed to
  * modify execute->packet and execute->md.  In practice, though:
  *
- *     - dpif-linux doesn't modify execute->packet or execute->md.
+ *     - dpif-netlink doesn't modify execute->packet or execute->md.
  *
  *     - dpif-netdev does modify them but it is less likely to have problems
  *       because it is built into ovs-vswitchd and cannot have version skew,
@@ -1535,7 +1557,8 @@ static void
 log_execute_message(struct dpif *dpif, const struct dpif_execute *execute,
                     bool subexecute, int error)
 {
-    if (!(error ? VLOG_DROP_WARN(&error_rl) : VLOG_DROP_DBG(&dpmsg_rl))) {
+    if (!(error ? VLOG_DROP_WARN(&error_rl) : VLOG_DROP_DBG(&dpmsg_rl))
+        && !execute->probe) {
         struct ds ds = DS_EMPTY_INITIALIZER;
         char *packet;