From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot0-f194.google.com (mail-ot0-f194.google.com [74.125.82.194]) by dpdk.org (Postfix) with ESMTP id BE1662AA0 for ; Tue, 19 Jun 2018 01:35:48 +0200 (CEST) Received: by mail-ot0-f194.google.com with SMTP id p95-v6so20520852ota.5 for ; Mon, 18 Jun 2018 16:35:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=DJEhK8kub6zpNT+xJ1xVG1DnPLFHxmDXU/A/FyGWr2E=; b=qLG+06/yfW3nasLQm849GvWRHqIqtN2+ji0EZClA4dGleEWlyeG28+RioMpko8tdE1 TwTBJo7HX7blNKZGTNTsetcqm0UPm9MDhl+2oRCPGJ67XS9GWts93lw0jfO+3KYl2tgn OIN36UB+6gcMZVoU/YBgBskDfCoYxPh/dGm4jWQTdAeKIte8F88MJ9c17h9a549uS46A vxeYXw6anAF5QH5L8U0NORO2iLN6u9Te0XSzwiUeSl9as4PzRa5WHs8VyR823f3u7KUo yMskFbdCZclhGPov4rkTEHcvv+/UF/lb5PunBnoDDkD+vTJvpIQ/dNI8ow3vaEMY7BLq 1UCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=DJEhK8kub6zpNT+xJ1xVG1DnPLFHxmDXU/A/FyGWr2E=; b=AA/4LdZ4e7U+kYc5MSqSdvV1hWT/Z3zD5pjO76CwuMThb/WdGEMzLXTGWfmLfFneWd taxlGD0cXWag/punEqWR4LwA69wBYxdLtcE6YuWE/sUI8IZVIBk3ymSp0rObuI1Hbv8i 4mQ0r/qW7xnWUFR5e4eDxoEYAcCzVQVZ/FuzxK0foM9pF2tnvY5f3alSGUpv4pbtiM6I 2M9Sy0ze2vFHoYBxfJq5w+wyZiziFSl0utPfu1kL8Y1tlpH8RP4Tc3nM5OFZoDscNzXA 0DRjela8yYk1lOryVrPC0CkBosIE7LNc26zwncb9uWjFORLPderXEqtumW4i8UpO2PyX 4ABA== X-Gm-Message-State: APt69E2pPZA5m9ZDKIP4LiTSu8loWjkwHbxxaoEr1xeuA3TDHQcZHxrl T/eCTob8mk/PIt9m4SvdxAUPFQ== X-Google-Smtp-Source: ADUXVKIM8Npg6k9oJj/5MMq0GqRqmVXO+nJAOSYN/Vp5qBF+HP5T1gn84/PsgytAtDDRjH4LWmLbgw== X-Received: by 2002:a9d:428c:: with SMTP id r12-v6mr8453070ote.296.1529364947799; Mon, 18 Jun 2018 16:35:47 -0700 (PDT) Received: from linux.adax.com (172-11-198-60.lightspeed.sntcca.sbcglobal.net. [172.11.198.60]) by smtp.gmail.com with ESMTPSA id p128-v6sm7091635oia.31.2018.06.18.16.35.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Jun 2018 16:35:47 -0700 (PDT) Sender: Dan Gora From: Dan Gora To: dev@dpdk.org Cc: Dan Gora , Olivier Matz Date: Mon, 18 Jun 2018 16:35:34 -0700 Message-Id: <20180618233534.21611-1-dg@adax.com> X-Mailer: git-send-email 2.18.0.rc1.1.g6f333ff2f Subject: [dpdk-dev] [PATCH v2 1/4] mbuf: add accessor function for private data area X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2018 23:35:49 -0000 Add an inline accessor function to return the starting address of the private data area in the supplied mbuf. This allows applications to easily access the private data area between the struct rte_mbuf and the data buffer in the specified mbuf without creating private macros or accessor functions. No checks are made to ensure that a private data area actually exists in the buffer. Signed-off-by: Dan Gora --- lib/librte_mbuf/rte_mbuf.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 8e6b4d292..08c58335d 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -728,6 +728,24 @@ rte_mbuf_to_baddr(struct rte_mbuf *md) return buffer_addr; } +/** + * Return the starting address of the private data area embedded in + * the given mbuf. + * + * Note that no check is made to ensure that a private data area + * actually exists in the supplied mbuf. + * + * @param md + * The pointer to the mbuf. + * @return + * The starting address of the private data area of the given mbuf. + */ +static inline void * __rte_experimental +rte_mbuf_to_priv(struct rte_mbuf *m) +{ + return RTE_PTR_ADD(m, sizeof(struct rte_mbuf)); +} + /** * Returns TRUE if given mbuf is cloned by mbuf indirection, or FALSE * otherwise. -- 2.18.0.rc1.1.g6f333ff2f