diff --git a/doc/source/contributor/internals/quality_of_service.rst b/doc/source/contributor/internals/quality_of_service.rst index 4b494dbbd97..889ad8cc869 100644 --- a/doc/source/contributor/internals/quality_of_service.rst +++ b/doc/source/contributor/internals/quality_of_service.rst @@ -363,6 +363,11 @@ integration bridge functions: The DSCP markings are in fact configured on the port by means of openflow rules. +.. note:: + As of Ussuri release, the QoS rules can be applied for direct ports with hardware + offload capability (switchdev), this requires Open vSwitch version 2.11.0 or newer + and Linux kernel based on kernel 5.4.0 or newer. + SR-IOV ++++++ diff --git a/neutron/cmd/sanity/checks.py b/neutron/cmd/sanity/checks.py index cbb2cef7b5d..8ecdc73e195 100644 --- a/neutron/cmd/sanity/checks.py +++ b/neutron/cmd/sanity/checks.py @@ -23,6 +23,7 @@ from neutron_lib import exceptions from oslo_config import cfg from oslo_log import log as logging from oslo_utils import uuidutils +from oslo_utils import versionutils from neutron.agent.common import ovs_lib from neutron.agent.l3 import ha_router @@ -42,6 +43,7 @@ LOG = logging.getLogger(__name__) MINIMUM_DNSMASQ_VERSION = 2.67 DNSMASQ_VERSION_DHCP_RELEASE6 = 2.76 +DIRECT_PORT_QOS_MIN_OVS_VERSION = '2.11' MINIMUM_DIBBLER_VERSION = '1.0.1' CONNTRACK_GRE_MODULE = 'nf_conntrack_proto_gre' @@ -199,6 +201,10 @@ def get_dnsmasq_version_with_dhcp_release6(): return DNSMASQ_VERSION_DHCP_RELEASE6 +def get_ovs_version_for_qos_direct_port_support(): + return DIRECT_PORT_QOS_MIN_OVS_VERSION + + def dnsmasq_local_service_supported(): cmd = ['dnsmasq', '--test', '--local-service'] env = {'LC_ALL': 'C'} @@ -230,6 +236,26 @@ def dnsmasq_version_supported(): return True +def ovs_qos_direct_port_supported(): + try: + cmd = ['ovs-vsctl', '-V'] + out = agent_utils.execute(cmd) + matched_line = re.search(r"ovs-vsctl.*", out) + matched_version = re.search(r"(\d+\.\d+)", matched_line.group(0)) + ver = versionutils.convert_version_to_tuple(matched_version.group(1) if + matched_version else '0.0') + minver = versionutils.convert_version_to_tuple( + DIRECT_PORT_QOS_MIN_OVS_VERSION) + if ver < minver: + return False + except (OSError, RuntimeError, ValueError) as e: + LOG.debug("Exception while checking minimal ovs version " + "required for supporting direct ports QoS rules. " + "Exception: %s", e) + return False + return True + + def dhcp_release6_supported(): return runtime_checks.dhcp_release6_supported() diff --git a/neutron/cmd/sanity_check.py b/neutron/cmd/sanity_check.py index 3bd6fed5586..b19a435b7bf 100644 --- a/neutron/cmd/sanity_check.py +++ b/neutron/cmd/sanity_check.py @@ -118,6 +118,16 @@ def check_dnsmasq_version(): return result +def check_ovs_qos_direct_ports_supported(): + result = checks.ovs_qos_direct_port_supported() + if not result: + LOG.error('The installed version of OVS does not support ' + 'QoS rules for direct ports. ' + 'Please update to version %s or newer.', + checks.get_ovs_version_for_qos_direct_port_support()) + return result + + def check_dnsmasq_local_service_supported(): result = checks.dnsmasq_local_service_supported() if not result: @@ -324,6 +334,9 @@ OPTS = [ BoolOptCallback('dnsmasq_local_service_supported', check_dnsmasq_local_service_supported, help=_('Check for local-service support in dnsmasq')), + BoolOptCallback('ovs_qos_direct_port_supported', + check_ovs_qos_direct_ports_supported, + help=_('Check if the ovs supports QoS for direct ports')), BoolOptCallback('dnsmasq_version', check_dnsmasq_version, help=_('Check minimal dnsmasq version'), deprecated_for_removal=True, diff --git a/neutron/services/qos/drivers/openvswitch/driver.py b/neutron/services/qos/drivers/openvswitch/driver.py index e5cd39b3b36..d73a636c4c4 100644 --- a/neutron/services/qos/drivers/openvswitch/driver.py +++ b/neutron/services/qos/drivers/openvswitch/driver.py @@ -53,7 +53,7 @@ class OVSDriver(base.DriverBase): name='openvswitch', vif_types=[portbindings.VIF_TYPE_OVS, portbindings.VIF_TYPE_VHOST_USER], - vnic_types=[portbindings.VNIC_NORMAL], + vnic_types=[portbindings.VNIC_NORMAL, portbindings.VNIC_DIRECT], supported_rules=SUPPORTED_RULES, requires_rpc_notifications=True) diff --git a/releasenotes/notes/Add-support-for-direct-ports-with-QoS-in-OVS-48c78c156606e724.yaml b/releasenotes/notes/Add-support-for-direct-ports-with-QoS-in-OVS-48c78c156606e724.yaml new file mode 100644 index 00000000000..d42dd14c82c --- /dev/null +++ b/releasenotes/notes/Add-support-for-direct-ports-with-QoS-in-OVS-48c78c156606e724.yaml @@ -0,0 +1,7 @@ +--- +other: + - | + Added QoS support for direct ports in neutron. + The support requires Open vSwitch 2.11.0 or newer and is based on Linux kernel 5.4.0 or newer. + [`bug 1843165 `_]. +