| 1882 | } |
| 1883 | |
| 1884 | static int |
| 1885 | vhost_check_queue_inflights_split(struct virtio_net *dev, |
| 1886 | struct vhost_virtqueue *vq) |
| 1887 | { |
| 1888 | uint16_t i; |
| 1889 | uint16_t resubmit_num = 0, last_io, num; |
| 1890 | struct vring_used *used = vq->used; |
| 1891 | struct rte_vhost_resubmit_info *resubmit; |
| 1892 | struct rte_vhost_inflight_info_split *inflight_split; |
| 1893 | |
| 1894 | if (!(dev->protocol_features & |
| 1895 | (1ULL << VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD))) |
| 1896 | return RTE_VHOST_MSG_RESULT_OK; |
| 1897 | |
| 1898 | /* The frontend may still not support the inflight feature |
| 1899 | * although we negotiate the protocol feature. |
| 1900 | */ |
| 1901 | if ((!vq->inflight_split)) |
| 1902 | return RTE_VHOST_MSG_RESULT_OK; |
| 1903 | |
| 1904 | if (!vq->inflight_split->version) { |
| 1905 | vq->inflight_split->version = INFLIGHT_VERSION; |
| 1906 | return RTE_VHOST_MSG_RESULT_OK; |
| 1907 | } |
| 1908 | |
| 1909 | if (vq->resubmit_inflight) |
| 1910 | return RTE_VHOST_MSG_RESULT_OK; |
| 1911 | |
| 1912 | inflight_split = vq->inflight_split; |
| 1913 | vq->global_counter = 0; |
| 1914 | last_io = inflight_split->last_inflight_io; |
| 1915 | |
| 1916 | if (inflight_split->used_idx != used->idx) { |
| 1917 | inflight_split->desc[last_io].inflight = 0; |
| 1918 | rte_atomic_thread_fence(rte_memory_order_seq_cst); |
| 1919 | inflight_split->used_idx = used->idx; |
| 1920 | } |
| 1921 | |
| 1922 | for (i = 0; i < inflight_split->desc_num; i++) { |
| 1923 | if (inflight_split->desc[i].inflight == 1) |
| 1924 | resubmit_num++; |
| 1925 | } |
| 1926 | |
| 1927 | vq->last_avail_idx += resubmit_num; |
| 1928 | |
| 1929 | if (resubmit_num) { |
| 1930 | resubmit = rte_zmalloc_socket("resubmit", sizeof(struct rte_vhost_resubmit_info), |
| 1931 | 0, vq->numa_node); |
| 1932 | if (!resubmit) { |
| 1933 | VHOST_LOG_CONFIG(dev->ifname, ERR, |
| 1934 | "failed to allocate memory for resubmit info.\n"); |
| 1935 | return RTE_VHOST_MSG_RESULT_ERR; |
| 1936 | } |
| 1937 | |
| 1938 | resubmit->resubmit_list = rte_zmalloc_socket("resubmit_list", |
| 1939 | resubmit_num * sizeof(struct rte_vhost_resubmit_desc), |
| 1940 | 0, vq->numa_node); |
| 1941 | if (!resubmit->resubmit_list) { |
no test coverage detected