summaryrefslogtreecommitdiffstats
path: root/src/vnet/dev/dev_funcs.h
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2023-11-22 16:25:55 +0000
committerDamjan Marion <damarion@cisco.com>2023-11-25 12:39:25 +0000
commitddf6cec37027547ff7cc61e15bb8080664d41514 (patch)
tree6896d6e6a050a43344a22d0c4bc080db092c9caf /src/vnet/dev/dev_funcs.h
parent07a62cc236978a0f01ec8be70bdd1d3e8fa27f71 (diff)
dev: initial set of APIs
Type: improvement Change-Id: I9ecbf705d460a1744f36c7005b08097dc58d9522 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/dev/dev_funcs.h')
-rw-r--r--src/vnet/dev/dev_funcs.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/vnet/dev/dev_funcs.h b/src/vnet/dev/dev_funcs.h
index a74d3399511..521157abbec 100644
--- a/src/vnet/dev/dev_funcs.h
+++ b/src/vnet/dev/dev_funcs.h
@@ -75,6 +75,16 @@ vnet_dev_get_port_from_hw_if_index (u32 hw_if_index)
}
static_always_inline vnet_dev_t *
+vnet_dev_by_index (u32 index)
+{
+ vnet_dev_main_t *dm = &vnet_dev_main;
+ if (pool_is_free_index (dm->devices, index))
+ return 0;
+
+ return *pool_elt_at_index (dm->devices, index);
+}
+
+static_always_inline vnet_dev_t *
vnet_dev_by_id (char *id)
{
vnet_dev_main_t *dm = &vnet_dev_main;