BD ARP entry use common API types
[vpp.git] / src / vnet / l2 / l2_fib.c
index dcfee7b..48be42e 100644 (file)
 
 l2fib_main_t l2fib_main;
 
+u8 *
+format_l2fib_entry_result_flags (u8 * s, va_list * args)
+{
+  l2fib_entry_result_flags_t flags = va_arg (*args, int);
+
+  if (L2FIB_ENTRY_RESULT_FLAG_NONE == flags)
+    {
+      s = format (s, "none");
+    }
+  else
+    {
+#define _(a,v,t) {                              \
+      if (flags & L2FIB_ENTRY_RESULT_FLAG_##a)  \
+        s = format (s, "%s ", t);               \
+    }
+      foreach_l2fib_entry_result_attr
+#undef _
+    }
+  return (s);
+}
+
 static void
 incr_mac_address (u8 * mac)
 {
@@ -287,7 +308,7 @@ show_l2fib (vlib_main_t * vm,
 }
 
 /*?
- * This command dispays the MAC Address entries of the L2 FIB table.
+ * This command displays the MAC Address entries of the L2 FIB table.
  * Output can be filtered to just get the number of MAC Addresses or display
  * each MAC Address for all bridge domains or just a single bridge domain.
  *
@@ -389,7 +410,7 @@ l2fib_add_entry (const u8 * mac, u32 bd_index,
   /* set up key */
   key.raw = l2fib_make_key (mac, bd_index);
 
-  /* check if entry alread exist */
+  /* check if entry already exist */
   if (BV (clib_bihash_search) (&fm->mac_table, &kv, &kv))
     {
       /* decrement counter if overwriting a learned mac  */
@@ -1070,7 +1091,7 @@ l2fib_scan (vlib_main_t * vm, f64 start_time, u8 event_only)
                }
 
              if (event_only || l2fib_entry_result_is_set_AGE_NOT (&result))
-               continue;       /* skip aging - static_mac alsways age_not */
+               continue;       /* skip aging - static_mac always age_not */
 
              /* start aging processing */
              u32 bd_index = key.fields.bd_index;
@@ -1242,7 +1263,7 @@ l2fib_init (vlib_main_t * vm)
                         L2FIB_NUM_BUCKETS, L2FIB_MEMORY_SIZE);
 
   /* verify the key constructor is good, since it is endian-sensitive */
-  memset (test_mac, 0, sizeof (test_mac));
+  clib_memset (test_mac, 0, sizeof (test_mac));
   test_mac[0] = 0x11;
   test_key.raw = 0;
   test_key.raw = l2fib_make_key ((u8 *) & test_mac, 0x1234);