From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C299C43D06; Wed, 20 Mar 2024 18:32:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A8B5C41132; Wed, 20 Mar 2024 18:32:47 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id C237240A6F for ; Wed, 20 Mar 2024 18:32:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710955965; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bQwX6om9PN7Lu6n2oqVJ7SxwqFb+45+Do7Gi5Yz0zR4=; b=Q2+eBAqom9uqDu2ze0PCfUELyqjf3f7Fcvy1S8bIbZquv70YWXS043EgNL7k8jJigFA+8H AC9G5rfNZgSZqWJUCdeH2d+SHcTuv+eadbmeFdqoL3WJGrUZMIvcK7s/AdmFV69Sxq1Eew lbV5uYUSDmxd3r4JKOyDjGuFO1V3s2U= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-680-odLCDwTaOIqWmnUs5nU6Rw-1; Wed, 20 Mar 2024 13:32:40 -0400 X-MC-Unique: odLCDwTaOIqWmnUs5nU6Rw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B5DD28007A3; Wed, 20 Mar 2024 17:32:39 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B8C92166BA6; Wed, 20 Mar 2024 17:32:38 +0000 (UTC) From: Robin Jarry To: dev@dpdk.org, Jerin Jacob , Kiran Kumar K , Nithin Dabilpuram , Zhirun Yan Subject: [PATCH] graph: expose node context as pointers Date: Wed, 20 Mar 2024 18:32:18 +0100 Message-ID: <20240320173217.311340-2-rjarry@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 In some cases, the node context data is used to store two pointers because the data is larger than the reserved 16 bytes. Having to define intermediate structures just to be able to cast is tedious. Add two pointers that take the same space than ctx. Signed-off-by: Robin Jarry --- lib/graph/rte_graph_worker_common.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/graph/rte_graph_worker_common.h b/lib/graph/rte_graph_worker_common.h index 36d864e2c14e..a7fcdf4893ea 100644 --- a/lib/graph/rte_graph_worker_common.h +++ b/lib/graph/rte_graph_worker_common.h @@ -112,7 +112,14 @@ struct __rte_cache_aligned rte_node { }; /* Fast path area */ #define RTE_NODE_CTX_SZ 16 - alignas(RTE_CACHE_LINE_SIZE) uint8_t ctx[RTE_NODE_CTX_SZ]; /**< Node Context. */ + alignas(RTE_CACHE_LINE_SIZE) union { + uint8_t ctx[RTE_NODE_CTX_SZ]; + /* Convenience aliases to store pointers without complex casting. */ + struct { + void *ctx_ptr; + void *ctx_ptr2; + }; + }; /**< Node Context. */ uint16_t size; /**< Total number of objects available. */ uint16_t idx; /**< Number of objects used. */ rte_graph_off_t off; /**< Offset of node in the graph reel. */ -- 2.44.0