Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodire...@intel.com>
Signed-off-by: Antonio Fischetti <antonio.fische...@intel.com>
---
 lib/flow.h | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/lib/flow.h b/lib/flow.h
index ea24e28..4eb19ae 100644
--- a/lib/flow.h
+++ b/lib/flow.h
@@ -570,15 +570,27 @@ struct mf_for_each_in_map_aux {
     const uint64_t *values;
 };
 
+/*
+ * Parse the bitmap mask of the subtable and output the next value
+ * from the search-key.
+ */
 static inline bool
 mf_get_next_in_map(struct mf_for_each_in_map_aux *aux,
                    uint64_t *value)
 {
-    map_t *map, *fmap;
+    map_t *map;    /* map refers to the bitmap mask of the subtable. */
+    map_t *fmap;   /* fmap refers to the bitmap of the search-key. */
     map_t rm1bit;
 
+    /* The bitmap mask selects which value must be considered from the
+     * search-key. We process the corresponding 'unit' of size 64 bits.
+     * 'aux->unit' is an index to the current unit of 64 bits. */
     while (OVS_UNLIKELY(!*(map = &aux->map.bits[aux->unit]))) {
-        /* Skip remaining data in the previous unit. */
+        /* No bits are enabled, so no search-key value will be output.
+         * In case some of the corresponding data chunks in the search-key
+         * bitmap are set, the data chunks must be skipped, as they are not
+         * considered by this mask. This is handled by incrementing aux->values
+         * accordingly. */
         aux->values += count_1bits(aux->fmap.bits[aux->unit]);
         if (++aux->unit == FLOWMAP_UNITS) {
             return false;
@@ -589,7 +601,12 @@ mf_get_next_in_map(struct mf_for_each_in_map_aux *aux,
     *map -= rm1bit;
     fmap = &aux->fmap.bits[aux->unit];
 
+    /* If the 8-byte value referred by 'rm1bit' is present in the
+     * search-key return 'value', otherwise return 0. */
     if (OVS_LIKELY(*fmap & rm1bit)) {
+        /* The value is in the search-key, if the search-key contains other
+         * values preceeding the 'rm1bit' bit, we consider it trash and the
+         * corresponding data chunks should be skipped accordingly. */
         map_t trash = *fmap & (rm1bit - 1);
 
         *fmap -= trash;
@@ -600,6 +617,8 @@ mf_get_next_in_map(struct mf_for_each_in_map_aux *aux,
 
         *value = *aux->values;
     } else {
+        /* The search-key does not contain a value that corresponds to
+         * rm1bit. */
         *value = 0;
     }
     return true;
-- 
2.4.11

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to