From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by dpdk.org (Postfix) with ESMTP id 84BEA1BB71 for ; Fri, 22 Jun 2018 15:43:51 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 273AB212D3; Fri, 22 Jun 2018 13:43:51 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8285B2026D6B; Fri, 22 Jun 2018 13:43:49 +0000 (UTC) From: Maxime Coquelin To: tiwei.bie@intel.com, zhihong.wang@intel.com, jfreimann@redhat.com, dev@dpdk.org Cc: mst@redhat.com, jasowang@redhat.com, wexu@redhat.com, Maxime Coquelin Date: Fri, 22 Jun 2018 15:43:17 +0200 Message-Id: <20180622134327.18973-6-maxime.coquelin@redhat.com> In-Reply-To: <20180622134327.18973-1-maxime.coquelin@redhat.com> References: <20180622134327.18973-1-maxime.coquelin@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 22 Jun 2018 13:43:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 22 Jun 2018 13:43:51 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'maxime.coquelin@redhat.com' RCPT:'' Subject: [dpdk-dev] [PATCH v5 05/15] vhost: make indirect desc table copy desc type agnostic X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2018 13:43:51 -0000 Signed-off-by: Maxime Coquelin --- lib/librte_vhost/virtio_net.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 28ce2d073..5cfc100a9 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -37,16 +37,15 @@ is_valid_virt_queue_idx(uint32_t idx, int is_tx, uint32_t nr_vring) return (is_tx ^ (idx & 1)) == 0 && idx < nr_vring; } -static __rte_always_inline struct vring_desc * +static __rte_always_inline void * alloc_copy_ind_table(struct virtio_net *dev, struct vhost_virtqueue *vq, - struct vring_desc *desc) + uint64_t desc_addr, uint64_t desc_len) { - struct vring_desc *idesc; + void *idesc; uint64_t src, dst; - uint64_t len, remain = desc->len; - uint64_t desc_addr = desc->addr; + uint64_t len, remain = desc_len; - idesc = rte_malloc(__func__, desc->len, 0); + idesc = rte_malloc(__func__, desc_len, 0); if (unlikely(!idesc)) return 0; @@ -72,7 +71,7 @@ alloc_copy_ind_table(struct virtio_net *dev, struct vhost_virtqueue *vq, } static __rte_always_inline void -free_ind_table(struct vring_desc *idesc) +free_ind_table(void *idesc) { rte_free(idesc); } @@ -251,7 +250,8 @@ fill_vec_buf(struct virtio_net *dev, struct vhost_virtqueue *vq, * The indirect desc table is not contiguous * in process VA space, we have to copy it. */ - idesc = alloc_copy_ind_table(dev, vq, &vq->desc[idx]); + idesc = alloc_copy_ind_table(dev, vq, + vq->desc[idx].addr, vq->desc[idx].len); if (unlikely(!idesc)) return -1; -- 2.14.4