diff options
author | John Lo <loj@cisco.com> | 2018-03-13 21:53:18 -0400 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2018-03-14 12:07:48 +0000 |
commit | e23c99ec0061991cf3904122979ac755fe1b78ca (patch) | |
tree | 9ffa879cbdc7721138e5c0833605c7a060bebf52 /src/vnet/l2/l2_fib.c | |
parent | 04def7418b649a94e32149ee924a3743358b5c84 (diff) |
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 <loj@cisco.com>
Diffstat (limited to 'src/vnet/l2/l2_fib.c')
-rw-r--r-- | src/vnet/l2/l2_fib.c | 8 |
1 files changed, 5 insertions, 3 deletions
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++; |