| 927 | } |
| 928 | |
| 929 | static int |
| 930 | vring_state_changed(int vid, uint16_t vring, int enable) |
| 931 | { |
| 932 | struct rte_vhost_vring_state *state; |
| 933 | struct rte_eth_dev *eth_dev; |
| 934 | struct internal_list *list; |
| 935 | char ifname[PATH_MAX]; |
| 936 | |
| 937 | rte_vhost_get_ifname(vid, ifname, sizeof(ifname)); |
| 938 | list = find_internal_resource(ifname); |
| 939 | if (list == NULL) { |
| 940 | VHOST_LOG(ERR, "Invalid interface name: %s\n", ifname); |
| 941 | return -1; |
| 942 | } |
| 943 | |
| 944 | eth_dev = list->eth_dev; |
| 945 | /* won't be NULL */ |
| 946 | state = vring_states[eth_dev->data->port_id]; |
| 947 | |
| 948 | if (eth_dev->data->dev_conf.intr_conf.rxq && vring % 2) |
| 949 | eth_vhost_update_intr(eth_dev, (vring - 1) >> 1); |
| 950 | |
| 951 | rte_spinlock_lock(&state->lock); |
| 952 | if (state->cur[vring] == enable) { |
| 953 | rte_spinlock_unlock(&state->lock); |
| 954 | return 0; |
| 955 | } |
| 956 | state->cur[vring] = enable; |
| 957 | state->max_vring = RTE_MAX(vring, state->max_vring); |
| 958 | rte_spinlock_unlock(&state->lock); |
| 959 | |
| 960 | update_queuing_status(eth_dev, false); |
| 961 | |
| 962 | VHOST_LOG(INFO, "vring%u is %s\n", |
| 963 | vring, enable ? "enabled" : "disabled"); |
| 964 | |
| 965 | rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_QUEUE_STATE, NULL); |
| 966 | |
| 967 | return 0; |
| 968 | } |
| 969 | |
| 970 | static struct rte_vhost_device_ops vhost_ops = { |
| 971 | .new_device = new_device, |
nothing calls this directly
no test coverage detected