From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 20174A0C4D; Wed, 13 Oct 2021 03:46:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AC8D440150; Wed, 13 Oct 2021 03:46:35 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 7085540142; Wed, 13 Oct 2021 03:46:33 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10135"; a="250730971" X-IronPort-AV: E=Sophos;i="5.85,369,1624345200"; d="scan'208";a="250730971" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2021 18:46:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,369,1624345200"; d="scan'208";a="562930324" Received: from dpdk-xuanding-dev2.sh.intel.com ([10.67.119.250]) by FMSMGA003.fm.intel.com with ESMTP; 12 Oct 2021 18:46:23 -0700 From: Xuan Ding To: dev@dpdk.org, maxime.coquelin@redhat.com, chenbo.xia@intel.com Cc: jiayu.hu@intel.com, yinan.wang@intel.com, Xuan Ding , stable@dpdk.org, yong.liu@intel.com Date: Wed, 13 Oct 2021 01:36:40 +0000 Message-Id: <20211013013640.71513-1-xuan.ding@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210819053518.106296-1-xuan.ding@intel.com> References: <20210819053518.106296-1-xuan.ding@intel.com> Subject: [dpdk-dev] [PATCH v2] net/virtio: fix indirect descriptors reconnection 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" Add initialization for packed ring indirect descriptors in reconnection path. Fixes: 381f39ebb78a ("net/virtio: fix packed ring indirect descricptors setup") Cc: stable@dpdk.org Cc: yong.liu@intel.com Signed-off-by: Xuan Ding Tested-by: Yinan Wang --- v2: * Fix the position of some declarations. --- drivers/net/virtio/virtqueue.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/net/virtio/virtqueue.c b/drivers/net/virtio/virtqueue.c index 1f9af3c31b..65bf792eb0 100644 --- a/drivers/net/virtio/virtqueue.c +++ b/drivers/net/virtio/virtqueue.c @@ -186,6 +186,8 @@ virtqueue_txvq_reset_packed(struct virtqueue *vq) struct vq_desc_extra *dxp; struct virtnet_tx *txvq; uint16_t desc_idx; + struct virtio_tx_region *txr; + struct vring_packed_desc *start_dp; vq->vq_used_cons_idx = 0; vq->vq_desc_head_idx = 0; @@ -198,6 +200,7 @@ virtqueue_txvq_reset_packed(struct virtqueue *vq) vq->vq_packed.event_flags_shadow = 0; txvq = &vq->txq; + txr = txvq->virtio_net_hdr_mz->addr; memset(txvq->mz->addr, 0, txvq->mz->len); memset(txvq->virtio_net_hdr_mz->addr, 0, txvq->virtio_net_hdr_mz->len); @@ -208,6 +211,17 @@ virtqueue_txvq_reset_packed(struct virtqueue *vq) rte_pktmbuf_free(dxp->cookie); dxp->cookie = NULL; } + + if (virtio_with_feature(vq->hw, VIRTIO_RING_F_INDIRECT_DESC)) { + /* first indirect descriptor is always the tx header */ + start_dp = txr[desc_idx].tx_packed_indir; + vring_desc_init_indirect_packed(start_dp, + RTE_DIM(txr[desc_idx].tx_packed_indir)); + start_dp->addr = txvq->virtio_net_hdr_mem + + desc_idx * sizeof(*txr) + + offsetof(struct virtio_tx_region, tx_hdr); + start_dp->len = vq->hw->vtnet_hdr_size; + } } vring_desc_init_packed(vq, size); -- 2.17.1