From patchwork Sun Dec 4 10:10:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Morten_Br=C3=B8rup?= X-Patchwork-Id: 120442 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 8FDD1A0542; Sun, 4 Dec 2022 11:10:44 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2EDA04068E; Sun, 4 Dec 2022 11:10:44 +0100 (CET) Received: from smartserver.smartsharesystems.com (smartserver.smartsharesystems.com [77.243.40.215]) by mails.dpdk.org (Postfix) with ESMTP id 564FD40042 for ; Sun, 4 Dec 2022 11:10:42 +0100 (CET) Received: from dkrd2.smartsharesys.local ([192.168.4.12]) by smartserver.smartsharesystems.com with Microsoft SMTPSVC(6.0.3790.4675); Sun, 4 Dec 2022 11:10:41 +0100 From: =?utf-8?q?Morten_Br=C3=B8rup?= To: dev@dpdk.org Cc: =?utf-8?q?Morten_Br=C3=B8rup?= Subject: [PATCH v2] mbuf perf test, please ignore Date: Sun, 4 Dec 2022 11:10:40 +0100 Message-Id: <20221204101040.30504-1-mb@smartsharesystems.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35D8754C@smartserver.smartshare.dk> References: <98CBD80474FA8B44BF855DF32C47DC35D8754C@smartserver.smartshare.dk> MIME-Version: 1.0 X-OriginalArrivalTime: 04 Dec 2022 10:10:41.0649 (UTC) FILETIME=[AA51EE10:01D907C8] 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 Playing around with the mbuf structure, trying to reduce the use of the second cache line in some common scenarios. v2: * Remove BUILD_BUG_ON in cnxk PMD. Signed-off-by: Morten Brørup --- drivers/net/cnxk/cn10k_ethdev.c | 2 ++ drivers/net/cnxk/cn9k_ethdev.c | 2 ++ lib/mbuf/rte_mbuf_core.h | 38 ++++++++++++++++----------------- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/drivers/net/cnxk/cn10k_ethdev.c b/drivers/net/cnxk/cn10k_ethdev.c index 4658713591..9f6086efe6 100644 --- a/drivers/net/cnxk/cn10k_ethdev.c +++ b/drivers/net/cnxk/cn10k_ethdev.c @@ -72,8 +72,10 @@ nix_tx_offload_flags(struct rte_eth_dev *eth_dev) offsetof(struct rte_mbuf, buf_addr) + 24); RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) != offsetof(struct rte_mbuf, ol_flags) + 12); +/* RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, tx_offload) != offsetof(struct rte_mbuf, pool) + 2 * sizeof(void *)); +*/ if (conf & RTE_ETH_TX_OFFLOAD_VLAN_INSERT || conf & RTE_ETH_TX_OFFLOAD_QINQ_INSERT) diff --git a/drivers/net/cnxk/cn9k_ethdev.c b/drivers/net/cnxk/cn9k_ethdev.c index 3b702d9696..3e9161ca79 100644 --- a/drivers/net/cnxk/cn9k_ethdev.c +++ b/drivers/net/cnxk/cn9k_ethdev.c @@ -72,8 +72,10 @@ nix_tx_offload_flags(struct rte_eth_dev *eth_dev) offsetof(struct rte_mbuf, buf_addr) + 24); RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) != offsetof(struct rte_mbuf, ol_flags) + 12); +/* RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, tx_offload) != offsetof(struct rte_mbuf, pool) + 2 * sizeof(void *)); +*/ if (conf & RTE_ETH_TX_OFFLOAD_VLAN_INSERT || conf & RTE_ETH_TX_OFFLOAD_QINQ_INSERT) diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h index a30e1e0eaf..c0c3b45024 100644 --- a/lib/mbuf/rte_mbuf_core.h +++ b/lib/mbuf/rte_mbuf_core.h @@ -594,25 +594,6 @@ struct rte_mbuf { uint16_t buf_len; /**< Length of segment buffer. */ - struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */ - - /* second cache line - fields only used in slow path or on TX */ - RTE_MARKER cacheline1 __rte_cache_min_aligned; - -#if RTE_IOVA_AS_PA - /** - * Next segment of scattered packet. Must be NULL in the last - * segment or in case of non-segmented packet. - */ - struct rte_mbuf *next; -#else - /** - * Reserved for dynamic fields - * when the next pointer is in first cache line (i.e. RTE_IOVA_AS_PA is 0). - */ - uint64_t dynfield2; -#endif - /* fields to support TX offloads */ RTE_STD_C11 union { @@ -651,6 +632,25 @@ struct rte_mbuf { }; }; + /* second cache line - fields only used in slow path or on TX */ + RTE_MARKER cacheline1 __rte_cache_min_aligned; + +#if RTE_IOVA_AS_PA + /** + * Next segment of scattered packet. Must be NULL in the last + * segment or in case of non-segmented packet. + */ + struct rte_mbuf *next; +#else + /** + * Reserved for dynamic fields + * when the next pointer is in first cache line (i.e. RTE_IOVA_AS_PA is 0). + */ + uint64_t dynfield2; +#endif + + struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */ + /** Shared data for external buffer attached to mbuf. See * rte_pktmbuf_attach_extbuf(). */