[dpdk-dev] [PATCH v3 10/15] vhost: optimize enqueue function of packed ring
Tiwei Bie
tiwei.bie at intel.com
Thu Sep 26 07:56:34 CEST 2019
On Thu, Sep 26, 2019 at 01:13:24AM +0800, Marvin Liu wrote:
> static __rte_noinline uint32_t
> virtio_dev_rx_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,
> struct rte_mbuf **pkts, uint32_t count)
> {
> uint32_t pkt_idx = 0;
> - uint16_t num_buffers;
> - struct buf_vector buf_vec[BUF_VECTOR_MAX];
> -
> - for (pkt_idx = 0; pkt_idx < count; pkt_idx++) {
> - uint32_t pkt_len = pkts[pkt_idx]->pkt_len + dev->vhost_hlen;
> - uint16_t nr_vec = 0;
> - uint16_t nr_descs = 0;
> -
> - if (unlikely(reserve_avail_buf_packed(dev, vq,
> - pkt_len, buf_vec, &nr_vec,
> - &num_buffers, &nr_descs) < 0)) {
> - VHOST_LOG_DEBUG(VHOST_DATA,
> - "(%d) failed to get enough desc from vring\n",
> - dev->vid);
> - vq->shadow_used_idx -= num_buffers;
> - break;
> + uint32_t remained = count;
> +
> + do {
> + rte_prefetch0(&vq->desc_packed[vq->last_avail_idx &
> + (vq->size - 1)]);
You can't assume packed ring size is a power of 2.
More information about the dev
mailing list