From patchwork Mon Aug 5 10:08:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiva Shankar Kommula X-Patchwork-Id: 142894 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 0E2234572F; Mon, 5 Aug 2024 12:08:52 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F1475402B7; Mon, 5 Aug 2024 12:08:50 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id D38E4402AC for ; Mon, 5 Aug 2024 12:08:48 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47590t71025420; Mon, 5 Aug 2024 03:08:48 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=pfpt0220; bh=uZY20vQ3p6/xVYdlrf9hhnd wPXl+6k8meD2+TGGU8kA=; b=Tiah3xFm+Q5jQfCKoIcMvDeREeS2/kY6SSIINPu zfMwwSiLaiABUVAI93nQf1saln7XDf/HbXxVXE9OB7uhnpNQr24b1CTO2wN5gQwA Cwf6vg0II9WlipmChcbwIEpPXrL0edEGB2sasf5LYBGUtEiKBKZy7PbDxVHoRqDy /hN34sSnWw+pTkoDEUetwWieJWje3mhOwPTpPkH+asdts4oBhjapghDkibaytXMo SUaTDdFQwEVWNlhcFo4auKA6/6mjPX08cqLdfReuMMktS6IyE62bVa3rtW9/b+5P GlEh4sPywF/pFVuYX5CNecJUuky4OA6D+/QKawMbUwMO/3Q== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 40tuqug6bd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 05 Aug 2024 03:08:47 -0700 (PDT) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 5 Aug 2024 03:08:45 -0700 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 5 Aug 2024 03:08:45 -0700 Received: from 5810.caveonetworks.com (unknown [10.29.45.105]) by maili.marvell.com (Postfix) with ESMTP id 964773F70B1; Mon, 5 Aug 2024 03:08:42 -0700 (PDT) From: Kommula Shiva Shankar To: , , CC: , , , Subject: [PATCH] net/virtio-user: reset used index counter in dev reset Date: Mon, 5 Aug 2024 10:08:41 +0000 Message-ID: <20240805100841.276796-1-kshankar@marvell.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: CQ1IRiQDr66tQ1-7T1mHfaENRfJ-wjx- X-Proofpoint-GUID: CQ1IRiQDr66tQ1-7T1mHfaENRfJ-wjx- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-04_14,2024-08-02_01,2024-05-17_01 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 When the virtio device is reinitialized during ethdev reconfiguration, all the virtio rings are recreated and repopulated on the device. Accordingly, reset the used index counter value back to zero. Signed-off-by: Kommula Shiva Shankar Reviewed-by: Maxime Coquelin --- drivers/net/virtio/virtio_user_ethdev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index ae6593ba0b..d60c7e188c 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -204,6 +204,7 @@ virtio_user_setup_queue_packed(struct virtqueue *vq, vring->device = (void *)(uintptr_t)used_addr; dev->packed_queues[queue_idx].avail_wrap_counter = true; dev->packed_queues[queue_idx].used_wrap_counter = true; + dev->packed_queues[queue_idx].used_idx = 0; for (i = 0; i < vring->num; i++) vring->desc[i].flags = 0;