Interface profile support for VF rate limiting configuration

This feature is part of 'Single NIC support'.
This commit eanbles interface profile creation and apply of
interface configuration which includes VF max-tx-rate config.

Story: 2008470
Task: 41683

Depends-On: https://review.opendev.org/c/starlingx/config/+/770135
Signed-off-by: Litao Gao <litao.gao@windriver.com>
Change-Id: Ib8a8a1844d5a151c15454f446129642ed4f4dfe8
This commit is contained in:
Litao Gao 2021-01-25 03:46:08 -05:00 committed by Don Penney
parent 69664edc58
commit b40f98b57e
3 changed files with 8 additions and 1 deletions

View File

@ -163,6 +163,7 @@
</xs:sequence>
<xs:attribute name="virtualFunctions" type="xs:nonNegativeInteger" use="required" />
<xs:attribute name="virtualFunctionDriver" type="xs:string" />
<xs:attribute name="maxTxRate" type="xs:nonNegativeInteger" />
</xs:complexType>
<xs:complexType name="route">

View File

@ -79,7 +79,7 @@ INTERFACE_PROFILE_FIELDS = ['ifname', 'iftype', 'imtu', 'networktype',
'txhashpolicy', 'forihostid', 'datanetworks',
'vlan_id', 'ipv4_mode', 'ipv6_mode',
'ipv4_pool', 'ipv6_pool',
'sriov_numvfs', 'sriov_vf_driver']
'sriov_numvfs', 'sriov_vf_driver', 'max_tx_rate']
class Profile(base.APIBase):
@ -1355,6 +1355,7 @@ def _create_if_profile(profile_name, profile_node):
'ipv6_pool': ipv6_mode['pool'],
'sriov_numvfs': ethIf.virtualFunctions,
'sriov_vf_driver': ethIf.virtualFunctionDriver,
'max_tx_rate': ethIf.maxTxRate,
'interface_profile': True
}
newIf = interface_api._create(idict, from_profile=True)
@ -1397,6 +1398,7 @@ def _create_if_profile(profile_name, profile_node):
'imtu': aeIf.mtu,
'sriov_numvfs': ethIf.virtualFunctions,
'sriov_vf_driver': ethIf.virtualFunctionDriver,
'max_tx_rate': ethIf.maxTxRate,
'interface_profile': True
}
@ -1425,6 +1427,7 @@ def _create_if_profile(profile_name, profile_node):
'imtu': vlanIf.mtu,
'sriov_numvfs': ethIf.virtualFunctions,
'sriov_vf_driver': ethIf.virtualFunctionDriver,
'max_tx_rate': ethIf.maxTxRate,
'interface_profile': True
}

View File

@ -136,6 +136,7 @@ class PciSriov(Network):
super(PciSriov, self).__init__(node, constants.NETWORK_TYPE_PCI_SRIOV)
self.virtualFunctions = int(node.get('virtualFunctions'))
self.virtualFunctionDriver = node.get('virtualFunctionDriver')
self.maxTxRate = node.get('maxTxRate')
class Interface(object):
@ -150,6 +151,7 @@ class Interface(object):
self.routes = []
self.virtualFunctions = 0
self.virtualFunctionDriver = None
self.maxTxRate = None
networksNode = ifNode.find('networks')
if networksNode is not None:
for netNode in networksNode:
@ -171,6 +173,7 @@ class Interface(object):
elif network.networkType == constants.NETWORK_TYPE_PCI_SRIOV:
self.virtualFunctions = network.virtualFunctions
self.virtualFunctionDriver = network.virtualFunctionDriver
self.maxTxRate = network.maxTxRate
if isinstance(network, Network):
self.providerNetworks = network.providerNetworks