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

Function detach_devargs

dpdk/app/test-pmd/testpmd.c:3736–3777  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3734}
3735
3736void
3737detach_devargs(char *identifier)
3738{
3739 struct rte_dev_iterator iterator;
3740 struct rte_devargs da;
3741 portid_t port_id;
3742
3743 printf("Removing a device...\n");
3744
3745 memset(&da, 0, sizeof(da));
3746 if (rte_devargs_parsef(&da, "%s", identifier)) {
3747 fprintf(stderr, "cannot parse identifier\n");
3748 return;
3749 }
3750
3751 RTE_ETH_FOREACH_MATCHING_DEV(port_id, identifier, &iterator) {
3752 if (ports[port_id].port_status != RTE_PORT_CLOSED) {
3753 if (ports[port_id].port_status != RTE_PORT_STOPPED) {
3754 fprintf(stderr, "Port %u not stopped\n",
3755 port_id);
3756 rte_eth_iterator_cleanup(&iterator);
3757 rte_devargs_reset(&da);
3758 return;
3759 }
3760 flush_port_owned_resources(port_id);
3761 }
3762 }
3763
3764 if (rte_eal_hotplug_remove(rte_bus_name(da.bus), da.name) != 0) {
3765 TESTPMD_LOG(ERR, "Failed to detach device %s(%s)\n",
3766 da.name, rte_bus_name(da.bus));
3767 rte_devargs_reset(&da);
3768 return;
3769 }
3770
3771 remove_invalid_ports();
3772
3773 printf("Device %s is detached\n", identifier);
3774 printf("Now total ports is %d\n", nb_ports);
3775 printf("Done\n");
3776 rte_devargs_reset(&da);
3777}
3778
3779void
3780pmd_test_exit(void)

Callers 1

Calls 9

memsetFunction · 0.85
rte_devargs_parsefFunction · 0.85
rte_eth_iterator_cleanupFunction · 0.85
rte_devargs_resetFunction · 0.85
rte_eal_hotplug_removeFunction · 0.85
rte_bus_nameFunction · 0.85
remove_invalid_portsFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected