From patchwork Mon Oct 18 08:25:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Naga Harish K, S V" X-Patchwork-Id: 101942 X-Patchwork-Delegate: jerinj@marvell.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 AFBA0A0C43; Mon, 18 Oct 2021 10:25:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7184840141; Mon, 18 Oct 2021 10:25:47 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id ED7924003C for ; Mon, 18 Oct 2021 10:25:45 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10140"; a="208300929" X-IronPort-AV: E=Sophos;i="5.85,381,1624345200"; d="scan'208";a="208300929" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2021 01:25:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,381,1624345200"; d="scan'208";a="493492911" Received: from txandevlnx322.an.intel.com ([10.123.117.44]) by orsmga008.jf.intel.com with ESMTP; 18 Oct 2021 01:25:44 -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:25:41 -0500 Message-Id: <20211018082541.2742861-1-s.v.naga.harish.k@intel.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 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 variable 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 Acked-by: Jay Jayatheerthan --- 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) {