2 # SPDX-License-Identifier: BSD-3-Clause
3 # Copyright(c) 2010-2014 Intel Corporation
13 from os.path import exists, basename
14 from os.path import join as path_join
16 # The PCI base class for all devices
17 network_class = {'Class': '02', 'Vendor': None, 'Device': None,
18 'SVendor': None, 'SDevice': None}
19 acceleration_class = {'Class': '12', 'Vendor': None, 'Device': None,
20 'SVendor': None, 'SDevice': None}
21 ifpga_class = {'Class': '12', 'Vendor': '8086', 'Device': '0b30',
22 'SVendor': None, 'SDevice': None}
23 encryption_class = {'Class': '10', 'Vendor': None, 'Device': None,
24 'SVendor': None, 'SDevice': None}
25 intel_processor_class = {'Class': '0b', 'Vendor': '8086', 'Device': None,
26 'SVendor': None, 'SDevice': None}
27 cavium_sso = {'Class': '08', 'Vendor': '177d', 'Device': 'a04b,a04d',
28 'SVendor': None, 'SDevice': None}
29 cavium_fpa = {'Class': '08', 'Vendor': '177d', 'Device': 'a053',
30 'SVendor': None, 'SDevice': None}
31 cavium_pkx = {'Class': '08', 'Vendor': '177d', 'Device': 'a0dd,a049',
32 'SVendor': None, 'SDevice': None}
33 cavium_tim = {'Class': '08', 'Vendor': '177d', 'Device': 'a051',
34 'SVendor': None, 'SDevice': None}
35 cavium_zip = {'Class': '12', 'Vendor': '177d', 'Device': 'a037',
36 'SVendor': None, 'SDevice': None}
37 avp_vnic = {'Class': '05', 'Vendor': '1af4', 'Device': '1110',
38 'SVendor': None, 'SDevice': None}
40 octeontx2_sso = {'Class': '08', 'Vendor': '177d', 'Device': 'a0f9,a0fa',
41 'SVendor': None, 'SDevice': None}
42 octeontx2_npa = {'Class': '08', 'Vendor': '177d', 'Device': 'a0fb,a0fc',
43 'SVendor': None, 'SDevice': None}
44 octeontx2_dma = {'Class': '08', 'Vendor': '177d', 'Device': 'a081',
45 'SVendor': None, 'SDevice': None}
46 octeontx2_ree = {'Class': '08', 'Vendor': '177d', 'Device': 'a0f4',
47 'SVendor': None, 'SDevice': None}
48 cnxk_bphy = {'Class': '08', 'Vendor': '177d', 'Device': 'a089',
49 'SVendor': None, 'SDevice': None}
50 cnxk_bphy_cgx = {'Class': '08', 'Vendor': '177d', 'Device': 'a059,a060',
51 'SVendor': None, 'SDevice': None}
52 cnxk_inl_dev = {'Class': '08', 'Vendor': '177d', 'Device': 'a0f0,a0f1',
53 'SVendor': None, 'SDevice': None}
55 intel_dlb = {'Class': '0b', 'Vendor': '8086', 'Device': '270b,2710,2714',
56 'SVendor': None, 'SDevice': None}
57 intel_ioat_bdw = {'Class': '08', 'Vendor': '8086',
58 'Device': '6f20,6f21,6f22,6f23,6f24,6f25,6f26,6f27,6f2e,6f2f',
59 'SVendor': None, 'SDevice': None}
60 intel_ioat_skx = {'Class': '08', 'Vendor': '8086', 'Device': '2021',
61 'SVendor': None, 'SDevice': None}
62 intel_ioat_icx = {'Class': '08', 'Vendor': '8086', 'Device': '0b00',
63 'SVendor': None, 'SDevice': None}
64 intel_idxd_spr = {'Class': '08', 'Vendor': '8086', 'Device': '0b25',
65 'SVendor': None, 'SDevice': None}
66 intel_ntb_skx = {'Class': '06', 'Vendor': '8086', 'Device': '201c',
67 'SVendor': None, 'SDevice': None}
68 intel_ntb_icx = {'Class': '06', 'Vendor': '8086', 'Device': '347e',
69 'SVendor': None, 'SDevice': None}
71 network_devices = [network_class, cavium_pkx, avp_vnic, ifpga_class]
72 baseband_devices = [acceleration_class]
73 crypto_devices = [encryption_class, intel_processor_class]
74 dma_devices = [intel_idxd_spr, intel_ioat_bdw, intel_ioat_icx, intel_ioat_skx]
75 eventdev_devices = [cavium_sso, cavium_tim, intel_dlb, octeontx2_sso]
76 mempool_devices = [cavium_fpa, octeontx2_npa]
77 compress_devices = [cavium_zip]
78 regex_devices = [octeontx2_ree]
79 misc_devices = [cnxk_bphy, cnxk_bphy_cgx, cnxk_inl_dev, intel_ntb_skx,
80 intel_ntb_icx, octeontx2_dma]
82 # global dict ethernet devices present. Dictionary indexed by PCI address.
83 # Each device within this is itself a dictionary of device properties
85 # list of supported DPDK drivers
86 dpdk_drivers = ["igb_uio", "vfio-pci", "uio_pci_generic"]
87 # list of currently loaded kernel modules
90 # command-line arg flags
97 # check if a specific kernel module is loaded
98 def module_is_loaded(module):
101 if module == 'vfio_pci':
105 return module in loaded_modules
107 # Get list of sysfs modules (both built-in and dynamically loaded)
108 sysfs_path = '/sys/module/'
110 # Get the list of directories in sysfs_path
111 sysfs_mods = [m for m in os.listdir(sysfs_path)
112 if os.path.isdir(os.path.join(sysfs_path, m))]
114 # special case for vfio_pci (module is named vfio-pci,
115 # but its .ko is named vfio_pci)
116 sysfs_mods = [a if a != 'vfio_pci' else 'vfio-pci' for a in sysfs_mods]
118 loaded_modules = sysfs_mods
120 # add built-in modules as loaded
121 release = platform.uname().release
122 filename = os.path.join("/lib/modules/", release, "modules.builtin")
123 if os.path.exists(filename):
125 with open(filename) as f:
126 loaded_modules += [os.path.splitext(os.path.basename(mod))[0] for mod in f]
128 print("Warning: cannot read list of built-in kernel modules")
130 return module in loaded_modules
134 '''Checks that igb_uio is loaded'''
137 # list of supported modules
138 mods = [{"Name": driver, "Found": False} for driver in dpdk_drivers]
140 # first check if module is loaded
142 if module_is_loaded(mod["Name"]):
145 # check if we have at least one loaded module
146 if True not in [mod["Found"] for mod in mods] and b_flag is not None:
147 print("Warning: no supported DPDK kernel modules are loaded", file=sys.stderr)
149 # change DPDK driver list to only contain drivers that are loaded
150 dpdk_drivers = [mod["Name"] for mod in mods if mod["Found"]]
153 def has_driver(dev_id):
154 '''return true if a device is assigned to a driver. False otherwise'''
155 return "Driver_str" in devices[dev_id]
158 def get_pci_device_details(dev_id, probe_lspci):
159 '''This function gets additional details for a PCI device'''
163 extra_info = subprocess.check_output(["lspci", "-vmmks", dev_id]).splitlines()
164 # parse lspci details
165 for line in extra_info:
168 name, value = line.decode("utf8").split("\t", 1)
169 name = name.strip(":") + "_str"
171 # check for a unix interface name
172 device["Interface"] = ""
173 for base, dirs, _ in os.walk("/sys/bus/pci/devices/%s/" % dev_id):
175 device["Interface"] = \
176 ",".join(os.listdir(os.path.join(base, "net")))
178 # check if a port is used for ssh connection
179 device["Ssh_if"] = False
180 device["Active"] = ""
186 '''This function clears any old data'''
191 def get_device_details(devices_type):
192 '''This function populates the "devices" dictionary. The keys used are
193 the pci addresses (domain:bus:slot.func). The values are themselves
194 dictionaries - one for each NIC.'''
198 # first loop through and read details for all devices
199 # request machine readable format, with numeric IDs and String
201 dev_lines = subprocess.check_output(["lspci", "-Dvmmnnk"]).splitlines()
202 for dev_line in dev_lines:
204 if device_type_match(dev, devices_type):
205 # Replace "Driver" with "Driver_str" to have consistency of
206 # of dictionary key names
207 if "Driver" in dev.keys():
208 dev["Driver_str"] = dev.pop("Driver")
209 if "Module" in dev.keys():
210 dev["Module_str"] = dev.pop("Module")
211 # use dict to make copy of dev
212 devices[dev["Slot"]] = dict(dev)
213 # Clear previous device's data
216 name, value = dev_line.decode("utf8").split("\t", 1)
217 value_list = value.rsplit(' ', 1)
219 # String stored in <name>_str
220 dev[name.rstrip(":") + '_str'] = value_list[0]
222 dev[name.rstrip(":")] = value_list[len(value_list) - 1] \
223 .rstrip("]").lstrip("[")
225 if devices_type == network_devices:
226 # check what is the interface if any for an ssh connection if
227 # any to this host, so we can mark it later.
229 route = subprocess.check_output(["ip", "-o", "route"])
230 # filter out all lines for 169.254 routes
231 route = "\n".join(filter(lambda ln: not ln.startswith("169.254"),
232 route.decode().splitlines()))
233 rt_info = route.split()
234 for i in range(len(rt_info) - 1):
235 if rt_info[i] == "dev":
236 ssh_if.append(rt_info[i + 1])
238 # based on the basic info, get extended text details
239 for d in devices.keys():
240 if not device_type_match(devices[d], devices_type):
243 # get additional info and add it to existing data
244 devices[d] = devices[d].copy()
245 # No need to probe lspci
246 devices[d].update(get_pci_device_details(d, False).items())
248 if devices_type == network_devices:
250 if _if in devices[d]["Interface"].split(","):
251 devices[d]["Ssh_if"] = True
252 devices[d]["Active"] = "*Active*"
255 # add igb_uio to list of supporting modules if needed
256 if "Module_str" in devices[d]:
257 for driver in dpdk_drivers:
258 if driver not in devices[d]["Module_str"]:
259 devices[d]["Module_str"] = \
260 devices[d]["Module_str"] + ",%s" % driver
262 devices[d]["Module_str"] = ",".join(dpdk_drivers)
264 # make sure the driver and module strings do not have any duplicates
266 modules = devices[d]["Module_str"].split(",")
267 if devices[d]["Driver_str"] in modules:
268 modules.remove(devices[d]["Driver_str"])
269 devices[d]["Module_str"] = ",".join(modules)
272 def device_type_match(dev, devices_type):
273 for i in range(len(devices_type)):
275 [x for x in devices_type[i].values() if x is not None])
277 if dev["Class"][0:2] == devices_type[i]["Class"]:
278 match_count = match_count + 1
279 for key in devices_type[i].keys():
280 if key != 'Class' and devices_type[i][key]:
281 value_list = devices_type[i][key].split(',')
282 for value in value_list:
283 if value.strip(' ') == dev[key]:
284 match_count = match_count + 1
285 # count must be the number of non None parameters to match
286 if match_count == param_count:
291 def dev_id_from_dev_name(dev_name):
292 '''Take a device "name" - a string passed in by user to identify a NIC
293 device, and determine the device id - i.e. the domain:bus:slot.func - for
294 it, which can then be used to index into the devices array'''
296 # check if it's already a suitable index
297 if dev_name in devices:
299 # check if it's an index just missing the domain part
300 if "0000:" + dev_name in devices:
301 return "0000:" + dev_name
303 # check if it's an interface name, e.g. eth1
304 for d in devices.keys():
305 if dev_name in devices[d]["Interface"].split(","):
306 return devices[d]["Slot"]
307 # if nothing else matches - error
308 raise ValueError("Unknown device: %s. "
309 "Please specify device in \"bus:slot.func\" format" % dev_name)
312 def unbind_one(dev_id, force):
313 '''Unbind the device identified by "dev_id" from its current driver'''
314 dev = devices[dev_id]
315 if not has_driver(dev_id):
316 print("Notice: %s %s %s is not currently managed by any driver" %
317 (dev["Slot"], dev["Device_str"], dev["Interface"]), file=sys.stderr)
320 # prevent us disconnecting ourselves
321 if dev["Ssh_if"] and not force:
322 print("Warning: routing table indicates that interface %s is active. "
323 "Skipping unbind" % dev_id, file=sys.stderr)
326 # write to /sys to unbind
327 filename = "/sys/bus/pci/drivers/%s/unbind" % dev["Driver_str"]
329 f = open(filename, "a")
330 except OSError as err:
331 sys.exit("Error: unbind failed for %s - Cannot open %s: %s" %
332 (dev_id, filename, err))
337 def bind_one(dev_id, driver, force):
338 '''Bind the device given by "dev_id" to the driver "driver". If the device
339 is already bound to a different driver, it will be unbound first'''
340 dev = devices[dev_id]
341 saved_driver = None # used to rollback any unbind in case of failure
343 # prevent disconnection of our ssh session
344 if dev["Ssh_if"] and not force:
345 print("Warning: routing table indicates that interface %s is active. "
346 "Not modifying" % dev_id, file=sys.stderr)
349 # unbind any existing drivers we don't want
350 if has_driver(dev_id):
351 if dev["Driver_str"] == driver:
352 print("Notice: %s already bound to driver %s, skipping" %
353 (dev_id, driver), file=sys.stderr)
355 saved_driver = dev["Driver_str"]
356 unbind_one(dev_id, force)
357 dev["Driver_str"] = "" # clear driver string
359 # For kernels >= 3.15 driver_override can be used to specify the driver
360 # for a device rather than relying on the driver to provide a positive
361 # match of the device. The existing process of looking up
362 # the vendor and device ID, adding them to the driver new_id,
363 # will erroneously bind other devices too which has the additional burden
364 # of unbinding those devices
365 if driver in dpdk_drivers:
366 filename = "/sys/bus/pci/devices/%s/driver_override" % dev_id
369 f = open(filename, "w")
370 except OSError as err:
371 print("Error: bind failed for %s - Cannot open %s: %s"
372 % (dev_id, filename, err), file=sys.stderr)
375 f.write("%s" % driver)
377 except OSError as err:
378 print("Error: bind failed for %s - Cannot write driver %s to "
379 "PCI ID: %s" % (dev_id, driver, err), file=sys.stderr)
381 # For kernels < 3.15 use new_id to add PCI id's to the driver
383 filename = "/sys/bus/pci/drivers/%s/new_id" % driver
385 f = open(filename, "w")
386 except OSError as err:
387 print("Error: bind failed for %s - Cannot open %s: %s"
388 % (dev_id, filename, err), file=sys.stderr)
391 # Convert Device and Vendor Id to int to write to new_id
392 f.write("%04x %04x" % (int(dev["Vendor"], 16),
393 int(dev["Device"], 16)))
395 except OSError as err:
396 print("Error: bind failed for %s - Cannot write new PCI ID to "
397 "driver %s: %s" % (dev_id, driver, err), file=sys.stderr)
400 # do the bind by writing to /sys
401 filename = "/sys/bus/pci/drivers/%s/bind" % driver
403 f = open(filename, "a")
404 except OSError as err:
405 print("Error: bind failed for %s - Cannot open %s: %s"
406 % (dev_id, filename, err), file=sys.stderr)
407 if saved_driver is not None: # restore any previous driver
408 bind_one(dev_id, saved_driver, force)
413 except OSError as err:
414 # for some reason, closing dev_id after adding a new PCI ID to new_id
415 # results in IOError. however, if the device was successfully bound,
416 # we don't care for any errors and can safely ignore IOError
417 tmp = get_pci_device_details(dev_id, True)
418 if "Driver_str" in tmp and tmp["Driver_str"] == driver:
420 print("Error: bind failed for %s - Cannot bind to driver %s: %s"
421 % (dev_id, driver, err), file=sys.stderr)
422 if saved_driver is not None: # restore any previous driver
423 bind_one(dev_id, saved_driver, force)
426 # For kernels > 3.15 driver_override is used to bind a device to a driver.
427 # Before unbinding it, overwrite driver_override with empty string so that
428 # the device can be bound to any other driver
429 filename = "/sys/bus/pci/devices/%s/driver_override" % dev_id
432 f = open(filename, "w")
433 except OSError as err:
434 sys.exit("Error: unbind failed for %s - Cannot open %s: %s"
435 % (dev_id, filename, err))
439 except OSError as err:
440 sys.exit("Error: unbind failed for %s - Cannot write %s: %s"
441 % (dev_id, filename, err))
444 def unbind_all(dev_list, force=False):
445 """Unbind method, takes a list of device locations"""
447 if dev_list[0] == "dpdk":
448 for d in devices.keys():
449 if "Driver_str" in devices[d]:
450 if devices[d]["Driver_str"] in dpdk_drivers:
451 unbind_one(devices[d]["Slot"], force)
455 dev_list = map(dev_id_from_dev_name, dev_list)
456 except ValueError as ex:
464 def bind_all(dev_list, driver, force=False):
465 """Bind method, takes a list of device locations"""
468 # a common user error is to forget to specify the driver the devices need to
469 # be bound to. check if the driver is a valid device, and if it is, show
470 # a meaningful error.
472 dev_id_from_dev_name(driver)
473 # if we've made it this far, this means that the "driver" was a valid
474 # device string, so it's probably not a valid driver name.
475 sys.exit("Error: Driver '%s' does not look like a valid driver. "
476 "Did you forget to specify the driver to bind devices to?" % driver)
478 # driver generated error - it's not a valid device ID, so all is well
481 # check if we're attempting to bind to a driver that isn't loaded
482 if not module_is_loaded(driver.replace('-', '_')):
483 sys.exit("Error: Driver '%s' is not loaded." % driver)
486 dev_list = map(dev_id_from_dev_name, dev_list)
487 except ValueError as ex:
491 bind_one(d, driver, force)
493 # For kernels < 3.15 when binding devices to a generic driver
494 # (i.e. one that doesn't have a PCI ID table) using new_id, some devices
495 # that are not bound to any other driver could be bound even if no one has
496 # asked them to. hence, we check the list of drivers again, and see if
497 # some of the previously-unbound devices were erroneously bound.
498 if not exists("/sys/bus/pci/devices/%s/driver_override" % d):
499 for d in devices.keys():
500 # skip devices that were already bound or that we know should be bound
501 if "Driver_str" in devices[d] or d in dev_list:
504 # update information about this device
505 devices[d] = dict(devices[d].items()
506 + get_pci_device_details(d, True).items())
508 # check if updated information indicates that the device was bound
509 if "Driver_str" in devices[d]:
513 def display_devices(title, dev_list, extra_params=None):
514 '''Displays to the user the details of a list of devices given in
515 "dev_list". The "extra_params" parameter, if given, should contain a string
516 with %()s fields in it for replacement by the named fields in each
517 device's dictionary.'''
518 strings = [] # this holds the strings to print. We sort before printing
519 print("\n%s" % title)
520 print("=" * len(title))
522 strings.append("<none>")
525 if extra_params is not None:
526 strings.append("%s '%s %s' %s" % (dev["Slot"],
531 strings.append("%s '%s'" % (dev["Slot"], dev["Device_str"]))
532 # sort before printing, so that the entries appear in PCI order
534 print("\n".join(strings)) # print one per line
537 def show_device_status(devices_type, device_name, if_field=False):
543 # split our list of network devices into the three categories above
544 for d in devices.keys():
545 if device_type_match(devices[d], devices_type):
546 if not has_driver(d):
547 no_drv.append(devices[d])
549 if devices[d]["Driver_str"] in dpdk_drivers:
550 dpdk_drv.append(devices[d])
552 kernel_drv.append(devices[d])
554 n_devs = len(dpdk_drv) + len(kernel_drv) + len(no_drv)
556 # don't bother displaying anything if there are no devices
558 msg = "No '%s' devices detected" % device_name
561 print("".join('=' * len(msg)))
564 # print each category separately, so we can clearly see what's used by DPDK
566 display_devices("%s devices using DPDK-compatible driver" % device_name,
567 dpdk_drv, "drv=%(Driver_str)s unused=%(Module_str)s")
571 if_text = "if=%(Interface)s "
572 display_devices("%s devices using kernel driver" % device_name, kernel_drv,
573 if_text + "drv=%(Driver_str)s "
574 "unused=%(Module_str)s %(Active)s")
576 display_devices("Other %s devices" % device_name, no_drv,
577 "unused=%(Module_str)s")
581 '''Function called when the script is passed the "--status" option.
582 Displays to the user what devices are bound to the igb_uio driver, the
583 kernel driver or to no driver'''
585 if status_dev in ["net", "all"]:
586 show_device_status(network_devices, "Network", if_field=True)
588 if status_dev in ["baseband", "all"]:
589 show_device_status(baseband_devices, "Baseband")
591 if status_dev in ["crypto", "all"]:
592 show_device_status(crypto_devices, "Crypto")
594 if status_dev in ["dma", "all"]:
595 show_device_status(dma_devices, "DMA")
597 if status_dev in ["event", "all"]:
598 show_device_status(eventdev_devices, "Eventdev")
600 if status_dev in ["mempool", "all"]:
601 show_device_status(mempool_devices, "Mempool")
603 if status_dev in ["compress", "all"]:
604 show_device_status(compress_devices, "Compress")
606 if status_dev in ["misc", "all"]:
607 show_device_status(misc_devices, "Misc (rawdev)")
609 if status_dev in ["regex", "all"]:
610 show_device_status(regex_devices, "Regex")
614 '''Returns a list containing either:
615 * List of PCI B:D:F matching arg, using shell wildcards e.g. 80:04.*
616 * Only the passed arg if matching list is empty'''
617 sysfs_path = "/sys/bus/pci/devices"
618 for _glob in [arg, '0000:' + arg]:
619 paths = [basename(path) for path in glob(path_join(sysfs_path, _glob))]
626 '''Parses the command-line arguments given by the user and takes the
627 appropriate action for each'''
634 parser = argparse.ArgumentParser(
635 description='Utility to bind and unbind devices from Linux kernel',
636 formatter_class=argparse.RawDescriptionHelpFormatter,
641 To display current device status:
644 To display current network device status:
645 %(prog)s --status-dev net
647 To bind eth1 from the current driver and move to use vfio-pci
648 %(prog)s --bind=vfio-pci eth1
650 To unbind 0000:01:00.0 from using any driver
651 %(prog)s -u 0000:01:00.0
653 To bind 0000:02:00.0 and 0000:02:00.1 to the ixgbe kernel driver
654 %(prog)s -b ixgbe 02:00.0 02:00.1
661 help="Print the current status of all known devices.")
664 help="Print the status of given device group.",
665 choices=['baseband', 'compress', 'crypto', 'dma', 'event',
666 'mempool', 'misc', 'net', 'regex'])
667 bind_group = parser.add_mutually_exclusive_group()
668 bind_group.add_argument(
672 help="Select the driver to use or \"none\" to unbind the device")
673 bind_group.add_argument(
677 help="Unbind a device (equivalent to \"-b none\")")
682 Override restriction on binding devices in use by Linux"
683 WARNING: This can lead to loss of network connection and should be used with caution.
690 Device specified as PCI "domain:bus:slot.func" syntax or "bus:slot.func" syntax.
691 For devices bound to Linux kernel drivers, they may be referred to by interface name.
694 opt = parser.parse_args()
698 status_dev = opt.status_dev
710 if not b_flag and not status_flag:
711 print("Error: No action specified for devices. "
712 "Please give a --bind, --ubind or --status option",
717 if b_flag and not args:
718 print("Error: No devices specified.", file=sys.stderr)
722 # resolve any PCI globs in the args
725 new_args.extend(pci_glob(arg))
729 def do_arg_actions():
730 '''do the actual action requested by the user'''
736 if b_flag in ["none", "None"]:
737 unbind_all(args, force_flag)
738 elif b_flag is not None:
739 bind_all(args, b_flag, force_flag)
741 if b_flag is not None:
743 # refresh if we have changed anything
744 get_device_details(network_devices)
745 get_device_details(baseband_devices)
746 get_device_details(crypto_devices)
747 get_device_details(dma_devices)
748 get_device_details(eventdev_devices)
749 get_device_details(mempool_devices)
750 get_device_details(compress_devices)
751 get_device_details(regex_devices)
752 get_device_details(misc_devices)
757 '''program main function'''
758 # check if lspci is installed, suppress any output
759 with open(os.devnull, 'w') as devnull:
760 ret = subprocess.call(['which', 'lspci'],
761 stdout=devnull, stderr=devnull)
763 sys.exit("'lspci' not found - please install 'pciutils'")
767 get_device_details(network_devices)
768 get_device_details(baseband_devices)
769 get_device_details(crypto_devices)
770 get_device_details(dma_devices)
771 get_device_details(eventdev_devices)
772 get_device_details(mempool_devices)
773 get_device_details(compress_devices)
774 get_device_details(regex_devices)
775 get_device_details(misc_devices)
779 if __name__ == "__main__":