struct rte_mbuf *m)
{
uint16_t ret;
- struct rte_mbuf *m_cpl[1];
+ struct rte_mbuf *m_cpl[1], *comp_pkt;
+ uint32_t nr_comp = 0;
if (builtin_net_driver) {
ret = vs_enqueue_pkts(dst_vdev, VIRTIO_RXQ, &m, 1);
} else if (async_vhost_driver) {
ret = rte_vhost_submit_enqueue_burst(dst_vdev->vid, VIRTIO_RXQ,
- &m, 1);
+ &m, 1, &comp_pkt, &nr_comp);
+ if (nr_comp == 1)
+ goto done;
if (likely(ret))
dst_vdev->nr_async_pkts++;
ret = rte_vhost_enqueue_burst(dst_vdev->vid, VIRTIO_RXQ, &m, 1);
}
+done:
if (enable_stats) {
rte_atomic64_inc(&dst_vdev->stats.rx_total_atomic);
rte_atomic64_add(&dst_vdev->stats.rx_atomic, ret);
drain_eth_rx(struct vhost_dev *vdev)
{
uint16_t rx_count, enqueue_count;
- struct rte_mbuf *pkts[MAX_PKT_BURST];
+ struct rte_mbuf *pkts[MAX_PKT_BURST], *comp_pkts[MAX_PKT_BURST];
+ uint32_t nr_comp = 0;
rx_count = rte_eth_rx_burst(ports[0], vdev->vmdq_rx_q,
pkts, MAX_PKT_BURST);
pkts, rx_count);
} else if (async_vhost_driver) {
enqueue_count = rte_vhost_submit_enqueue_burst(vdev->vid,
- VIRTIO_RXQ, pkts, rx_count);
+ VIRTIO_RXQ, pkts, rx_count, comp_pkts,
+ &nr_comp);
+ if (nr_comp > 0) {
+ free_pkts(comp_pkts, nr_comp);
+ enqueue_count -= nr_comp;
+ }
vdev->nr_async_pkts += enqueue_count;
} else {
enqueue_count = rte_vhost_enqueue_burst(vdev->vid, VIRTIO_RXQ,
int lcore, core_add = 0;
uint32_t device_num_min = num_devices;
struct vhost_dev *vdev;
-
- struct rte_vhost_async_channel_ops channel_ops = {
- .transfer_data = ioat_transfer_data_cb,
- .check_completed_copies = ioat_check_completed_copies_cb
- };
- struct rte_vhost_async_features f;
-
vdev = rte_zmalloc("vhost device", sizeof(*vdev), RTE_CACHE_LINE_SIZE);
if (vdev == NULL) {
RTE_LOG(INFO, VHOST_DATA,
vid, vdev->coreid);
if (async_vhost_driver) {
- f.async_inorder = 1;
- f.async_threshold = 256;
- return rte_vhost_async_channel_register(vid, VIRTIO_RXQ,
- f.intval, &channel_ops);
+ struct rte_vhost_async_features f;
+ struct rte_vhost_async_channel_ops channel_ops;
+ if (strncmp(dma_type, "ioat", 4) == 0) {
+ channel_ops.transfer_data = ioat_transfer_data_cb;
+ channel_ops.check_completed_copies =
+ ioat_check_completed_copies_cb;
+ f.async_inorder = 1;
+ f.async_threshold = 256;
+ return rte_vhost_async_channel_register(vid, VIRTIO_RXQ,
+ f.intval, &channel_ops);
+ }
}
return 0;