From patchwork Mon Feb 24 15:14:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marvin Liu X-Patchwork-Id: 66000 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 E4076A0524; Mon, 24 Feb 2020 08:37:44 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 219E41BFAC; Mon, 24 Feb 2020 08:37:43 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 0E7721BFA5; Mon, 24 Feb 2020 08:37:41 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Feb 2020 23:37:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,479,1574150400"; d="scan'208";a="260257788" Received: from npg-dpdk-virtual-marvin-dev.sh.intel.com ([10.67.119.58]) by fmsmga004.fm.intel.com with ESMTP; 23 Feb 2020 23:37:39 -0800 From: Marvin Liu To: maxime.coquelin@redhat.com, tiwei.bie@intel.com, zhihong.wang@intel.com Cc: dev@dpdk.org, stable@dpdk.org, Marvin Liu Date: Mon, 24 Feb 2020 23:14:19 +0800 Message-Id: <20200224151419.85565-1-yong.liu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200224145025.84899-1-yong.liu@intel.com> References: <20200224145025.84899-1-yong.liu@intel.com> Subject: [dpdk-dev] [PATCH v2] vhost: fix packed ring zero-copy 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" Available buffer ID should be stored in the zmbuf in the packed-ring dequeue path. There's no guarantee that local queue avail index is equal to buffer ID. Fixes: d1eafb532268 ("vhost: add packed ring zcopy batch and single dequeue") Cc: stable@dpdk.org Signed-off-by: Marvin Liu Reported-by: Yinan Wang Reviewed-by: Maxime Coquelin diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 37c47c7dc..210415904 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -2004,7 +2004,7 @@ virtio_dev_tx_batch_packed_zmbuf(struct virtio_net *dev, vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) { zmbufs[i]->mbuf = pkts[i]; - zmbufs[i]->desc_idx = avail_idx + i; + zmbufs[i]->desc_idx = ids[i]; zmbufs[i]->desc_count = 1; } @@ -2045,7 +2045,7 @@ virtio_dev_tx_single_packed_zmbuf(struct virtio_net *dev, return -1; } zmbuf->mbuf = *pkts; - zmbuf->desc_idx = vq->last_avail_idx; + zmbuf->desc_idx = buf_id; zmbuf->desc_count = desc_count; rte_mbuf_refcnt_update(*pkts, 1);