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

Function vring_state_changed

dpdk/drivers/net/vhost/rte_eth_vhost.c:929–968  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

927}
928
929static int
930vring_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
970static struct rte_vhost_device_ops vhost_ops = {
971 .new_device = new_device,

Callers

nothing calls this directly

Calls 7

rte_vhost_get_ifnameFunction · 0.85
eth_vhost_update_intrFunction · 0.85
update_queuing_statusFunction · 0.85
find_internal_resourceFunction · 0.70
rte_spinlock_lockFunction · 0.50
rte_spinlock_unlockFunction · 0.50

Tested by

no test coverage detected