From patchwork Wed Aug 30 15:59:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 130913 X-Patchwork-Delegate: thomas@monjalon.net 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 6829841FD1; Wed, 30 Aug 2023 18:06:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B9BEE427DE; Wed, 30 Aug 2023 18:00:14 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id C27DB402BB; Wed, 30 Aug 2023 17:59:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1693411185; x=1724947185; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=82J2yt48GRNjIYEQ/H5nj7iVeoV8VOdSOMgaQN8UVbs=; b=XqIRCA6EOc0k2fR1UqE0WhpORRlOUH/w71dBL0u0BFwEYCb6FW3aI/b8 zuhrLlYKmWyU5KUvucmhd0+8ZmPX0p9Pz/LiBPd1Ft0FjOQ8Ng4rQbLve akz5VDG1/b8bwmUZExEK+L5DRwDEzbBlPfgHWRk399lwkfvA8LJXG+0QS 4Diru36p8UasD/7noO7HUG22F+Y+nzDV/ZSyv++ZlRSwyQU0uPKSuPCfk 8xeVg4swEVarVwkqDREXx7+QtjX21Q9kWIko1VUTE96eA46yegAbIQxWO vBAYxqztSLKNpOCNfXyobzI2M8OkcByeG/QcE1yttUT/+ClOZrhDkq86X w==; X-IronPort-AV: E=McAfee;i="6600,9927,10818"; a="360674181" X-IronPort-AV: E=Sophos;i="6.02,214,1688454000"; d="scan'208";a="360674181" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2023 08:59:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10818"; a="739142701" X-IronPort-AV: E=Sophos;i="6.02,214,1688454000"; d="scan'208";a="739142701" Received: from silpixa00401385.ir.intel.com ([10.237.214.14]) by orsmga002.jf.intel.com with ESMTP; 30 Aug 2023 08:59:42 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Yuying Zhang , Beilei Xing , Jingjing Wu , Bruce Richardson , qi.z.zhang@intel.com, stable@dpdk.org Subject: [PATCH 1/4] net/i40e: fix buffer leak on Rx reconfiguration Date: Wed, 30 Aug 2023 16:59:16 +0100 Message-Id: <20230830155919.592390-2-bruce.richardson@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230830155919.592390-1-bruce.richardson@intel.com> References: <20230830155919.592390-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 --- 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; }