From patchwork Mon Jul 20 02:52:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Fu X-Patchwork-Id: 74458 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8FF12A0540; Mon, 20 Jul 2020 04:54:35 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EBE691AFB; Mon, 20 Jul 2020 04:54:34 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id D87041023 for ; Mon, 20 Jul 2020 04:54:32 +0200 (CEST) IronPort-SDR: r3WRVQ6F3LyazJfCxQ/LIpOE1pofXkiI8ciCKbfKGaNHUR1spxZrQm8i3YZIG9YfcAZZRP3Fir /3IlFXpADg1g== X-IronPort-AV: E=McAfee;i="6000,8403,9687"; a="151191512" X-IronPort-AV: E=Sophos;i="5.75,373,1589266800"; d="scan'208";a="151191512" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jul 2020 19:54:31 -0700 IronPort-SDR: p/JMtpUo6CtE3xnC8jR9x9e2uQYTcCoyRwWSzv/Ov0oksumKLPMvdPkxOyy9V0depn3jFywrKY q+oythFFLoOw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,373,1589266800"; d="scan'208";a="391910597" Received: from npg-dpdk-patrickfu-casc2.sh.intel.com ([10.67.119.92]) by fmsmga001.fm.intel.com with ESMTP; 19 Jul 2020 19:54:29 -0700 From: patrick.fu@intel.com To: dev@dpdk.org, maxime.coquelin@redhat.com, chenbo.xia@intel.com Cc: patrick.fu@intel.com Date: Mon, 20 Jul 2020 10:52:42 +0800 Message-Id: <20200720025242.3066787-1-patrick.fu@intel.com> X-Mailer: git-send-email 2.18.4 Subject: [dpdk-dev] [PATCH v1] vhost: support cross page buf in async data path 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Patrick Fu Async copy fails when ring buffer cross two physical pages. This patch fix the failure by letting copies occur in sync mode if crossing page buffers are given. Fixes: cd6760da1076 ("vhost: introduce async enqueue for split ring") Signed-off-by: Patrick Fu --- lib/librte_vhost/virtio_net.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 1d0be3dd4..44b22a8ad 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -1071,16 +1071,10 @@ async_mbuf_to_desc(struct virtio_net *dev, struct vhost_virtqueue *vq, } cpy_len = RTE_MIN(buf_avail, mbuf_avail); + hpa = (void *)(uintptr_t)gpa_to_hpa(dev, + buf_iova + buf_offset, cpy_len); - if (unlikely(cpy_len >= cpy_threshold)) { - hpa = (void *)(uintptr_t)gpa_to_hpa(dev, - buf_iova + buf_offset, cpy_len); - - if (unlikely(!hpa)) { - error = -1; - goto out; - } - + if (unlikely(cpy_len >= cpy_threshold && hpa)) { async_fill_vec(src_iovec + tvec_idx, (void *)(uintptr_t)rte_pktmbuf_iova_offset(m, mbuf_offset), cpy_len);