From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id EC6355909 for ; Thu, 11 Sep 2014 15:10:38 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP; 11 Sep 2014 06:07:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="384718627" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by FMSMGA003.fm.intel.com with ESMTP; 11 Sep 2014 06:10:42 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id s8BDFna8002153; Thu, 11 Sep 2014 14:15:49 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id s8BDFnZT023659; Thu, 11 Sep 2014 14:15:49 +0100 Received: (from bricha3@localhost) by sivswdev02.ir.intel.com with id s8BDFn4F023655; Thu, 11 Sep 2014 14:15:49 +0100 From: Bruce Richardson To: dev@dpdk.org Date: Thu, 11 Sep 2014 14:15:42 +0100 Message-Id: <1410441347-22840-9-git-send-email-bruce.richardson@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1410441347-22840-1-git-send-email-bruce.richardson@intel.com> References: <1409759378-10113-1-git-send-email-bruce.richardson@intel.com> <1410441347-22840-1-git-send-email-bruce.richardson@intel.com> Subject: [dpdk-dev] [PATCH v2 08/13] mbuf: add named points inside the mbuf structure X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Sep 2014 13:10:39 -0000 Add markers or "labels" at given points inside the mbuf which can be used instead of individual fields to identify the start of logical sections inside the mbuf. The use of typedefs and dummy fields was chosen over using unions because of a couple reasons: * unions cause an extra level of indentation (more likely two levels as a union containing a struct for multiple fields would be needed). This makes the lines longer than they need to be and increases the need for wrapping. [This was the main reason] * with markers, you can apply multiple markers at the same point if wanted. Updates in V2: * None Signed-off-by: Bruce Richardson --- lib/librte_mbuf/rte_mbuf.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 2f1bd4a..34900d4 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -115,14 +115,22 @@ extern "C" { */ #define PKT_TX_OFFLOAD_MASK (PKT_TX_VLAN_PKT | PKT_TX_IP_CKSUM | PKT_TX_L4_MASK) +/* define a set of marker types that can be used to refer to set points in the + * mbuf */ +typedef void *MARKER[0]; /**< generic marker for a point in a structure */ +typedef uint64_t MARKER64[0]; /**< marker that allows us to overwrite 8 bytes + * with a single assignment */ /** * The generic rte_mbuf, containing a packet mbuf. */ struct rte_mbuf { + MARKER cacheline0; + void *buf_addr; /**< Virtual address of segment buffer. */ phys_addr_t buf_physaddr; /**< Physical address of segment buffer. */ /* next 8 bytes are initialised on RX descriptor rearm */ + MARKER64 rearm_data; uint16_t buf_len; /**< Length of segment buffer. */ uint16_t data_off; @@ -147,6 +155,7 @@ struct rte_mbuf { uint64_t ol_flags; /**< Offload features. */ /* remaining bytes are set on RX when pulling packet from descriptor */ + MARKER rx_descriptor_fields1; uint16_t reserved2; /**< Unused field. Required for padding */ uint16_t data_len; /**< Amount of data in segment buffer. */ uint32_t pkt_len; /**< Total pkt len: sum of all segments. */ -- 1.9.3