| 3672 | } |
| 3673 | |
| 3674 | static void |
| 3675 | detach_device(struct rte_device *dev) |
| 3676 | { |
| 3677 | portid_t sibling; |
| 3678 | |
| 3679 | if (dev == NULL) { |
| 3680 | fprintf(stderr, "Device already removed\n"); |
| 3681 | return; |
| 3682 | } |
| 3683 | |
| 3684 | printf("Removing a device...\n"); |
| 3685 | |
| 3686 | RTE_ETH_FOREACH_DEV_OF(sibling, dev) { |
| 3687 | if (ports[sibling].port_status != RTE_PORT_CLOSED) { |
| 3688 | if (ports[sibling].port_status != RTE_PORT_STOPPED) { |
| 3689 | fprintf(stderr, "Port %u not stopped\n", |
| 3690 | sibling); |
| 3691 | return; |
| 3692 | } |
| 3693 | flush_port_owned_resources(sibling); |
| 3694 | } |
| 3695 | } |
| 3696 | |
| 3697 | if (rte_dev_remove(dev) < 0) { |
| 3698 | TESTPMD_LOG(ERR, "Failed to detach device %s\n", rte_dev_name(dev)); |
| 3699 | return; |
| 3700 | } |
| 3701 | remove_invalid_ports(); |
| 3702 | |
| 3703 | printf("Device is detached\n"); |
| 3704 | printf("Now total ports is %d\n", nb_ports); |
| 3705 | printf("Done\n"); |
| 3706 | return; |
| 3707 | } |
| 3708 | |
| 3709 | void |
| 3710 | detach_port_device(portid_t port_id) |
no test coverage detected