| 622 | } |
| 623 | |
| 624 | void |
| 625 | device_infos_display(const char *identifier) |
| 626 | { |
| 627 | static const char *info_border = "*********************"; |
| 628 | struct rte_bus *start = NULL, *next; |
| 629 | struct rte_dev_iterator dev_iter; |
| 630 | char name[RTE_ETH_NAME_MAX_LEN]; |
| 631 | struct rte_ether_addr mac_addr; |
| 632 | struct rte_device *dev; |
| 633 | struct rte_devargs da; |
| 634 | portid_t port_id; |
| 635 | struct rte_eth_dev_info dev_info; |
| 636 | char devstr[128]; |
| 637 | |
| 638 | memset(&da, 0, sizeof(da)); |
| 639 | if (!identifier) |
| 640 | goto skip_parse; |
| 641 | |
| 642 | if (rte_devargs_parsef(&da, "%s", identifier)) { |
| 643 | fprintf(stderr, "cannot parse identifier\n"); |
| 644 | return; |
| 645 | } |
| 646 | |
| 647 | skip_parse: |
| 648 | while ((next = rte_bus_find(start, bus_match_all, NULL)) != NULL) { |
| 649 | |
| 650 | start = next; |
| 651 | if (identifier && da.bus != next) |
| 652 | continue; |
| 653 | |
| 654 | snprintf(devstr, sizeof(devstr), "bus=%s", rte_bus_name(next)); |
| 655 | RTE_DEV_FOREACH(dev, devstr, &dev_iter) { |
| 656 | |
| 657 | if (rte_dev_driver(dev) == NULL) |
| 658 | continue; |
| 659 | /* Check for matching device if identifier is present */ |
| 660 | if (identifier && |
| 661 | strncmp(da.name, rte_dev_name(dev), strlen(rte_dev_name(dev)))) |
| 662 | continue; |
| 663 | printf("\n%s Infos for device %s %s\n", |
| 664 | info_border, rte_dev_name(dev), info_border); |
| 665 | printf("Bus name: %s", rte_bus_name(rte_dev_bus(dev))); |
| 666 | printf("\nBus information: %s", |
| 667 | rte_dev_bus_info(dev) ? rte_dev_bus_info(dev) : ""); |
| 668 | printf("\nDriver name: %s", rte_driver_name(rte_dev_driver(dev))); |
| 669 | printf("\nDevargs: %s", |
| 670 | rte_dev_devargs(dev) ? rte_dev_devargs(dev)->args : ""); |
| 671 | printf("\nConnect to socket: %d", rte_dev_numa_node(dev)); |
| 672 | printf("\n"); |
| 673 | |
| 674 | /* List ports with matching device name */ |
| 675 | RTE_ETH_FOREACH_DEV_OF(port_id, dev) { |
| 676 | printf("\n\tPort id: %-2d", port_id); |
| 677 | if (eth_macaddr_get_print_err(port_id, |
| 678 | &mac_addr) == 0) |
| 679 | print_ethaddr("\n\tMAC address: ", |
| 680 | &mac_addr); |
| 681 | rte_eth_dev_get_name_by_port(port_id, name); |
no test coverage detected