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 949F0A034F for ; Tue, 7 Dec 2021 09:10:50 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 66ED0410FC; Tue, 7 Dec 2021 09:10:50 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 1FC21410FC for ; Tue, 7 Dec 2021 09:10:48 +0100 (CET) X-IronPort-AV: E=McAfee;i="6200,9189,10190"; a="224394670" X-IronPort-AV: E=Sophos;i="5.87,293,1631602800"; d="scan'208";a="224394670" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Dec 2021 00:10:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,293,1631602800"; d="scan'208";a="502496558" Received: from npg-dpdk-xuan-cbdma.sh.intel.com ([10.67.110.228]) by orsmga007.jf.intel.com with ESMTP; 07 Dec 2021 00:10:46 -0800 From: xuan.ding@intel.com To: christian.ehrhardt@canonical.com Cc: stable@dpdk.org, Xuan Ding Subject: [PATCH 19.11] net/virtio: fix indirect descriptor reconnection Date: Tue, 7 Dec 2021 16:50:06 +0000 Message-Id: <20211207165006.66790-1-xuan.ding@intel.com> X-Mailer: git-send-email 2.17.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org From: Xuan Ding [ upstream commit 04bcc80204db16ca77d1dd11a6ea1773214cc755 ] Add initialization for packed ring indirect descriptors in reconnection path. Fixes: 8c1df8846b15 ("net/virtio: fix packed ring indirect descricptors setup") Signed-off-by: Xuan Ding Tested-by: Yinan Wang Reviewed-by: Maxime Coquelin --- 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 02c8b9fc5..8195aaa8c 100644 --- a/drivers/net/virtio/virtqueue.c +++ b/drivers/net/virtio/virtqueue.c @@ -185,6 +185,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; @@ -197,6 +199,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); @@ -207,6 +210,17 @@ virtqueue_txvq_reset_packed(struct virtqueue *vq) rte_pktmbuf_free(dxp->cookie); dxp->cookie = NULL; } + + if (vtpci_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