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

Function detach_device

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

Source from the content-addressed store, hash-verified

3672}
3673
3674static void
3675detach_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
3709void
3710detach_port_device(portid_t port_id)

Callers 2

detach_port_deviceFunction · 0.85
rmv_port_callbackFunction · 0.85

Calls 5

rte_dev_removeFunction · 0.85
rte_dev_nameFunction · 0.85
remove_invalid_portsFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected