summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2017-03-10 16:05:16 +0200
committerYaroslav Brustinov <ybrustin@cisco.com>2017-03-10 16:05:16 +0200
commit129a116bd9af059fcb9029881f6bdce457c00577 (patch)
treef24e36bad3287f131c278b77b051847b6d27f1ed /scripts
parent94a7c25c5f788df6e3577679e0f37a67a298ceae (diff)
dpdk_setup_ports: fix path if missing, and check of uio is loaded at first try of igb_uio
Change-Id: I9b4ddaaf2294a2fb3025bcf7caf65fecb0898f83 Signed-off-by: Yaroslav Brustinov <ybrustin@cisco.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/dpdk_setup_ports.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/scripts/dpdk_setup_ports.py b/scripts/dpdk_setup_ports.py
index 3ec77fbf..cea81e47 100755
--- a/scripts/dpdk_setup_ports.py
+++ b/scripts/dpdk_setup_ports.py
@@ -26,6 +26,12 @@ MLX_EXIT_CODE = 32
class VFIOBindErr(Exception): pass
+PATH_ARR = os.getenv('PATH', '').split(':')
+for path in ['/usr/local/sbin', '/usr/sbin', '/sbin']:
+ if path not in PATH_ARR:
+ PATH_ARR.append(path)
+os.environ['PATH'] = ':'.join(PATH_ARR)
+
class ConfigCreator(object):
mandatory_interface_fields = ['Slot_str', 'Device_str', 'NUMA']
_2hex_re = '[\da-fA-F]{2}'
@@ -249,8 +255,13 @@ class ConfigCreator(object):
# only load igb_uio if it's available
def load_igb_uio():
- if 'igb_uio' in dpdk_nic_bind.get_loaded_modules():
+ loaded_mods = dpdk_nic_bind.get_loaded_modules()
+ if 'igb_uio' in loaded_mods:
return True
+ if 'uio' not in loaded_mods:
+ ret = os.system('modprobe uio')
+ if ret:
+ return False
km = './ko/%s/igb_uio.ko' % dpdk_nic_bind.kernel_ver
if os.path.exists(km):
return os.system('insmod %s' % km) == 0
@@ -261,8 +272,8 @@ def compile_and_load_igb_uio():
if 'igb_uio' in loaded_mods:
return
if 'uio' not in loaded_mods:
- res = os.system('modprobe uio')
- if res:
+ ret = os.system('modprobe uio')
+ if ret:
print('Failed inserting uio module, please check if it is installed')
sys.exit(-1)
km = './ko/%s/igb_uio.ko' % dpdk_nic_bind.kernel_ver
@@ -289,8 +300,8 @@ def compile_and_load_igb_uio():
print(' sudo apt install linux-headers-`uname -r`')
print(' sudo apt install build-essential')
sys.exit(-1)
- res = os.system('insmod %s' % km)
- if res:
+ ret = os.system('insmod %s' % km)
+ if ret:
print('Failed inserting igb_uio module')
sys.exit(-1)