From patchwork Tue Feb 27 05:41:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 137295 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 A3D9B43C03; Tue, 27 Feb 2024 06:42:11 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BDB6840295; Tue, 27 Feb 2024 06:42:10 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 958BF402A7 for ; Tue, 27 Feb 2024 06:41:41 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id B234720B74C1; Mon, 26 Feb 2024 21:41:40 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com B234720B74C1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1709012500; bh=v1tKUXog76Mxk6grlZIt7+LwqsEUivznLL61OoHb5T0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kIz4no/XMIXhlJTjSbjRINvMJXjS0Oy+seagqifOeGCeLw4+YIQyAsfaBkDlq23I8 2T785h68fa4m7LMJ6dRpWtq90nBfocA/IHOcxrDtmtagKi/gETpzPD/jPnOpxZGJ7u LG40pfBreqyBJltMKBDxoV0Ux0nU+F4sy7wcwkj0= From: Tyler Retzlaff To: dev@dpdk.org Cc: Ajit Khaparde , Andrew Boyer , Andrew Rybchenko , Bruce Richardson , Chenbo Xia , Chengwen Feng , Dariusz Sosnowski , David Christensen , Hyong Youb Kim , Jerin Jacob , Jie Hai , Jingjing Wu , John Daley , Kevin Laatz , Kiran Kumar K , Konstantin Ananyev , Maciej Czekaj , Matan Azrad , Maxime Coquelin , Nithin Dabilpuram , Ori Kam , Ruifeng Wang , Satha Rao , Somnath Kotur , Suanming Mou , Sunil Kumar Kori , Viacheslav Ovsiienko , Yisen Zhuang , Yuying Zhang , mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v6 01/23] mbuf: add accessors for rearm and Rx descriptor fields Date: Mon, 26 Feb 2024 21:41:17 -0800 Message-Id: <1709012499-12813-2-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1709012499-12813-1-git-send-email-roretzla@linux.microsoft.com> References: <1706657173-26166-1-git-send-email-roretzla@linux.microsoft.com> <1709012499-12813-1-git-send-email-roretzla@linux.microsoft.com> 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 RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Provide inline functions to access compatible type pointer to rearm_data and rx_descriptor_fields1 which will allow direct references on the rte marker fields to be removed. Signed-off-by: Tyler Retzlaff --- lib/mbuf/rte_mbuf.h | 13 +++++++++++++ lib/mbuf/rte_mbuf_core.h | 11 ++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h index 286b32b..aa7495b 100644 --- a/lib/mbuf/rte_mbuf.h +++ b/lib/mbuf/rte_mbuf.h @@ -132,6 +132,19 @@ #endif } +static inline +uint64_t * +rte_mbuf_rearm_data(struct rte_mbuf *m) +{ + return (uint64_t *)&m->data_off; +} + +static inline +void * +rte_mbuf_rx_descriptor_fields1(struct rte_mbuf *m) +{ + return &m->packet_type; +} static inline uint16_t rte_pktmbuf_priv_size(struct rte_mempool *mp); diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h index 5688683..7000c04 100644 --- a/lib/mbuf/rte_mbuf_core.h +++ b/lib/mbuf/rte_mbuf_core.h @@ -486,7 +486,12 @@ struct rte_mbuf { struct rte_mbuf *next; #endif - /* next 8 bytes are initialised on RX descriptor rearm */ + /** + * next 8 bytes are initialised on RX descriptor rearm + * + * To obtain a pointer to rearm_data use the rte_mbuf_rearm_data() + * accessor instead of directly referencing through the data_off field. + */ RTE_MARKER64 rearm_data; uint16_t data_off; @@ -522,6 +527,10 @@ struct rte_mbuf { * mbuf. Example: if vlan stripping is enabled, a received vlan packet * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the * vlan is stripped from the data. + * + * To obtain a pointer to rx_descriptor_fields1 use the + * rte_mbuf_rx_descriptor_fields1() accessor instead of directly + * referencing through the the anonymous union fields. */ union { uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */