diff options
author | Damjan Marion <damjan.marion@gmail.com> | 2024-10-23 18:38:18 +0200 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2024-10-23 18:41:55 +0000 |
commit | 46beb0d48bca4fe524597ead71bfcb63a180c7bd (patch) | |
tree | 6fd4c2c0fa2ff35a4b47dac063074403077dc44f | |
parent | d794af6771b4fec82e1f58efa7a0298448450cff (diff) |
dev: _with_ptr process node calls
Type: improvement
Change-Id: Ib392d74e7629cef5d335e4320a71ceec25ddb020
Signed-off-by: Damjan Marion <damjan.marion@gmail.com>
-rw-r--r-- | src/vnet/dev/dev.h | 11 | ||||
-rw-r--r-- | src/vnet/dev/process.c | 49 |
2 files changed, 60 insertions, 0 deletions
diff --git a/src/vnet/dev/dev.h b/src/vnet/dev/dev.h index eb06eeba34e..744dc5ac819 100644 --- a/src/vnet/dev/dev.h +++ b/src/vnet/dev/dev.h @@ -104,6 +104,11 @@ typedef void (vnet_dev_rx_queue_op_no_rv_t) (vlib_main_t *, vnet_dev_rx_queue_t *); typedef void (vnet_dev_tx_queue_op_no_rv_t) (vlib_main_t *, vnet_dev_tx_queue_t *); +typedef vnet_dev_rv_t (vnet_dev_op_with_ptr_t) (vlib_main_t *, vnet_dev_t *, + void *); +typedef vnet_dev_rv_t (vnet_dev_port_op_with_ptr_t) (vlib_main_t *, + vnet_dev_port_t *, + void *); typedef u16 vnet_dev_queue_id_t; typedef u16 vnet_dev_bus_index_t; @@ -612,6 +617,9 @@ vnet_dev_rv_t vnet_dev_process_call_op (vlib_main_t *, vnet_dev_t *, vnet_dev_op_t *); vnet_dev_rv_t vnet_dev_process_call_op_no_rv (vlib_main_t *, vnet_dev_t *, vnet_dev_op_no_rv_t *); +vnet_dev_rv_t vnet_dev_process_call_op_with_ptr (vlib_main_t *, vnet_dev_t *, + vnet_dev_op_with_ptr_t *, + void *); void vnet_dev_process_call_op_no_wait (vlib_main_t *, vnet_dev_t *, vnet_dev_op_no_rv_t *); vnet_dev_rv_t vnet_dev_process_call_port_op (vlib_main_t *, vnet_dev_port_t *, @@ -619,6 +627,9 @@ vnet_dev_rv_t vnet_dev_process_call_port_op (vlib_main_t *, vnet_dev_port_t *, vnet_dev_rv_t vnet_dev_process_call_port_op_no_rv (vlib_main_t *vm, vnet_dev_port_t *, vnet_dev_port_op_no_rv_t *); +vnet_dev_rv_t +vnet_dev_process_call_port_op_with_ptr (vlib_main_t *, vnet_dev_port_t *, + vnet_dev_port_op_with_ptr_t *, void *); void vnet_dev_process_call_port_op_no_wait (vlib_main_t *, vnet_dev_port_t *, vnet_dev_port_op_no_rv_t *); vnet_dev_rv_t diff --git a/src/vnet/dev/process.c b/src/vnet/dev/process.c index 3d3b49c01b6..4df56296444 100644 --- a/src/vnet/dev/process.c +++ b/src/vnet/dev/process.c @@ -20,9 +20,11 @@ typedef enum VNET_DEV_EVENT_PROCESS_QUIT, VNET_DEV_EVENT_CALL_OP, VNET_DEV_EVENT_CALL_OP_NO_RV, + VNET_DEV_EVENT_CALL_OP_WITH_PTR, VNET_DEV_EVENT_CALL_OP_NO_WAIT, VNET_DEV_EVENT_CALL_PORT_OP, VNET_DEV_EVENT_CALL_PORT_OP_NO_RV, + VNET_DEV_EVENT_CALL_PORT_OP_WITH_PTR, VNET_DEV_EVENT_CALL_PORT_OP_NO_WAIT, VNET_DEV_EVENT_CLOCK = ~0 } __clib_packed vnet_dev_event_t; @@ -51,6 +53,11 @@ typedef struct } call_op_no_rv; struct { + vnet_dev_op_with_ptr_t *op; + void *ptr; + } call_op_with_ptr; + struct + { vnet_dev_op_no_rv_t *op; } call_op_no_wait; struct @@ -65,6 +72,12 @@ typedef struct } call_port_op_no_rv; struct { + vnet_dev_port_op_with_ptr_t *op; + vnet_dev_port_t *port; + void *ptr; + } call_port_op_with_ptr; + struct + { vnet_dev_port_op_no_rv_t *op; vnet_dev_port_t *port; } call_port_op_no_wait; @@ -132,6 +145,10 @@ vnet_dev_process_one_event (vlib_main_t *vm, vnet_dev_t *dev, ev_log_debug (vm, dev, ed, "call op no rv"); ed->call_op_no_rv.op (vm, dev); break; + case VNET_DEV_EVENT_CALL_OP_WITH_PTR: + ev_log_debug (vm, dev, ed, "call op woth ptr"); + rv = ed->call_op_with_ptr.op (vm, dev, ed->call_op_with_ptr.ptr); + break; case VNET_DEV_EVENT_CALL_OP_NO_WAIT: ev_log_debug (vm, dev, ed, "call op no wait"); ed->call_op_no_wait.op (vm, dev); @@ -144,6 +161,11 @@ vnet_dev_process_one_event (vlib_main_t *vm, vnet_dev_t *dev, ev_log_debug (vm, dev, ed, "call port op no rv"); ed->call_port_op_no_rv.op (vm, ed->call_port_op_no_rv.port); break; + case VNET_DEV_EVENT_CALL_PORT_OP_WITH_PTR: + ev_log_debug (vm, dev, ed, "call port op woth ptr"); + rv = ed->call_port_op_with_ptr.op (vm, ed->call_port_op_with_ptr.port, + ed->call_port_op_with_ptr.ptr); + break; case VNET_DEV_EVENT_CALL_PORT_OP_NO_WAIT: ev_log_debug (vm, dev, ed, "call port op no wait"); ed->call_port_op_no_wait.op (vm, ed->call_port_op_no_wait.port); @@ -477,6 +499,19 @@ vnet_dev_process_call_op_no_rv (vlib_main_t *vm, vnet_dev_t *dev, return vnet_dev_process_event_send_and_wait (vm, dev, ed); } +vnet_dev_rv_t +vnet_dev_process_call_op_with_ptr (vlib_main_t *vm, vnet_dev_t *dev, + vnet_dev_op_with_ptr_t *op, void *p) +{ + vnet_dev_event_data_t *ed = vnet_dev_event_data_alloc (vm, dev); + *ed = (vnet_dev_event_data_t){ + .event = VNET_DEV_EVENT_CALL_OP_WITH_PTR, + .call_op_with_ptr = { .op = op, .ptr = p }, + }; + + return vnet_dev_process_event_send_and_wait (vm, dev, ed); +} + void vnet_dev_process_call_op_no_wait (vlib_main_t *vm, vnet_dev_t *dev, vnet_dev_op_no_rv_t *op) @@ -516,6 +551,20 @@ vnet_dev_process_call_port_op_no_rv (vlib_main_t *vm, vnet_dev_port_t *port, return vnet_dev_process_event_send_and_wait (vm, port->dev, ed); } +vnet_dev_rv_t +vnet_dev_process_call_port_op_with_ptr (vlib_main_t *vm, vnet_dev_port_t *port, + vnet_dev_port_op_with_ptr_t *op, + void *p) +{ + vnet_dev_event_data_t *ed = vnet_dev_event_data_alloc (vm, port->dev); + *ed = (vnet_dev_event_data_t){ + .event = VNET_DEV_EVENT_CALL_PORT_OP_WITH_PTR, + .call_port_op_with_ptr = { .op = op, .port = port, .ptr = p }, + }; + + return vnet_dev_process_event_send_and_wait (vm, port->dev, ed); +} + void vnet_dev_process_call_port_op_no_wait (vlib_main_t *vm, vnet_dev_port_t *port, vnet_dev_port_op_no_rv_t *op) |