xref: /dpdk/usertools/dpdk-devbind.py (revision bfd84d7e7f778a2f91c7b68a60c364b2921a9895)
1#! /usr/bin/env python
2# SPDX-License-Identifier: BSD-3-Clause
3# Copyright(c) 2010-2014 Intel Corporation
4#
5
6import sys
7import os
8import getopt
9import subprocess
10from os.path import exists, abspath, dirname, basename
11
12# The PCI base class for all devices
13network_class = {'Class': '02', 'Vendor': None, 'Device': None,
14                    'SVendor': None, 'SDevice': None}
15ifpga_class = {'Class': '12', 'Vendor': '8086', 'Device': '0b30',
16                    'SVendor': None, 'SDevice': None}
17encryption_class = {'Class': '10', 'Vendor': None, 'Device': None,
18                   'SVendor': None, 'SDevice': None}
19intel_processor_class = {'Class': '0b', 'Vendor': '8086', 'Device': None,
20                   'SVendor': None, 'SDevice': None}
21cavium_sso = {'Class': '08', 'Vendor': '177d', 'Device': 'a04b,a04d',
22              'SVendor': None, 'SDevice': None}
23cavium_fpa = {'Class': '08', 'Vendor': '177d', 'Device': 'a053',
24              'SVendor': None, 'SDevice': None}
25cavium_pkx = {'Class': '08', 'Vendor': '177d', 'Device': 'a0dd,a049',
26              'SVendor': None, 'SDevice': None}
27cavium_tim = {'Class': '08', 'Vendor': '177d', 'Device': 'a051',
28              'SVendor': None, 'SDevice': None}
29cavium_zip = {'Class': '12', 'Vendor': '177d', 'Device': 'a037',
30              'SVendor': None, 'SDevice': None}
31avp_vnic = {'Class': '05', 'Vendor': '1af4', 'Device': '1110',
32              'SVendor': None, 'SDevice': None}
33
34octeontx2_sso = {'Class': '08', 'Vendor': '177d', 'Device': 'a0f9,a0fa',
35              'SVendor': None, 'SDevice': None}
36octeontx2_npa = {'Class': '08', 'Vendor': '177d', 'Device': 'a0fb,a0fc',
37              'SVendor': None, 'SDevice': None}
38
39network_devices = [network_class, cavium_pkx, avp_vnic, ifpga_class]
40crypto_devices = [encryption_class, intel_processor_class]
41eventdev_devices = [cavium_sso, cavium_tim, octeontx2_sso]
42mempool_devices = [cavium_fpa, octeontx2_npa]
43compress_devices = [cavium_zip]
44
45# global dict ethernet devices present. Dictionary indexed by PCI address.
46# Each device within this is itself a dictionary of device properties
47devices = {}
48# list of supported DPDK drivers
49dpdk_drivers = ["igb_uio", "vfio-pci", "uio_pci_generic"]
50
51# command-line arg flags
52b_flag = None
53status_flag = False
54force_flag = False
55args = []
56
57
58def usage():
59    '''Print usage information for the program'''
60    argv0 = basename(sys.argv[0])
61    print("""
62Usage:
63------
64
65     %(argv0)s [options] DEVICE1 DEVICE2 ....
66
67where DEVICE1, DEVICE2 etc, are specified via PCI "domain:bus:slot.func" syntax
68or "bus:slot.func" syntax. For devices bound to Linux kernel drivers, they may
69also be referred to by Linux interface name e.g. eth0, eth1, em0, em1, etc.
70
71Options:
72    --help, --usage:
73        Display usage information and quit
74
75    -s, --status:
76        Print the current status of all known network, crypto, event
77        and mempool devices.
78        For each device, it displays the PCI domain, bus, slot and function,
79        along with a text description of the device. Depending upon whether the
80        device is being used by a kernel driver, the igb_uio driver, or no
81        driver, other relevant information will be displayed:
82        * the Linux interface name e.g. if=eth0
83        * the driver being used e.g. drv=igb_uio
84        * any suitable drivers not currently using that device
85            e.g. unused=igb_uio
86        NOTE: if this flag is passed along with a bind/unbind option, the
87        status display will always occur after the other operations have taken
88        place.
89
90    --status-dev:
91        Print the status of given device group. Supported device groups are:
92        "net", "crypto", "event", "mempool" and "compress"
93
94    -b driver, --bind=driver:
95        Select the driver to use or \"none\" to unbind the device
96
97    -u, --unbind:
98        Unbind a device (Equivalent to \"-b none\")
99
100    --force:
101        By default, network devices which are used by Linux - as indicated by
102        having routes in the routing table - cannot be modified. Using the
103        --force flag overrides this behavior, allowing active links to be
104        forcibly unbound.
105        WARNING: This can lead to loss of network connection and should be used
106        with caution.
107
108Examples:
109---------
110
111To display current device status:
112        %(argv0)s --status
113
114To display current network device status:
115        %(argv0)s --status-dev net
116
117To bind eth1 from the current driver and move to use igb_uio
118        %(argv0)s --bind=igb_uio eth1
119
120To unbind 0000:01:00.0 from using any driver
121        %(argv0)s -u 0000:01:00.0
122
123To bind 0000:02:00.0 and 0000:02:00.1 to the ixgbe kernel driver
124        %(argv0)s -b ixgbe 02:00.0 02:00.1
125
126    """ % locals())  # replace items from local variables
127
128
129# This is roughly compatible with check_output function in subprocess module
130# which is only available in python 2.7.
131def check_output(args, stderr=None):
132    '''Run a command and capture its output'''
133    return subprocess.Popen(args, stdout=subprocess.PIPE,
134                            stderr=stderr).communicate()[0]
135
136
137def check_modules():
138    '''Checks that igb_uio is loaded'''
139    global dpdk_drivers
140
141    # list of supported modules
142    mods = [{"Name": driver, "Found": False} for driver in dpdk_drivers]
143
144    # first check if module is loaded
145    try:
146        # Get list of sysfs modules (both built-in and dynamically loaded)
147        sysfs_path = '/sys/module/'
148
149        # Get the list of directories in sysfs_path
150        sysfs_mods = [os.path.join(sysfs_path, o) for o
151                      in os.listdir(sysfs_path)
152                      if os.path.isdir(os.path.join(sysfs_path, o))]
153
154        # Extract the last element of '/sys/module/abc' in the array
155        sysfs_mods = [a.split('/')[-1] for a in sysfs_mods]
156
157        # special case for vfio_pci (module is named vfio-pci,
158        # but its .ko is named vfio_pci)
159        sysfs_mods = [a if a != 'vfio_pci' else 'vfio-pci' for a in sysfs_mods]
160
161        for mod in mods:
162            if mod["Name"] in sysfs_mods:
163                mod["Found"] = True
164    except:
165        pass
166
167    # check if we have at least one loaded module
168    if True not in [mod["Found"] for mod in mods] and b_flag is not None:
169        if b_flag in dpdk_drivers:
170            print("Error - no supported modules(DPDK driver) are loaded")
171            sys.exit(1)
172        else:
173            print("Warning - no supported modules(DPDK driver) are loaded")
174
175    # change DPDK driver list to only contain drivers that are loaded
176    dpdk_drivers = [mod["Name"] for mod in mods if mod["Found"]]
177
178
179def has_driver(dev_id):
180    '''return true if a device is assigned to a driver. False otherwise'''
181    return "Driver_str" in devices[dev_id]
182
183
184def get_pci_device_details(dev_id, probe_lspci):
185    '''This function gets additional details for a PCI device'''
186    device = {}
187
188    if probe_lspci:
189        extra_info = check_output(["lspci", "-vmmks", dev_id]).splitlines()
190
191        # parse lspci details
192        for line in extra_info:
193            if len(line) == 0:
194                continue
195            name, value = line.decode().split("\t", 1)
196            name = name.strip(":") + "_str"
197            device[name] = value
198    # check for a unix interface name
199    device["Interface"] = ""
200    for base, dirs, _ in os.walk("/sys/bus/pci/devices/%s/" % dev_id):
201        if "net" in dirs:
202            device["Interface"] = \
203                ",".join(os.listdir(os.path.join(base, "net")))
204            break
205    # check if a port is used for ssh connection
206    device["Ssh_if"] = False
207    device["Active"] = ""
208
209    return device
210
211def clear_data():
212    '''This function clears any old data'''
213    devices = {}
214
215def get_device_details(devices_type):
216    '''This function populates the "devices" dictionary. The keys used are
217    the pci addresses (domain:bus:slot.func). The values are themselves
218    dictionaries - one for each NIC.'''
219    global devices
220    global dpdk_drivers
221
222    # first loop through and read details for all devices
223    # request machine readable format, with numeric IDs and String
224    dev = {}
225    dev_lines = check_output(["lspci", "-Dvmmnnk"]).splitlines()
226    for dev_line in dev_lines:
227        if len(dev_line) == 0:
228            if device_type_match(dev, devices_type):
229                # Replace "Driver" with "Driver_str" to have consistency of
230                # of dictionary key names
231                if "Driver" in dev.keys():
232                    dev["Driver_str"] = dev.pop("Driver")
233                if "Module" in dev.keys():
234                    dev["Module_str"] = dev.pop("Module")
235                # use dict to make copy of dev
236                devices[dev["Slot"]] = dict(dev)
237            # Clear previous device's data
238            dev = {}
239        else:
240            name, value = dev_line.decode().split("\t", 1)
241            value_list = value.rsplit(' ', 1)
242            if len(value_list) > 1:
243                # String stored in <name>_str
244                dev[name.rstrip(":") + '_str'] = value_list[0]
245            # Numeric IDs
246            dev[name.rstrip(":")] = value_list[len(value_list) - 1] \
247                .rstrip("]").lstrip("[")
248
249    if devices_type == network_devices:
250        # check what is the interface if any for an ssh connection if
251        # any to this host, so we can mark it later.
252        ssh_if = []
253        route = check_output(["ip", "-o", "route"])
254        # filter out all lines for 169.254 routes
255        route = "\n".join(filter(lambda ln: not ln.startswith("169.254"),
256                             route.decode().splitlines()))
257        rt_info = route.split()
258        for i in range(len(rt_info) - 1):
259            if rt_info[i] == "dev":
260                ssh_if.append(rt_info[i+1])
261
262    # based on the basic info, get extended text details
263    for d in devices.keys():
264        if not device_type_match(devices[d], devices_type):
265            continue
266
267        # get additional info and add it to existing data
268        devices[d] = devices[d].copy()
269        # No need to probe lspci
270        devices[d].update(get_pci_device_details(d, False).items())
271
272        if devices_type == network_devices:
273            for _if in ssh_if:
274                if _if in devices[d]["Interface"].split(","):
275                    devices[d]["Ssh_if"] = True
276                    devices[d]["Active"] = "*Active*"
277                    break
278
279        # add igb_uio to list of supporting modules if needed
280        if "Module_str" in devices[d]:
281            for driver in dpdk_drivers:
282                if driver not in devices[d]["Module_str"]:
283                    devices[d]["Module_str"] = \
284                        devices[d]["Module_str"] + ",%s" % driver
285        else:
286            devices[d]["Module_str"] = ",".join(dpdk_drivers)
287
288        # make sure the driver and module strings do not have any duplicates
289        if has_driver(d):
290            modules = devices[d]["Module_str"].split(",")
291            if devices[d]["Driver_str"] in modules:
292                modules.remove(devices[d]["Driver_str"])
293                devices[d]["Module_str"] = ",".join(modules)
294
295
296def device_type_match(dev, devices_type):
297    for i in range(len(devices_type)):
298        param_count = len(
299            [x for x in devices_type[i].values() if x is not None])
300        match_count = 0
301        if dev["Class"][0:2] == devices_type[i]["Class"]:
302            match_count = match_count + 1
303            for key in devices_type[i].keys():
304                if key != 'Class' and devices_type[i][key]:
305                    value_list = devices_type[i][key].split(',')
306                    for value in value_list:
307                        if value.strip(' ') == dev[key]:
308                            match_count = match_count + 1
309            # count must be the number of non None parameters to match
310            if match_count == param_count:
311                return True
312    return False
313
314def dev_id_from_dev_name(dev_name):
315    '''Take a device "name" - a string passed in by user to identify a NIC
316    device, and determine the device id - i.e. the domain:bus:slot.func - for
317    it, which can then be used to index into the devices array'''
318
319    # check if it's already a suitable index
320    if dev_name in devices:
321        return dev_name
322    # check if it's an index just missing the domain part
323    elif "0000:" + dev_name in devices:
324        return "0000:" + dev_name
325    else:
326        # check if it's an interface name, e.g. eth1
327        for d in devices.keys():
328            if dev_name in devices[d]["Interface"].split(","):
329                return devices[d]["Slot"]
330    # if nothing else matches - error
331    print("Unknown device: %s. "
332          "Please specify device in \"bus:slot.func\" format" % dev_name)
333    sys.exit(1)
334
335
336def unbind_one(dev_id, force):
337    '''Unbind the device identified by "dev_id" from its current driver'''
338    dev = devices[dev_id]
339    if not has_driver(dev_id):
340        print("%s %s %s is not currently managed by any driver\n" %
341              (dev["Slot"], dev["Device_str"], dev["Interface"]))
342        return
343
344    # prevent us disconnecting ourselves
345    if dev["Ssh_if"] and not force:
346        print("Routing table indicates that interface %s is active. "
347              "Skipping unbind" % (dev_id))
348        return
349
350    # write to /sys to unbind
351    filename = "/sys/bus/pci/drivers/%s/unbind" % dev["Driver_str"]
352    try:
353        f = open(filename, "a")
354    except:
355        print("Error: unbind failed for %s - Cannot open %s"
356              % (dev_id, filename))
357        sys.exit(1)
358    f.write(dev_id)
359    f.close()
360
361
362def bind_one(dev_id, driver, force):
363    '''Bind the device given by "dev_id" to the driver "driver". If the device
364    is already bound to a different driver, it will be unbound first'''
365    dev = devices[dev_id]
366    saved_driver = None  # used to rollback any unbind in case of failure
367
368    # prevent disconnection of our ssh session
369    if dev["Ssh_if"] and not force:
370        print("Routing table indicates that interface %s is active. "
371              "Not modifying" % (dev_id))
372        return
373
374    # unbind any existing drivers we don't want
375    if has_driver(dev_id):
376        if dev["Driver_str"] == driver:
377            print("%s already bound to driver %s, skipping\n"
378                  % (dev_id, driver))
379            return
380        else:
381            saved_driver = dev["Driver_str"]
382            unbind_one(dev_id, force)
383            dev["Driver_str"] = ""  # clear driver string
384
385    # For kernels >= 3.15 driver_override can be used to specify the driver
386    # for a device rather than relying on the driver to provide a positive
387    # match of the device.  The existing process of looking up
388    # the vendor and device ID, adding them to the driver new_id,
389    # will erroneously bind other devices too which has the additional burden
390    # of unbinding those devices
391    if driver in dpdk_drivers:
392        filename = "/sys/bus/pci/devices/%s/driver_override" % dev_id
393        if os.path.exists(filename):
394            try:
395                f = open(filename, "w")
396            except:
397                print("Error: bind failed for %s - Cannot open %s"
398                      % (dev_id, filename))
399                return
400            try:
401                f.write("%s" % driver)
402                f.close()
403            except:
404                print("Error: bind failed for %s - Cannot write driver %s to "
405                      "PCI ID " % (dev_id, driver))
406                return
407        # For kernels < 3.15 use new_id to add PCI id's to the driver
408        else:
409            filename = "/sys/bus/pci/drivers/%s/new_id" % driver
410            try:
411                f = open(filename, "w")
412            except:
413                print("Error: bind failed for %s - Cannot open %s"
414                      % (dev_id, filename))
415                return
416            try:
417                # Convert Device and Vendor Id to int to write to new_id
418                f.write("%04x %04x" % (int(dev["Vendor"],16),
419                        int(dev["Device"], 16)))
420                f.close()
421            except:
422                print("Error: bind failed for %s - Cannot write new PCI ID to "
423                      "driver %s" % (dev_id, driver))
424                return
425
426    # do the bind by writing to /sys
427    filename = "/sys/bus/pci/drivers/%s/bind" % driver
428    try:
429        f = open(filename, "a")
430    except:
431        print("Error: bind failed for %s - Cannot open %s"
432              % (dev_id, filename))
433        if saved_driver is not None:  # restore any previous driver
434            bind_one(dev_id, saved_driver, force)
435        return
436    try:
437        f.write(dev_id)
438        f.close()
439    except:
440        # for some reason, closing dev_id after adding a new PCI ID to new_id
441        # results in IOError. however, if the device was successfully bound,
442        # we don't care for any errors and can safely ignore IOError
443        tmp = get_pci_device_details(dev_id, True)
444        if "Driver_str" in tmp and tmp["Driver_str"] == driver:
445            return
446        print("Error: bind failed for %s - Cannot bind to driver %s"
447              % (dev_id, driver))
448        if saved_driver is not None:  # restore any previous driver
449            bind_one(dev_id, saved_driver, force)
450        return
451
452    # For kernels > 3.15 driver_override is used to bind a device to a driver.
453    # Before unbinding it, overwrite driver_override with empty string so that
454    # the device can be bound to any other driver
455    filename = "/sys/bus/pci/devices/%s/driver_override" % dev_id
456    if os.path.exists(filename):
457        try:
458            f = open(filename, "w")
459        except:
460            print("Error: unbind failed for %s - Cannot open %s"
461                  % (dev_id, filename))
462            sys.exit(1)
463        try:
464            f.write("\00")
465            f.close()
466        except:
467            print("Error: unbind failed for %s - Cannot open %s"
468                  % (dev_id, filename))
469            sys.exit(1)
470
471
472def unbind_all(dev_list, force=False):
473    """Unbind method, takes a list of device locations"""
474
475    if dev_list[0] == "dpdk":
476        for d in devices.keys():
477            if "Driver_str" in devices[d]:
478                if devices[d]["Driver_str"] in dpdk_drivers:
479                    unbind_one(devices[d]["Slot"], force)
480        return
481
482    dev_list = map(dev_id_from_dev_name, dev_list)
483    for d in dev_list:
484        unbind_one(d, force)
485
486
487def bind_all(dev_list, driver, force=False):
488    """Bind method, takes a list of device locations"""
489    global devices
490
491    dev_list = map(dev_id_from_dev_name, dev_list)
492
493    for d in dev_list:
494        bind_one(d, driver, force)
495
496    # For kernels < 3.15 when binding devices to a generic driver
497    # (i.e. one that doesn't have a PCI ID table) using new_id, some devices
498    # that are not bound to any other driver could be bound even if no one has
499    # asked them to. hence, we check the list of drivers again, and see if
500    # some of the previously-unbound devices were erroneously bound.
501    if not os.path.exists("/sys/bus/pci/devices/%s/driver_override" % d):
502        for d in devices.keys():
503            # skip devices that were already bound or that we know should be bound
504            if "Driver_str" in devices[d] or d in dev_list:
505                continue
506
507            # update information about this device
508            devices[d] = dict(devices[d].items() +
509                              get_pci_device_details(d, True).items())
510
511            # check if updated information indicates that the device was bound
512            if "Driver_str" in devices[d]:
513                unbind_one(d, force)
514
515
516def display_devices(title, dev_list, extra_params=None):
517    '''Displays to the user the details of a list of devices given in
518    "dev_list". The "extra_params" parameter, if given, should contain a string
519     with %()s fields in it for replacement by the named fields in each
520     device's dictionary.'''
521    strings = []  # this holds the strings to print. We sort before printing
522    print("\n%s" % title)
523    print("="*len(title))
524    if len(dev_list) == 0:
525        strings.append("<none>")
526    else:
527        for dev in dev_list:
528            if extra_params is not None:
529                strings.append("%s '%s %s' %s" % (dev["Slot"],
530                                               dev["Device_str"],
531                                               dev["Device"],
532                                               extra_params % dev))
533            else:
534                strings.append("%s '%s'" % (dev["Slot"], dev["Device_str"]))
535    # sort before printing, so that the entries appear in PCI order
536    strings.sort()
537    print("\n".join(strings))  # print one per line
538
539def show_device_status(devices_type, device_name):
540    global dpdk_drivers
541    kernel_drv = []
542    dpdk_drv = []
543    no_drv = []
544
545    # split our list of network devices into the three categories above
546    for d in devices.keys():
547        if device_type_match(devices[d], devices_type):
548            if not has_driver(d):
549                no_drv.append(devices[d])
550                continue
551            if devices[d]["Driver_str"] in dpdk_drivers:
552                dpdk_drv.append(devices[d])
553            else:
554                kernel_drv.append(devices[d])
555
556    n_devs = len(dpdk_drv) + len(kernel_drv) + len(no_drv)
557
558    # don't bother displaying anything if there are no devices
559    if n_devs == 0:
560        msg = "No '%s' devices detected" % device_name
561        print("")
562        print(msg)
563        print("".join('=' * len(msg)))
564        return
565
566    # print each category separately, so we can clearly see what's used by DPDK
567    if len(dpdk_drv) != 0:
568        display_devices("%s devices using DPDK-compatible driver" % device_name,
569                        dpdk_drv, "drv=%(Driver_str)s unused=%(Module_str)s")
570    if len(kernel_drv) != 0:
571        display_devices("%s devices using kernel driver" % device_name, kernel_drv,
572                        "if=%(Interface)s drv=%(Driver_str)s "
573                        "unused=%(Module_str)s %(Active)s")
574    if len(no_drv) != 0:
575        display_devices("Other %s devices" % device_name, no_drv,
576                        "unused=%(Module_str)s")
577
578def show_status():
579    '''Function called when the script is passed the "--status" option.
580    Displays to the user what devices are bound to the igb_uio driver, the
581    kernel driver or to no driver'''
582
583    if status_dev == "net" or status_dev == "all":
584        show_device_status(network_devices, "Network")
585
586    if status_dev == "crypto" or status_dev == "all":
587        show_device_status(crypto_devices, "Crypto")
588
589    if status_dev == "event" or status_dev == "all":
590        show_device_status(eventdev_devices, "Eventdev")
591
592    if status_dev == "mempool" or status_dev == "all":
593        show_device_status(mempool_devices, "Mempool")
594
595    if status_dev == "compress" or status_dev == "all":
596        show_device_status(compress_devices , "Compress")
597
598
599def parse_args():
600    '''Parses the command-line arguments given by the user and takes the
601    appropriate action for each'''
602    global b_flag
603    global status_flag
604    global status_dev
605    global force_flag
606    global args
607    if len(sys.argv) <= 1:
608        usage()
609        sys.exit(0)
610
611    try:
612        opts, args = getopt.getopt(sys.argv[1:], "b:us",
613                                   ["help", "usage", "status", "status-dev=",
614                                    "force", "bind=", "unbind", ])
615    except getopt.GetoptError as error:
616        print(str(error))
617        print("Run '%s --usage' for further information" % sys.argv[0])
618        sys.exit(1)
619
620    for opt, arg in opts:
621        if opt == "--help" or opt == "--usage":
622            usage()
623            sys.exit(0)
624        if opt == "--status-dev":
625            status_flag = True
626            status_dev = arg
627        if opt == "--status" or opt == "-s":
628            status_flag = True
629            status_dev = "all"
630        if opt == "--force":
631            force_flag = True
632        if opt == "-b" or opt == "-u" or opt == "--bind" or opt == "--unbind":
633            if b_flag is not None:
634                print("Error - Only one bind or unbind may be specified\n")
635                sys.exit(1)
636            if opt == "-u" or opt == "--unbind":
637                b_flag = "none"
638            else:
639                b_flag = arg
640
641
642def do_arg_actions():
643    '''do the actual action requested by the user'''
644    global b_flag
645    global status_flag
646    global force_flag
647    global args
648
649    if b_flag is None and not status_flag:
650        print("Error: No action specified for devices."
651              "Please give a -b or -u option")
652        print("Run '%s --usage' for further information" % sys.argv[0])
653        sys.exit(1)
654
655    if b_flag is not None and len(args) == 0:
656        print("Error: No devices specified.")
657        print("Run '%s --usage' for further information" % sys.argv[0])
658        sys.exit(1)
659
660    if b_flag == "none" or b_flag == "None":
661        unbind_all(args, force_flag)
662    elif b_flag is not None:
663        bind_all(args, b_flag, force_flag)
664    if status_flag:
665        if b_flag is not None:
666            clear_data()
667            # refresh if we have changed anything
668            get_device_details(network_devices)
669            get_device_details(crypto_devices)
670            get_device_details(eventdev_devices)
671            get_device_details(mempool_devices)
672            get_device_details(compress_devices)
673        show_status()
674
675
676def main():
677    '''program main function'''
678    # check if lspci is installed, suppress any output
679    with open(os.devnull, 'w') as devnull:
680        ret = subprocess.call(['which', 'lspci'],
681                              stdout=devnull, stderr=devnull)
682        if ret != 0:
683            print("'lspci' not found - please install 'pciutils'")
684            sys.exit(1)
685    parse_args()
686    check_modules()
687    clear_data()
688    get_device_details(network_devices)
689    get_device_details(crypto_devices)
690    get_device_details(eventdev_devices)
691    get_device_details(mempool_devices)
692    get_device_details(compress_devices)
693    do_arg_actions()
694
695if __name__ == "__main__":
696    main()
697