summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2021-03-26 13:45:37 +0100
committerDamjan Marion <damarion@cisco.com>2021-03-26 16:33:42 +0100
commitf553a2cbbb8cca84ebf033335ebd2cd26dc19d69 (patch)
tree3705c2c0121769dff96a122cef13886d5f0e5205 /src/plugins
parent6ffb7c61899eb782416cbd2f117042a583f189f7 (diff)
vlib: introduce vlib_get_elog_main()
Type: improvement Change-Id: I73383eb15186021cd6527d112da8443a0082f129 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/avf/device.c58
-rw-r--r--src/plugins/dpdk/device/init.c7
-rw-r--r--src/plugins/unittest/util_test.c2
3 files changed, 29 insertions, 38 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;