| 3909 | } |
| 3910 | |
| 3911 | static void |
| 3912 | rmv_port_callback(void *arg) |
| 3913 | { |
| 3914 | int need_to_start = 0; |
| 3915 | int org_no_link_check = no_link_check; |
| 3916 | portid_t port_id = (intptr_t)arg; |
| 3917 | struct rte_eth_dev_info dev_info; |
| 3918 | int ret; |
| 3919 | |
| 3920 | RTE_ETH_VALID_PORTID_OR_RET(port_id); |
| 3921 | |
| 3922 | if (!test_done && port_is_forwarding(port_id)) { |
| 3923 | need_to_start = 1; |
| 3924 | stop_packet_forwarding(); |
| 3925 | } |
| 3926 | no_link_check = 1; |
| 3927 | stop_port(port_id); |
| 3928 | no_link_check = org_no_link_check; |
| 3929 | |
| 3930 | ret = eth_dev_info_get_print_err(port_id, &dev_info); |
| 3931 | if (ret != 0) |
| 3932 | TESTPMD_LOG(ERR, |
| 3933 | "Failed to get device info for port %d, not detaching\n", |
| 3934 | port_id); |
| 3935 | else { |
| 3936 | struct rte_device *device = dev_info.device; |
| 3937 | close_port(port_id); |
| 3938 | detach_device(device); /* might be already removed or have more ports */ |
| 3939 | } |
| 3940 | if (need_to_start) |
| 3941 | start_packet_forwarding(0); |
| 3942 | } |
| 3943 | |
| 3944 | /* This function is used by the interrupt thread */ |
| 3945 | static int |
nothing calls this directly
no test coverage detected