[dpdk-dev] [PATCH v2 2/6] vhost: remove obsolete

2016-08-19 Thread Yuanhan Liu
On Thu, Aug 18, 2016 at 02:33:07AM -0400, Zhihong Wang wrote:
> This patch removes obsolete functions.

Splitting patches doesn't work in this way: this should be in the first
patch. Otherwise, build breaks in the first patch, as some functions are
defined but not used.

--yliu


[dpdk-dev] [PATCH v2 2/6] vhost: remove obsolete

2016-08-19 Thread Wang, Zhihong


> -Original Message-
> From: Yuanhan Liu [mailto:yuanhan.liu at linux.intel.com]
> Sent: Friday, August 19, 2016 10:33 AM
> To: Wang, Zhihong 
> Cc: dev at dpdk.org; maxime.coquelin at redhat.com
> Subject: Re: [PATCH v2 2/6] vhost: remove obsolete
> 
> On Thu, Aug 18, 2016 at 02:33:07AM -0400, Zhihong Wang wrote:
> > This patch removes obsolete functions.
> 
> Splitting patches doesn't work in this way: this should be in the first
> patch. Otherwise, build breaks in the first patch, as some functions are
> defined but not used.

Thanks. I'll send out v3 soon, also to fix a small glitch
while running in old platform like snb and ivb.

> 
>   --yliu


[dpdk-dev] [PATCH v2 2/6] vhost: remove obsolete

2016-08-18 Thread Zhihong Wang
This patch removes obsolete functions.

Signed-off-by: Zhihong Wang 
---
 lib/librte_vhost/vhost_rxtx.c | 408 --
 1 file changed, 408 deletions(-)

diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c
index 8e6d782..939957d 100644
--- a/lib/librte_vhost/vhost_rxtx.c
+++ b/lib/librte_vhost/vhost_rxtx.c
@@ -125,414 +125,6 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct 
virtio_net_hdr *net_hdr)
}
 }

-static inline void
-copy_virtio_net_hdr(struct virtio_net *dev, uint64_t desc_addr,
-   struct virtio_net_hdr_mrg_rxbuf hdr)
-{
-   if (dev->vhost_hlen == sizeof(struct virtio_net_hdr_mrg_rxbuf))
-   *(struct virtio_net_hdr_mrg_rxbuf *)(uintptr_t)desc_addr = hdr;
-   else
-   *(struct virtio_net_hdr *)(uintptr_t)desc_addr = hdr.hdr;
-}
-
-static inline int __attribute__((always_inline))
-copy_mbuf_to_desc(struct virtio_net *dev, struct vhost_virtqueue *vq,
- struct rte_mbuf *m, uint16_t desc_idx)
-{
-   uint32_t desc_avail, desc_offset;
-   uint32_t mbuf_avail, mbuf_offset;
-   uint32_t cpy_len;
-   struct vring_desc *desc;
-   uint64_t desc_addr;
-   struct virtio_net_hdr_mrg_rxbuf virtio_hdr = {{0, 0, 0, 0, 0, 0}, 0};
-
-   desc = >desc[desc_idx];
-   desc_addr = gpa_to_vva(dev, desc->addr);
-   /*
-* Checking of 'desc_addr' placed outside of 'unlikely' macro to avoid
-* performance issue with some versions of gcc (4.8.4 and 5.3.0) which
-* otherwise stores offset on the stack instead of in a register.
-*/
-   if (unlikely(desc->len < dev->vhost_hlen) || !desc_addr)
-   return -1;
-
-   rte_prefetch0((void *)(uintptr_t)desc_addr);
-
-   virtio_enqueue_offload(m, _hdr.hdr);
-   copy_virtio_net_hdr(dev, desc_addr, virtio_hdr);
-   vhost_log_write(dev, desc->addr, dev->vhost_hlen);
-   PRINT_PACKET(dev, (uintptr_t)desc_addr, dev->vhost_hlen, 0);
-
-   desc_offset = dev->vhost_hlen;
-   desc_avail  = desc->len - dev->vhost_hlen;
-
-   mbuf_avail  = rte_pktmbuf_data_len(m);
-   mbuf_offset = 0;
-   while (mbuf_avail != 0 || m->next != NULL) {
-   /* done with current mbuf, fetch next */
-   if (mbuf_avail == 0) {
-   m = m->next;
-
-   mbuf_offset = 0;
-   mbuf_avail  = rte_pktmbuf_data_len(m);
-   }
-
-   /* done with current desc buf, fetch next */
-   if (desc_avail == 0) {
-   if ((desc->flags & VRING_DESC_F_NEXT) == 0) {
-   /* Room in vring buffer is not enough */
-   return -1;
-   }
-   if (unlikely(desc->next >= vq->size))
-   return -1;
-
-   desc = >desc[desc->next];
-   desc_addr = gpa_to_vva(dev, desc->addr);
-   if (unlikely(!desc_addr))
-   return -1;
-
-   desc_offset = 0;
-   desc_avail  = desc->len;
-   }
-
-   cpy_len = RTE_MIN(desc_avail, mbuf_avail);
-   rte_memcpy((void *)((uintptr_t)(desc_addr + desc_offset)),
-   rte_pktmbuf_mtod_offset(m, void *, mbuf_offset),
-   cpy_len);
-   vhost_log_write(dev, desc->addr + desc_offset, cpy_len);
-   PRINT_PACKET(dev, (uintptr_t)(desc_addr + desc_offset),
-cpy_len, 0);
-
-   mbuf_avail  -= cpy_len;
-   mbuf_offset += cpy_len;
-   desc_avail  -= cpy_len;
-   desc_offset += cpy_len;
-   }
-
-   return 0;
-}
-
-/**
- * This function adds buffers to the virtio devices RX virtqueue. Buffers can
- * be received from the physical port or from another virtio device. A packet
- * count is returned to indicate the number of packets that are succesfully
- * added to the RX queue. This function works when the mbuf is scattered, but
- * it doesn't support the mergeable feature.
- */
-static inline uint32_t __attribute__((always_inline))
-virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,
- struct rte_mbuf **pkts, uint32_t count)
-{
-   struct vhost_virtqueue *vq;
-   uint16_t avail_idx, free_entries, start_idx;
-   uint16_t desc_indexes[MAX_PKT_BURST];
-   uint16_t used_idx;
-   uint32_t i;
-
-   LOG_DEBUG(VHOST_DATA, "(%d) %s\n", dev->vid, __func__);
-   if (unlikely(!is_valid_virt_queue_idx(queue_id, 0, dev->virt_qp_nb))) {
-   RTE_LOG(ERR, VHOST_DATA, "(%d) %s: invalid virtqueue idx %d.\n",
-   dev->vid, __func__, queue_id);
-   return 0;
-   }
-
-   vq = dev->virtqueue[queue_id];
-   if (unlikely(vq->enabled == 0))
-