Add support for VNIC type vDPA to ML2/OVS and ML2/OVN

This change adds VNIC type vDPA ("vdpa") to the list of
supported VNIC types for the OVS and OVN mech drivers.

Depends-On: https://review.opendev.org/#/c/760043/
Change-Id: If22aedc147f7e2256f8f8ad3bebb80b6bb2f6d3d
This commit is contained in:
Sean Mooney 2020-10-28 04:20:41 +00:00 committed by Slawek Kaplonski
parent a128ff6713
commit ae22fe4495
5 changed files with 49 additions and 3 deletions

View File

@ -75,7 +75,9 @@ class OpenvswitchMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
self.supported_vnic_types = self.prohibit_list_supported_vnic_types( self.supported_vnic_types = self.prohibit_list_supported_vnic_types(
vnic_types=[portbindings.VNIC_NORMAL, vnic_types=[portbindings.VNIC_NORMAL,
portbindings.VNIC_DIRECT, portbindings.VNIC_DIRECT,
portbindings.VNIC_SMARTNIC], portbindings.VNIC_SMARTNIC,
portbindings.VNIC_VHOST_VDPA,
],
prohibit_list=cfg.CONF.OVS_DRIVER.vnic_type_prohibit_list prohibit_list=cfg.CONF.OVS_DRIVER.vnic_type_prohibit_list
) )
LOG.info("%s's supported_vnic_types: %s", LOG.info("%s's supported_vnic_types: %s",
@ -121,6 +123,11 @@ class OpenvswitchMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
capabilities = [] capabilities = []
if profile: if profile:
capabilities = profile.get('capabilities', []) capabilities = profile.get('capabilities', [])
# TODO(sean-k-mooney): in the case of the Mellanox connectx6 dx and lx
# nics vhost-vdpa is only supported in switchdev mode but that is not
# strictly required by other vendors so we should ideally add a config
# value to control checking of switchdev support per host via the
# agent['configurations']
if (vnic_type == portbindings.VNIC_DIRECT and if (vnic_type == portbindings.VNIC_DIRECT and
'switchdev' not in capabilities): 'switchdev' not in capabilities):
LOG.debug("Refusing to bind due to unsupported vnic_type: %s with " LOG.debug("Refusing to bind due to unsupported vnic_type: %s with "

View File

@ -176,7 +176,9 @@ class OVNMechanismDriver(api.MechanismDriver):
self.supported_vnic_types = [portbindings.VNIC_NORMAL, self.supported_vnic_types = [portbindings.VNIC_NORMAL,
portbindings.VNIC_DIRECT, portbindings.VNIC_DIRECT,
portbindings.VNIC_DIRECT_PHYSICAL, portbindings.VNIC_DIRECT_PHYSICAL,
portbindings.VNIC_MACVTAP] portbindings.VNIC_MACVTAP,
portbindings.VNIC_VHOST_VDPA,
]
self.vif_details = { self.vif_details = {
portbindings.VIF_TYPE_OVS: { portbindings.VIF_TYPE_OVS: {
portbindings.CAP_PORT_FILTER: self.sg_enabled portbindings.CAP_PORT_FILTER: self.sg_enabled

View File

@ -332,7 +332,9 @@ class OpenvswitchMechVnicTypesTestCase(OpenvswitchMechanismBaseTestCase):
supported_vnics = [portbindings.VNIC_NORMAL, supported_vnics = [portbindings.VNIC_NORMAL,
portbindings.VNIC_DIRECT, portbindings.VNIC_DIRECT,
portbindings.VNIC_SMARTNIC] portbindings.VNIC_SMARTNIC,
portbindings.VNIC_VHOST_VDPA,
]
def setUp(self): def setUp(self):
self.prohibit_list_cfg = { self.prohibit_list_cfg = {

View File

@ -1132,6 +1132,27 @@ class TestOVNMechanismDriver(test_plugin.Ml2PluginV2TestCase):
portbindings.VIF_TYPE_OVS, portbindings.VIF_TYPE_OVS,
self.mech_driver.vif_details[portbindings.VIF_TYPE_OVS]) self.mech_driver.vif_details[portbindings.VIF_TYPE_OVS])
def test_bind_port_vdpa(self):
segment_attrs = {'network_type': 'geneve',
'physical_network': None,
'segmentation_id': 1023}
fake_segments = \
[fakes.FakeSegment.create_one_segment(attrs=segment_attrs).info()]
fake_port = fakes.FakePort.create_one_port(
attrs={'binding:vnic_type': 'vdpa',
'binding:profile': {'pci_slot': "0000:04:00.0"}}).info()
fake_host = 'host'
fake_port_context = fakes.FakePortContext(
fake_port, fake_host, fake_segments)
self.mech_driver.bind_port(fake_port_context)
self.sb_ovn.get_chassis_data_for_ml2_bind_port.assert_called_once_with(
fake_host)
fake_port_context.set_binding.assert_called_once_with(
fake_segments[0]['id'],
portbindings.VIF_TYPE_OVS,
self.mech_driver.vif_details[portbindings.VIF_TYPE_OVS])
def test_bind_port_geneve(self): def test_bind_port_geneve(self):
segment_attrs = {'network_type': 'geneve', segment_attrs = {'network_type': 'geneve',
'physical_network': None, 'physical_network': None,

View File

@ -0,0 +1,14 @@
---
features:
- |
A new vnic type ``vdpa`` has been added to allow requesting port that
utilize a vHost-vDPA offload. The ML2/OVS and ML2/OVN mech drivers now
have support for the vHost-vDPA vnic type. vHost-vDPA is similar to
vHost-user or kernel vhost offload but utilizes the newly added vDPA bus
introduced in the Linux 5.7 kernel. vDPA interface can be implemented in
software or hardware, when implemented in hardware they provide equivalent
performance to SR-IOV or hardware offloaded OVS while providing two main
advantages over both SR-IOV and hardware offloaded OVS. Unlike the
alternatives, vHost-vDPA enables live migration of instance transparently
and provides a standard virtio-net interface to the guest avoiding the
need to install vendor specific drivers in the guest.