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 DF220A0C43; Mon, 18 Oct 2021 10:20:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CA2B0410E5; Mon, 18 Oct 2021 10:20:36 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 35B0840142 for ; Mon, 18 Oct 2021 10:20:35 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10140"; a="226964359" X-IronPort-AV: E=Sophos;i="5.85,381,1624345200"; d="scan'208";a="226964359" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2021 01:20:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,381,1624345200"; d="scan'208";a="493491589" Received: from txandevlnx322.an.intel.com ([10.123.117.44]) by orsmga008.jf.intel.com with ESMTP; 18 Oct 2021 01:20:33 -0700 From: Naga Harish K S V To: jerinj@marvell.com, jay.jayatheerthan@intel.com Cc: dev@dpdk.org Date: Mon, 18 Oct 2021 03:20:29 -0500 Message-Id: <20211018082029.2742631-1-s.v.naga.harish.k@intel.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] eventdev/rx_adapter: fix wrr buffer overrun issue 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" when a poll queue is removed from a rx_adapter instance, the wrr poll array is recomputed. The wrr array length is reduced in this case. The next wrr position to poll is stored in wrr_pos variable of rx_adapter instance. This wrr_pos can become invalid in some cases after wrr is recomputed. Using this varaible to get the next queue and device pair may leed to wrr buffer overruns. Resetting the wrr_pos to zero after recomputation of wrr array fixes the buffer overrun issue. Fixes: 9c38b704d280 ("eventdev: add eth Rx adapter implementation") Signed-off-by: Naga Harish K S V --- lib/eventdev/rte_event_eth_rx_adapter.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c index bd68b8efe1..82a652d305 100644 --- a/lib/eventdev/rte_event_eth_rx_adapter.c +++ b/lib/eventdev/rte_event_eth_rx_adapter.c @@ -2773,6 +2773,11 @@ rte_event_eth_rx_adapter_queue_del(uint8_t id, uint16_t eth_dev_id, rx_adapter->eth_rx_poll = rx_poll; rx_adapter->wrr_sched = rx_wrr; rx_adapter->wrr_len = nb_wrr; + /* + * reset next poll start position (wrr_pos) to avoid buffer + * overrun when wrr_len is reduced in case of queue delete + */ + rx_adapter->wrr_pos = 0; rx_adapter->num_intr_vec += num_intr_vec; if (dev_info->nb_dev_queues == 0) { -- 2.25.1