diff options
author | Steven Luong <sluong@cisco.com> | 2019-06-20 11:43:22 -0700 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2019-06-22 12:57:41 +0000 |
commit | b98dbb1f2f94aba78a1b37c70721b562d13e1d7c (patch) | |
tree | 1ee963837c291f4dedf87f0f86eadbc3655382d2 | |
parent | dd7736b5157f126903513dfc29e3567b9334fa1b (diff) |
lacp: convert clib_warning to event logger
Replace clib_warning with event logger. The messages for the latter are
stored in the event buffers which can be viewed with debug CLI anytime.
Type: fix
Change-Id: I5ede4d1f1f9f0ab8d66394f49383fc1838d397ae
Signed-off-by: Steven Luong <sluong@cisco.com>
-rw-r--r-- | src/plugins/lacp/mux_machine.c | 25 | ||||
-rw-r--r-- | src/plugins/lacp/ptx_machine.c | 25 | ||||
-rw-r--r-- | src/plugins/lacp/rx_machine.c | 24 | ||||
-rw-r--r-- | src/plugins/lacp/tx_machine.c | 24 |
4 files changed, 78 insertions, 20 deletions
diff --git a/src/plugins/lacp/mux_machine.c b/src/plugins/lacp/mux_machine.c index 2dba60f5f9a..bbe452da454 100644 --- a/src/plugins/lacp/mux_machine.c +++ b/src/plugins/lacp/mux_machine.c @@ -212,11 +212,26 @@ void lacp_mux_debug_func (slave_if_t * sif, int event, int state, lacp_fsm_state_t * transition) { - clib_warning ("%U-MUX: event %U, old state %U, new state %U", - format_vnet_sw_if_index_name, vnet_get_main (), - sif->sw_if_index, format_mux_event, - event, format_mux_sm_state, state, format_mux_sm_state, - transition->next_state); + vlib_worker_thread_t *w = vlib_worker_threads + os_get_thread_index (); + /* *INDENT-OFF* */ + ELOG_TYPE_DECLARE (e) = + { + .format = "%s", + .format_args = "T4", + }; + /* *INDENT-ON* */ + struct + { + u32 event; + } *ed = 0; + + ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, e, w->elog_track); + ed->event = + elog_string (&vlib_global_main.elog_main, "%U-MUX: %U, %U->%U%c", + format_vnet_sw_if_index_name, vnet_get_main (), + sif->sw_if_index, format_mux_event, event, + format_mux_sm_state, state, format_mux_sm_state, + transition->next_state, 0); } void diff --git a/src/plugins/lacp/ptx_machine.c b/src/plugins/lacp/ptx_machine.c index b933a87e759..bd4150fe39f 100644 --- a/src/plugins/lacp/ptx_machine.c +++ b/src/plugins/lacp/ptx_machine.c @@ -197,11 +197,26 @@ void lacp_ptx_debug_func (slave_if_t * sif, int event, int state, lacp_fsm_state_t * transition) { - clib_warning ("%U-PTX: event %U, old state %U, new state %U", - format_vnet_sw_if_index_name, vnet_get_main (), - sif->sw_if_index, format_ptx_event, - event, format_ptx_sm_state, state, format_ptx_sm_state, - transition->next_state); + vlib_worker_thread_t *w = vlib_worker_threads + os_get_thread_index (); + /* *INDENT-OFF* */ + ELOG_TYPE_DECLARE (e) = + { + .format = "%s", + .format_args = "T4", + }; + /* *INDENT-ON* */ + struct + { + u32 event; + } *ed = 0; + + ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, e, w->elog_track); + ed->event = + elog_string (&vlib_global_main.elog_main, "%U-PTX: %U, %U->%U%c", + format_vnet_sw_if_index_name, vnet_get_main (), + sif->sw_if_index, format_ptx_event, event, + format_ptx_sm_state, state, format_ptx_sm_state, + transition->next_state, 0); } void diff --git a/src/plugins/lacp/rx_machine.c b/src/plugins/lacp/rx_machine.c index 293cdac846d..0d9d703ff42 100644 --- a/src/plugins/lacp/rx_machine.c +++ b/src/plugins/lacp/rx_machine.c @@ -403,11 +403,25 @@ void lacp_rx_debug_func (slave_if_t * sif, int event, int state, lacp_fsm_state_t * transition) { - clib_warning ("%U-RX: event %U, old state %U, new state %U", - format_vnet_sw_if_index_name, vnet_get_main (), - sif->sw_if_index, format_rx_event, - event, format_rx_sm_state, state, format_rx_sm_state, - transition->next_state); + vlib_worker_thread_t *w = vlib_worker_threads + os_get_thread_index (); + /* *INDENT-OFF* */ + ELOG_TYPE_DECLARE (e) = + { + .format = "%s", + .format_args = "T4", + }; + /* *INDENT-ON* */ + struct + { + u32 event; + } *ed = 0; + + ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, e, w->elog_track); + ed->event = elog_string (&vlib_global_main.elog_main, "%U-RX: %U, %U->%U%c", + format_vnet_sw_if_index_name, vnet_get_main (), + sif->sw_if_index, format_rx_event, event, + format_rx_sm_state, state, format_rx_sm_state, + transition->next_state, 0); } void diff --git a/src/plugins/lacp/tx_machine.c b/src/plugins/lacp/tx_machine.c index b252485d73c..73ca4862fe8 100644 --- a/src/plugins/lacp/tx_machine.c +++ b/src/plugins/lacp/tx_machine.c @@ -84,11 +84,25 @@ void lacp_tx_debug_func (slave_if_t * sif, int event, int state, lacp_fsm_state_t * transition) { - clib_warning ("%U-TX: event %U, old state %U, new state %U", - format_vnet_sw_if_index_name, vnet_get_main (), - sif->sw_if_index, format_tx_event, - event, format_tx_sm_state, state, format_tx_sm_state, - transition->next_state); + vlib_worker_thread_t *w = vlib_worker_threads + os_get_thread_index (); + /* *INDENT-OFF* */ + ELOG_TYPE_DECLARE (e) = + { + .format = "%s", + .format_args = "T4", + }; + /* *INDENT-ON* */ + struct + { + u32 event; + } *ed = 0; + + ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, e, w->elog_track); + ed->event = elog_string (&vlib_global_main.elog_main, "%U-TX: %U, %U->%U%c", + format_vnet_sw_if_index_name, vnet_get_main (), + sif->sw_if_index, format_tx_event, event, + format_tx_sm_state, state, format_tx_sm_state, + transition->next_state, 0); } void |