From 8ff25e725e148acf83ef6e1f6a3c445da00e3932 Mon Sep 17 00:00:00 2001 From: Moshe Levi Date: Mon, 4 Jan 2016 11:14:58 +0200 Subject: [PATCH] hardware offload support for openvswitch In Kernel 4.8 we introduced Traffic Control (TC see [1]) hardware offloads framework for SR-IOV VFs which allows us to configure the NIC [2]. Subsequent OVS patches [3] allow us to use the TC framework to offload OVS datapath rules. This patch allow OVS mech driver to bind direct (SR-IOV) port. This will allow to offload the OVS flows using tc to the SR-IOV NIC and gain accelerate OVS. [1] https://linux.die.net/man/8/tc [2] http://netdevconf.org/1.2/papers/efraim-gerlitz-sriov-ovs-final.pdf [3] https://mail.openvswitch.org/pipermail/ovs-dev/2017-April/330606.html DocImpact: Add SR-IOV offload support for OVS mech driver Partial-Bug: #1627987 Depends-On: I6bc2539a1ddbf7990164abeb8bb951ddcb45c993 Change-Id: I77650be5f04775a72e2bdf694f93988825a84b72 --- .../openvswitch/mech_driver/mech_openvswitch.py | 8 +++++++- .../mech_driver/test_mech_openvswitch.py | 13 +++++++++++++ ...s_hardware_offload_support-798d3896ab2c4b1d.yaml | 7 +++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/ovs_hardware_offload_support-798d3896ab2c4b1d.yaml diff --git a/neutron/plugins/ml2/drivers/openvswitch/mech_driver/mech_openvswitch.py b/neutron/plugins/ml2/drivers/openvswitch/mech_driver/mech_openvswitch.py index 30ef4c8e882..afacb7da7e1 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/mech_driver/mech_openvswitch.py +++ b/neutron/plugins/ml2/drivers/openvswitch/mech_driver/mech_openvswitch.py @@ -50,10 +50,16 @@ class OpenvswitchMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase): IPTABLES_FW_DRIVER_FULL, 'iptables_hybrid')) and sg_enabled vif_details = {portbindings.CAP_PORT_FILTER: sg_enabled, portbindings.OVS_HYBRID_PLUG: hybrid_plug_required} + # NOTE(moshele): Bind DIRECT (SR-IOV) port allows + # to offload the OVS flows using tc to the SR-IOV NIC. + # We are using OVS mechanism driver because the openvswitch (>=2.8.0) + # support hardware offload via tc and that allow us to manage the VF by + # OpenFlow control plane using representor net-device. super(OpenvswitchMechanismDriver, self).__init__( constants.AGENT_TYPE_OVS, portbindings.VIF_TYPE_OVS, - vif_details) + vif_details, supported_vnic_types=[portbindings.VNIC_NORMAL, + portbindings.VNIC_DIRECT]) ovs_qos_driver.register() def get_allowed_network_types(self, agent): diff --git a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/mech_driver/test_mech_openvswitch.py b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/mech_driver/test_mech_openvswitch.py index ff22690252e..9e21316b938 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/mech_driver/test_mech_openvswitch.py +++ b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/mech_driver/test_mech_openvswitch.py @@ -236,3 +236,16 @@ class OpenvswitchMechanismDPDKTestCase(OpenvswitchMechanismBaseTestCase): result = self.driver.get_vif_type(None, self.AGENT_SYSTEM, None) self.assertEqual(portbindings.VIF_TYPE_OVS, result) + + +class OpenvswitchMechanismSRIOVTestCase(OpenvswitchMechanismBaseTestCase): + + def _make_port_ctx(self, agents): + segments = [{api.ID: 'local_segment_id', api.NETWORK_TYPE: 'local'}] + return base.FakePortContext(self.AGENT_TYPE, agents, segments, + vnic_type=portbindings.VNIC_DIRECT) + + def test_get_vif_type(self): + context = self._make_port_ctx(self.AGENTS) + result = self.driver.get_vif_type(context, self.AGENTS[0], None) + self.assertEqual(self.VIF_TYPE, result) diff --git a/releasenotes/notes/ovs_hardware_offload_support-798d3896ab2c4b1d.yaml b/releasenotes/notes/ovs_hardware_offload_support-798d3896ab2c4b1d.yaml new file mode 100644 index 00000000000..287afb22f9c --- /dev/null +++ b/releasenotes/notes/ovs_hardware_offload_support-798d3896ab2c4b1d.yaml @@ -0,0 +1,7 @@ +--- +prelude: > + The ``openvswitch`` mechanism driver now supports hardware offload via SR-IOV. +features: + - The ``openvswitch`` mechanism driver now allows binding direct (SR-IOV) ports. + Using ``openvswitch`` 2.8.0 and 'Linux Kernel' 4.8 allows to control the SR-IOV VF + via OpenFlow control plane and gain accelerated 'Open vSwitch'. \ No newline at end of file