diff options
-rw-r--r-- | src/plugins/avf/device.c | 58 | ||||
-rw-r--r-- | src/plugins/dpdk/device/init.c | 7 | ||||
-rw-r--r-- | src/plugins/unittest/util_test.c | 2 | ||||
-rw-r--r-- | src/vlib/cli.c | 16 | ||||
-rw-r--r-- | src/vlib/error_funcs.h | 2 | ||||
-rw-r--r-- | src/vlib/global_funcs.h | 7 | ||||
-rw-r--r-- | src/vlib/log.c | 5 | ||||
-rw-r--r-- | src/vlib/main.c | 21 | ||||
-rw-r--r-- | src/vlib/node.c | 3 | ||||
-rw-r--r-- | src/vlib/threads.c | 6 | ||||
-rw-r--r-- | src/vlib/threads.h | 6 | ||||
-rw-r--r-- | src/vlib/unix/main.c | 4 | ||||
-rw-r--r-- | src/vlibmemory/memory_api.h | 27 | ||||
-rw-r--r-- | src/vnet/ip6-nd/ip6_ra.c | 7 | ||||
-rw-r--r-- | src/vnet/session/session_cli.c | 2 |
15 files changed, 88 insertions, 85 deletions
diff --git a/src/plugins/avf/device.c b/src/plugins/avf/device.c index def8a799ecb..4418dfdefbe 100644 --- a/src/plugins/avf/device.c +++ b/src/plugins/avf/device.c @@ -183,7 +183,6 @@ retry: done: if (ad->flags & AVF_DEVICE_F_ELOG) { - /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (el) = { .format = "avf[%d] aq enq: s_flags 0x%x r_flags 0x%x opcode 0x%x " @@ -199,14 +198,13 @@ done: u16 datalen; u16 retval; } *ed; - ed = ELOG_DATA (&vm->elog_main, el); - ed->dev_instance = ad->dev_instance; - ed->s_flags = dc.flags; - ed->r_flags = d->flags; - ed->opcode = dc.opcode; - ed->datalen = dc.datalen; - ed->retval = d->retval; - /* *INDENT-ON* */ + ed = ELOG_DATA (&vlib_global_main.elog_main, el); + ed->dev_instance = ad->dev_instance; + ed->s_flags = dc.flags; + ed->r_flags = d->flags; + ed->opcode = dc.opcode; + ed->datalen = dc.datalen; + ed->retval = d->retval; } return err; @@ -222,7 +220,6 @@ avf_cmd_rx_ctl_reg_write (vlib_main_t * vm, avf_device_t * ad, u32 reg, if (ad->flags & AVF_DEVICE_F_ELOG) { - /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (el) = { .format = "avf[%d] rx ctl reg write: reg 0x%x val 0x%x ", @@ -234,11 +231,10 @@ avf_cmd_rx_ctl_reg_write (vlib_main_t * vm, avf_device_t * ad, u32 reg, u32 reg; u32 val; } *ed; - ed = ELOG_DATA (&vm->elog_main, el); - ed->dev_instance = ad->dev_instance; - ed->reg = reg; - ed->val = val; - /* *INDENT-ON* */ + ed = ELOG_DATA (&vlib_global_main.elog_main, el); + ed->dev_instance = ad->dev_instance; + ed->reg = reg; + ed->val = val; } return err; } @@ -500,7 +496,6 @@ done: if (ad->flags & AVF_DEVICE_F_ELOG) { - /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (el) = { .format = "avf[%d] send to pf: v_opcode %s (%d) v_retval 0x%x", @@ -519,12 +514,11 @@ done: u32 v_opcode_val; u32 v_retval; } *ed; - ed = ELOG_DATA (&vm->elog_main, el); - ed->dev_instance = ad->dev_instance; - ed->v_opcode = op; - ed->v_opcode_val = op; - ed->v_retval = d->v_retval; - /* *INDENT-ON* */ + ed = ELOG_DATA (&vlib_global_main.elog_main, el); + ed->dev_instance = ad->dev_instance; + ed->v_opcode = op; + ed->v_opcode_val = op; + ed->v_retval = d->v_retval; } return err; } @@ -1138,10 +1132,10 @@ avf_process_one_device (vlib_main_t * vm, avf_device_t * ad, int is_irq) u8 link_status; u32 link_speed; } *ed; - ed = ELOG_DATA (&vm->elog_main, el); - ed->dev_instance = ad->dev_instance; - ed->link_status = link_up; - ed->link_speed = mbps; + ed = ELOG_DATA (&vlib_global_main.elog_main, el); + ed->dev_instance = ad->dev_instance; + ed->link_status = link_up; + ed->link_speed = mbps; } } else @@ -1159,10 +1153,10 @@ avf_process_one_device (vlib_main_t * vm, avf_device_t * ad, int is_irq) u32 event; u32 severity; } *ed; - ed = ELOG_DATA (&vm->elog_main, el); - ed->dev_instance = ad->dev_instance; - ed->event = e->event; - ed->severity = e->severity; + ed = ELOG_DATA (&vlib_global_main.elog_main, el); + ed->dev_instance = ad->dev_instance; + ed->event = e->event; + ed->severity = e->severity; } } } @@ -1374,7 +1368,7 @@ avf_irq_0_handler (vlib_main_t * vm, vlib_pci_dev_handle_t h, u16 line) u32 icr0; } *ed; - ed = ELOG_DATA (&vm->elog_main, el); + ed = ELOG_DATA (&vlib_global_main.elog_main, el); ed->dev_instance = ad->dev_instance; ed->icr0 = icr0; } @@ -1410,7 +1404,7 @@ avf_irq_n_handler (vlib_main_t * vm, vlib_pci_dev_handle_t h, u16 line) u16 line; } *ed; - ed = ELOG_DATA (&vm->elog_main, el); + ed = ELOG_DATA (&vlib_global_main.elog_main, el); ed->dev_instance = ad->dev_instance; ed->line = line; } diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c index 2834a3196e4..24f822ec495 100644 --- a/src/plugins/dpdk/device/init.c +++ b/src/plugins/dpdk/device/init.c @@ -1730,7 +1730,6 @@ dpdk_update_link_state (dpdk_device_t * xd, f64 now) if (LINK_STATE_ELOGS) { - vlib_main_t *vm = vlib_get_main (); ELOG_TYPE_DECLARE (e) = { .format = @@ -1744,7 +1743,7 @@ dpdk_update_link_state (dpdk_device_t * xd, f64 now) u8 old_link_state; u8 new_link_state; } *ed; - ed = ELOG_DATA (&vm->elog_main, e); + ed = ELOG_DATA (&vlib_global_main.elog_main, e); ed->sw_if_index = xd->sw_if_index; ed->admin_up = (xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP) != 0; ed->old_link_state = (u8) @@ -1783,8 +1782,6 @@ dpdk_update_link_state (dpdk_device_t * xd, f64 now) { if (LINK_STATE_ELOGS) { - vlib_main_t *vm = vlib_get_main (); - ELOG_TYPE_DECLARE (e) = { .format = @@ -1796,7 +1793,7 @@ dpdk_update_link_state (dpdk_device_t * xd, f64 now) u32 sw_if_index; u32 flags; } *ed; - ed = ELOG_DATA (&vm->elog_main, e); + ed = ELOG_DATA (&vlib_global_main.elog_main, e); ed->sw_if_index = xd->sw_if_index; ed->flags = hw_flags; } diff --git a/src/plugins/unittest/util_test.c b/src/plugins/unittest/util_test.c index 67fe0093ab8..8dce270f814 100644 --- a/src/plugins/unittest/util_test.c +++ b/src/plugins/unittest/util_test.c @@ -29,7 +29,7 @@ test_crash_command_fn (vlib_main_t * vm, .format_args = "i4", }; /* *INDENT-ON* */ - elog (&vm->elog_main, &e, 0xdefec8ed); + elog (&vlib_global_main.elog_main, &e, 0xdefec8ed); *p = 0xdeadbeef; diff --git a/src/vlib/cli.c b/src/vlib/cli.c index 85ec6cbc43c..3215a3264f5 100644 --- a/src/vlib/cli.c +++ b/src/vlib/cli.c @@ -575,8 +575,8 @@ vlib_cli_dispatch_sub_commands (vlib_main_t * vm, { u32 c; } *ed; - ed = ELOG_DATA (&vm->elog_main, e); - ed->c = elog_string (&vm->elog_main, "%v", c->path); + ed = ELOG_DATA (vlib_get_elog_main (), e); + ed->c = elog_string (vlib_get_elog_main (), "%v", c->path); } if (!c->is_mp_safe) @@ -607,17 +607,17 @@ vlib_cli_dispatch_sub_commands (vlib_main_t * vm, { u32 c, err; } *ed; - ed = ELOG_DATA (&vm->elog_main, e); - ed->c = elog_string (&vm->elog_main, "%v", c->path); + ed = ELOG_DATA (vlib_get_elog_main (), e); + ed->c = elog_string (vlib_get_elog_main (), "%v", c->path); if (c_error) { vec_add1 (c_error->what, 0); - ed->err = - elog_string (&vm->elog_main, (char *) c_error->what); + ed->err = elog_string (vlib_get_elog_main (), + (char *) c_error->what); _vec_len (c_error->what) -= 1; } else - ed->err = elog_string (&vm->elog_main, "OK"); + ed->err = elog_string (vlib_get_elog_main (), "OK"); } if (c_error) @@ -1547,7 +1547,7 @@ event_logger_trace_command_fn (vlib_main_t * vm, */ if (dispatch || circuit) { - elog_main_t *em = &vm->elog_main; + elog_main_t *em = &vlib_global_main.elog_main; em->n_total_events_disable_limit = em->n_total_events + vec_len (em->event_ring); diff --git a/src/vlib/error_funcs.h b/src/vlib/error_funcs.h index ab281ba2ef8..4fea1ce6dc0 100644 --- a/src/vlib/error_funcs.h +++ b/src/vlib/error_funcs.h @@ -47,7 +47,7 @@ vlib_error_elog_count (vlib_main_t * vm, uword counter, uword increment) { if (VLIB_ELOG_MAIN_LOOP > 0 && increment > 0) { - elog_main_t *em = &vm->elog_main; + elog_main_t *em = vlib_get_elog_main (); elog (em, vec_elt_at_index (vm->error_elog_event_types, counter), increment); } diff --git a/src/vlib/global_funcs.h b/src/vlib/global_funcs.h index b1d636f7ce4..63f8115a181 100644 --- a/src/vlib/global_funcs.h +++ b/src/vlib/global_funcs.h @@ -52,6 +52,13 @@ vlib_get_thread_main () return &vlib_thread_main; } +always_inline elog_main_t * +vlib_get_elog_main () +{ + vlib_main_t *vm = vlib_get_first_main (); + return &vm->elog_main; +} + #endif /* included_vlib_global_funcs_h_ */ /* diff --git a/src/vlib/log.c b/src/vlib/log.c index ed14d9ecdc6..fc67a1f8903 100644 --- a/src/vlib/log.c +++ b/src/vlib/log.c @@ -249,9 +249,10 @@ vlib_log (vlib_log_level_t level, vlib_log_class_t class, char *fmt, ...) u32 string_index; } *ed; /* *INDENT-ON* */ - ed = ELOG_DATA (&vm->elog_main, ee); + ed = ELOG_DATA (&vlib_global_main.elog_main, ee); ed->log_level = level; - ed->string_index = elog_string (&vm->elog_main, "%v", e->string); + ed->string_index = + elog_string (&vlib_global_main.elog_main, "%v", e->string); } lm->next = (lm->next + 1) % lm->size; diff --git a/src/vlib/main.c b/src/vlib/main.c index fc6fadb625e..62da7b9ff0a 100644 --- a/src/vlib/main.c +++ b/src/vlib/main.c @@ -694,7 +694,7 @@ static clib_error_t * vlib_cli_elog_clear (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { - elog_reset_buffer (&vm->elog_main); + elog_reset_buffer (&vlib_global_main.elog_main); return 0; } @@ -711,7 +711,7 @@ static clib_error_t * elog_save_buffer (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { - elog_main_t *em = &vm->elog_main; + elog_main_t *em = &vlib_global_main.elog_main; char *file, *chroot_file; clib_error_t *error = 0; @@ -765,7 +765,7 @@ static clib_error_t * elog_stop (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { - elog_main_t *em = &vm->elog_main; + elog_main_t *em = &vlib_global_main.elog_main; em->n_total_events_disable_limit = em->n_total_events; @@ -785,7 +785,7 @@ static clib_error_t * elog_restart (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { - elog_main_t *em = &vm->elog_main; + elog_main_t *em = &vlib_global_main.elog_main; em->n_total_events_disable_limit = ~0; @@ -805,11 +805,11 @@ static clib_error_t * elog_resize_command_fn (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { - elog_main_t *em = &vm->elog_main; + elog_main_t *em = &vlib_global_main.elog_main; u32 tmp; /* Stop the parade */ - elog_reset_buffer (&vm->elog_main); + elog_reset_buffer (em); if (unformat (input, "%d", &tmp)) { @@ -836,7 +836,7 @@ VLIB_CLI_COMMAND (elog_resize_cli, static) = { static void elog_show_buffer_internal (vlib_main_t * vm, u32 n_events_to_show) { - elog_main_t *em = &vm->elog_main; + elog_main_t *em = &vlib_global_main.elog_main; elog_event_t *e, *es; f64 dt; @@ -902,7 +902,7 @@ vlib_elog_main_loop_event (vlib_main_t * vm, u64 time, u32 n_vectors, u32 is_return) { vlib_main_t *evm = &vlib_global_main; - elog_main_t *em = &evm->elog_main; + elog_main_t *em = vlib_get_elog_main (); int enabled = evm->elog_trace_graph_dispatch | evm->elog_trace_graph_circuit; @@ -1819,8 +1819,7 @@ vlib_add_del_post_mortem_callback (void *cb, int is_add) static void elog_post_mortem_dump (void) { - vlib_main_t *vm = &vlib_global_main; - elog_main_t *em = &vm->elog_main; + elog_main_t *em = vlib_get_elog_main (); u8 *filename; clib_error_t *error; @@ -1933,7 +1932,7 @@ vlib_main (vlib_main_t * volatile vm, unformat_input_t * input) if (vm->configured_elog_ring_size && vm->configured_elog_ring_size != vm->elog_main.event_ring_size) elog_resize (&vm->elog_main, vm->configured_elog_ring_size); - vl_api_set_elog_main (&vm->elog_main); + vl_api_set_elog_main (vlib_get_elog_main ()); (void) vl_api_set_elog_trace_api_messages (1); /* Default name. */ diff --git a/src/vlib/node.c b/src/vlib/node.c index 3c96d9d2a04..9de4c690c3f 100644 --- a/src/vlib/node.c +++ b/src/vlib/node.c @@ -68,7 +68,8 @@ node_set_elog_name (vlib_main_t * vm, uword node_index) vec_free (t->format); t->format = (char *) format (0, "%v-return: %%d%c", n->name, 0); - n->name_elog_string = elog_string (&vm->elog_main, "%v%c", n->name, 0); + n->name_elog_string = + elog_string (&vlib_global_main.elog_main, "%v%c", n->name, 0); } void diff --git a/src/vlib/threads.c b/src/vlib/threads.c index 939f9107556..cf82e1802d6 100644 --- a/src/vlib/threads.c +++ b/src/vlib/threads.c @@ -686,7 +686,7 @@ start_workers (vlib_main_t * vm) /* Set up the main thread */ vec_add2_aligned (vlib_worker_threads, w, 1, CLIB_CACHE_LINE_BYTES); w->elog_track.name = "main thread"; - elog_track_register (&vm->elog_main, &w->elog_track); + elog_track_register (vlib_get_elog_main (), &w->elog_track); if (vec_len (tm->thread_prefix)) { @@ -770,7 +770,7 @@ start_workers (vlib_main_t * vm) w->elog_track.name = (char *) format (0, "%s %d", tr->name, k + 1); vec_add1 (w->elog_track.name, 0); - elog_track_register (&vm->elog_main, &w->elog_track); + elog_track_register (vlib_get_elog_main (), &w->elog_track); if (tr->no_data_structure_clone) continue; @@ -944,7 +944,7 @@ start_workers (vlib_main_t * vm) (char *) format (0, "%s %d", tr->name, j + 1); w->registration = tr; vec_add1 (w->elog_track.name, 0); - elog_track_register (&vm->elog_main, &w->elog_track); + elog_track_register (vlib_get_elog_main (), &w->elog_track); } } } diff --git a/src/vlib/threads.h b/src/vlib/threads.h index eb31edc2706..b514ba415ec 100644 --- a/src/vlib/threads.h +++ b/src/vlib/threads.h @@ -425,8 +425,7 @@ vlib_worker_thread_barrier_check (void) u32 thread_index; } __clib_packed *ed; - ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, e, - w->elog_track); + ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, e, w->elog_track); ed->thread_index = thread_index; } @@ -503,8 +502,7 @@ vlib_worker_thread_barrier_check (void) u32 duration; } __clib_packed *ed; - ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, e, - w->elog_track); + ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, e, w->elog_track); ed->thread_index = thread_index; ed->duration = (int) (1000000.0 * t); } diff --git a/src/vlib/unix/main.c b/src/vlib/unix/main.c index f73f9ca325f..a0a13f3affa 100644 --- a/src/vlib/unix/main.c +++ b/src/vlib/unix/main.c @@ -708,8 +708,8 @@ vlib_unix_main (int argc, char *argv[]) /* Turn on the event logger at the first possible moment */ vm->configured_elog_ring_size = 128 << 10; - elog_init (&vm->elog_main, vm->configured_elog_ring_size); - elog_enable_disable (&vm->elog_main, 1); + elog_init (vlib_get_elog_main (), vm->configured_elog_ring_size); + elog_enable_disable (vlib_get_elog_main (), 1); unformat_init_command_line (&input, (char **) vm->argv); if ((e = vlib_plugin_config (vm, &input))) diff --git a/src/vlibmemory/memory_api.h b/src/vlibmemory/memory_api.h index f6580067d46..843bf8935b2 100644 --- a/src/vlibmemory/memory_api.h +++ b/src/vlibmemory/memory_api.h @@ -67,17 +67,22 @@ vl_msg_api_handle_is_valid (u32 handle, u32 restarts) return ((restarts & VL_API_EPOCH_MASK) == epoch); } -#define VL_MEM_API_LOG_Q_LEN(fmt,qlen) \ -if (TRACE_VLIB_MEMORY_QUEUE) \ - do { \ - ELOG_TYPE_DECLARE (e) = { \ - .format = fmt, \ - .format_args = "i4", \ - }; \ - struct { u32 len; } *ed; \ - ed = ELOG_DATA (&vm->elog_main, e); \ - ed->len = qlen; \ - } while (0) +#define VL_MEM_API_LOG_Q_LEN(fmt, qlen) \ + if (TRACE_VLIB_MEMORY_QUEUE) \ + do \ + { \ + ELOG_TYPE_DECLARE (e) = { \ + .format = fmt, \ + .format_args = "i4", \ + }; \ + struct \ + { \ + u32 len; \ + } * ed; \ + ed = ELOG_DATA (&vlib_global_main.elog_main, e); \ + ed->len = qlen; \ + } \ + while (0) #endif /* SRC_VLIBMEMORY_MEMORY_API_H_ */ diff --git a/src/vnet/ip6-nd/ip6_ra.c b/src/vnet/ip6-nd/ip6_ra.c index a3d95eee9fb..547ecf31034 100644 --- a/src/vnet/ip6-nd/ip6_ra.c +++ b/src/vnet/ip6-nd/ip6_ra.c @@ -252,9 +252,10 @@ ip6_neighbor_syslog (vlib_main_t * vm, int priority, char *fmt, ...) { u32 s[2]; } *ed; - ed = ELOG_DATA (&vm->elog_main, e); - ed->s[0] = elog_string (&vm->elog_main, log_level_strings[priority]); - ed->s[1] = elog_string (&vm->elog_main, (char *) what); + ed = ELOG_DATA (vlib_get_elog_main (), e); + ed->s[0] = + elog_string (vlib_get_elog_main (), log_level_strings[priority]); + ed->s[1] = elog_string (vlib_get_elog_main (), (char *) what); } va_end (va); return; diff --git a/src/vnet/session/session_cli.c b/src/vnet/session/session_cli.c index 0d541748d9e..2ca9630996a 100644 --- a/src/vnet/session/session_cli.c +++ b/src/vnet/session/session_cli.c @@ -598,7 +598,7 @@ show_session_command_fn (vlib_main_t * vm, unformat_input_t * input, u8 *str = format (0, "%U", format_session, s, 3); if (do_elog && s->session_state != SESSION_STATE_LISTENING) { - elog_main_t *em = &vm->elog_main; + elog_main_t *em = &vlib_global_main.elog_main; transport_connection_t *tc; f64 dt; |