From patchwork Thu Oct 21 14:25:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Ding, Xuan" X-Patchwork-Id: 102520 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C0119A0C4B; Thu, 21 Oct 2021 07:54:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8C419410E2; Thu, 21 Oct 2021 07:54:11 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 3243A40142; Thu, 21 Oct 2021 07:54:10 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10143"; a="289794401" X-IronPort-AV: E=Sophos;i="5.87,168,1631602800"; d="scan'208";a="289794401" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2021 22:54:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,168,1631602800"; d="scan'208";a="484063170" Received: from npg-dpdk-xuan-cbdma.sh.intel.com ([10.67.110.228]) by orsmga007.jf.intel.com with ESMTP; 20 Oct 2021 22:54:06 -0700 From: xuan.ding@intel.com To: dev@dpdk.org, maxime.coquelin@redhat.com, chenbo.xia@intel.com Cc: Xuan Ding , stable@dpdk.org, Yong Liu , Miao Li Date: Thu, 21 Oct 2021 14:25:40 +0000 Message-Id: <20211021142540.43753-1-xuan.ding@intel.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] net/virtio: fix incorrect avail desc id X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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: Xuan Ding Vhost will update desc’s Buffer ID advance to next used descriptor when VIRTIO_F_IN_ORDER feature negotiated. When virtio reuses the descriptor, the Buffer ID should be restored even VIRTQ_DESC_F_INDIRECT feature negotiated. Fixes: b473061b0e1d ("net/virtio: fix indirect descriptors in packed datapaths") Cc: stable@dpdk.org Signed-off-by: Xuan Ding Signed-off-by: Yong Liu Signed-off-by: Miao Li Reviewed-by: Maxime Coquelin --- drivers/net/virtio/virtqueue.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h index d0c48ca415..5259a6f814 100644 --- a/drivers/net/virtio/virtqueue.h +++ b/drivers/net/virtio/virtqueue.h @@ -709,6 +709,9 @@ virtqueue_enqueue_xmit_packed(struct virtnet_tx *txvq, struct rte_mbuf *cookie, RTE_PTR_DIFF(&txr[idx].tx_packed_indir, txr); start_dp[idx].len = (seg_num + 1) * sizeof(struct vring_packed_desc); + /* Packed descriptor id needs to be restored when inorder. */ + if (in_order) + start_dp[idx].id = idx; /* reset flags for indirect desc */ head_flags = VRING_DESC_F_INDIRECT; head_flags |= vq->vq_packed.cached_flags;