From 4a302ee7c75f3d4fd1a73a9d1f6c34b3bde8d620 Mon Sep 17 00:00:00 2001 From: John Lo Date: Tue, 12 May 2020 22:34:39 -0400 Subject: ethernet: fix DMAC check and skip unnecessary ones (VPP-1868) Fix and optimize DMAC check in ethernet-input node to utilize NIC or driver which support L3 DMAC-filtering mode so that DMAC check can be bypassed safely for interfaces/sub-interfaces in L3 mode. Checking of interface in L3-DMAC-filtering state to avoid DMAC check require the following: a) Fix interface driver init sequence for devices which supports L3 DMAC-filtering to indicate its capability and initialize interface to L3 DMAC-filtering state. b) Fix ethernet_set_flags() function and its associated callback flags_change() functions registered by various drivers in interface infra to provide proper L3 DMAC filtering status. Maintain interface/sub-interface L3 config count so DMAC checks can be bypassed if L3 forwarding is not setup on any main/sub-interfaces. Type: fix Ticket: VPP-1868 Signed-off-by: John Lo Change-Id: I204d90459c13e9e486cfcba4e64e3d479bc9f2ae --- src/vnet/mpls/interface.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/vnet/mpls') diff --git a/src/vnet/mpls/interface.c b/src/vnet/mpls/interface.c index 46d80f07a38..0742312aa2c 100644 --- a/src/vnet/mpls/interface.c +++ b/src/vnet/mpls/interface.c @@ -42,6 +42,8 @@ mpls_sw_interface_enable_disable (mpls_main_t * mm, u8 is_api) { fib_node_index_t lfib_index; + vnet_main_t *vnm = vnet_get_main (); + vnet_hw_interface_t *hi = vnet_get_sup_hw_interface (vnm, sw_if_index); vec_validate_init_empty (mm->mpls_enabled_by_sw_if_index, sw_if_index, 0); @@ -79,6 +81,11 @@ mpls_sw_interface_enable_disable (mpls_main_t * mm, vnet_feature_enable_disable ("mpls-input", "mpls-not-enabled", sw_if_index, !is_enable, 0, 0); + if (is_enable) + hi->l3_if_count++; + else if (hi->l3_if_count) + hi->l3_if_count--; + return (0); } -- cgit 1.2.3-korg