aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/linux-cp/lcp_interface.c
diff options
context:
space:
mode:
authorAkeel Ali <akeelapi@gmail.com>2025-01-09 12:01:13 -0500
committerMatthew Smith <mgsmith@netgate.com>2025-02-26 15:39:58 +0000
commit9543e29708524accce591eab3aa23270ab44ae1a (patch)
treef56465c95800058c98b210a5653db23b6c385fae /src/plugins/linux-cp/lcp_interface.c
parent1cdebd8ca18bdf38af95047b1e9daf520e03030c (diff)
linux-cp: Add support for LACP packets
This patch adds support to mirror LACP packets between host and phy. It is needed for the Sonic-VPP project to support LAG and allow Sonic to run LACP in the control plane. The change has 3 parts: (1) Converted lip_punt_node to lip_punt_xc_inline, which now supports the creation of two distinct nodes: lip_punt_node and lip_punt_xc_node. lip_punt_node retains its original punt functionality. lip_punt_xc_node supports both punt and x-connect between host & phy. (2) Add 2 new API (and corresponding CLI) to the linux-cp plugin: (A) lcp_ethertype_enable ("lcp ethertype enable <ethertype>") (B) lcp_ethertype_get ("show lcp ethertype") (3) Add UT to test the new functionality and API/CLI for LACP and LLDP. Type: improvement Change-Id: Iab66e3b29351dcf2c471babd4f1ef4bdd19da46e Signed-off-by: Akeel Ali <akeelapi@gmail.com>
Diffstat (limited to 'src/plugins/linux-cp/lcp_interface.c')
-rw-r--r--src/plugins/linux-cp/lcp_interface.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/plugins/linux-cp/lcp_interface.c b/src/plugins/linux-cp/lcp_interface.c
index 9a6b9b11be5..31864f791af 100644
--- a/src/plugins/linux-cp/lcp_interface.c
+++ b/src/plugins/linux-cp/lcp_interface.c
@@ -1230,6 +1230,53 @@ lcp_itf_pair_link_up_down (vnet_main_t *vnm, u32 hw_if_index, u32 flags)
return 0;
}
+int
+lcp_ethertype_enable (ethernet_type_t ethertype)
+{
+ ethernet_main_t *em = &ethernet_main;
+ ethernet_type_info_t *eti;
+ vlib_main_t *vm = vlib_get_main ();
+ vlib_node_t *node = vlib_get_node_by_name (vm, (u8 *) "linux-cp-punt-xc");
+
+ if (!node)
+ return VNET_API_ERROR_UNIMPLEMENTED;
+
+ eti = ethernet_get_type_info (em, ethertype);
+ if (!eti)
+ return VNET_API_ERROR_INVALID_VALUE;
+
+ if (eti->node_index != ~0 && eti->node_index != node->index)
+ return VNET_API_ERROR_INVALID_REGISTRATION;
+
+ ethernet_register_input_type (vm, ethertype, node->index);
+ return 0;
+}
+
+int
+lcp_ethertype_get_enabled (ethernet_type_t **ethertypes_vec)
+{
+ ethernet_main_t *em = &ethernet_main;
+ ethernet_type_info_t *eti;
+ vlib_main_t *vm = vlib_get_main ();
+ vlib_node_t *node = vlib_get_node_by_name (vm, (u8 *) "linux-cp-punt-xc");
+
+ if (!ethertypes_vec)
+ return VNET_API_ERROR_INVALID_ARGUMENT;
+
+ if (!node)
+ return VNET_API_ERROR_UNIMPLEMENTED;
+
+ vec_foreach (eti, em->type_infos)
+ {
+ if (eti->node_index == node->index)
+ {
+ vec_add1 (*ethertypes_vec, eti->type);
+ }
+ }
+
+ return 0;
+}
+
VNET_HW_INTERFACE_LINK_UP_DOWN_FUNCTION (lcp_itf_pair_link_up_down);
static clib_error_t *