[ovs-dev] [PATCH v3 6/9] dpif-netdev: Count exact match cache hits.

Daniele Di Proietto diproiettod at vmware.com
Fri Mar 27 13:26:06 UTC 2015


We used to count exact match cache hits and masked classifier hits
together. This commit splits the DP_STAT_HIT counter into two.
This change will be used by future commits.

Signed-off-by: Daniele Di Proietto <diproiettod at vmware.com>
---
 lib/dpif-netdev.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index ba677eb..f7978ad 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -221,7 +221,8 @@ static struct dp_netdev_port *dp_netdev_lookup_port(const struct dp_netdev *dp,
                                                     odp_port_t);
 
 enum dp_stat_type {
-    DP_STAT_HIT,                /* Packets that matched in the flow table. */
+    DP_STAT_EXACT_HIT,          /* Packets that had an exact match (emc). */
+    DP_STAT_MASKED_HIT,         /* Packets that matched in the flow table. */
     DP_STAT_MISS,               /* Packets that did not match. */
     DP_STAT_LOST,               /* Packets not passed up to the client. */
     DP_N_STATS
@@ -771,7 +772,7 @@ dpif_netdev_get_stats(const struct dpif *dpif, struct dpif_dp_stats *stats)
 
         stats->n_flows += cmap_count(&pmd->flow_table);
 
-        stats->n_hit += s.n[DP_STAT_HIT];
+        stats->n_hit += s.n[DP_STAT_MASKED_HIT] + s.n[DP_STAT_EXACT_HIT];
         stats->n_missed += s.n[DP_STAT_MISS];
         stats->n_lost += s.n[DP_STAT_LOST];
     }
@@ -2801,7 +2802,8 @@ packet_batch_init(struct packet_batch *batch, struct dp_netdev_flow *flow)
 
 static inline void
 packet_batch_execute(struct packet_batch *batch,
-                     struct dp_netdev_pmd_thread *pmd)
+                     struct dp_netdev_pmd_thread *pmd,
+                     enum dp_stat_type hit_type)
 {
     struct dp_netdev_actions *actions;
     struct dp_netdev_flow *flow = batch->flow;
@@ -2814,7 +2816,7 @@ packet_batch_execute(struct packet_batch *batch,
     dp_netdev_execute_actions(pmd, batch->packets, batch->packet_count, true,
                               actions->actions, actions->size);
 
-    dp_netdev_count_packet(pmd, DP_STAT_HIT, batch->packet_count);
+    dp_netdev_count_packet(pmd, hit_type, batch->packet_count);
 }
 
 static inline bool
@@ -2905,7 +2907,7 @@ emc_processing(struct dp_netdev_pmd_thread *pmd, struct dp_packet **packets,
     }
 
     for (i = 0; i < n_batches; i++) {
-        packet_batch_execute(&batches[i], pmd);
+        packet_batch_execute(&batches[i], pmd, DP_STAT_EXACT_HIT);
     }
 
     return notfound_cnt;
@@ -3042,7 +3044,7 @@ fast_path_processing(struct dp_netdev_pmd_thread *pmd,
     }
 
     for (i = 0; i < n_batches; i++) {
-        packet_batch_execute(&batches[i], pmd);
+        packet_batch_execute(&batches[i], pmd, DP_STAT_MASKED_HIT);
     }
 }
 
-- 
2.1.4




More information about the dev mailing list