Lines Matching defs:devices
16 # The PCI base class for all devices
98 # global dict ethernet devices present. Dictionary indexed by PCI address.
100 devices = {}
172 return "Driver_str" in devices[dev_id]
190 for base, dirs, _ in os.walk("/sys/bus/pci/devices/%s/" % dev_id):
204 global devices
205 devices = {}
209 '''This function populates the "devices" dictionary. The keys used are
212 global devices
215 # first loop through and read details for all devices
229 devices[dev["Slot"]] = dict(dev)
256 for d in devices.keys():
257 if not device_type_match(devices[d], devices_type):
261 devices[d] = devices[d].copy()
263 devices[d].update(get_pci_device_details(d, False).items())
267 if _if in devices[d]["Interface"].split(","):
268 devices[d]["Ssh_if"] = True
269 devices[d]["Active"] = "*Active*"
273 if "Module_str" in devices[d]:
275 if driver not in devices[d]["Module_str"]:
276 devices[d]["Module_str"] = \
277 devices[d]["Module_str"] + ",%s" % driver
279 devices[d]["Module_str"] = ",".join(dpdk_drivers)
283 modules = devices[d]["Module_str"].split(",")
284 if devices[d]["Driver_str"] in modules:
285 modules.remove(devices[d]["Driver_str"])
286 devices[d]["Module_str"] = ",".join(modules)
311 it, which can then be used to index into the devices array'''
314 if dev_name in devices:
317 if "0000:" + dev_name in devices:
321 for d in devices.keys():
322 if dev_name in devices[d]["Interface"].split(","):
323 return devices[d]["Slot"]
331 dev = devices[dev_id]
357 dev = devices[dev_id]
380 # will erroneously bind other devices too which has the additional burden
381 # of unbinding those devices
383 filename = "/sys/bus/pci/devices/%s/driver_override" % dev_id
446 filename = "/sys/bus/pci/devices/%s/driver_override" % dev_id
465 for d in devices.keys():
466 if "Driver_str" in devices[d]:
467 if devices[d]["Driver_str"] in dpdk_drivers:
468 unbind_one(devices[d]["Slot"], force)
512 global devices
514 # a common user error is to forget to specify the driver the devices need to
522 "Did you forget to specify the driver to bind devices to?" % driver)
543 # For kernels < 3.15 when binding devices to a generic driver
544 # (i.e. one that doesn't have a PCI ID table) using new_id, some devices
547 # some of the previously-unbound devices were erroneously bound.
548 if not exists("/sys/bus/pci/devices/%s/driver_override" % d):
549 for d in devices.keys():
550 # skip devices that were already bound or that we know should be bound
551 if "Driver_str" in devices[d] or d in dev_list:
555 devices[d] = dict(devices[d].items()
559 if "Driver_str" in devices[d]:
564 '''Displays to the user the details of a list of devices given in
595 # split our list of network devices into the three categories above
596 for d in devices.keys():
597 if device_type_match(devices[d], devices_type):
598 print_numa &= "NUMANode" in devices[d]
600 no_drv.append(devices[d])
602 if devices[d]["Driver_str"] in dpdk_drivers:
603 dpdk_drv.append(devices[d])
605 kernel_drv.append(devices[d])
609 # don't bother displaying anything if there are no devices
611 msg = "No '%s' devices detected" % device_name
622 display_devices("%s devices using DPDK-compatible driver" % device_name,
631 display_devices("%s devices using kernel driver" % device_name,
637 display_devices("Other %s devices" % device_name, no_drv, extra_param)
642 Displays to the user what devices are bound to the igb_uio driver, the
680 sysfs_path = "/sys/bus/pci/devices"
699 description='Utility to bind and unbind devices from Linux kernel',
725 help="Print the current status of all known devices.")
750 Override restriction on binding devices in use by Linux"
754 'devices',
759 For devices bound to Linux kernel drivers, they may be referred to by interface name.
778 args = opt.devices
781 print("Error: No action specified for devices. "
788 print("Error: No devices specified.", file=sys.stderr)