aboutsummaryrefslogtreecommitdiffstats
path: root/extras/vpp_config/vpplib
diff options
context:
space:
mode:
Diffstat (limited to 'extras/vpp_config/vpplib')
-rw-r--r--extras/vpp_config/vpplib/AutoConfig.py64
-rw-r--r--extras/vpp_config/vpplib/VPPUtil.py32
-rw-r--r--extras/vpp_config/vpplib/VppPCIUtil.py8
3 files changed, 65 insertions, 39 deletions
diff --git a/extras/vpp_config/vpplib/AutoConfig.py b/extras/vpp_config/vpplib/AutoConfig.py
index c36cdd5accc..2664a6aa7c4 100644
--- a/extras/vpp_config/vpplib/AutoConfig.py
+++ b/extras/vpp_config/vpplib/AutoConfig.py
@@ -1048,10 +1048,11 @@ class AutoConfig(object):
if answer == 'y':
if 'unused' in device and len(device['unused']) != 0 and device['unused'][0] != '':
driver = device['unused'][0]
- VppPCIUtil.bind_vpp_device(node, driver, dvid)
- else:
- logging.debug('Could not bind device {}'.format(dvid))
- vppd[dvid] = device
+ ret = VppPCIUtil.bind_vpp_device(node, driver, dvid)
+ if ret:
+ logging.debug('Could not bind device {}'.format(dvid))
+ else:
+ vppd[dvid] = device
for dit in vppd.items():
dvid = dit[0]
device = dit[1]
@@ -1081,11 +1082,12 @@ class AutoConfig(object):
if 'unused' in device and len(device['unused']) != 0 and device['unused'][0] != '':
driver = device['unused'][0]
logging.debug('Binding device {} to driver {}'.format(dvid, driver))
- VppPCIUtil.bind_vpp_device(node, driver, dvid)
- else:
- logging.debug('Could not bind device {}'.format(dvid))
- dpdk_devices[dvid] = device
- del other_devices[dvid]
+ ret = VppPCIUtil.bind_vpp_device(node, driver, dvid)
+ if ret:
+ logging.debug('Could not bind device {}'.format(dvid))
+ else:
+ dpdk_devices[dvid] = device
+ del other_devices[dvid]
def update_interfaces_config(self):
"""
@@ -1162,11 +1164,12 @@ class AutoConfig(object):
if 'unused' in device and len(device['unused']) != 0 and device['unused'][0] != '':
driver = device['unused'][0]
logging.debug('Binding device {} to driver {}'.format(dvid, driver))
- VppPCIUtil.bind_vpp_device(node, driver, dvid)
- else:
- logging.debug('Could not bind device {}'.format(dvid))
- dpdk_devices[dvid] = device
- del kernel_devices[dvid]
+ ret = VppPCIUtil.bind_vpp_device(node, driver, dvid)
+ if ret:
+ logging.debug('Could not bind device {}'.format(dvid))
+ else:
+ dpdk_devices[dvid] = device
+ del kernel_devices[dvid]
dlen = len(dpdk_devices)
if dlen > 0:
@@ -1191,11 +1194,12 @@ class AutoConfig(object):
if 'unused' in device and len(device['unused']) != 0 and device['unused'][0] != '':
driver = device['unused'][0]
logging.debug('Binding device {} to driver {}'.format(dvid, driver))
- VppPCIUtil.bind_vpp_device(node, driver, dvid)
- else:
- logging.debug('Could not bind device {}'.format(dvid))
- kernel_devices[dvid] = device
- del dpdk_devices[dvid]
+ ret = VppPCIUtil.bind_vpp_device(node, driver, dvid)
+ if ret:
+ logging.debug('Could not bind device {}'.format(dvid))
+ else:
+ kernel_devices[dvid] = device
+ del dpdk_devices[dvid]
interfaces = {}
for dit in dpdk_devices.items():
@@ -1386,6 +1390,14 @@ class AutoConfig(object):
else:
print ("\nNo devices bound to DPDK drivers")
+ other_devs = vpp.get_other_devices()
+ if len(other_devs):
+ print ("\nDevices not bound to Kernel or DPDK drivers:")
+ vpp.show_vpp_devices(other_devs, show_interfaces=True,
+ show_header=False)
+ else:
+ print ("\nNo devices not bound to Kernel or DPDK drivers")
+
vpputl = VPPUtil()
interfaces = vpputl.get_hardware(node)
if interfaces == {}:
@@ -1397,17 +1409,17 @@ class AutoConfig(object):
print ("None")
return
- print "{:30} {:6} {:4} {:7} {:4} {:7}". \
- format('Name', 'Socket', 'RXQs',
+ print "{:30} {:4} {:4} {:7} {:4} {:7}". \
+ format('Name', 'Numa', 'RXQs',
'RXDescs', 'TXQs', 'TXDescs')
for intf in sorted(interfaces.items()):
name = intf[0]
value = intf[1]
if name == 'local0':
continue
- socket = rx_qs = rx_ds = tx_qs = tx_ds = ''
- if 'cpu socket' in value:
- socket = int(value['cpu socket'])
+ numa = rx_qs = rx_ds = tx_qs = tx_ds = ''
+ if 'numa' in value:
+ numa = int(value['numa'])
if 'rx queues' in value:
rx_qs = int(value['rx queues'])
if 'rx descs' in value:
@@ -1417,8 +1429,8 @@ class AutoConfig(object):
if 'tx descs' in value:
tx_ds = int(value['tx descs'])
- print ("{:30} {:>6} {:>4} {:>7} {:>4} {:>7}".
- format(name, socket, rx_qs, rx_ds, tx_qs, tx_ds))
+ print ("{:30} {:>4} {:>4} {:>7} {:>4} {:>7}".
+ format(name, numa, rx_qs, rx_ds, tx_qs, tx_ds))
@staticmethod
def hugepage_info(node):
diff --git a/extras/vpp_config/vpplib/VPPUtil.py b/extras/vpp_config/vpplib/VPPUtil.py
index 336097d6e0a..89e2d74fc5d 100644
--- a/extras/vpp_config/vpplib/VPPUtil.py
+++ b/extras/vpp_config/vpplib/VPPUtil.py
@@ -138,7 +138,9 @@ class VPPUtil(object):
# When using release
reps += 'release/ubuntu {} main ./\n'.format(ubuntu_version)
# When using master
- # reps += 'master/ubuntu {} main/ ./\n'.format(ubuntu_version)
+ # reps += 'master/ubuntu {} main ./\n'.format(ubuntu_version)
+ # When using 1807
+ # reps += '1807/ubuntu {} main ./\n'.format(ubuntu_version)
with open(sfile, 'w') as sfd:
sfd.write(reps)
@@ -146,8 +148,8 @@ class VPPUtil(object):
# Add the key
key = requests.get('https://packagecloud.io/fdio/{}/gpgkey'.format('release'))
- # cmd = 'curl -L https://packagecloud.io/fdio/{}/gpgkey | apt-key add -'.format(fdio_release)
- # cmd = 'curl -L https://packagecloud.io/fdio/{}/gpgkey | apt-key add -'.format('mastert')
+ # key = requests.get('https://packagecloud.io/fdio/{}/gpgkey'.format('master'))
+ # key = requests.get('https://packagecloud.io/fdio/{}/gpgkey'.format('1807'))
cmd = 'echo "{}" | apt-key add -'.format(key.content)
(ret, stdout, stderr) = self.exec_command(cmd)
if ret != 0:
@@ -541,19 +543,25 @@ class VPPUtil(object):
interfaces[name]['carrier'] = spl[1]
# Socket
- rfall = re.findall(r'cpu socket', line)
+ rfall = re.findall(r'numa \d+', line)
if rfall:
- spl = line.split('cpu socket ')
- interfaces[name]['cpu socket'] = spl[1]
+ spl = rfall[0].split()
+ interfaces[name]['numa'] = rfall[0].split()[1]
# Queues and Descriptors
- rfall = re.findall(r'rx queues', line)
+ rfall = re.findall(r'rx\: queues \d+', line)
if rfall:
- spl = line.split(',')
- interfaces[name]['rx queues'] = spl[0].lstrip(' ').split(' ')[2]
- interfaces[name]['rx descs'] = spl[1].split(' ')[3]
- interfaces[name]['tx queues'] = spl[2].split(' ')[3]
- interfaces[name]['tx descs'] = spl[3].split(' ')[3]
+ interfaces[name]['rx queues'] = rfall[0].split()[2]
+ rdesc = re.findall(r'desc \d+', line)
+ if rdesc:
+ interfaces[name]['rx descs'] = rdesc[0].split()[1]
+
+ rfall = re.findall(r'tx\: queues \d+', line)
+ if rfall:
+ interfaces[name]['tx queues'] = rfall[0].split()[2]
+ rdesc = re.findall(r'desc \d+', line)
+ if rdesc:
+ interfaces[name]['tx descs'] = rdesc[0].split()[1]
return interfaces
diff --git a/extras/vpp_config/vpplib/VppPCIUtil.py b/extras/vpp_config/vpplib/VppPCIUtil.py
index 591dfab96cd..fe64c9d4b14 100644
--- a/extras/vpp_config/vpplib/VppPCIUtil.py
+++ b/extras/vpp_config/vpplib/VppPCIUtil.py
@@ -14,6 +14,7 @@
"""VPP PCI Utility libraries"""
import re
+import logging
from vpplib.VPPUtil import VPPUtil
@@ -318,6 +319,7 @@ class VppPCIUtil(object):
:type node: dict
:type driver: string
:type device_id: string
+ :returns ret: Command return code
"""
rootdir = node['rootdir']
@@ -325,5 +327,9 @@ class VppPCIUtil(object):
cmd = dpdk_script + ' -b ' + driver + ' ' + device_id
(ret, stdout, stderr) = VPPUtil.exec_command(cmd)
if ret != 0:
- raise RuntimeError('{} failed on node {} {} {}'.format(
+ logging.error('{} failed on node {}'.format(
cmd, node['host'], stdout, stderr))
+ logging.error('{} {}'.format(
+ stdout, stderr))
+
+ return ret