aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/linux-cp
diff options
context:
space:
mode:
authorPim van Pelt <pim@ipng.nl>2025-01-25 12:49:20 +0100
committerMatthew Smith <mgsmith@netgate.com>2025-01-29 14:13:20 +0000
commitf1467f6be578088586abad1cc2c96038d8247794 (patch)
tree4f639544c7de80577e0660a895f011aa829f1f20 /src/plugins/linux-cp
parent81996c1970b7db39f1ffe7a919bbb3a3ab9a0740 (diff)
sflow: replace VAPI with DLAPI
Remove the requirement to coordinate between linux-cp and sflow at build time via cmake. Also, remove 350 lines of awkward thread-forking VAPI code. Replace it with a dynamically retrieved function from the linux-cp plugin, called lcp_itf_pair_get_vif_index_by_phy(). Remove build inhibit based on Netlink headers, and only inhibit the build for FreeBSD. This plugin can now run regardless of Linux CP being built or loaded, and then return VPP ifIndex numbers instead. Also, fix a flaky test where non-ephemeral source ports throw off packet captures. Type: improvement Change-Id: I5486742fa0e343e382630a22672a05fe3dcf7836 Signed-off-by: neil.mckee@inmon.com Signed-off-by: pim@ipng.nl
Diffstat (limited to 'src/plugins/linux-cp')
-rw-r--r--src/plugins/linux-cp/lcp_interface.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/plugins/linux-cp/lcp_interface.c b/src/plugins/linux-cp/lcp_interface.c
index 61665ad4146..9a6b9b11be5 100644
--- a/src/plugins/linux-cp/lcp_interface.c
+++ b/src/plugins/linux-cp/lcp_interface.c
@@ -162,6 +162,22 @@ lcp_itf_pair_get (u32 index)
return pool_elt_at_index (lcp_itf_pair_pool, index);
}
+/* binary-direct API: for access from other plugins, bypassing VAPI.
+ * Important for parameters and return types to be simple C types, rather
+ * than structures. See src/plugins/sflow/sflow_dlapi.h for an example.
+ */
+u32
+lcp_itf_pair_get_vif_index_by_phy (u32 phy_sw_if_index)
+{
+ if (phy_sw_if_index < vec_len (lip_db_by_phy))
+ {
+ lcp_itf_pair_t *lip = lcp_itf_pair_get (lip_db_by_phy[phy_sw_if_index]);
+ if (lip)
+ return lip->lip_vif_index;
+ }
+ return INDEX_INVALID;
+}
+
index_t
lcp_itf_pair_find_by_vif (u32 vif_index)
{