From patchwork Thu Aug 31 12:33:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 130985 X-Patchwork-Delegate: qi.z.zhang@intel.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 6B4B641FDD; Thu, 31 Aug 2023 14:33:54 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3279340299; Thu, 31 Aug 2023 14:33:53 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 0490C40299; Thu, 31 Aug 2023 14:33:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1693485231; x=1725021231; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=82J2yt48GRNjIYEQ/H5nj7iVeoV8VOdSOMgaQN8UVbs=; b=jXYvnSbiUry71nOwZKdcwoc2xWK8Y6rgvE3LQ0Q3NXO8t49jd6o0UJdo dmWGZzCfyx/h7p5WHTZA6woQbDBlHo21yYqUZb3fXQnP3IXzvWUpNCp0C 2xzuahD7pGn/XpxpMr0M+FqYNg+zz/UuyRC9r2l5HmXYvP8jusMT9N+Mt 9s0IJsBDKF7ownXgPlZitcLjsGefCKOCdZLtNuHDA3P6X4gsCJA+FInwV jYOZ23DKGXze4t8/JaX5kDOD0qGQo7YunZ2XL6Gf7xNN9+IFeYq2s31AP xXAoJAlUDY5+OjOMN9aHID+oQuc4phNndqRzKfufp3STlmCezvLRrbrWD g==; X-IronPort-AV: E=McAfee;i="6600,9927,10818"; a="439873970" X-IronPort-AV: E=Sophos;i="6.02,216,1688454000"; d="scan'208";a="439873970" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2023 05:33:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10818"; a="913230898" X-IronPort-AV: E=Sophos;i="6.02,216,1688454000"; d="scan'208";a="913230898" Received: from silpixa00401385.ir.intel.com ([10.237.214.14]) by orsmga005.jf.intel.com with ESMTP; 31 Aug 2023 05:33:49 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , qi.z.zhang@intel.com, stable@dpdk.org Subject: [PATCH v2 1/4] net/i40e: fix buffer leak on Rx reconfiguration Date: Thu, 31 Aug 2023 13:33:34 +0100 Message-Id: <20230831123337.871496-2-bruce.richardson@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230831123337.871496-1-bruce.richardson@intel.com> References: <20230830155919.592390-1-bruce.richardson@intel.com> <20230831123337.871496-1-bruce.richardson@intel.com> MIME-Version: 1.0 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 reconfiguring a single queue on a device, the mbuf initializer value was not getting set, and remained at zero. This lead to mbuf leaks as the refcount was incorrect (0), so on free it wrapped around to UINT16_MAX. When setting up the mbuf initializer, also ensure that the queue is explicitly marked as using a vector function by setting the "rx_using_sse" flag. Fixes: a3c83a2527e1 ("net/i40e: enable runtime queue setup") Cc: qi.z.zhang@intel.com Cc: stable@dpdk.org Signed-off-by: Bruce Richardson Acked-by: Qi Zhang --- drivers/net/i40e/i40e_rxtx.c | 6 ++++++ drivers/net/i40e/i40e_rxtx_vec_common.h | 1 + 2 files changed, 7 insertions(+) diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index b4f65b58fa..d96bbbb677 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -1918,6 +1918,12 @@ i40e_dev_rx_queue_setup_runtime(struct rte_eth_dev *dev, if (use_def_burst_func) ad->rx_bulk_alloc_allowed = false; i40e_set_rx_function(dev); + + if (ad->rx_vec_allowed && i40e_rxq_vec_setup(rxq)) { + PMD_DRV_LOG(ERR, "Failed vector rx setup."); + return -EINVAL; + } + return 0; } else if (ad->rx_vec_allowed && !rte_is_power_of_2(rxq->nb_rx_desc)) { PMD_DRV_LOG(ERR, "Vector mode is allowed, but descriptor" diff --git a/drivers/net/i40e/i40e_rxtx_vec_common.h b/drivers/net/i40e/i40e_rxtx_vec_common.h index fe1a6ec75e..8b745630e4 100644 --- a/drivers/net/i40e/i40e_rxtx_vec_common.h +++ b/drivers/net/i40e/i40e_rxtx_vec_common.h @@ -201,6 +201,7 @@ i40e_rxq_vec_setup_default(struct i40e_rx_queue *rxq) rte_compiler_barrier(); p = (uintptr_t)&mb_def.rearm_data; rxq->mbuf_initializer = *(uint64_t *)p; + rxq->rx_using_sse = 1; return 0; }