From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 2BF3A45E7A;
	Wed, 11 Dec 2024 18:34:58 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 36ECF406A2;
	Wed, 11 Dec 2024 18:33:57 +0100 (CET)
Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19])
 by mails.dpdk.org (Postfix) with ESMTP id 80B8D40685
 for <dev@dpdk.org>; Wed, 11 Dec 2024 18:33:55 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
 d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
 t=1733938436; x=1765474436;
 h=from:to:cc:subject:date:message-id:in-reply-to:
 references:mime-version:content-transfer-encoding;
 bh=trCoGgVV2uKzWu0IL5wI1u2IxnHZxPrnp+7M1jjEZzo=;
 b=mn0cPo1EVoNjEQS+W0XSQB7Gw0RDC2mBtARr34nplCRe0f1xFZlJp1Iu
 YtKOxmUnlYIavXxuOP0vCbQPtA8xu6iR6RL50bXyFdGyr9co+71ttlo84
 d0BWPm1h3RWnRrcR3RgPgkOzZvbIEpwfilrim8ry0dcJ+6mtrLX/R09Eh
 6ATcneDPZ83wahAzBjV8OfJyf6y3O6Mjj71KzOWKRaKqVJXOGuoqfmfgM
 s6lUGMNURYffZJxYFPDPwkxuAhgd0Nonqczjb5UX3P12/a6Bbf7c20WvF
 RoqSd53KuSZtP9vkFuQAMJw4ikXWE4gVgpKw5hfz0ok7YkivenVzag8+T A==;
X-CSE-ConnectionGUID: lH/CX/peSUaH3F0CS+eR+Q==
X-CSE-MsgGUID: QnsxLpeCTa6SfIAXB/9c4g==
X-IronPort-AV: E=McAfee;i="6700,10204,11283"; a="34206066"
X-IronPort-AV: E=Sophos;i="6.12,226,1728975600"; d="scan'208";a="34206066"
Received: from fmviesa007.fm.intel.com ([10.60.135.147])
 by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 11 Dec 2024 09:33:55 -0800
X-CSE-ConnectionGUID: L8RoAgIeTNWGsqZonEzB4A==
X-CSE-MsgGUID: zcC9h9ERRoWgOKkFdbMPQQ==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="6.12,226,1728975600"; d="scan'208";a="95719167"
Received: from silpixa00401197coob.ir.intel.com (HELO
 silpixa00401385.ir.intel.com) ([10.237.214.45])
 by fmviesa007.fm.intel.com with ESMTP; 11 Dec 2024 09:33:54 -0800
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>,
 Anatoly Burakov <anatoly.burakov@intel.com>,
 Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Subject: [PATCH v3 08/22] net/ixgbe: convert Tx queue context cache field to
 ptr
Date: Wed, 11 Dec 2024 17:33:14 +0000
Message-ID: <20241211173331.65262-9-bruce.richardson@intel.com>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <20241211173331.65262-1-bruce.richardson@intel.com>
References: <20241122125418.2857301-1-bruce.richardson@intel.com>
 <20241211173331.65262-1-bruce.richardson@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

Rather than having a two element array of context cache values inside
the Tx queue structure, convert it to a pointer to a cache at the end of
the structure. This makes future merging of the structure easier as we
don't need the "ixgbe_advctx_info" struct defined when defining a
combined queue structure.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/ixgbe/ixgbe_rxtx.c            | 7 ++++---
 drivers/net/ixgbe/ixgbe_rxtx.h            | 4 ++--
 drivers/net/ixgbe/ixgbe_rxtx_vec_common.h | 3 +--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index f7ddbba1b6..2ca26cd132 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -2522,8 +2522,7 @@ ixgbe_reset_tx_queue(struct ixgbe_tx_queue *txq)
 	txq->last_desc_cleaned = (uint16_t)(txq->nb_tx_desc - 1);
 	txq->nb_tx_free = (uint16_t)(txq->nb_tx_desc - 1);
 	txq->ctx_curr = 0;
-	memset((void *)&txq->ctx_cache, 0,
-		IXGBE_CTX_NUM * sizeof(struct ixgbe_advctx_info));
+	memset(txq->ctx_cache, 0, IXGBE_CTX_NUM * sizeof(struct ixgbe_advctx_info));
 }
 
 static const struct ixgbe_txq_ops def_txq_ops = {
@@ -2741,10 +2740,12 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,
 	}
 
 	/* First allocate the tx queue data structure */
-	txq = rte_zmalloc_socket("ethdev TX queue", sizeof(struct ixgbe_tx_queue),
+	txq = rte_zmalloc_socket("ethdev TX queue", sizeof(struct ixgbe_tx_queue) +
+					sizeof(struct ixgbe_advctx_info) * IXGBE_CTX_NUM,
 				 RTE_CACHE_LINE_SIZE, socket_id);
 	if (txq == NULL)
 		return -ENOMEM;
+	txq->ctx_cache = RTE_PTR_ADD(txq, sizeof(struct ixgbe_tx_queue));
 
 	/*
 	 * Allocate TX ring hardware descriptors. A memzone large enough to
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h
index f6bae37cf3..847cacf7b5 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.h
+++ b/drivers/net/ixgbe/ixgbe_rxtx.h
@@ -215,8 +215,8 @@ struct ixgbe_tx_queue {
 	uint8_t             wthresh;       /**< Write-back threshold reg. */
 	uint64_t offloads; /**< Tx offload flags of RTE_ETH_TX_OFFLOAD_* */
 	uint32_t            ctx_curr;      /**< Hardware context states. */
-	/** Hardware context0 history. */
-	struct ixgbe_advctx_info ctx_cache[IXGBE_CTX_NUM];
+	/** Hardware context history. */
+	struct ixgbe_advctx_info *ctx_cache;
 	const struct ixgbe_txq_ops *ops;       /**< txq ops */
 	bool            tx_deferred_start; /**< not in global dev start. */
 #ifdef RTE_LIB_SECURITY
diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h b/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h
index cc51bf6eed..ec334b5f65 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h
@@ -176,8 +176,7 @@ _ixgbe_reset_tx_queue_vec(struct ixgbe_tx_queue *txq)
 	txq->last_desc_cleaned = (uint16_t)(txq->nb_tx_desc - 1);
 	txq->nb_tx_free = (uint16_t)(txq->nb_tx_desc - 1);
 	txq->ctx_curr = 0;
-	memset((void *)&txq->ctx_cache, 0,
-		IXGBE_CTX_NUM * sizeof(struct ixgbe_advctx_info));
+	memset(txq->ctx_cache, 0, IXGBE_CTX_NUM * sizeof(struct ixgbe_advctx_info));
 }
 
 static inline int
-- 
2.43.0