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)
{
tmp += 1 << 16; /* skip unused (least significant) octets */
tmp = clib_host_to_net_u64 (tmp);
- clib_memcpy (mac, &tmp, 6);
+ clib_memcpy_fast (mac, &tmp, 6);
}
/** Format sw_if_index. If the value is ~0, use the text "N/A" */
}
/*?
- * 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.
*
/* 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 */
return clib_error_return (0,
"noop: pick at least one of (add,del,check)");
- clib_memcpy (save_mac, mac, 6);
+ clib_memcpy_fast (save_mac, mac, 6);
if (is_add)
{
BVT (clib_bihash_kv) kv;
l2fib_main_t *mp = &l2fib_main;
- clib_memcpy (mac, save_mac, 6);
+ clib_memcpy_fast (mac, save_mac, 6);
for (i = 0; i < count; i++)
{
if (is_del)
{
- clib_memcpy (mac, save_mac, 6);
+ clib_memcpy_fast (mac, save_mac, 6);
for (i = 0; i < count; i++)
{
if (l2fib_entry_result_is_set_LRN_EVT (&result))
{
/* copy mac entry to event msg */
- clib_memcpy (mp->mac[evt_idx].mac_addr, key.fields.mac,
- 6);
+ clib_memcpy_fast (mp->mac[evt_idx].mac_addr,
+ key.fields.mac, 6);
mp->mac[evt_idx].action =
l2fib_entry_result_is_set_LRN_MOV (&result) ?
MAC_EVENT_ACTION_MOVE : MAC_EVENT_ACTION_ADD;
}
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;
if (client)
{
/* copy mac entry to event msg */
- clib_memcpy (mp->mac[evt_idx].mac_addr, key.fields.mac, 6);
+ clib_memcpy_fast (mp->mac[evt_idx].mac_addr, key.fields.mac,
+ 6);
mp->mac[evt_idx].action = MAC_EVENT_ACTION_DELETE;
mp->mac[evt_idx].sw_if_index =
htonl (result.fields.sw_if_index);
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);