ofproto-dpif: Probe for userdata after backer is fully operational.
authorJarno Rajahalme <jrajahalme@nicira.com>
Thu, 11 Sep 2014 20:27:29 +0000 (13:27 -0700)
committerJarno Rajahalme <jrajahalme@nicira.com>
Thu, 11 Sep 2014 20:27:29 +0000 (13:27 -0700)
When probing for variable length userdata before handler threads are
set, the pid included in the userspace action will be 0, which is
flagged as an error by the linux kernel datapath.  As a result the
feature probe will produce an unnecessary log message.  By probing for
variable length userdata later the probe works as intended and the
unnecessary log message is avoided.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
ofproto/ofproto-dpif.c

index d3e527a..6a59098 100644 (file)
@@ -943,7 +943,6 @@ open_dpif_backer(const char *type, struct dpif_backer **backerp)
     shash_add(&all_dpif_backers, type, backer);
 
     backer->enable_recirc = check_recirc(backer);
-    backer->variable_length_userdata = check_variable_length_userdata(backer);
     backer->max_mpls_depth = check_max_mpls_depth(backer);
     backer->masked_set_action = check_masked_set_action(backer);
     backer->rid_pool = recirc_id_pool_create();
@@ -960,6 +959,11 @@ open_dpif_backer(const char *type, struct dpif_backer **backerp)
         udpif_set_threads(backer->udpif, n_handlers, n_revalidators);
     }
 
+    /* This check fails if performed before udpif threads have been set,
+     * as the kernel module checks that the 'pid' in userspace action
+     * is non-zero. */
+    backer->variable_length_userdata = check_variable_length_userdata(backer);
+
     return error;
 }
 
@@ -1115,7 +1119,8 @@ check_max_mpls_depth(struct dpif_backer *backer)
         odp_flow_key_from_flow(&key, &flow, NULL, 0, false);
 
         error = dpif_flow_put(backer->dpif, DPIF_FP_CREATE,
-                              ofpbuf_data(&key), ofpbuf_size(&key), NULL, 0, NULL, 0, NULL);
+                              ofpbuf_data(&key), ofpbuf_size(&key), NULL, 0,
+                              NULL, 0, NULL);
         if (error && error != EEXIST) {
             if (error != EINVAL) {
                 VLOG_WARN("%s: MPLS stack length feature probe failed (%s)",
@@ -1124,7 +1129,8 @@ check_max_mpls_depth(struct dpif_backer *backer)
             break;
         }
 
-        error = dpif_flow_del(backer->dpif, ofpbuf_data(&key), ofpbuf_size(&key), NULL);
+        error = dpif_flow_del(backer->dpif, ofpbuf_data(&key),
+                              ofpbuf_size(&key), NULL);
         if (error) {
             VLOG_WARN("%s: failed to delete MPLS feature probe flow",
                       dpif_name(backer->dpif));