MCPcopy Create free account
hub / github.com/F-Stack/f-stack / show_device_status

Function show_device_status

dpdk/usertools/dpdk-devbind.py:550–590  ·  view source on GitHub ↗
(devices_type, device_name, if_field=False)

Source from the content-addressed store, hash-verified

548
549
550def show_device_status(devices_type, device_name, if_field=False):
551 global dpdk_drivers
552 kernel_drv = []
553 dpdk_drv = []
554 no_drv = []
555
556 # split our list of network devices into the three categories above
557 for d in devices.keys():
558 if device_type_match(devices[d], devices_type):
559 if not has_driver(d):
560 no_drv.append(devices[d])
561 continue
562 if devices[d]["Driver_str"] in dpdk_drivers:
563 dpdk_drv.append(devices[d])
564 else:
565 kernel_drv.append(devices[d])
566
567 n_devs = len(dpdk_drv) + len(kernel_drv) + len(no_drv)
568
569 # don't bother displaying anything if there are no devices
570 if n_devs == 0:
571 msg = "No '%s' devices detected" % device_name
572 print("")
573 print(msg)
574 print("".join('=' * len(msg)))
575 return
576
577 # print each category separately, so we can clearly see what's used by DPDK
578 if dpdk_drv:
579 display_devices("%s devices using DPDK-compatible driver" % device_name,
580 dpdk_drv, "drv=%(Driver_str)s unused=%(Module_str)s")
581 if kernel_drv:
582 if_text = ""
583 if if_field:
584 if_text = "if=%(Interface)s "
585 display_devices("%s devices using kernel driver" % device_name, kernel_drv,
586 if_text + "drv=%(Driver_str)s "
587 "unused=%(Module_str)s %(Active)s")
588 if no_drv:
589 display_devices("Other %s devices" % device_name, no_drv,
590 "unused=%(Module_str)s")
591
592
593def show_status():

Callers 1

show_statusFunction · 0.85

Calls 4

device_type_matchFunction · 0.85
has_driverFunction · 0.85
display_devicesFunction · 0.85
printFunction · 0.50

Tested by

no test coverage detected