[ovs-dev] [PATCH 1/5] mac-learning: Add additional mac-learning coverage counters

Eelco Chaudron echaudro at redhat.com
Mon Jun 25 10:57:26 UTC 2018


This patch adds two additional mac-learning coverage counters:
  - mac_learning_evicted, entries deleted due to mac table being full
  - mac_learning_moved, entries where the port has changed.

Signed-off-by: Eelco Chaudron <echaudro at redhat.com>
---
 lib/mac-learning.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/mac-learning.c b/lib/mac-learning.c
index 215caf0ba..8b7981dbb 100644
--- a/lib/mac-learning.c
+++ b/lib/mac-learning.c
@@ -32,6 +32,8 @@
 
 COVERAGE_DEFINE(mac_learning_learned);
 COVERAGE_DEFINE(mac_learning_expired);
+COVERAGE_DEFINE(mac_learning_evicted);
+COVERAGE_DEFINE(mac_learning_moved);
 
 /* Returns the number of seconds since 'e' (within 'ml') was last learned. */
 int
@@ -150,6 +152,7 @@ evict_mac_entry_fairly(struct mac_learning *ml)
                           struct mac_learning_port, heap_node);
     e = CONTAINER_OF(ovs_list_front(&mlport->port_lrus),
                      struct mac_entry, port_lru_node);
+    COVERAGE_INC(mac_learning_evicted);
     mac_learning_expire(ml, e);
 }
 
@@ -421,6 +424,9 @@ update_learning_table__(struct mac_learning *ml, struct eth_addr src,
     }
 
     if (mac_entry_get_port(ml, mac) != in_port) {
+        if (mac_entry_get_port(ml, mac) != NULL) {
+            COVERAGE_INC(mac_learning_moved);
+        }
         mac_entry_set_port(ml, mac, in_port);
         return true;
     }



More information about the dev mailing list