| 872 | } |
| 873 | |
| 874 | static void |
| 875 | destroy_device(int vid) |
| 876 | { |
| 877 | struct rte_eth_dev *eth_dev; |
| 878 | struct pmd_internal *internal; |
| 879 | struct vhost_queue *vq; |
| 880 | struct internal_list *list; |
| 881 | char ifname[PATH_MAX]; |
| 882 | unsigned i; |
| 883 | struct rte_vhost_vring_state *state; |
| 884 | |
| 885 | rte_vhost_get_ifname(vid, ifname, sizeof(ifname)); |
| 886 | list = find_internal_resource(ifname); |
| 887 | if (list == NULL) { |
| 888 | VHOST_LOG(ERR, "Invalid interface name: %s\n", ifname); |
| 889 | return; |
| 890 | } |
| 891 | eth_dev = list->eth_dev; |
| 892 | internal = eth_dev->data->dev_private; |
| 893 | |
| 894 | rte_atomic32_set(&internal->dev_attached, 0); |
| 895 | update_queuing_status(eth_dev, true); |
| 896 | eth_vhost_unconfigure_intr(eth_dev); |
| 897 | |
| 898 | eth_dev->data->dev_link.link_status = RTE_ETH_LINK_DOWN; |
| 899 | |
| 900 | if (eth_dev->data->rx_queues && eth_dev->data->tx_queues) { |
| 901 | for (i = 0; i < eth_dev->data->nb_rx_queues; i++) { |
| 902 | vq = eth_dev->data->rx_queues[i]; |
| 903 | if (!vq) |
| 904 | continue; |
| 905 | vq->vid = -1; |
| 906 | } |
| 907 | for (i = 0; i < eth_dev->data->nb_tx_queues; i++) { |
| 908 | vq = eth_dev->data->tx_queues[i]; |
| 909 | if (!vq) |
| 910 | continue; |
| 911 | vq->vid = -1; |
| 912 | } |
| 913 | } |
| 914 | |
| 915 | state = vring_states[eth_dev->data->port_id]; |
| 916 | rte_spinlock_lock(&state->lock); |
| 917 | for (i = 0; i <= state->max_vring; i++) { |
| 918 | state->cur[i] = false; |
| 919 | state->seen[i] = false; |
| 920 | } |
| 921 | state->max_vring = 0; |
| 922 | rte_spinlock_unlock(&state->lock); |
| 923 | |
| 924 | VHOST_LOG(INFO, "Vhost device %d destroyed\n", vid); |
| 925 | |
| 926 | rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL); |
| 927 | } |
| 928 | |
| 929 | static int |
| 930 | vring_state_changed(int vid, uint16_t vring, int enable) |
nothing calls this directly
no test coverage detected