summaryrefslogtreecommitdiffstats
path: root/src/plugins/avf
diff options
context:
space:
mode:
authorJohn Lo <loj@cisco.com>2020-05-12 22:34:39 -0400
committerDamjan Marion <dmarion@me.com>2020-05-27 17:27:27 +0000
commit4a302ee7c75f3d4fd1a73a9d1f6c34b3bde8d620 (patch)
tree46afc10a5fb0edc511b18ab8cac176458a9e59c0 /src/plugins/avf
parent94f3295d3807ccadbadbc863640af4fc4c224d7f (diff)
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 <loj@cisco.com> Change-Id: I204d90459c13e9e486cfcba4e64e3d479bc9f2ae
Diffstat (limited to 'src/plugins/avf')
-rw-r--r--src/plugins/avf/device.c43
1 files changed, 27 insertions, 16 deletions
diff --git a/src/plugins/avf/device.c b/src/plugins/avf/device.c
index 8d44bd0422a..f086cd67741 100644
--- a/src/plugins/avf/device.c
+++ b/src/plugins/avf/device.c
@@ -1158,25 +1158,29 @@ avf_flag_change (vnet_main_t * vnm, vnet_hw_interface_t * hw, u32 flags)
vlib_main_t *vm = vlib_get_main ();
avf_main_t *am = &avf_main;
avf_device_t *ad = vec_elt_at_index (am->devices, hw->dev_instance);
- if (ETHERNET_INTERFACE_FLAG_CONFIG_PROMISC (flags))
- {
- clib_error_t *error;
- int promisc_enabled = (flags & ETHERNET_INTERFACE_FLAG_ACCEPT_ALL) != 0;
- u32 new_flags = promisc_enabled ?
- ad->flags | AVF_DEVICE_F_PROMISC : ad->flags & ~AVF_DEVICE_F_PROMISC;
-
- if (new_flags == ad->flags)
- return flags;
+ clib_error_t *error;
+ u8 promisc_enabled;
- if ((error = avf_config_promisc_mode (vm, ad, promisc_enabled)))
- {
- avf_log_err (ad, "%s: %U", format_clib_error, error);
- clib_error_free (error);
- return 0;
- }
+ switch (flags)
+ {
+ case ETHERNET_INTERFACE_FLAG_DEFAULT_L3:
+ ad->flags &= ~AVF_DEVICE_F_PROMISC;
+ break;
+ case ETHERNET_INTERFACE_FLAG_ACCEPT_ALL:
+ ad->flags |= AVF_DEVICE_F_PROMISC;
+ break;
+ default:
+ return ~0;
+ }
- ad->flags = new_flags;
+ promisc_enabled = ((ad->flags & AVF_DEVICE_F_PROMISC) != 0);
+ if ((error = avf_config_promisc_mode (vm, ad, promisc_enabled)))
+ {
+ avf_log_err (ad, "%s: %U", format_clib_error, error);
+ clib_error_free (error);
+ return ~0;
}
+
return 0;
}
@@ -1501,6 +1505,13 @@ avf_create_if (vlib_main_t * vm, avf_create_if_args_t * args)
if (error)
goto error;
+ /* Indicate ability to support L3 DMAC filtering and
+ * initialize interface to L3 non-promisc mode */
+ vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, ad->hw_if_index);
+ hi->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_MAC_FILTER;
+ ethernet_set_flags (vnm, ad->hw_if_index,
+ ETHERNET_INTERFACE_FLAG_DEFAULT_L3);
+
vnet_sw_interface_t *sw = vnet_get_hw_sw_interface (vnm, ad->hw_if_index);
args->sw_if_index = ad->sw_if_index = sw->sw_if_index;