[ovs-dev] [RFC 12/14] dpif-netdev: Support unique flow identifiers.

Joe Stringer joestringer at nicira.com
Thu Aug 21 05:42:07 UTC 2014


Signed-off-by: Joe Stringer <joestringer at nicira.com>
---
 lib/dpif-netdev.c       |  209 ++++++++++++++++++++++++++++++++---------------
 lib/flow.h              |    6 ++
 tests/dpif-netdev.at    |    3 +
 tests/ofproto-dpif.at   |   20 +++--
 tests/ofproto-macros.at |    1 +
 5 files changed, 164 insertions(+), 75 deletions(-)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index c5bec00..3e10196 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -228,8 +228,9 @@ struct dp_netdev_flow {
     /* Packet classification. */
     const struct cls_rule cr;   /* In owning dp_netdev's 'cls'. */
 
-    /* Hash table index by unmasked flow. */
+    /* Hash table index by uid. */
     const struct cmap_node node; /* In owning dp_netdev's 'flow_table'. */
+    const ovs_u128 uid;          /* Unique flow identifier. */
     const struct flow flow;      /* The flow that created this entry. */
 
     /* Number of references.
@@ -917,7 +918,7 @@ dp_netdev_remove_flow(struct dp_netdev *dp, struct dp_netdev_flow *flow)
     struct cmap_node *node = CONST_CAST(struct cmap_node *, &flow->node);
 
     classifier_remove(&dp->cls, cr);
-    cmap_remove(&dp->flow_table, node, flow_hash(&flow->flow, 0));
+    cmap_remove(&dp->flow_table, node, flow_uid_hash(&flow->uid, 0));
 
     dp_netdev_flow_unref(flow);
 }
@@ -1038,13 +1039,13 @@ dp_netdev_lookup_flow(const struct dp_netdev *dp, const struct miniflow *key)
 }
 
 static struct dp_netdev_flow *
-dp_netdev_find_flow(const struct dp_netdev *dp, const struct flow *flow)
+dp_netdev_find_flow(const struct dp_netdev *dp, const ovs_u128 *uid)
 {
     struct dp_netdev_flow *netdev_flow;
 
-    CMAP_FOR_EACH_WITH_HASH (netdev_flow, node, flow_hash(flow, 0),
+    CMAP_FOR_EACH_WITH_HASH (netdev_flow, node, flow_uid_hash(uid, 0),
                              &dp->flow_table) {
-        if (flow_equal(&netdev_flow->flow, flow)) {
+        if (!memcmp(&netdev_flow->uid, uid, sizeof *uid)) {
             return netdev_flow;
         }
     }
@@ -1070,30 +1071,81 @@ get_dpif_flow_stats(const struct dp_netdev_flow *netdev_flow,
     }
 }
 
+struct dp_netdev_flow_convert_buf {
+    struct ofpbuf *key, *mask, *uid;
+    bool actions;
+};
+
 static void
-dp_netdev_flow_to_dpif_flow(const struct dp_netdev_flow *netdev_flow,
-                            struct ofpbuf *buffer, struct dpif_flow *flow)
+dp_netdev_init_flow_convert(struct dp_netdev_flow_convert_buf *convert,
+                            uint32_t flags, struct ofpbuf *key,
+                            struct ofpbuf *mask, struct ofpbuf *uid)
+{
+    memset(convert, 0, sizeof *convert);
+    if (!(flags & OVS_UID_F_SKIP_KEY)) {
+        convert->key = key;
+    }
+    if (!(flags & OVS_UID_F_SKIP_MASK)) {
+        convert->mask = mask;
+    }
+    if (!(flags & OVS_UID_F_SKIP_ACTIONS)) {
+        convert->actions = true;
+    }
+    convert->uid = uid;
+}
+
+static void
+dp_netdev_flow_to_dpif_flow__(const struct dp_netdev_flow *netdev_flow,
+                              struct dpif_flow *flow,
+                              struct dp_netdev_flow_convert_buf *buf)
 {
     struct flow_wildcards wc;
-    struct dp_netdev_actions *actions;
+    size_t offset;
 
     minimask_expand(&netdev_flow->cr.match.mask, &wc);
-    odp_flow_key_from_mask(buffer, &wc.masks, &netdev_flow->flow,
-                           odp_to_u32(wc.masks.in_port.odp_port),
-                           SIZE_MAX, true);
-    flow->mask = ofpbuf_data(buffer);
-    flow->mask_len = ofpbuf_size(buffer);
 
-    actions = dp_netdev_flow_get_actions(netdev_flow);
-    flow->actions = actions->actions;
-    flow->actions_len = actions->size;
+    if (buf->key) {
+        offset = ofpbuf_size(buf->key);
+        flow->key = ofpbuf_tail(buf->key);
+        odp_flow_key_from_flow(buf->key, &netdev_flow->flow, &wc.masks,
+                               netdev_flow->flow.in_port.odp_port, true);
+        flow->key_len = ofpbuf_size(buf->key) - offset;
+    }
+    if (buf->mask) {
+        offset = ofpbuf_size(buf->mask);
+        flow->mask = ofpbuf_tail(buf->mask);
+        odp_flow_key_from_mask(buf->mask, &wc.masks, &netdev_flow->flow,
+                               odp_to_u32(wc.masks.in_port.odp_port),
+                               SIZE_MAX, true);
+        flow->mask_len = ofpbuf_size(buf->mask) - offset;
+    }
+
+    if (buf->actions) {
+        struct dp_netdev_actions *netdev_actions;
 
-    flow->uid = NULL;
-    flow->uid_len = 0;
+        netdev_actions = dp_netdev_flow_get_actions(netdev_flow);
+        flow->actions = netdev_actions->actions;
+        flow->actions_len = netdev_actions->size;
+    }
 
+    offset = ofpbuf_size(buf->uid);
+    flow->uid = ofpbuf_tail(buf->uid);
+    odp_uid_to_nlattrs(buf->uid, &netdev_flow->uid, 0);
+    flow->uid_len = ofpbuf_size(buf->uid) - offset;
     get_dpif_flow_stats(netdev_flow, &flow->stats);
 }
 
+static void
+dp_netdev_flow_to_dpif_flow(const struct dp_netdev_flow *netdev_flow,
+                            struct ofpbuf *buffer, struct dpif_flow *flow,
+                            uint32_t flags)
+{
+    struct dp_netdev_flow_convert_buf convert;
+
+    dp_netdev_init_flow_convert(&convert, flags, buffer, buffer, buffer);
+    dp_netdev_flow_to_dpif_flow__(netdev_flow, flow, &convert);
+}
+
 static int
 dpif_netdev_mask_from_nlattrs(const struct nlattr *key, uint32_t key_len,
                               const struct nlattr *mask_key,
@@ -1187,22 +1239,45 @@ dpif_netdev_flow_from_nlattrs(const struct nlattr *key, uint32_t key_len,
 }
 
 static int
+dpif_netdev_uid_from_nlattrs(const struct nlattr *nla, size_t nla_len,
+                             ovs_u128 *uid, uint32_t *flags)
+{
+    if (odp_uid_from_nlattrs(nla, nla_len, uid, flags)) {
+        static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
+
+        if (!VLOG_DROP_ERR(&rl)) {
+            VLOG_ERR("Failed to parse UID for flow_add (%p, len:%"PRIuSIZE")",
+                     nla, nla_len);
+        }
+        return EINVAL;
+    }
+
+    return 0;
+}
+
+static int
 dpif_netdev_flow_get(const struct dpif *dpif, const struct dpif_flow_get *get)
 {
     struct dp_netdev *dp = get_dp_netdev(dpif);
     struct dp_netdev_flow *netdev_flow;
-    struct flow key;
+    ovs_u128 uid;
+    uint32_t flags;
     int error;
 
-    error = dpif_netdev_flow_from_nlattrs(get->key, get->key_len, &key);
+    if (!get->uid) {
+        return EINVAL;
+    }
+
+    error = dpif_netdev_uid_from_nlattrs(get->uid, get->uid_len, &uid, &flags);
     if (error) {
         return error;
     }
 
-    netdev_flow = dp_netdev_find_flow(dp, &key);
+    netdev_flow = dp_netdev_find_flow(dp, &uid);
 
     if (netdev_flow) {
-        dp_netdev_flow_to_dpif_flow(netdev_flow, get->buffer, get->flow);
+        dp_netdev_flow_to_dpif_flow(netdev_flow, get->buffer, get->flow,
+                                    flags);
      } else {
         error = ENOENT;
     }
@@ -1211,7 +1286,7 @@ dpif_netdev_flow_get(const struct dpif *dpif, const struct dpif_flow_get *get)
 }
 
 static int
-dp_netdev_flow_add(struct dp_netdev *dp, struct match *match,
+dp_netdev_flow_add(struct dp_netdev *dp, struct match *match, ovs_u128 *uid,
                    const struct nlattr *actions, size_t actions_len)
     OVS_REQUIRES(dp->flow_mutex)
 {
@@ -1219,7 +1294,7 @@ dp_netdev_flow_add(struct dp_netdev *dp, struct match *match,
 
     netdev_flow = xzalloc(sizeof *netdev_flow);
     *CONST_CAST(struct flow *, &netdev_flow->flow) = match->flow;
-
+    *CONST_CAST(ovs_u128 *, &netdev_flow->uid) = *uid;
     ovs_refcount_init(&netdev_flow->ref_cnt);
 
     ovsthread_stats_init(&netdev_flow->stats);
@@ -1231,7 +1306,7 @@ dp_netdev_flow_add(struct dp_netdev *dp, struct match *match,
                   match, NETDEV_RULE_PRIORITY);
     cmap_insert(&dp->flow_table,
                 CONST_CAST(struct cmap_node *, &netdev_flow->node),
-                flow_hash(&match->flow, 0));
+                flow_uid_hash(uid, 0));
     classifier_insert(&dp->cls,
                       CONST_CAST(struct cls_rule *, &netdev_flow->cr));
 
@@ -1239,6 +1314,7 @@ dp_netdev_flow_add(struct dp_netdev *dp, struct match *match,
         struct ds ds = DS_EMPTY_INITIALIZER;
 
         ds_put_cstr(&ds, "flow_add: ");
+        odp_format_uid(uid, &ds);
         match_format(match, &ds, OFP_DEFAULT_PRIORITY);
         ds_put_cstr(&ds, ", actions:");
         format_odp_actions(&ds, actions, actions_len);
@@ -1274,6 +1350,7 @@ dpif_netdev_flow_put(struct dpif *dpif, const struct dpif_flow_put *put)
     struct dp_netdev_flow *netdev_flow;
     struct miniflow miniflow;
     struct match match;
+    ovs_u128 uid;
     int error;
 
     error = dpif_netdev_flow_from_nlattrs(put->key, put->key_len, &match.flow);
@@ -1288,6 +1365,11 @@ dpif_netdev_flow_put(struct dpif *dpif, const struct dpif_flow_put *put)
     }
     miniflow_init(&miniflow, &match.flow);
 
+    error = dpif_netdev_uid_from_nlattrs(put->uid, put->uid_len, &uid, NULL);
+    if (error) {
+        return error;
+    }
+
     ovs_mutex_lock(&dp->flow_mutex);
     netdev_flow = dp_netdev_lookup_flow(dp, &miniflow);
     if (!netdev_flow) {
@@ -1296,7 +1378,7 @@ dpif_netdev_flow_put(struct dpif *dpif, const struct dpif_flow_put *put)
                 if (put->stats) {
                     memset(put->stats, 0, sizeof *put->stats);
                 }
-                error = dp_netdev_flow_add(dp, &match, put->actions,
+                error = dp_netdev_flow_add(dp, &match, &uid, put->actions,
                                            put->actions_len);
             } else {
                 error = EFBIG;
@@ -1342,16 +1424,20 @@ dpif_netdev_flow_del(struct dpif *dpif, const struct dpif_flow_del *del)
 {
     struct dp_netdev *dp = get_dp_netdev(dpif);
     struct dp_netdev_flow *netdev_flow;
-    struct flow key;
+    ovs_u128 uid;
     int error;
 
-    error = dpif_netdev_flow_from_nlattrs(del->key, del->key_len, &key);
+    if (!del->uid) {
+        return EINVAL;
+    }
+
+    error = dpif_netdev_uid_from_nlattrs(del->uid, del->uid_len, &uid, NULL);
     if (error) {
         return error;
     }
 
     ovs_mutex_lock(&dp->flow_mutex);
-    netdev_flow = dp_netdev_find_flow(dp, &key);
+    netdev_flow = dp_netdev_find_flow(dp, &uid);
     if (netdev_flow) {
         if (del->stats) {
             get_dpif_flow_stats(netdev_flow, del->stats);
@@ -1369,6 +1455,7 @@ struct dpif_netdev_flow_dump {
     struct dpif_flow_dump up;
     struct cmap_position pos;
     int status;
+    uint32_t dump_flags;       /* Bitmask of OVS_UID_F_* */
     struct ovs_mutex mutex;
 };
 
@@ -1379,8 +1466,7 @@ dpif_netdev_flow_dump_cast(struct dpif_flow_dump *dump)
 }
 
 static struct dpif_flow_dump *
-dpif_netdev_flow_dump_create(const struct dpif *dpif_,
-                             uint32_t dump_flags OVS_UNUSED)
+dpif_netdev_flow_dump_create(const struct dpif *dpif_, uint32_t dump_flags)
 {
     struct dpif_netdev_flow_dump *dump;
 
@@ -1388,6 +1474,7 @@ dpif_netdev_flow_dump_create(const struct dpif *dpif_,
     dpif_flow_dump_init(&dump->up, dpif_);
     memset(&dump->pos, 0, sizeof dump->pos);
     dump->status = 0;
+    dump->dump_flags = dump_flags;
     ovs_mutex_init(&dump->mutex);
 
     return &dump->up;
@@ -1408,6 +1495,7 @@ struct dpif_netdev_flow_dump_thread {
     struct dpif_netdev_flow_dump *dump;
     struct odputil_keybuf keybuf[FLOW_DUMP_MAX_BATCH];
     struct odputil_keybuf maskbuf[FLOW_DUMP_MAX_BATCH];
+    struct odputil_uidbuf uidbuf[FLOW_DUMP_MAX_BATCH];
 };
 
 static struct dpif_netdev_flow_dump_thread *
@@ -1447,6 +1535,7 @@ dpif_netdev_flow_dump_next(struct dpif_flow_dump_thread *thread_,
     struct dpif_netdev *dpif = dpif_netdev_cast(thread->up.dpif);
     struct dp_netdev_flow *netdev_flows[FLOW_DUMP_MAX_BATCH];
     struct dp_netdev *dp = get_dp_netdev(&dpif->dpif);
+    uint32_t dump_flags;
     int n_flows = 0;
     int i;
 
@@ -1465,45 +1554,28 @@ dpif_netdev_flow_dump_next(struct dpif_flow_dump_thread *thread_,
                                                  node);
         }
     }
+    dump_flags = dump->dump_flags;
     ovs_mutex_unlock(&dump->mutex);
 
     for (i = 0; i < n_flows; i++) {
-        struct odputil_keybuf *maskbuf = &thread->maskbuf[i];
         struct odputil_keybuf *keybuf = &thread->keybuf[i];
+        struct odputil_keybuf *maskbuf = &thread->maskbuf[i];
+        struct odputil_uidbuf *uidbuf = &thread->uidbuf[i];
         struct dp_netdev_flow *netdev_flow = netdev_flows[i];
+        struct dp_netdev_flow_convert_buf convert;
         struct dpif_flow *f = &flows[i];
-        struct dp_netdev_actions *dp_actions;
-        struct flow_wildcards wc;
-        struct ofpbuf buf;
+        struct ofpbuf key, mask, uid;
 
-        minimask_expand(&netdev_flow->cr.match.mask, &wc);
-
-        /* Key. */
-        ofpbuf_use_stack(&buf, keybuf, sizeof *keybuf);
-        odp_flow_key_from_flow(&buf, &netdev_flow->flow, &wc.masks,
-                               netdev_flow->flow.in_port.odp_port, true);
-        f->key = ofpbuf_data(&buf);
-        f->key_len = ofpbuf_size(&buf);
-
-        /* Mask. */
-        ofpbuf_use_stack(&buf, maskbuf, sizeof *maskbuf);
-        odp_flow_key_from_mask(&buf, &wc.masks, &netdev_flow->flow,
-                               odp_to_u32(wc.masks.in_port.odp_port),
-                               SIZE_MAX, true);
-        f->mask = ofpbuf_data(&buf);
-        f->mask_len = ofpbuf_size(&buf);
-
-        /* Actions. */
-        dp_actions = dp_netdev_flow_get_actions(netdev_flow);
-        f->actions = dp_actions->actions;
-        f->actions_len = dp_actions->size;
+        if (dump_flags) {
+            memset(f, 0, sizeof *f);
+        }
 
-        /* UID. */
-        f->uid = NULL;
-        f->uid_len = 0;
+        ofpbuf_use_stack(&key, keybuf, sizeof *keybuf);
+        ofpbuf_use_stack(&mask, maskbuf, sizeof *maskbuf);
+        ofpbuf_use_stack(&uid, uidbuf, sizeof *uidbuf);
 
-        /* Stats. */
-        get_dpif_flow_stats(netdev_flow, &f->stats);
+        dp_netdev_init_flow_convert(&convert, dump_flags, &key, &mask, &uid);
+        dp_netdev_flow_to_dpif_flow__(netdev_flow, f, &convert);
     }
 
     return n_flows;
@@ -1874,7 +1946,8 @@ static int
 dp_netdev_upcall(struct dp_netdev *dp, struct dpif_packet *packet_,
                  struct flow *flow, struct flow_wildcards *wc,
                  enum dpif_upcall_type type, const struct nlattr *userdata,
-                 struct ofpbuf *actions, struct ofpbuf *put_actions)
+                 ovs_u128 *uid, struct ofpbuf *actions,
+                 struct ofpbuf *put_actions)
 {
     struct ofpbuf *packet = &packet_->ofpbuf;
 
@@ -1908,7 +1981,7 @@ dp_netdev_upcall(struct dp_netdev *dp, struct dpif_packet *packet_,
         ds_destroy(&ds);
     }
 
-    return dp->upcall_cb(packet, flow, type, userdata, actions, wc, NULL,
+    return dp->upcall_cb(packet, flow, type, userdata, actions, wc, uid,
                          put_actions, dp->upcall_aux);
 }
 
@@ -1990,6 +2063,7 @@ dp_netdev_input(struct dp_netdev *dp, struct dpif_packet **packets, int cnt,
         uint64_t actions_stub[512 / 8], slow_stub[512 / 8];
         struct ofpbuf actions, put_actions;
         struct match match;
+        ovs_u128 uid;
 
         ofpbuf_use_stub(&actions, actions_stub, sizeof actions_stub);
         ofpbuf_use_stub(&put_actions, slow_stub, sizeof slow_stub);
@@ -2018,7 +2092,7 @@ dp_netdev_input(struct dp_netdev *dp, struct dpif_packet **packets, int cnt,
             ofpbuf_clear(&put_actions);
 
             error = dp_netdev_upcall(dp, packets[i], &match.flow, &match.wc,
-                                      DPIF_UC_MISS, NULL, &actions,
+                                      DPIF_UC_MISS, NULL, &uid, &actions,
                                       &put_actions);
             if (OVS_UNLIKELY(error && error != ENOSPC)) {
                 continue;
@@ -2044,7 +2118,8 @@ dp_netdev_input(struct dp_netdev *dp, struct dpif_packet **packets, int cnt,
              * reasonable. */
             if (OVS_LIKELY(error != ENOSPC)
                 && !dp_netdev_lookup_flow(dp, mfs[i])) {
-                dp_netdev_flow_add(dp, &match, ofpbuf_data(add_actions),
+                dp_netdev_flow_add(dp, &match, &uid,
+                                   ofpbuf_data(add_actions),
                                    ofpbuf_size(add_actions));
             }
             ovs_mutex_unlock(&dp->flow_mutex);
@@ -2157,8 +2232,8 @@ dp_execute_cb(void *aux_, struct dpif_packet **packets, int cnt,
 
                 flow_extract(&packets[i]->ofpbuf, md, &flow);
                 error = dp_netdev_upcall(dp, packets[i], &flow, NULL,
-                                         DPIF_UC_ACTION, userdata, &actions,
-                                         NULL);
+                                         DPIF_UC_ACTION, userdata, NULL,
+                                         &actions, NULL);
                 if (!error || error == ENOSPC) {
                     dp_netdev_execute_actions(dp, &packets[i], 1, false, md,
                                               ofpbuf_data(&actions),
diff --git a/lib/flow.h b/lib/flow.h
index 3b8d24d..bea2b2c 100644
--- a/lib/flow.h
+++ b/lib/flow.h
@@ -246,6 +246,12 @@ flow_hash(const struct flow *flow, uint32_t basis)
     return hash_words((const uint32_t *) flow, sizeof *flow / 4, basis);
 }
 
+static inline uint32_t
+flow_uid_hash(const ovs_u128 *uid, uint32_t basis)
+{
+    return hash_words((const uint32_t *) uid, sizeof *uid / 4, basis);
+}
+
 static inline uint16_t
 ofp_to_u16(ofp_port_t ofp_port)
 {
diff --git a/tests/dpif-netdev.at b/tests/dpif-netdev.at
index c50b1a8..1d55735 100644
--- a/tests/dpif-netdev.at
+++ b/tests/dpif-netdev.at
@@ -3,6 +3,7 @@ AT_BANNER([dpif-netdev])
 # Strips out uninteresting parts of flow output, as well as parts
 # that vary from one run to another (e.g., timing and bond actions).
 m4_define([STRIP_XOUT], [[sed '
+    s/uid:[0-9a-f]* //
     s/used:[0-9]*\.[0-9]*/used:0.0/
     s/actions:.*/actions: <del>/
     s/packets:[0-9]*/packets:0/
@@ -93,6 +94,8 @@ OVS_VSWITCHD_START(
   [add-port br0 p1 -- set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p0.sock
    set bridge br0 datapath-type=dummy other-config:datapath-id=1234 \
                   fail-mode=secure])
+AT_CHECK([ovs-appctl upcall/disable-uid], [0], [uid support disabled
+], [])
 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
 
 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
index 05015fa..49afef8 100644
--- a/tests/ofproto-dpif.at
+++ b/tests/ofproto-dpif.at
@@ -4652,7 +4652,7 @@ for dl_src in 00 01; do
 done
 sleep 1  # wait for the datapath flow installed
 for dl_src in 00 01; do
-    AT_CHECK_UNQUOTED([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | grep "$dl_src," | STRIP_USED], [0], [dnl
+    AT_CHECK_UNQUOTED([cat ovs-vswitchd.log | STRIP_UID | FILTER_FLOW_INSTALL | grep "$dl_src," | STRIP_USED], [0], [dnl
 recirc_id=0,skb_priority=0,mpls,in_port=1,dl_src=60:66:66:66:66:$dl_src,mpls_label=20,mpls_tc=0,mpls_ttl=32,mpls_bos=0,mpls_lse1=82208,mpls_lse2=0, actions:userspace(pid=0,slow_path(controller))
 ])
 done
@@ -4692,7 +4692,7 @@ for dl_src in 00 01; do
 done
 sleep 1  # wait for the datapath flow installed
 for dl_src in 00 01; do
-    AT_CHECK_UNQUOTED([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | grep "$dl_src," | STRIP_USED], [0], [dnl
+    AT_CHECK_UNQUOTED([cat ovs-vswitchd.log | STRIP_UID | FILTER_FLOW_INSTALL | grep "$dl_src," | STRIP_USED], [0], [dnl
 recirc_id=0,skb_priority=0,mpls,in_port=1,dl_src=60:66:66:66:66:$dl_src,mpls_label=20,mpls_tc=0,mpls_ttl=32,mpls_bos=0,mpls_lse1=82208,mpls_lse2=0, actions:userspace(pid=0,slow_path(controller))
 ])
 done
@@ -4709,6 +4709,8 @@ OVS_VSWITCHD_START([add-br br1 \
 ADD_OF_PORTS([br0], [2])
 ADD_OF_PORTS([br1], [3])
 
+AT_CHECK([ovs-appctl upcall/disable-uid], [0], [uid support disabled
+], [])
 AT_CHECK([ovs-appctl time/stop])
 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
 
@@ -4746,15 +4748,15 @@ dummy at ovs-dummy: hit:13 missed:2
 		pbr1 1/none: (patch: peer=pbr0)
 ])
 
-AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_USED], [0], [dnl
+AT_CHECK([cat ovs-vswitchd.log | STRIP_UID | FILTER_FLOW_INSTALL | STRIP_USED], [0], [dnl
 recirc_id=0,skb_priority=0,ip,in_port=100,nw_frag=no, actions:101,3,2
 recirc_id=0,skb_priority=0,ip,in_port=101,nw_frag=no, actions:100,2,3
 ])
 
-AT_CHECK([cat ovs-vswitchd.log | grep -e 'in_port(100).*packets:9' | FILTER_FLOW_DUMP], [0], [dnl
+AT_CHECK([cat ovs-vswitchd.log | grep -e 'in_port(100).*packets:9' | STRIP_UID | FILTER_FLOW_DUMP], [0], [dnl
 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(100),eth(src=50:54:00:00:00:05/00:00:00:00:00:00,dst=50:54:00:00:00:07/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=192.168.0.1/0.0.0.0,dst=192.168.0.2/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), packets:9, bytes:540, used:0.0s, actions:101,3,2
 ])
-AT_CHECK([cat ovs-vswitchd.log | grep -e 'in_port(101).*packets:4' | FILTER_FLOW_DUMP], [0], [dnl
+AT_CHECK([cat ovs-vswitchd.log | grep -e 'in_port(101).*packets:4' | STRIP_UID | FILTER_FLOW_DUMP], [0], [dnl
 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(101),eth(src=50:54:00:00:00:07/00:00:00:00:00:00,dst=50:54:00:00:00:05/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=192.168.0.2/0.0.0.0,dst=192.168.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), packets:4, bytes:240, used:0.0s, actions:100,2,3
 ])
 
@@ -5274,7 +5276,7 @@ dnl ofproto-dpif).  The second entry actually updates the destination
 dnl MAC, so both the source and destination MAC addresses are
 dnl un-wildcarded, since the ODP commit functions update both the source
 dnl and destination MAC addresses.
-AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_USED], [0], [dnl
+AT_CHECK([cat ovs-vswitchd.log | STRIP_UID | FILTER_FLOW_INSTALL | STRIP_USED], [0], [dnl
 recirc_id=0,skb_priority=0,ip,in_port=1,dl_dst=50:54:00:00:00:0a,nw_frag=no, actions:2
 recirc_id=0,skb_priority=0,ip,in_port=1,dl_src=50:54:00:00:00:0b,dl_dst=50:54:00:00:00:0c,nw_frag=no, actions:set(eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0a)),2
 ])
@@ -5291,6 +5293,8 @@ table=0 in_port=1,ip,nw_dst=10.0.0.3 actions=drop
 ])
 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
 ], [])
+AT_CHECK([ovs-appctl upcall/disable-uid], [0], [uid support disabled
+], [])
 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg], [0], [], [])
 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
 for i in 1 2 3 4; do
@@ -5301,11 +5305,11 @@ for i in 1 2 3 4; do
     fi
 done
 sleep 1
-AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_USED], [0], [dnl
+AT_CHECK([cat ovs-vswitchd.log | STRIP_UID | FILTER_FLOW_INSTALL | STRIP_USED], [0], [dnl
 pkt_mark=0,recirc_id=0,skb_priority=0,icmp,tun_id=0,tun_src=0.0.0.0,tun_dst=0.0.0.0,tun_tos=0,tun_ttl=0,,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.0.0.2,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=64,mpls_label=0,mpls_tc=0,mpls_ttl=0,mpls_bos=0,mpls_lse1=0,mpls_lse2=0,icmp_type=8,icmp_code=0, actions:2
 pkt_mark=0,recirc_id=0,skb_priority=0,icmp,tun_id=0,tun_src=0.0.0.0,tun_dst=0.0.0.0,tun_tos=0,tun_ttl=0,,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:0b,dl_dst=50:54:00:00:00:0c,nw_src=10.0.0.4,nw_dst=10.0.0.3,nw_tos=0,nw_ecn=0,nw_ttl=64,mpls_label=0,mpls_tc=0,mpls_ttl=0,mpls_bos=0,mpls_lse1=0,mpls_lse2=0,icmp_type=8,icmp_code=0, actions:drop
 ])
-AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_DUMP | grep 'packets:3'], [0], [dnl
+AT_CHECK([cat ovs-vswitchd.log | STRIP_UID | FILTER_FLOW_DUMP | grep 'packets:3'], [0], [dnl
 skb_priority(0),skb_mark(0),recirc_id(0),dp_hash(0),in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), packets:3, bytes:180, used:0.0s, actions:2
 skb_priority(0),skb_mark(0),recirc_id(0),dp_hash(0),in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), packets:3, bytes:180, used:0.0s, actions:drop
 ])
diff --git a/tests/ofproto-macros.at b/tests/ofproto-macros.at
index 77b9b39..80ec8d3 100644
--- a/tests/ofproto-macros.at
+++ b/tests/ofproto-macros.at
@@ -36,6 +36,7 @@ m4_divert_pop([PREPARE_TESTS])
 m4_define([STRIP_XIDS], [[sed 's/ (xid=0x[0-9a-fA-F]*)//']])
 m4_define([STRIP_DURATION], [[sed 's/\bduration=[0-9.]*s/duration=?s/']])
 m4_define([STRIP_USED], [[sed 's/used:[0-9]\.[0-9]*/used:0.0/']])
+m4_define([STRIP_UID], [[sed 's/uid:[0-9a-f]* //']])
 m4_define([TESTABLE_LOG], [-vPATTERN:ANY:'%c|%p|%m'])
 
 # OVS_VSWITCHD_START([vsctl-args], [vsctl-output], [=override])
-- 
1.7.10.4




More information about the dev mailing list