summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorIntel <intel.com>2013-06-03 00:00:00 +0000
committerThomas Monjalon <thomas.monjalon@6wind.com>2013-09-17 14:09:22 +0200
commita22f5ce8fccad93876997aee05564486de2823dc (patch)
tree410a2295db23f7a87b35de35b7f88dba4ed1b9ec /tools
parent0a45657a6794a1dbd0533ecc908367fc81684f1c (diff)
downloaddpdk-a22f5ce8fccad93876997aee05564486de2823dc.zip
dpdk-a22f5ce8fccad93876997aee05564486de2823dc.tar.gz
dpdk-a22f5ce8fccad93876997aee05564486de2823dc.tar.xz
pci: don't unbind resources on exit
unbind operations must be done before starting eal application Signed-off-by: Intel
Diffstat (limited to 'tools')
-rwxr-xr-xtools/pci_unbind.py15
-rwxr-xr-xtools/setup.sh67
2 files changed, 67 insertions, 15 deletions
diff --git a/tools/pci_unbind.py b/tools/pci_unbind.py
index fbc3140..1fbe12e 100755
--- a/tools/pci_unbind.py
+++ b/tools/pci_unbind.py
@@ -174,13 +174,20 @@ def check_modules():
sys.exit(1)
depmod_output = check_output(["depmod", "-n", modpath]).splitlines()
for line in depmod_output:
- if not line.startswith(mod):
+ if not line.startswith("alias"):
continue
- if line.endswith(mod+".ko:"):
+ if not line.endswith(mod):
continue
lineparts = line.split()
- module_dev_ids.append({"Vendor": int(lineparts[1],0),
- "Device": int(lineparts[2],0)})
+ if not(lineparts[1].startswith("pci:")):
+ continue;
+ else:
+ lineparts[1] = lineparts[1][4:]
+ vendor = lineparts[1][:9]
+ device = lineparts[1][9:18]
+ if vendor.startswith("v") and device.startswith("d"):
+ module_dev_ids.append({"Vendor": int(vendor[1:],16),
+ "Device": int(device[1:],16)})
def is_supported_device(dev_id):
'''return true if device is supported by igb_uio, false otherwise'''
diff --git a/tools/setup.sh b/tools/setup.sh
index 9326d84..a2c3806 100755
--- a/tools/setup.sh
+++ b/tools/setup.sh
@@ -325,11 +325,49 @@ grep_meminfo()
}
#
-# List all hugepage file references
+# Calls pci_unbind.py --status to show the NIC and what they
+# are all bound to, in terms of drivers.
#
-ls_mnt_huge()
+show_nics()
{
- ls -lh /mnt/huge
+ if /sbin/lsmod | grep -q igb_uio ; then
+ ${RTE_SDK}/tools/pci_unbind.py --status
+ else
+ echo "# Please load the 'igb_uio' kernel module before querying or "
+ echo "# adjusting NIC device bindings"
+ fi
+}
+
+#
+# Uses pci_unbind.py to move devices to work with igb_uio
+#
+bind_nics()
+{
+ if /sbin/lsmod | grep -q igb_uio ; then
+ ${RTE_SDK}/tools/pci_unbind.py --status
+ echo ""
+ echo -n "Enter PCI address of device to bind to IGB UIO driver: "
+ read PCI_PATH
+ sudo ${RTE_SDK}/tools/pci_unbind.py -b igb_uio $PCI_PATH && echo "OK"
+ else
+ echo "# Please load the 'igb_uio' kernel module before querying or "
+ echo "# adjusting NIC device bindings"
+ fi
+}
+
+#
+# Uses pci_unbind.py to move devices to work with kernel drivers again
+#
+unbind_nics()
+{
+ ${RTE_SDK}/tools/pci_unbind.py --status
+ echo ""
+ echo -n "Enter PCI address of device to bind to IGB UIO driver: "
+ read PCI_PATH
+ echo ""
+ echo -n "Enter name of kernel driver to bind the device to: "
+ read DRV
+ sudo ${RTE_SDK}/tools/pci_unbind.py -b $DRV $PCI_PATH && echo "OK"
}
#
@@ -368,6 +406,12 @@ step2_func()
TEXT[4]="Setup hugepage mappings for NUMA systems"
FUNC[4]="set_numa_pages"
+
+ TEXT[5]="Display current Ethernet device settings"
+ FUNC[5]="show_nics"
+
+ TEXT[6]="Bind Ethernet device to IGB UIO module"
+ FUNC[6]="bind_nics"
}
#
@@ -394,8 +438,6 @@ step4_func()
TEXT[1]="List hugepage info from /proc/meminfo"
FUNC[1]="grep_meminfo"
- TEXT[2]="List hugepage files in /mnt/huge"
- FUNC[2]="ls_mnt_huge"
}
#
@@ -408,14 +450,17 @@ step5_func()
TEXT[1]="Uninstall all targets"
FUNC[1]="uninstall_targets"
- TEXT[2]="Remove IGB UIO module"
- FUNC[2]="remove_igb_uio_module"
+ TEXT[2]="Unbind NICs from IGB UIO driver"
+ FUNC[2]="unbind_nics"
+
+ TEXT[3]="Remove IGB UIO module"
+ FUNC[3]="remove_igb_uio_module"
- TEXT[3]="Remove KNI module"
- FUNC[3]="remove_kni_module"
+ TEXT[4]="Remove KNI module"
+ FUNC[4]="remove_kni_module"
- TEXT[4]="Remove hugepage mappings"
- FUNC[4]="clear_huge_pages"
+ TEXT[5]="Remove hugepage mappings"
+ FUNC[5]="clear_huge_pages"
}
STEPS[1]="step1_func"