aboutsummaryrefslogtreecommitdiffstats
path: root/resources
diff options
context:
space:
mode:
authorpmikus <pmikus@cisco.com>2016-05-04 07:40:18 +0200
committerMatej Klotton <mklotton@cisco.com>2016-05-11 05:59:03 +0000
commit807afe3f73ef9f6170e72f922338d0a726028ec6 (patch)
tree0b98556f80f4e60e70dd132b5e325b4e54aa4100 /resources
parent395ed47437010c9852d9d620f491f660a085dbfd (diff)
Add Max TX Queues configuration to VppConfigGenerator
- Add ability to configure max-tx-queus parameter in VPP startup configuration Change-Id: Iaf857ed037c934fbda46eda6bfe1be4ef7faba15 Signed-off-by: pmikus <pmikus@cisco.com>
Diffstat (limited to 'resources')
-rw-r--r--resources/libraries/python/VppConfigGenerator.py45
1 files changed, 44 insertions, 1 deletions
diff --git a/resources/libraries/python/VppConfigGenerator.py b/resources/libraries/python/VppConfigGenerator.py
index 53ae6ac8cc..a9c7618c92 100644
--- a/resources/libraries/python/VppConfigGenerator.py
+++ b/resources/libraries/python/VppConfigGenerator.py
@@ -52,6 +52,7 @@ cpu {{
dpdk {{
socket-mem {socketmemconfig}
+{txqueuesconfig}
{pciconfig}
{rssconfig}
}}
@@ -182,6 +183,27 @@ class VppConfigGenerator(object):
logger.debug('Setting hostname {} RSS config to {}'.\
format(hostname, rss_config))
+ def add_max_tx_queues_config(self, node, max_tx_queues_config):
+ """Add Max TX Queues configuration for node.
+
+ :param node: DUT node.
+ :param max_tx_queues_config: Max TX Queues configuration, as a string.
+ :type node: dict
+ :type max_tx_queues_config: str
+ :return: nothing
+ """
+ if node['type'] != NodeType.DUT:
+ raise ValueError('Node type is not a DUT')
+ hostname = Topology.get_node_hostname(node)
+ if not hostname in self._nodeconfig:
+ self._nodeconfig[hostname] = {}
+ if not 'max_tx_queues_config' in self._nodeconfig[hostname]:
+ self._nodeconfig[hostname]['max_tx_queues_config'] = []
+ self._nodeconfig[hostname]['max_tx_queues_config'].append(
+ max_tx_queues_config)
+ logger.debug('Setting hostname {} max_tx_queues config to {}'.\
+ format(hostname, max_tx_queues_config))
+
def remove_all_pci_devices(self, node):
"""Remove PCI device configuration from node.
@@ -257,6 +279,21 @@ class VppConfigGenerator(object):
logger.debug('Clearing RSS config for hostname {}.'.\
format(hostname))
+ def remove_max_tx_queues_config(self, node):
+ """Remove Max TX Queues configuration from node.
+
+ :param node: DUT node.
+ :type node: dict
+ :return: nothing
+ """
+ if node['type'] != NodeType.DUT:
+ raise ValueError('Node type is not a DUT')
+ hostname = Topology.get_node_hostname(node)
+ if hostname in self._nodeconfig:
+ self._nodeconfig[hostname]['max_tx_queues_config'] = []
+ logger.debug('Clearing Max TX Queues config for hostname {}.'.\
+ format(hostname))
+
def apply_config(self, node, waittime=5, retries=12):
"""Generate and apply VPP configuration for node.
@@ -280,6 +317,7 @@ class VppConfigGenerator(object):
socketmemconfig = DEFAULT_SOCKETMEM_CONFIG
heapsizeconfig = ""
rssconfig = ""
+ txqueuesconfig = ""
if hostname in self._nodeconfig:
cfg = self._nodeconfig[hostname]
@@ -299,11 +337,16 @@ class VppConfigGenerator(object):
if 'rss_config' in cfg:
rssconfig = " " + "\n ".join(cfg['rss_config'])
+ if 'max_tx_queues_config' in cfg:
+ txqueuesconfig = " " + "\n ".join(
+ cfg['max_tx_queues_config'])
+
vppconfig = VPP_CONFIG_TEMPLATE.format(cpuconfig=cpuconfig,
pciconfig=pciconfig,
socketmemconfig=socketmemconfig,
heapsizeconfig=heapsizeconfig,
- rssconfig=rssconfig)
+ rssconfig=rssconfig,
+ txqueuesconfig=txqueuesconfig)
logger.debug('Writing VPP config to host {}: "{}"'.format(hostname,
vppconfig))