Checks that igb_uio is loaded
()
| 183 | |
| 184 | |
| 185 | def check_modules(): |
| 186 | '''Checks that igb_uio is loaded''' |
| 187 | global dpdk_drivers |
| 188 | |
| 189 | # list of supported modules |
| 190 | mods = [{"Name": driver, "Found": False} for driver in dpdk_drivers] |
| 191 | |
| 192 | # first check if module is loaded |
| 193 | try: |
| 194 | # Get list of sysfs modules (both built-in and dynamically loaded) |
| 195 | sysfs_path = '/sys/module/' |
| 196 | |
| 197 | # Get the list of directories in sysfs_path |
| 198 | sysfs_mods = [os.path.join(sysfs_path, o) for o |
| 199 | in os.listdir(sysfs_path) |
| 200 | if os.path.isdir(os.path.join(sysfs_path, o))] |
| 201 | |
| 202 | # Extract the last element of '/sys/module/abc' in the array |
| 203 | sysfs_mods = [a.split('/')[-1] for a in sysfs_mods] |
| 204 | |
| 205 | # special case for vfio_pci (module is named vfio-pci, |
| 206 | # but its .ko is named vfio_pci) |
| 207 | sysfs_mods = [a if a != 'vfio_pci' else 'vfio-pci' for a in sysfs_mods] |
| 208 | |
| 209 | for mod in mods: |
| 210 | if mod["Name"] in sysfs_mods: |
| 211 | mod["Found"] = True |
| 212 | except: |
| 213 | pass |
| 214 | |
| 215 | # check if we have at least one loaded module |
| 216 | if True not in [mod["Found"] for mod in mods] and b_flag is not None: |
| 217 | if b_flag in dpdk_drivers: |
| 218 | print("Error - no supported modules(DPDK driver) are loaded") |
| 219 | sys.exit(1) |
| 220 | else: |
| 221 | print("Warning - no supported modules(DPDK driver) are loaded") |
| 222 | |
| 223 | # change DPDK driver list to only contain drivers that are loaded |
| 224 | dpdk_drivers = [mod["Name"] for mod in mods if mod["Found"]] |
| 225 | |
| 226 | |
| 227 | def has_driver(dev_id): |