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 B735143D11; Thu, 21 Mar 2024 09:14:07 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 84D744028B; Thu, 21 Mar 2024 09:14:07 +0100 (CET) Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) by mails.dpdk.org (Postfix) with ESMTP id 022D040261 for ; Thu, 21 Mar 2024 09:14:06 +0100 (CET) Received: by mail-qt1-f170.google.com with SMTP id d75a77b69052e-430ddb1a227so4508071cf.3 for ; Thu, 21 Mar 2024 01:14:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711008845; x=1711613645; darn=dpdk.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=RciYyVUfjan7YwYh3/Ks1bEbSbTU1/nIt7kHJKUZcwY=; b=WU6iTI3RBTS4IWUGvH9GGryWmAxJKTaasg+Rm/9FtYKn6AV0qwHfyxW7fu+GAMlp/v Or8MvZr/M/oamPEwxuDyu5GxAg4WqeqfBtdCSj+Qoo0z+f8GuWkQLDjN91//DkNvE8IH MAhAiqTw3Kp3Q097tfRorY/bZ3NLNQF8Pk1zPQ08d6eahvF89atbAmo/pJ2QQnmaMJwo VM2YYZ/F+Fj3WRISIfw5XScZjVVA5DgEkZ8ui1gO5Z3w9qoUzTO8JLhZ+duyveaU6Xru 4XZHa+zxA+OaSi90a6jZyubSQTdOXNxYILQXofTIHUJS+GkptsRaqa/E1fcJ5h24KRTX bY6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711008845; x=1711613645; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RciYyVUfjan7YwYh3/Ks1bEbSbTU1/nIt7kHJKUZcwY=; b=o0NRjZC+uBkJWyOGEdbIjHdTEdM5dBANhLRwSeqE2amaI870wVKhY73eQ3A4dJXzjG zAStza18D45T05/bgBxvqAe/dvrkoUZxWT5PNgYg6v1N+AbfTJYWFedXrQLZIND1F9Zp PAMM5PAy2WIFWLd1AbpNh/12uyS9uklgsMjKmswOFL6Zvmfz+YIHnP5skj/cdgNDOZ8I 2ch8bVRdXprSbEBHd60bYsgqYfhKRdEPDPVtoOXPNF29XaBBrK6uiuRtj9AMjUbOlHpr UFlTP8djv/s2F5oWu98M6BiMf9loYyi7fWSL1a3lgsQrn8RtHcVXcpgcSup/WWsSUFfC 8X+A== X-Gm-Message-State: AOJu0YxMzcUMD6m1vsmKVTv6TR2UGNNiJ9IjO6wE0sUJA99/B5otgHCm G9c2XCxhaa9zB/JsbFaeo3owEGkHIb9GJG/xrX8odbO26FG7wK1z2yyRApj0hvGoh+B0Bhjo5W0 yE7N+K9nVg1ngZidv2S9itcslUGA= X-Google-Smtp-Source: AGHT+IHPhyMyNdegapaLnCk7lyoyLs1iNYjPIYXjnBRJY+hiA6CIoaC9SRi60IoUbQeAgEhfNp9RoHdGcW3zwdQ1XA4= X-Received: by 2002:a05:622a:1487:b0:42f:200b:450c with SMTP id t7-20020a05622a148700b0042f200b450cmr4283587qtx.64.1711008845190; Thu, 21 Mar 2024 01:14:05 -0700 (PDT) MIME-Version: 1.0 References: <20240320173217.311340-2-rjarry@redhat.com> In-Reply-To: <20240320173217.311340-2-rjarry@redhat.com> From: Jerin Jacob Date: Thu, 21 Mar 2024 13:43:39 +0530 Message-ID: Subject: Re: [PATCH] graph: expose node context as pointers To: Robin Jarry Cc: dev@dpdk.org, Jerin Jacob , Kiran Kumar K , Nithin Dabilpuram , Zhirun Yan Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 On Wed, Mar 20, 2024 at 11:02=E2=80=AFPM Robin Jarry wr= ote: > > 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_wo= rker_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]; /**< N= ode Context. */ > + alignas(RTE_CACHE_LINE_SIZE) union { > + uint8_t ctx[RTE_NODE_CTX_SZ]; > + /* Convenience aliases to store pointers without complex = casting. */ 1) Use _extension_ to not break this on windows build. See rte_mbuf. 2) Also add static assert to make sure the following struct is not greater than RTE_NODE_CTX_SZ. To avoid accidentally adding something in the future. > + 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 >