From e23c99ec0061991cf3904122979ac755fe1b78ca Mon Sep 17 00:00:00 2001 From: John Lo Date: Tue, 13 Mar 2018 21:53:18 -0400 Subject: Improve l2_macs_events API to provide MAC move information Change mac_entry layout in l2_macs_event API message so the MAC entry can be either add, delete or move where the sw_if_index of an existing MAC entry changed. Also added a 8-bit flags field in mac_entry for any future expansion. Change-Id: I3bf9e1cf2556f2938202025a5d0772c2ce2fc99f Signed-off-by: John Lo --- src/vnet/l2/l2_fib.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/vnet/l2/l2_fib.c') diff --git a/src/vnet/l2/l2_fib.c b/src/vnet/l2/l2_fib.c index 55cffc8047c..99d99c57f73 100644 --- a/src/vnet/l2/l2_fib.c +++ b/src/vnet/l2/l2_fib.c @@ -1037,11 +1037,13 @@ l2fib_scan (vlib_main_t * vm, f64 start_time, u8 event_only) /* copy mac entry to event msg */ clib_memcpy (mp->mac[evt_idx].mac_addr, key.fields.mac, 6); - mp->mac[evt_idx].is_del = 0; + mp->mac[evt_idx].action = result.fields.lrn_mov ? + MAC_EVENT_ACTION_MOVE : MAC_EVENT_ACTION_ADD; mp->mac[evt_idx].sw_if_index = htonl (result.fields.sw_if_index); - /* clear event bit and update mac entry */ + /* clear event bits and update mac entry */ result.fields.lrn_evt = 0; + result.fields.lrn_mov = 0; BVT (clib_bihash_kv) kv; kv.key = key.raw; kv.value = result.raw; @@ -1078,7 +1080,7 @@ l2fib_scan (vlib_main_t * vm, f64 start_time, u8 event_only) { /* copy mac entry to event msg */ clib_memcpy (mp->mac[evt_idx].mac_addr, key.fields.mac, 6); - mp->mac[evt_idx].is_del = 1; + mp->mac[evt_idx].action = MAC_EVENT_ACTION_DELETE; mp->mac[evt_idx].sw_if_index = htonl (result.fields.sw_if_index); evt_idx++; -- cgit 1.2.3-korg