Skip to content

Commit 698eeb1

Browse files
dmarionayourtch
authored andcommitted
avf: add assert to ensure that adminq is used only from avf process
Type: improvement Change-Id: Ib64c9b8207776986656e5a26c13a221edc6cc950 Signed-off-by: Damjan Marion <damarion@cisco.com>
1 parent 160a2a9 commit 698eeb1

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/plugins/avf/device.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,11 @@ avf_send_to_pf (vlib_main_t * vm, avf_device_t * ad, virtchnl_ops_t op,
399399
u32 head;
400400
f64 t0, suspend_time = AVF_SEND_TO_PF_SUSPEND_TIME;
401401

402+
/* adminq operations should be only done from process node after device
403+
* is initialized */
404+
ASSERT ((ad->flags & AVF_DEVICE_F_INITIALIZED) == 0 ||
405+
vlib_get_current_process_node_index (vm) == avf_process_node.index);
406+
402407
/* suppress interrupt in the next adminq receive slot
403408
as we are going to wait for response
404409
we only need interrupts when event is received */

src/vlib/node_funcs.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,13 @@ vlib_current_process (vlib_main_t * vm)
455455
return vlib_get_current_process (vm)->node_runtime.node_index;
456456
}
457457

458+
always_inline u32
459+
vlib_get_current_process_node_index (vlib_main_t * vm)
460+
{
461+
vlib_process_t *process = vlib_get_current_process (vm);
462+
return process->node_runtime.node_index;
463+
}
464+
458465
/** Returns TRUE if a process suspend time is less than 10us
459466
@param dt - remaining poll time in seconds
460467
@returns 1 if dt < 10e-6, 0 otherwise

0 commit comments

Comments
 (0)