From 552cab2ff17d4d430b24ce115cbf42ee51aee0f7 Mon Sep 17 00:00:00 2001 From: Alexey Odinokov Date: Wed, 14 Feb 2024 22:35:41 -0600 Subject: [PATCH] Make sure trust on command is applied to avoid race-condition with ovs-dpdk When i40e driver performs 'vf trust on' it actually resets the device. Intel recommends to check if the command actually finished by running 'ip link show' to avoid race-condition with too early start of openvswitch-dpdk which will use its own dpdk-based driver for VF and which will also try to reset the VF. Double reset of VF sometimes causes very strange behavior including completely non-functional VF interface.. Change-Id: I28c162a63f89b3cdfe857e00651572bbbaa36748 --- neutron/Chart.yaml | 2 +- .../_neutron-openvswitch-agent-init.sh.tpl | 21 +++++++++++++++++++ releasenotes/notes/neutron.yaml | 1 + 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/neutron/Chart.yaml b/neutron/Chart.yaml index 3e03de66e8..d1856408d2 100644 --- a/neutron/Chart.yaml +++ b/neutron/Chart.yaml @@ -14,7 +14,7 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Neutron name: neutron -version: 0.3.32 +version: 0.3.33 home: https://docs.openstack.org/neutron/latest/ icon: https://www.openstack.org/themes/openstack/images/project-mascots/Neutron/OpenStack_Project_Neutron_vertical.png sources: diff --git a/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl b/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl index 883b71a253..c7f13c104e 100644 --- a/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl +++ b/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl @@ -174,6 +174,21 @@ function bind_dpdk_nic { fi } +function ensure_vf_state { + iface=${1} + vf_string=${2} + check_string=${3} + expected=${4} + + # wait for the vf really get the needed state + for i in 0 1 2 4 8 16 32; do + sleep ${i}; + if [ "$(ip link show ${iface} | grep "${vf_string} " | grep -Eo "${check_string}")" == "${expected}" ]; then + break; + fi; + done +} + function process_dpdk_nics { target_driver=$(get_dpdk_config_value ${DPDK_CONFIG} '.driver') # loop over all nics @@ -195,11 +210,14 @@ function process_dpdk_nics { if [ -n "${vf_index}" ]; then vf_string="vf ${vf_index}" ip link set ${iface} ${vf_string} trust on + ensure_vf_state "${iface}" "${vf_string}" "trust o(n|ff)" "trust on" # NOTE: To ensure proper toggle of spoofchk, # turn it on then off. ip link set ${iface} ${vf_string} spoofchk on + ensure_vf_state "${iface}" "${vf_string}" "spoof checking o(n|ff)" "spoof checking on" ip link set ${iface} ${vf_string} spoofchk off + ensure_vf_state "${iface}" "${vf_string}" "spoof checking o(n|ff)" "spoof checking off" fi fi @@ -291,11 +309,14 @@ function process_dpdk_bonds { if [ -n "${vf_index}" ]; then vf_string="vf ${vf_index}" ip link set ${iface} ${vf_string} trust on + ensure_vf_state "${iface}" "${vf_string}" "trust o(n|ff)" "trust on" # NOTE: To ensure proper toggle of spoofchk, # turn it on then off. ip link set ${iface} ${vf_string} spoofchk on + ensure_vf_state "${iface}" "${vf_string}" "spoof checking o(n|ff)" "spoof checking on" ip link set ${iface} ${vf_string} spoofchk off + ensure_vf_state "${iface}" "${vf_string}" "spoof checking o(n|ff)" "spoof checking off" fi fi diff --git a/releasenotes/notes/neutron.yaml b/releasenotes/notes/neutron.yaml index df0eb1a73c..6af0b50b23 100644 --- a/releasenotes/notes/neutron.yaml +++ b/releasenotes/notes/neutron.yaml @@ -74,4 +74,5 @@ neutron: - 0.3.30 Fix designate auth url - 0.3.31 FIX ovn-metadata-agent mountPropagation overrides by parent directory - 0.3.32 Update dpdk override + - 0.3.33 Make sure trust on command is applied to avoid race-condition with ovs-dpdk ...