Skip to contentSkip to conversation

Mbuf structure Rework, part 1

PATCH Superseded Bruce Richardson 4 participants 35 messages Aug 27, 2014 – Sep 17, 2014 14 messages not in the archive

lore
Share & tools
lore
#0 lore raw

cover Mbuf structure Rework, part 1

This patch set does some initial pre-work to prepare the mbuf data structure (and ixgbe vector driver to a lesser extent) for more major changes which will follow on in a subsequent patch set. [See previous RFC patch set for more indications of the future coming changes].

The main changes here are the flattening out of the mbuf data structure, with much of it based off work by Olivier. The ctrlmbuf and pktmbuf structures are now gone, as is the vlan_macip structure. However, in this set, the concept of having a separate ctrl mbuf type is kept around. The plan is in a later set when we expand the flags field to 64-bits, we can use a single bit in the flags to indicate a control packet. For now, though, the ctrlmbuf functions and macros just are aliases for the pktmbuf equivalents as much as possible.

Bruce Richardson (3):
ixgbe: put only non-zero initializer in definition
mbuf: rename in_port to just port
mbuf: flatten struct vlan_macip into mbuf struct

Olivier Matz (3):
mbuf: rename RTE_MBUF_SCATTER_GATHER into RTE_MBUF_REFCNT
mbuf: remove rte_ctrlmbuf
mbuf: remove the rte_pktmbuf structure

 app/test-pmd/cmdline.c                             |   2 -
 app/test-pmd/csumonly.c                            |   6 +-
 app/test-pmd/flowgen.c                             |  22 +-
 app/test-pmd/icmpecho.c                            |   4 +-
 app/test-pmd/ieee1588fwd.c                         |   6 +-
 app/test-pmd/macfwd-retry.c                        |   2 +-
 app/test-pmd/macfwd.c                              |   8 +-
 app/test-pmd/macswap.c                             |   8 +-
 app/test-pmd/rxonly.c                              |  13 +-
 app/test-pmd/testpmd.c                             |  12 +-
 app/test-pmd/testpmd.h                             |   2 +-
 app/test-pmd/txonly.c                              |  44 +--
 app/test/commands.c                                |   2 -
 app/test/packet_burst_generator.c                  |  46 +--
 app/test/test_distributor.c                        |  18 +-
 app/test/test_distributor_perf.c                   |   4 +-
 app/test/test_mbuf.c                               | 100 ++-----
 app/test/test_sched.c                              |   4 +-
 app/test/test_table_acl.c                          |   6 +-
 app/test/test_table_pipeline.c                     |   4 +-
 config/common_bsdapp                               |   2 +-
 config/common_linuxapp                             |   2 +-
 doc/doxy-api.conf                                  |   2 +-
 examples/Makefile                                  |   4 +-
 examples/dpdk_qat/crypto.c                         |  22 +-
 examples/dpdk_qat/main.c                           |   2 +-
 examples/exception_path/main.c                     |  10 +-
 examples/ip_fragmentation/Makefile                 |   4 +-
 examples/ip_fragmentation/main.c                   |   6 +-
 examples/ip_pipeline/Makefile                      |   2 +-
 examples/ip_pipeline/cmdline.c                     |  44 +--
 examples/ip_pipeline/init.c                        |   2 +-
 examples/ip_pipeline/main.c                        |   2 +-
 examples/ip_pipeline/pipeline_firewall.c           |   4 +-
 .../ip_pipeline/pipeline_flow_classification.c     |   4 +-
 examples/ip_pipeline/pipeline_routing.c            |   4 +-
 examples/ip_pipeline/pipeline_rx.c                 |   8 +-
 examples/ip_pipeline/pipeline_tx.c                 |   2 +-
 examples/ip_reassembly/main.c                      |   8 +-
 examples/ipv4_multicast/Makefile                   |   4 +-
 examples/ipv4_multicast/main.c                     |  18 +-
 examples/l3fwd-acl/main.c                          |   2 +-
 examples/l3fwd-power/main.c                        |   2 +-
 examples/l3fwd-vf/main.c                           |   2 +-
 examples/l3fwd/main.c                              |  10 +-
 examples/load_balancer/runtime.c                   |   2 +-
 .../client_server_mp/mp_client/client.c            |   2 +-
 examples/quota_watermark/qw/main.c                 |   4 +-
 examples/vhost/main.c                              |  74 ++---
 examples/vhost_xen/main.c                          |  22 +-
 lib/librte_distributor/rte_distributor.c           |   2 +-
 lib/librte_ip_frag/ip_frag_common.h                |  13 +-
 lib/librte_ip_frag/rte_ipv4_fragmentation.c        |  40 +--
 lib/librte_ip_frag/rte_ipv4_reassembly.c           |   6 +-
 lib/librte_ip_frag/rte_ipv6_fragmentation.c        |  38 +--
 lib/librte_ip_frag/rte_ipv6_reassembly.c           |   5 +-
 lib/librte_mbuf/rte_mbuf.c                         |  84 ++----
 lib/librte_mbuf/rte_mbuf.h                         | 311 +++++++++------------
 lib/librte_pmd_bond/rte_eth_bond_pmd.c             |   4 +-
 lib/librte_pmd_e1000/em_rxtx.c                     |  98 ++++---
 lib/librte_pmd_e1000/igb_rxtx.c                    | 103 ++++---
 lib/librte_pmd_i40e/i40e_rxtx.c                    | 104 ++++---
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c                  | 114 ++++----
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h                  |  25 +-
 lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c              |  47 +---
 lib/librte_pmd_pcap/rte_eth_pcap.c                 |  14 +-
 lib/librte_pmd_virtio/virtio_rxtx.c                |  22 +-
 lib/librte_pmd_virtio/virtqueue.h                  |   2 +-
 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c              |  30 +-
 lib/librte_pmd_xenvirt/rte_eth_xenvirt.c           |  14 +-
 lib/librte_pmd_xenvirt/virtqueue.h                 |   4 +-
 lib/librte_port/Makefile                           |   4 +-
 lib/librte_port/rte_port_frag.c                    |   2 +-
 lib/librte_sched/rte_sched.c                       |  14 +-
 lib/librte_sched/rte_sched.h                       |  10 +-
 75 files changed, 790 insertions(+), 909 deletions(-)
Signature · 1 line
1.9.3

A message that is not in the archive (sent off-list or not yet received): 1409154628-30825-1-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#2 lore raw

PATCH 1/6 ixgbe: put only non-zero initializer in definition

Since all unspecified fields in an initializer are assumed to be zero we can simplify the empty mbuf definition in the vector driver to only use the fields that are non-zero, i.e. just nb_segs = 1. This makes things shorter and means that the structure doesn't need as many updates for other fields being renamed or moved.

The variable itself is never modified and only used by a single function so it can be made const and local to the using function.

---
 lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 29 +++++------------------------
 1 file changed, 5 insertions(+), 24 deletions(-)
lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c +5 -24
index 92e07de..56dce23 100644
@@ -44,33 +44,14 @@
 #pragma GCC diagnostic ignored "-Wcast-qual"
 #endif
 
-static struct rte_mbuf mb_def = {
-
-	.ol_flags = 0,
-	{
-		.pkt = {
-			.data_len = 0,
-			.pkt_len = 0,
-
-			.vlan_macip = {
-				.data = 0,
-			},
-			.hash = {
-				.rss = 0,
-			},
-
-			.nb_segs = 1,
-			.in_port = 0,
-
-			.next = NULL,
-			.data = NULL,
-		},
-	},
-};
-
 static inline void
 ixgbe_rxq_rearm(struct igb_rx_queue *rxq)
 {
+	static const struct rte_mbuf mb_def = {
+		.pkt = {
+			.nb_segs = 1,
+		},
+	};
 	int i;
 	uint16_t rx_id;
 	volatile union ixgbe_adv_rx_desc *rxdp;
Signature · 1 line
1.9.3
#3 lore raw

PATCH 2/6 mbuf: rename RTE_MBUF_SCATTER_GATHER into RTE_MBUF_REFCNT

In reply to a message not in the archive

From: Olivier Matz <[email protected]>

It seems that RTE_MBUF_SCATTER_GATHER is not the proper name for the feature it provides. "Scatter gather" means that data is stored using several buffers. RTE_MBUF_REFCNT seems to be a better name for that feature as it provides a reference counter for mbufs.

The macro RTE_MBUF_SCATTER_GATHER is poisoned to ensure this modification is seen by drivers or applications using it.

---
 app/test/test_mbuf.c                  | 16 ++++++++--------
 config/common_bsdapp                  |  2 +-
 config/common_linuxapp                |  2 +-
 doc/doxy-api.conf                     |  2 +-
 examples/Makefile                     |  4 ++--
 examples/ip_fragmentation/Makefile    |  4 ++--
 examples/ip_pipeline/Makefile         |  2 +-
 examples/ip_pipeline/main.c           |  2 +-
 examples/ipv4_multicast/Makefile      |  4 ++--
 examples/vhost/main.c                 |  4 ++--
 lib/librte_mbuf/rte_mbuf.c            |  2 +-
 lib/librte_mbuf/rte_mbuf.h            | 35 +++++++++++++++++++----------------
 lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c |  4 ++--
 lib/librte_port/Makefile              |  4 ++--
 14 files changed, 45 insertions(+), 42 deletions(-)
app/test/test_mbuf.c +8 -8
index 2b87521..678c382 100644
@@ -82,7 +82,7 @@
 static struct rte_mempool *pktmbuf_pool = NULL;
 static struct rte_mempool *ctrlmbuf_pool = NULL;
 
-#if defined RTE_MBUF_SCATTER_GATHER  && defined RTE_MBUF_REFCNT_ATOMIC
+#if defined RTE_MBUF_REFCNT  && defined RTE_MBUF_REFCNT_ATOMIC
 
 static struct rte_mempool *refcnt_pool = NULL;
 static struct rte_ring *refcnt_mbuf_ring = NULL;
@@ -365,7 +365,7 @@ fail:
 static int
 testclone_testupdate_testdetach(void)
 {
-#ifndef RTE_MBUF_SCATTER_GATHER
+#ifndef RTE_MBUF_REFCNT
 	return 0;
 #else
 	struct rte_mbuf *mc = NULL;
@@ -406,7 +406,7 @@ fail:
 	if (mc)
 		rte_pktmbuf_free(mc);
 	return -1;
-#endif /* RTE_MBUF_SCATTER_GATHER */
+#endif /* RTE_MBUF_REFCNT */
 }
 #undef GOTO_FAIL
 
@@ -439,7 +439,7 @@ test_pktmbuf_pool(void)
 		printf("Error pool not empty");
 		ret = -1;
 	}
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 	extra = rte_pktmbuf_clone(m[0], pktmbuf_pool);
 	if(extra != NULL) {
 		printf("Error pool not empty");
@@ -548,11 +548,11 @@ test_pktmbuf_free_segment(void)
 /*
  * Stress test for rte_mbuf atomic refcnt.
  * Implies that:
- * RTE_MBUF_SCATTER_GATHER and RTE_MBUF_REFCNT_ATOMIC are both defined.
+ * RTE_MBUF_REFCNT and RTE_MBUF_REFCNT_ATOMIC are both defined.
  * For more efficency, recomended to run with RTE_LIBRTE_MBUF_DEBUG defined.
  */
 
-#if defined RTE_MBUF_SCATTER_GATHER  && defined RTE_MBUF_REFCNT_ATOMIC
+#if defined RTE_MBUF_REFCNT  && defined RTE_MBUF_REFCNT_ATOMIC
 
 static int
 test_refcnt_slave(__attribute__((unused)) void *arg)
@@ -657,7 +657,7 @@ test_refcnt_master(void)
 static int
 test_refcnt_mbuf(void)
 {
-#if defined RTE_MBUF_SCATTER_GATHER  && defined RTE_MBUF_REFCNT_ATOMIC
+#if defined RTE_MBUF_REFCNT  && defined RTE_MBUF_REFCNT_ATOMIC
 
 	unsigned lnum, master, slave, tref;
 
@@ -808,7 +808,7 @@ test_failing_mbuf_sanity_check(void)
 		return -1;
 	}
 
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 	badbuf = *buf;
 	badbuf.refcnt = 0;
 	if (verify_mbuf_check_panics(&badbuf)) {
config/common_bsdapp +1 -1
index bf6d8a0..645949f 100644
@@ -249,7 +249,7 @@ CONFIG_RTE_LIBRTE_MEMPOOL_DEBUG=n
 #
 CONFIG_RTE_LIBRTE_MBUF=y
 CONFIG_RTE_LIBRTE_MBUF_DEBUG=n
-CONFIG_RTE_MBUF_SCATTER_GATHER=y
+CONFIG_RTE_MBUF_REFCNT=y
 CONFIG_RTE_MBUF_REFCNT_ATOMIC=y
 CONFIG_RTE_PKTMBUF_HEADROOM=128
 
config/common_linuxapp +1 -1
index 9047975..5bee910 100644
@@ -277,7 +277,7 @@ CONFIG_RTE_LIBRTE_MEMPOOL_DEBUG=n
 #
 CONFIG_RTE_LIBRTE_MBUF=y
 CONFIG_RTE_LIBRTE_MBUF_DEBUG=n
-CONFIG_RTE_MBUF_SCATTER_GATHER=y
+CONFIG_RTE_MBUF_REFCNT=y
 CONFIG_RTE_MBUF_REFCNT_ATOMIC=y
 CONFIG_RTE_PKTMBUF_HEADROOM=128
 
doc/doxy-api.conf +1 -1
index 1fd4492..63dc64d 100644
@@ -56,7 +56,7 @@ FILE_PATTERNS           = rte_*.h \
                           cmdline.h
 PREDEFINED              = __DOXYGEN__ \
                           __attribute__(x)= \
-                          RTE_MBUF_SCATTER_GATHER
+                          RTE_MBUF_REFCNT
 
 OPTIMIZE_OUTPUT_FOR_C   = YES
 ENABLE_PREPROCESSING    = YES
examples/Makefile +2 -2
index dc85cf3..6245f83 100644
@@ -45,8 +45,8 @@ DIRS-y += exception_path
 DIRS-y += helloworld
 DIRS-y += ip_pipeline
 DIRS-y += ip_reassembly
-DIRS-$(CONFIG_RTE_MBUF_SCATTER_GATHER) += ip_fragmentation
-DIRS-$(CONFIG_RTE_MBUF_SCATTER_GATHER) += ipv4_multicast
+DIRS-$(CONFIG_RTE_MBUF_REFCNT) += ip_fragmentation
+DIRS-$(CONFIG_RTE_MBUF_REFCNT) += ipv4_multicast
 DIRS-$(CONFIG_RTE_LIBRTE_KNI) += kni
 DIRS-y += l2fwd
 DIRS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += l2fwd-ivshmem
examples/ip_fragmentation/Makefile +2 -2
index 6d729f0..ea0e11f 100644
@@ -39,8 +39,8 @@ RTE_TARGET ?= x86_64-native-linuxapp-gcc
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
-ifneq ($(CONFIG_RTE_MBUF_SCATTER_GATHER),y)
-$(error This application requires RTE_MBUF_SCATTER_GATHER to be enabled)
+ifneq ($(CONFIG_RTE_MBUF_REFCNT),y)
+$(error This application requires RTE_MBUF_REFCNT to be enabled)
 endif
 
 # binary name
examples/ip_pipeline/Makefile +1 -1
index a807ee8..b0a4106 100644
@@ -52,7 +52,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_flow_classification.c
 SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_routing.c
 SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough.c
 
-ifeq ($(CONFIG_RTE_MBUF_SCATTER_GATHER),y)
+ifeq ($(CONFIG_RTE_MBUF_REFCNT),y)
 SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_ipv4_frag.c
 SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_ipv4_ras.c
 endif
examples/ip_pipeline/main.c +1 -1
index f773958..e19412f 100644
@@ -148,7 +148,7 @@ app_lcore_main_loop(__attribute__((unused)) void *arg)
 			rte_exit(EXIT_FAILURE, "ACL not present in build\n");
 #endif
 
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 		case APP_CORE_IPV4_FRAG:
 			app_main_loop_pipeline_ipv4_frag();
 			return 0;
examples/ipv4_multicast/Makefile +2 -2
index 191574b..604cebe 100644
@@ -39,8 +39,8 @@ RTE_TARGET ?= x86_64-native-linuxapp-gcc
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
-ifneq ($(CONFIG_RTE_MBUF_SCATTER_GATHER),y)
-$(error This application requires RTE_MBUF_SCATTER_GATHER to be enabled)
+ifneq ($(CONFIG_RTE_MBUF_REFCNT),y)
+$(error This application requires RTE_MBUF_REFCNT to be enabled)
 endif
 
 # binary name
examples/vhost/main.c +2 -2
index 193aa25..fe28912 100644
@@ -727,10 +727,10 @@ us_vhost_parse_args(int argc, char **argv)
 					zero_copy = ret;
 
 				if (zero_copy) {
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 					RTE_LOG(ERR, VHOST_CONFIG, "Before running "
 					"zero copy vhost APP, please "
-					"disable RTE_MBUF_SCATTER_GATHER\n"
+					"disable RTE_MBUF_REFCNT\n"
 					"in config file and then rebuild DPDK "
 					"core lib!\n"
 					"Otherwise please disable zero copy "
lib/librte_mbuf/rte_mbuf.c +1 -1
index 09d8934..a4967e3 100644
@@ -160,7 +160,7 @@ rte_mbuf_sanity_check(const struct rte_mbuf *m, enum rte_mbuf_type t,
 	if (m->buf_addr == NULL)
 		rte_panic("bad virt addr\n");
 
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 	uint16_t cnt = rte_mbuf_refcnt_read(m);
 	if ((cnt == 0) || (cnt == UINT16_MAX))
 		rte_panic("bad ref cnt\n");
lib/librte_mbuf/rte_mbuf.h +19 -16
index 2735f37..fbd1c7b 100644
@@ -67,6 +67,9 @@
 extern "C" {
 #endif
 
+/* deprecated feature, renamed in RTE_MBUF_REFCNT */
+#pragma GCC poison RTE_MBUF_SCATTER_GATHER
+
 /**
  * A control message buffer.
  */
@@ -185,7 +188,7 @@ struct rte_mbuf {
 	void *buf_addr;           /**< Virtual address of segment buffer. */
 	phys_addr_t buf_physaddr; /**< Physical address of segment buffer. */
 	uint16_t buf_len;         /**< Length of segment buffer. */
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 	/**
 	 * 16-bit Reference counter.
 	 * It should only be accessed using the following functions:
@@ -298,7 +301,7 @@ if (!(exp)) {                                                        \
 
 #endif /*  RTE_LIBRTE_MBUF_DEBUG */
 
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 #ifdef RTE_MBUF_REFCNT_ATOMIC
 
 /**
@@ -380,14 +383,14 @@ rte_mbuf_refcnt_set(struct rte_mbuf *m, uint16_t new_value)
 		rte_prefetch0(m);               \
 } while (0)
 
-#else /* ! RTE_MBUF_SCATTER_GATHER */
+#else /* ! RTE_MBUF_REFCNT */
 
 /** Mbuf prefetch */
 #define RTE_MBUF_PREFETCH_TO_FREE(m) do { } while(0)
 
 #define rte_mbuf_refcnt_set(m,v) do { } while(0)
 
-#endif /* RTE_MBUF_SCATTER_GATHER */
+#endif /* RTE_MBUF_REFCNT */
 
 
 /**
@@ -426,10 +429,10 @@ static inline struct rte_mbuf *__rte_mbuf_raw_alloc(struct rte_mempool *mp)
 	if (rte_mempool_get(mp, &mb) < 0)
 		return NULL;
 	m = (struct rte_mbuf *)mb;
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 	RTE_MBUF_ASSERT(rte_mbuf_refcnt_read(m) == 0);
 	rte_mbuf_refcnt_set(m, 1);
-#endif /* RTE_MBUF_SCATTER_GATHER */
+#endif /* RTE_MBUF_REFCNT */
 	return (m);
 }
 
@@ -444,9 +447,9 @@ static inline struct rte_mbuf *__rte_mbuf_raw_alloc(struct rte_mempool *mp)
 static inline void __attribute__((always_inline))
 __rte_mbuf_raw_free(struct rte_mbuf *m)
 {
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 	RTE_MBUF_ASSERT(rte_mbuf_refcnt_read(m) == 0);
-#endif /* RTE_MBUF_SCATTER_GATHER */
+#endif /* RTE_MBUF_REFCNT */
 	rte_mempool_put(m->pool, m);
 }
 
@@ -506,9 +509,9 @@ static inline struct rte_mbuf *rte_ctrlmbuf_alloc(struct rte_mempool *mp)
 static inline void rte_ctrlmbuf_free(struct rte_mbuf *m)
 {
 	__rte_mbuf_sanity_check(m, RTE_MBUF_CTRL, 0);
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 	if (rte_mbuf_refcnt_update(m, -1) == 0)
-#endif /* RTE_MBUF_SCATTER_GATHER */
+#endif /* RTE_MBUF_REFCNT */
 		__rte_mbuf_raw_free(m);
 }
 
@@ -623,7 +626,7 @@ static inline struct rte_mbuf *rte_pktmbuf_alloc(struct rte_mempool *mp)
 	return (m);
 }
 
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 
 /**
  * Attach packet mbuf to another packet mbuf.
@@ -691,7 +694,7 @@ static inline void rte_pktmbuf_detach(struct rte_mbuf *m)
 	m->pkt.data_len = 0;
 }
 
-#endif /* RTE_MBUF_SCATTER_GATHER */
+#endif /* RTE_MBUF_REFCNT */
 
 
 static inline struct rte_mbuf* __attribute__((always_inline))
@@ -699,7 +702,7 @@ __rte_pktmbuf_prefree_seg(struct rte_mbuf *m)
 {
 	__rte_mbuf_sanity_check(m, RTE_MBUF_PKT, 0);
 
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 	if (likely (rte_mbuf_refcnt_read(m) == 1) ||
 			likely (rte_mbuf_refcnt_update(m, -1) == 0)) {
 		struct rte_mbuf *md = RTE_MBUF_FROM_BADDR(m->buf_addr);
@@ -717,7 +720,7 @@ __rte_pktmbuf_prefree_seg(struct rte_mbuf *m)
 		}
 #endif
 		return(m);
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 	}
 	return (NULL);
 #endif
@@ -761,7 +764,7 @@ static inline void rte_pktmbuf_free(struct rte_mbuf *m)
 	}
 }
 
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 
 /**
  * Creates a "clone" of the given packet mbuf.
@@ -837,7 +840,7 @@ static inline void rte_pktmbuf_refcnt_update(struct rte_mbuf *m, int16_t v)
 	} while ((m = m->pkt.next) != NULL);
 }
 
-#endif /* RTE_MBUF_SCATTER_GATHER */
+#endif /* RTE_MBUF_REFCNT */
 
 /**
  * Get the headroom in a packet mbuf.
lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c +2 -2
index 56dce23..047acf0 100644
@@ -385,7 +385,7 @@ ixgbe_tx_free_bufs(struct igb_tx_queue *txq)
 	struct igb_tx_entry_seq *txsp;
 	uint32_t status;
 	uint32_t n, k;
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 	uint32_t i;
 	int nb_free = 0;
 	struct rte_mbuf *m, *free[RTE_IXGBE_TX_MAX_FREE_BUF_SZ];
@@ -408,7 +408,7 @@ ixgbe_tx_free_bufs(struct igb_tx_queue *txq)
 
 	while (n > 0) {
 		k = RTE_MIN(n, txsp[n-1].same_pool);
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 		for (i = 0; i < k; i++) {
 			m = __rte_pktmbuf_prefree_seg((txep+n-k+i)->mbuf);
 			if (m != NULL)
lib/librte_port/Makefile +2 -2
index 28793a5..82b5192 100644
@@ -45,7 +45,7 @@ CFLAGS += $(WERROR_FLAGS)
 SRCS-$(CONFIG_RTE_LIBRTE_PORT) += rte_port_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_PORT) += rte_port_ring.c
 ifeq ($(CONFIG_RTE_LIBRTE_IP_FRAG),y)
-ifeq ($(CONFIG_RTE_MBUF_SCATTER_GATHER),y)
+ifeq ($(CONFIG_RTE_MBUF_REFCNT),y)
 SRCS-$(CONFIG_RTE_LIBRTE_PORT) += rte_port_frag.c
 endif
 SRCS-$(CONFIG_RTE_LIBRTE_PORT) += rte_port_ras.c
@@ -58,7 +58,7 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_PORT)-include += rte_port.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_PORT)-include += rte_port_ethdev.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_PORT)-include += rte_port_ring.h
 ifeq ($(CONFIG_RTE_LIBRTE_IP_FRAG),y)
-ifeq ($(CONFIG_RTE_MBUF_SCATTER_GATHER),y)
+ifeq ($(CONFIG_RTE_MBUF_REFCNT),y)
 SYMLINK-$(CONFIG_RTE_LIBRTE_PORT)-include += rte_port_frag.h
 endif
 SYMLINK-$(CONFIG_RTE_LIBRTE_PORT)-include += rte_port_ras.h
Signature · 1 line
1.9.3
#4 lore raw

PATCH 3/6 mbuf: remove rte_ctrlmbuf

In reply to a message not in the archive

From: Olivier Matz <[email protected]>

The initial role of rte_ctrlmbuf is to carry generic messages (data pointer + data length) but it's not used by the DPDK or it applications. Keeping it implies:
- loosing 1 byte in the rte_mbuf structure
- having some dead code rte_mbuf.[ch]

This patch removes this feature. Thanks to it, it is now possible to simplify the rte_mbuf structure by merging the rte_pktmbuf structure in it. This is done in next commit.

* Updated patch to HEAD.
* Modified patch to retain the old function names for ctrl mbufs as macros. This helps with app compatibility, and allows the concept of a control mbuf to be reintroduced via a single-bit flag in a future change.
* Updated the packet framework ip_pipeline example application to work following this change.

---
 app/test-pmd/cmdline.c                             |   1 -
 app/test-pmd/flowgen.c                             |   2 +-
 app/test-pmd/testpmd.c                             |   2 -
 app/test-pmd/txonly.c                              |   2 +-
 app/test/commands.c                                |   1 -
 app/test/test_mbuf.c                               |  72 +------------
 examples/ip_pipeline/cmdline.c                     |  44 ++++----
 examples/ip_pipeline/init.c                        |   2 +-
 examples/ip_pipeline/pipeline_firewall.c           |   4 +-
 .../ip_pipeline/pipeline_flow_classification.c     |   4 +-
 examples/ip_pipeline/pipeline_routing.c            |   4 +-
 examples/ip_pipeline/pipeline_rx.c                 |   4 +-
 examples/ipv4_multicast/main.c                     |   2 +-
 lib/librte_mbuf/rte_mbuf.c                         |  60 +++--------
 lib/librte_mbuf/rte_mbuf.h                         | 117 +++++++--------------
 lib/librte_pmd_e1000/em_rxtx.c                     |   2 +-
 lib/librte_pmd_e1000/igb_rxtx.c                    |   2 +-
 lib/librte_pmd_i40e/i40e_rxtx.c                    |   4 +-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c                  |   4 +-
 lib/librte_pmd_virtio/virtio_rxtx.c                |   2 +-
 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c              |   2 +-
 lib/librte_pmd_xenvirt/rte_eth_xenvirt.c           |   2 +-
 22 files changed, 96 insertions(+), 243 deletions(-)
app/test-pmd/cmdline.c +0 -1
index 345be11..6dd576a 100644
@@ -6377,7 +6377,6 @@ dump_struct_sizes(void)
 #define DUMP_SIZE(t) printf("sizeof(" #t ") = %u\n", (unsigned)sizeof(t));
 	DUMP_SIZE(struct rte_mbuf);
 	DUMP_SIZE(struct rte_pktmbuf);
-	DUMP_SIZE(struct rte_ctrlmbuf);
 	DUMP_SIZE(struct rte_mempool);
 	DUMP_SIZE(struct rte_ring);
 #undef DUMP_SIZE
app/test-pmd/flowgen.c +1 -1
index 04911ff..a8f2a65 100644
@@ -96,7 +96,7 @@ tx_mbuf_alloc(struct rte_mempool *mp)
 	struct rte_mbuf *m;
 
 	m = __rte_mbuf_raw_alloc(mp);
-	__rte_mbuf_sanity_check_raw(m, RTE_MBUF_PKT, 0);
+	__rte_mbuf_sanity_check_raw(m, 0);
 	return (m);
 }
 
app/test-pmd/testpmd.c +0 -2
index e8a4b45..5368d01 100644
@@ -398,13 +398,11 @@ testpmd_mbuf_ctor(struct rte_mempool *mp,
 	mb_ctor_arg = (struct mbuf_ctor_arg *) opaque_arg;
 	mb = (struct rte_mbuf *) raw_mbuf;
 
-	mb->type         = RTE_MBUF_PKT;
 	mb->pool         = mp;
 	mb->buf_addr     = (void *) ((char *)mb + mb_ctor_arg->seg_buf_offset);
 	mb->buf_physaddr = (uint64_t) (rte_mempool_virt2phy(mp, mb) +
 			mb_ctor_arg->seg_buf_offset);
 	mb->buf_len      = mb_ctor_arg->seg_buf_size;
-	mb->type         = RTE_MBUF_PKT;
 	mb->ol_flags     = 0;
 	mb->pkt.data     = (char *) mb->buf_addr + RTE_PKTMBUF_HEADROOM;
 	mb->pkt.nb_segs  = 1;
app/test-pmd/txonly.c +1 -1
index ef93741..d634096 100644
@@ -93,7 +93,7 @@ tx_mbuf_alloc(struct rte_mempool *mp)
 	struct rte_mbuf *m;
 
 	m = __rte_mbuf_raw_alloc(mp);
-	__rte_mbuf_sanity_check_raw(m, RTE_MBUF_PKT, 0);
+	__rte_mbuf_sanity_check_raw(m, 0);
 	return (m);
 }
 
app/test/commands.c +0 -1
index 5f23420..f38d419 100644
@@ -276,7 +276,6 @@ dump_struct_sizes(void)
 #define DUMP_SIZE(t) printf("sizeof(" #t ") = %u\n", (unsigned)sizeof(t));
 	DUMP_SIZE(struct rte_mbuf);
 	DUMP_SIZE(struct rte_pktmbuf);
-	DUMP_SIZE(struct rte_ctrlmbuf);
 	DUMP_SIZE(struct rte_mempool);
 	DUMP_SIZE(struct rte_ring);
 #undef DUMP_SIZE
app/test/test_mbuf.c +3 -69

108 lines not on this page · raw message

examples/ip_pipeline/cmdline.c +22 -22

176 lines not on this page · raw message

examples/ip_pipeline/init.c +1 -1
index d00027f..e3ebd46 100644
@@ -561,7 +561,7 @@ app_ping(void)
 			rte_panic("Unable to allocate new message\n");
 
 		req = (struct app_msg_req *)
-			((struct rte_mbuf *)msg)->ctrl.data;
+				rte_ctrlmbuf_data((struct rte_mbuf *)msg);
 		req->type = APP_MSG_REQ_PING;
 
 		/* Send request */
examples/ip_pipeline/pipeline_firewall.c +2 -2
index ecc15a7..b70260e 100644
@@ -264,7 +264,7 @@ app_message_handle(struct app_core_firewall_message_handle_params *params)
 	table_id = params->table_id;
 
 	/* Handle request */
-	req = (struct app_msg_req *) msg->ctrl.data;
+	req = (struct app_msg_req *)rte_ctrlmbuf_data(msg);
 	switch (req->type) {
 	case APP_MSG_REQ_PING:
 	{
@@ -303,7 +303,7 @@ app_message_handle(struct app_core_firewall_message_handle_params *params)
 	}
 
 	/* Fill in response message */
-	resp = (struct app_msg_resp *) msg->ctrl.data;
+	resp = (struct app_msg_resp *)rte_ctrlmbuf_data(msg);
 	resp->result = result;
 
 	/* Send response */
examples/ip_pipeline/pipeline_flow_classification.c +2 -2
index 68d4f93..cc0cbf1 100644
@@ -250,7 +250,7 @@ app_message_handle(struct app_core_fc_message_handle_params *params)
 	table_id = params->table_id;
 
 	/* Handle request */
-	req = (struct app_msg_req *) ((struct rte_mbuf *)msg)->ctrl.data;
+	req = (struct app_msg_req *)rte_ctrlmbuf_data((struct rte_mbuf *)msg);
 	switch (req->type) {
 	case APP_MSG_REQ_PING:
 	{
@@ -296,7 +296,7 @@ app_message_handle(struct app_core_fc_message_handle_params *params)
 	}
 
 	/* Fill in response message */
-	resp = (struct app_msg_resp *) ((struct rte_mbuf *)msg)->ctrl.data;
+	resp = (struct app_msg_resp *)rte_ctrlmbuf_data((struct rte_mbuf *)msg);
 	resp->result = result;
 
 	/* Send response */
examples/ip_pipeline/pipeline_routing.c +2 -2
index f19506d..b1ce624 100644
@@ -370,7 +370,7 @@ app_message_handle(struct app_core_routing_message_handle_params *params)
 	arp_table_id = params->arp_table_id;
 
 	/* Handle request */
-	req = (struct app_msg_req *) ((struct rte_mbuf *)msg)->ctrl.data;
+	req = (struct app_msg_req *)rte_ctrlmbuf_data((struct rte_mbuf *)msg);
 	switch (req->type) {
 	case APP_MSG_REQ_PING:
 	{
@@ -464,7 +464,7 @@ app_message_handle(struct app_core_routing_message_handle_params *params)
 	}
 
 	/* Fill in response message */
-	resp = (struct app_msg_resp *) ((struct rte_mbuf *)msg)->ctrl.data;
+	resp = (struct app_msg_resp *)rte_ctrlmbuf_data((struct rte_mbuf *)msg);
 	resp->result = result;
 
 	/* Send response */
examples/ip_pipeline/pipeline_rx.c +2 -2
index ba5fa0a..e43ebfa 100644
@@ -348,7 +348,7 @@ app_message_handle(struct app_core_rx_message_handle_params *params)
 	port_in_id = params->port_in_id;
 
 	/* Handle request */
-	req = (struct app_msg_req *) ((struct rte_mbuf *)msg)->ctrl.data;
+	req = (struct app_msg_req *)rte_ctrlmbuf_data((struct rte_mbuf *)msg);
 	switch (req->type) {
 	case APP_MSG_REQ_PING:
 	{
@@ -375,7 +375,7 @@ app_message_handle(struct app_core_rx_message_handle_params *params)
 	}
 
 	/* Fill in response message */
-	resp = (struct app_msg_resp *) ((struct rte_mbuf *)msg)->ctrl.data;
+	resp = (struct app_msg_resp *)rte_ctrlmbuf_data((struct rte_mbuf *)msg);
 	resp->result = result;
 
 	/* Send response */
examples/ipv4_multicast/main.c +1 -1
index dfa0075..7b53296 100644
@@ -343,7 +343,7 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone)
 
 	hdr->ol_flags = pkt->ol_flags;
 
-	__rte_mbuf_sanity_check(hdr, RTE_MBUF_PKT, 1);
+	__rte_mbuf_sanity_check(hdr, 1);
 	return (hdr);
 }
 
lib/librte_mbuf/rte_mbuf.c +16 -44

106 lines not on this page · raw message

lib/librte_mbuf/rte_mbuf.h +36 -81

309 lines not on this page · raw message

lib/librte_pmd_e1000/em_rxtx.c +1 -1
index f254858..3304f50 100644
@@ -85,7 +85,7 @@ rte_rxmbuf_alloc(struct rte_mempool *mp)
 	struct rte_mbuf *m;
 
 	m = __rte_mbuf_raw_alloc(mp);
-	__rte_mbuf_sanity_check_raw(m, RTE_MBUF_PKT, 0);
+	__rte_mbuf_sanity_check_raw(m, 0);
 	return (m);
 }
 
lib/librte_pmd_e1000/igb_rxtx.c +1 -1
index 977c4a2..b0112be 100644
@@ -90,7 +90,7 @@ rte_rxmbuf_alloc(struct rte_mempool *mp)
 	struct rte_mbuf *m;
 
 	m = __rte_mbuf_raw_alloc(mp);
-	__rte_mbuf_sanity_check_raw(m, RTE_MBUF_PKT, 0);
+	__rte_mbuf_sanity_check_raw(m, 0);
 	return (m);
 }
 
lib/librte_pmd_i40e/i40e_rxtx.c +1 -3
index 83b9462..76ff019 100644
@@ -473,7 +473,7 @@ rte_rxmbuf_alloc(struct rte_mempool *mp)
 	struct rte_mbuf *m;
 
 	m = __rte_mbuf_raw_alloc(mp);
-	__rte_mbuf_sanity_check_raw(m, RTE_MBUF_PKT, 0);
+	__rte_mbuf_sanity_check_raw(m, 0);
 
 	return m;
 }
@@ -687,7 +687,6 @@ i40e_rx_alloc_bufs(struct i40e_rx_queue *rxq)
 	for (i = 0; i < rxq->rx_free_thresh; i++) {
 		mb = rxep[i].mbuf;
 		rte_mbuf_refcnt_set(mb, 1);
-		mb->type = RTE_MBUF_PKT;
 		mb->pkt.next = NULL;
 		mb->pkt.data = (char *)mb->buf_addr + RTE_PKTMBUF_HEADROOM;
 		mb->pkt.nb_segs = 1;
@@ -2020,7 +2019,6 @@ i40e_alloc_rx_queue_mbufs(struct i40e_rx_queue *rxq)
 		}
 
 		rte_mbuf_refcnt_set(mbuf, 1);
-		mbuf->type = RTE_MBUF_PKT;
 		mbuf->pkt.next = NULL;
 		mbuf->pkt.data = (char *)mbuf->buf_addr + RTE_PKTMBUF_HEADROOM;
 		mbuf->pkt.nb_segs = 1;
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +1 -3
index dfc2076..40ea4f8 100644
@@ -96,7 +96,7 @@ rte_rxmbuf_alloc(struct rte_mempool *mp)
 	struct rte_mbuf *m;
 
 	m = __rte_mbuf_raw_alloc(mp);
-	__rte_mbuf_sanity_check_raw(m, RTE_MBUF_PKT, 0);
+	__rte_mbuf_sanity_check_raw(m, 0);
 	return (m);
 }
 
@@ -995,7 +995,6 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
 		/* populate the static rte mbuf fields */
 		mb = rxep[i].mbuf;
 		rte_mbuf_refcnt_set(mb, 1);
-		mb->type = RTE_MBUF_PKT;
 		mb->pkt.next = NULL;
 		mb->pkt.data = (char *)mb->buf_addr + RTE_PKTMBUF_HEADROOM;
 		mb->pkt.nb_segs = 1;
@@ -3213,7 +3212,6 @@ ixgbe_alloc_rx_queue_mbufs(struct igb_rx_queue *rxq)
 		}
 
 		rte_mbuf_refcnt_set(mbuf, 1);
-		mbuf->type = RTE_MBUF_PKT;
 		mbuf->pkt.next = NULL;
 		mbuf->pkt.data = (char *)mbuf->buf_addr + RTE_PKTMBUF_HEADROOM;
 		mbuf->pkt.nb_segs = 1;
lib/librte_pmd_virtio/virtio_rxtx.c +1 -1
index fcd8bd1..186514d 100644
@@ -227,7 +227,7 @@ rte_rxmbuf_alloc(struct rte_mempool *mp)
 	struct rte_mbuf *m;
 
 	m = __rte_mbuf_raw_alloc(mp);
-	__rte_mbuf_sanity_check_raw(m, RTE_MBUF_PKT, 0);
+	__rte_mbuf_sanity_check_raw(m, 0);
 
 	return m;
 }
lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c +1 -1
index 2d9f5e0..2470c8e 100644
@@ -100,7 +100,7 @@ rte_rxmbuf_alloc(struct rte_mempool *mp)
 	struct rte_mbuf *m;
 
 	m = __rte_mbuf_raw_alloc(mp);
-	__rte_mbuf_sanity_check_raw(m, RTE_MBUF_PKT, 0);
+	__rte_mbuf_sanity_check_raw(m, 0);
 	return m;
 }
 
lib/librte_pmd_xenvirt/rte_eth_xenvirt.c +1 -1
index 450332a..ba82319 100644
@@ -81,7 +81,7 @@ rte_rxmbuf_alloc(struct rte_mempool *mp)
 	struct rte_mbuf *m;
 
 	m = __rte_mbuf_raw_alloc(mp);
-	__rte_mbuf_sanity_check_raw(m, RTE_MBUF_PKT, 0);
+	__rte_mbuf_sanity_check_raw(m, 0);
 
 	return m;
 }
Signature · 1 line
1.9.3
#5 lore raw

PATCH 4/6 mbuf: remove the rte_pktmbuf structure

In reply to a message not in the archive

From: Olivier Matz <[email protected]>

The rte_pktmbuf structure was initially included in the rte_mbuf structure. This was needed when there was 2 types of mbuf (ctrl and packet). As the control mbuf has been removed, we can merge the rte_pktmbuf into the rte_mbuf structure.

Advantages of doing this:
- the access to mbuf fields is easier (ex: m->data instead of m->pkt.data)
- make the structure more consistent: for instance, there was no reason to have the ol_flags field in rte_mbuf
- it will allow a deeper reorganization of the rte_mbuf structure in the next commits, allowing to gain several bytes in it

Updated to work with latest code, and to include new example apps.

---
 app/test-pmd/cmdline.c                             |   1 -
 app/test-pmd/csumonly.c                            |   6 +-
 app/test-pmd/flowgen.c                             |  16 +--
 app/test-pmd/icmpecho.c                            |   4 +-
 app/test-pmd/ieee1588fwd.c                         |   6 +-
 app/test-pmd/macfwd-retry.c                        |   2 +-
 app/test-pmd/macfwd.c                              |   8 +-
 app/test-pmd/macswap.c                             |   8 +-
 app/test-pmd/rxonly.c                              |  12 +-
 app/test-pmd/testpmd.c                             |   8 +-
 app/test-pmd/testpmd.h                             |   2 +-
 app/test-pmd/txonly.c                              |  42 +++---
 app/test/commands.c                                |   1 -
 app/test/packet_burst_generator.c                  |  46 +++----
 app/test/test_distributor.c                        |  18 +--
 app/test/test_distributor_perf.c                   |   4 +-
 app/test/test_mbuf.c                               |  12 +-
 app/test/test_sched.c                              |   4 +-
 app/test/test_table_acl.c                          |   6 +-
 app/test/test_table_pipeline.c                     |   4 +-
 examples/dpdk_qat/crypto.c                         |  22 ++--
 examples/dpdk_qat/main.c                           |   2 +-
 examples/exception_path/main.c                     |  10 +-
 examples/ip_fragmentation/main.c                   |   6 +-
 examples/ip_pipeline/pipeline_rx.c                 |   4 +-
 examples/ip_pipeline/pipeline_tx.c                 |   2 +-
 examples/ip_reassembly/main.c                      |   8 +-
 examples/ipv4_multicast/main.c                     |  14 +-
 examples/l3fwd-acl/main.c                          |   2 +-
 examples/l3fwd-power/main.c                        |   2 +-
 examples/l3fwd-vf/main.c                           |   2 +-
 examples/l3fwd/main.c                              |  10 +-
 examples/load_balancer/runtime.c                   |   2 +-
 .../client_server_mp/mp_client/client.c            |   2 +-
 examples/quota_watermark/qw/main.c                 |   4 +-
 examples/vhost/main.c                              |  70 +++++-----
 examples/vhost_xen/main.c                          |  22 ++--
 lib/librte_distributor/rte_distributor.c           |   2 +-
 lib/librte_ip_frag/ip_frag_common.h                |  14 +-
 lib/librte_ip_frag/rte_ipv4_fragmentation.c        |  40 +++---
 lib/librte_ip_frag/rte_ipv4_reassembly.c           |   6 +-
 lib/librte_ip_frag/rte_ipv6_fragmentation.c        |  38 +++---
 lib/librte_ip_frag/rte_ipv6_reassembly.c           |   4 +-
 lib/librte_mbuf/rte_mbuf.c                         |  26 ++--
 lib/librte_mbuf/rte_mbuf.h                         | 142 ++++++++++-----------
 lib/librte_pmd_bond/rte_eth_bond_pmd.c             |   4 +-
 lib/librte_pmd_e1000/em_rxtx.c                     |  64 +++++-----
 lib/librte_pmd_e1000/igb_rxtx.c                    |  68 +++++-----
 lib/librte_pmd_i40e/i40e_rxtx.c                    |  98 +++++++-------
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c                  | 100 +++++++--------
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h                  |   2 +-
 lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c              |  20 ++-
 lib/librte_pmd_pcap/rte_eth_pcap.c                 |  14 +-
 lib/librte_pmd_virtio/virtio_rxtx.c                |  20 +--
 lib/librte_pmd_virtio/virtqueue.h                  |   2 +-
 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c              |  26 ++--
 lib/librte_pmd_xenvirt/rte_eth_xenvirt.c           |  12 +-
 lib/librte_pmd_xenvirt/virtqueue.h                 |   4 +-
 lib/librte_port/rte_port_frag.c                    |   2 +-
 lib/librte_sched/rte_sched.c                       |  14 +-
 lib/librte_sched/rte_sched.h                       |  10 +-
 61 files changed, 560 insertions(+), 566 deletions(-)
app/test-pmd/cmdline.c +0 -1
index 6dd576a..e81530b 100644
@@ -6376,7 +6376,6 @@ dump_struct_sizes(void)
 {
 #define DUMP_SIZE(t) printf("sizeof(" #t ") = %u\n", (unsigned)sizeof(t));
 	DUMP_SIZE(struct rte_mbuf);
-	DUMP_SIZE(struct rte_pktmbuf);
 	DUMP_SIZE(struct rte_mempool);
 	DUMP_SIZE(struct rte_ring);
 #undef DUMP_SIZE
app/test-pmd/csumonly.c +3 -3
index e5a1f52..655b6d8 100644
@@ -263,7 +263,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 		pkt_ol_flags = mb->ol_flags;
 		ol_flags = (uint16_t) (pkt_ol_flags & (~PKT_TX_L4_MASK));
 
-		eth_hdr = (struct ether_hdr *) mb->pkt.data;
+		eth_hdr = (struct ether_hdr *) mb->data;
 		eth_type = rte_be_to_cpu_16(eth_hdr->ether_type);
 		if (eth_type == ETHER_TYPE_VLAN) {
 			/* Only allow single VLAN label here */
@@ -432,8 +432,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 		}
 
 		/* Combine the packet header write. VLAN is not consider here */
-		mb->pkt.vlan_macip.f.l2_len = l2_len;
-		mb->pkt.vlan_macip.f.l3_len = l3_len;
+		mb->vlan_macip.f.l2_len = l2_len;
+		mb->vlan_macip.f.l3_len = l3_len;
 		mb->ol_flags = ol_flags;
 	}
 	nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx);
app/test-pmd/flowgen.c +8 -8
index a8f2a65..17dbf83 100644
@@ -171,11 +171,11 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
 		if (!pkt)
 			break;
 
-		pkt->pkt.data_len = pkt_size;
-		pkt->pkt.next = NULL;
+		pkt->data_len = pkt_size;
+		pkt->next = NULL;
 
 		/* Initialize Ethernet header. */
-		eth_hdr = (struct ether_hdr *)pkt->pkt.data;
+		eth_hdr = (struct ether_hdr *)pkt->data;
 		ether_addr_copy(&cfg_ether_dst, &eth_hdr->d_addr);
 		ether_addr_copy(&cfg_ether_src, &eth_hdr->s_addr);
 		eth_hdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4);
@@ -205,12 +205,12 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
 		udp_hdr->dgram_len	= RTE_CPU_TO_BE_16(pkt_size -
 							   sizeof(*eth_hdr) -
 							   sizeof(*ip_hdr));
-		pkt->pkt.nb_segs		= 1;
-		pkt->pkt.pkt_len		= pkt_size;
+		pkt->nb_segs			= 1;
+		pkt->pkt_len			= pkt_size;
 		pkt->ol_flags			= ol_flags;
-		pkt->pkt.vlan_macip.f.vlan_tci	= vlan_tci;
-		pkt->pkt.vlan_macip.f.l2_len	= sizeof(struct ether_hdr);
-		pkt->pkt.vlan_macip.f.l3_len	= sizeof(struct ipv4_hdr);
+		pkt->vlan_macip.f.vlan_tci	= vlan_tci;
+		pkt->vlan_macip.f.l2_len	= sizeof(struct ether_hdr);
+		pkt->vlan_macip.f.l3_len	= sizeof(struct ipv4_hdr);
 		pkts_burst[nb_pkt]		= pkt;
 
 		next_flow = (next_flow + 1) % cfg_n_flows;
app/test-pmd/icmpecho.c +2 -2
index c28ff5a..4a277b8 100644
@@ -330,12 +330,12 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs)
 	nb_replies = 0;
 	for (i = 0; i < nb_rx; i++) {
 		pkt = pkts_burst[i];
-		eth_h = (struct ether_hdr *) pkt->pkt.data;
+		eth_h = (struct ether_hdr *) pkt->data;
 		eth_type = RTE_BE_TO_CPU_16(eth_h->ether_type);
 		l2_len = sizeof(struct ether_hdr);
 		if (verbose_level > 0) {
 			printf("\nPort %d pkt-len=%u nb-segs=%u\n",
-			       fs->rx_port, pkt->pkt.pkt_len, pkt->pkt.nb_segs);
+			       fs->rx_port, pkt->pkt_len, pkt->nb_segs);
 			ether_addr_dump("  ETH:  src=", &eth_h->s_addr);
 			ether_addr_dump(" dst=", &eth_h->d_addr);
 		}
app/test-pmd/ieee1588fwd.c +3 -3
index 3ce9979..ab5e06e 100644
@@ -546,7 +546,7 @@ ieee1588_packet_fwd(struct fwd_stream *fs)
 	 * Check that the received packet is a PTP packet that was detected
 	 * by the hardware.
 	 */
-	eth_hdr = (struct ether_hdr *)mb->pkt.data;
+	eth_hdr = (struct ether_hdr *)mb->data;
 	eth_type = rte_be_to_cpu_16(eth_hdr->ether_type);
 	if (! (mb->ol_flags & PKT_RX_IEEE1588_PTP)) {
 		if (eth_type == ETHER_TYPE_1588) {
@@ -557,7 +557,7 @@ ieee1588_packet_fwd(struct fwd_stream *fs)
 			printf("Port %u Received non PTP packet type=0x%4x "
 			       "len=%u\n",
 			       (unsigned) fs->rx_port, eth_type,
-			       (unsigned) mb->pkt.pkt_len);
+			       (unsigned) mb->pkt_len);
 		}
 		rte_pktmbuf_free(mb);
 		return;
@@ -574,7 +574,7 @@ ieee1588_packet_fwd(struct fwd_stream *fs)
 	 * Check that the received PTP packet is a PTP V2 packet of type
 	 * PTP_SYNC_MESSAGE.
 	 */
-	ptp_hdr = (struct ptpv2_msg *) ((char *) mb->pkt.data +
+	ptp_hdr = (struct ptpv2_msg *) ((char *) mb->data +
 					sizeof(struct ether_hdr));
 	if (ptp_hdr->version != 0x02) {
 		printf("Port %u Received PTP V2 Ethernet frame with wrong PTP"
app/test-pmd/macfwd-retry.c +1 -1
index f4e06c4..5122983 100644
@@ -119,7 +119,7 @@ pkt_burst_mac_retry_forward(struct fwd_stream *fs)
 	fs->rx_packets += nb_rx;
 	for (i = 0; i < nb_rx; i++) {
 		mb = pkts_burst[i];
-		eth_hdr = (struct ether_hdr *) mb->pkt.data;
+		eth_hdr = (struct ether_hdr *) mb->data;
 		ether_addr_copy(&peer_eth_addrs[fs->peer_addr],
 				&eth_hdr->d_addr);
 		ether_addr_copy(&ports[fs->tx_port].eth_addr,
app/test-pmd/macfwd.c +4 -4
index fc8f749..999c8e3 100644
@@ -110,15 +110,15 @@ pkt_burst_mac_forward(struct fwd_stream *fs)
 	txp = &ports[fs->tx_port];
 	for (i = 0; i < nb_rx; i++) {
 		mb = pkts_burst[i];
-		eth_hdr = (struct ether_hdr *) mb->pkt.data;
+		eth_hdr = (struct ether_hdr *) mb->data;
 		ether_addr_copy(&peer_eth_addrs[fs->peer_addr],
 				&eth_hdr->d_addr);
 		ether_addr_copy(&ports[fs->tx_port].eth_addr,
 				&eth_hdr->s_addr);
 		mb->ol_flags = txp->tx_ol_flags;
-		mb->pkt.vlan_macip.f.l2_len = sizeof(struct ether_hdr);
-		mb->pkt.vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
-		mb->pkt.vlan_macip.f.vlan_tci = txp->tx_vlan_id;
+		mb->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
+		mb->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+		mb->vlan_macip.f.vlan_tci = txp->tx_vlan_id;
 	}
 	nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx);
 	fs->tx_packets += nb_tx;
app/test-pmd/macswap.c +4 -4
index 4ed6096..731f487 100644
@@ -110,7 +110,7 @@ pkt_burst_mac_swap(struct fwd_stream *fs)
 	txp = &ports[fs->tx_port];
 	for (i = 0; i < nb_rx; i++) {
 		mb = pkts_burst[i];
-		eth_hdr = (struct ether_hdr *) mb->pkt.data;
+		eth_hdr = (struct ether_hdr *) mb->data;
 
 		/* Swap dest and src mac addresses. */
 		ether_addr_copy(&eth_hdr->d_addr, &addr);
@@ -118,9 +118,9 @@ pkt_burst_mac_swap(struct fwd_stream *fs)
 		ether_addr_copy(&addr, &eth_hdr->s_addr);
 
 		mb->ol_flags = txp->tx_ol_flags;
-		mb->pkt.vlan_macip.f.l2_len = sizeof(struct ether_hdr);
-		mb->pkt.vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
-		mb->pkt.vlan_macip.f.vlan_tci = txp->tx_vlan_id;
+		mb->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
+		mb->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+		mb->vlan_macip.f.vlan_tci = txp->tx_vlan_id;
 	}
 	nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx);
 	fs->tx_packets += nb_tx;
app/test-pmd/rxonly.c +6 -6
index 5f21a3e..c34a5e1 100644
@@ -149,24 +149,24 @@ pkt_burst_receive(struct fwd_stream *fs)
 			rte_pktmbuf_free(mb);
 			continue;
 		}
-		eth_hdr = (struct ether_hdr *) mb->pkt.data;
+		eth_hdr = (struct ether_hdr *) mb->data;
 		eth_type = RTE_BE_TO_CPU_16(eth_hdr->ether_type);
 		ol_flags = mb->ol_flags;
 		print_ether_addr("  src=", &eth_hdr->s_addr);
 		print_ether_addr(" - dst=", &eth_hdr->d_addr);
 		printf(" - type=0x%04x - length=%u - nb_segs=%d",
-		       eth_type, (unsigned) mb->pkt.pkt_len,
-		       (int)mb->pkt.nb_segs);
+		       eth_type, (unsigned) mb->pkt_len,
+		       (int)mb->nb_segs);
 		if (ol_flags & PKT_RX_RSS_HASH) {
-			printf(" - RSS hash=0x%x", (unsigned) mb->pkt.hash.rss);
+			printf(" - RSS hash=0x%x", (unsigned) mb->hash.rss);
 			printf(" - RSS queue=0x%x",(unsigned) fs->rx_queue);
 		}
 		else if (ol_flags & PKT_RX_FDIR)
 			printf(" - FDIR hash=0x%x - FDIR id=0x%x ",
-			       mb->pkt.hash.fdir.hash, mb->pkt.hash.fdir.id);
+			       mb->hash.fdir.hash, mb->hash.fdir.id);
 		if (ol_flags & PKT_RX_VLAN_PKT)
 			printf(" - VLAN tci=0x%x",
-				mb->pkt.vlan_macip.f.vlan_tci);
+				mb->vlan_macip.f.vlan_tci);
 		printf("\n");
 		if (ol_flags != 0) {
 			int rxf;
app/test-pmd/testpmd.c +4 -4
index 5368d01..81272a0 100644
@@ -404,10 +404,10 @@ testpmd_mbuf_ctor(struct rte_mempool *mp,
 			mb_ctor_arg->seg_buf_offset);
 	mb->buf_len      = mb_ctor_arg->seg_buf_size;
 	mb->ol_flags     = 0;
-	mb->pkt.data     = (char *) mb->buf_addr + RTE_PKTMBUF_HEADROOM;
-	mb->pkt.nb_segs  = 1;
-	mb->pkt.vlan_macip.data = 0;
-	mb->pkt.hash.rss = 0;
+	mb->data         = (char *) mb->buf_addr + RTE_PKTMBUF_HEADROOM;
+	mb->nb_segs      = 1;
+	mb->vlan_macip.data = 0;
+	mb->hash.rss     = 0;
 }
 
 static void
app/test-pmd/testpmd.h +1 -1
index ac86bfe..c1afd91 100644
@@ -60,7 +60,7 @@ int main(int argc, char **argv);
  * The maximum number of segments per packet is used when creating
  * scattered transmit packets composed of a list of mbufs.
  */
-#define RTE_MAX_SEGS_PER_PKT 255 /**< pkt.nb_segs is a 8-bit unsigned char. */
+#define RTE_MAX_SEGS_PER_PKT 255 /**< nb_segs is a 8-bit unsigned char. */
 
 #define MAX_PKT_BURST 512
 #define DEF_PKT_BURST 32
app/test-pmd/txonly.c +21 -21

78 lines not on this page · raw message

app/test/commands.c +0 -1
index f38d419..668b48d 100644
@@ -275,7 +275,6 @@ dump_struct_sizes(void)
 {
 #define DUMP_SIZE(t) printf("sizeof(" #t ") = %u\n", (unsigned)sizeof(t));
 	DUMP_SIZE(struct rte_mbuf);
-	DUMP_SIZE(struct rte_pktmbuf);
 	DUMP_SIZE(struct rte_mempool);
 	DUMP_SIZE(struct rte_ring);
 #undef DUMP_SIZE
app/test/packet_burst_generator.c +23 -23

89 lines not on this page · raw message

app/test/test_distributor.c +9 -9
index e7dc1fb..0e96d42 100644
@@ -121,7 +121,7 @@ sanity_test(struct rte_distributor *d, struct rte_mempool *p)
 	/* now set all hash values in all buffers to zero, so all pkts go to the
 	 * one worker thread */
 	for (i = 0; i < BURST; i++)
-		bufs[i]->pkt.hash.rss = 0;
+		bufs[i]->hash.rss = 0;
 
 	rte_distributor_process(d, bufs, BURST);
 	rte_distributor_flush(d);
@@ -143,7 +143,7 @@ sanity_test(struct rte_distributor *d, struct rte_mempool *p)
 	if (rte_lcore_count() >= 3) {
 		clear_packet_count();
 		for (i = 0; i < BURST; i++)
-			bufs[i]->pkt.hash.rss = (i & 1) << 8;
+			bufs[i]->hash.rss = (i & 1) << 8;
 
 		rte_distributor_process(d, bufs, BURST);
 		rte_distributor_flush(d);
@@ -168,7 +168,7 @@ sanity_test(struct rte_distributor *d, struct rte_mempool *p)
 	 * so load gets distributed */
 	clear_packet_count();
 	for (i = 0; i < BURST; i++)
-		bufs[i]->pkt.hash.rss = i;
+		bufs[i]->hash.rss = i;
 
 	rte_distributor_process(d, bufs, BURST);
 	rte_distributor_flush(d);
@@ -200,7 +200,7 @@ sanity_test(struct rte_distributor *d, struct rte_mempool *p)
 		return -1;
 	}
 	for (i = 0; i < BIG_BATCH; i++)
-		many_bufs[i]->pkt.hash.rss = i << 2;
+		many_bufs[i]->hash.rss = i << 2;
 
 	for (i = 0; i < BIG_BATCH/BURST; i++) {
 		rte_distributor_process(d, &many_bufs[i*BURST], BURST);
@@ -281,7 +281,7 @@ sanity_test_with_mbuf_alloc(struct rte_distributor *d, struct rte_mempool *p)
 		while (rte_mempool_get_bulk(p, (void *)bufs, BURST) < 0)
 			rte_distributor_process(d, NULL, 0);
 		for (j = 0; j < BURST; j++) {
-			bufs[j]->pkt.hash.rss = (i+j) << 1;
+			bufs[j]->hash.rss = (i+j) << 1;
 			bufs[j]->refcnt = 1;
 		}
 
@@ -360,7 +360,7 @@ sanity_test_with_worker_shutdown(struct rte_distributor *d,
 	/* now set all hash values in all buffers to zero, so all pkts go to the
 	 * one worker thread */
 	for (i = 0; i < BURST; i++)
-		bufs[i]->pkt.hash.rss = 0;
+		bufs[i]->hash.rss = 0;
 
 	rte_distributor_process(d, bufs, BURST);
 	/* at this point, we will have processed some packets and have a full
@@ -373,7 +373,7 @@ sanity_test_with_worker_shutdown(struct rte_distributor *d,
 		return -1;
 	}
 	for (i = 0; i < BURST; i++)
-		bufs[i]->pkt.hash.rss = 0;
+		bufs[i]->hash.rss = 0;
 
 	/* get worker zero to quit */
 	zero_quit = 1;
@@ -417,7 +417,7 @@ test_flush_with_worker_shutdown(struct rte_distributor *d,
 	/* now set all hash values in all buffers to zero, so all pkts go to the
 	 * one worker thread */
 	for (i = 0; i < BURST; i++)
-		bufs[i]->pkt.hash.rss = 0;
+		bufs[i]->hash.rss = 0;
 
 	rte_distributor_process(d, bufs, BURST);
 	/* at this point, we will have processed some packets and have a full
@@ -489,7 +489,7 @@ quit_workers(struct rte_distributor *d, struct rte_mempool *p)
 	zero_quit = 0;
 	quit = 1;
 	for (i = 0; i < num_workers; i++)
-		bufs[i]->pkt.hash.rss = i << 1;
+		bufs[i]->hash.rss = i << 1;
 	rte_distributor_process(d, bufs, num_workers);
 
 	rte_mempool_put_bulk(p, (void *)bufs, num_workers);
app/test/test_distributor_perf.c +2 -2
index 1031baa..7ecbc6b 100644
@@ -160,7 +160,7 @@ perf_test(struct rte_distributor *d, struct rte_mempool *p)
 	}
 	/* ensure we have different hash value for each pkt */
 	for (i = 0; i < BURST; i++)
-		bufs[i]->pkt.hash.rss = i;
+		bufs[i]->hash.rss = i;
 
 	start = rte_rdtsc();
 	for (i = 0; i < (1<<ITER_POWER); i++)
@@ -199,7 +199,7 @@ quit_workers(struct rte_distributor *d, struct rte_mempool *p)
 
 	quit = 1;
 	for (i = 0; i < num_workers; i++)
-		bufs[i]->pkt.hash.rss = i << 1;
+		bufs[i]->hash.rss = i << 1;
 	rte_distributor_process(d, bufs, num_workers);
 
 	rte_mempool_put_bulk(p, (void *)bufs, num_workers);
app/test/test_mbuf.c +6 -6
index 6b32d9d..fd26d6f 100644
@@ -344,8 +344,8 @@ testclone_testupdate_testdetach(void)
 		GOTO_FAIL("cannot clone data\n");
 	rte_pktmbuf_free(clone);
 
-	mc->pkt.next = rte_pktmbuf_alloc(pktmbuf_pool);
-	if(mc->pkt.next == NULL)
+	mc->next = rte_pktmbuf_alloc(pktmbuf_pool);
+	if(mc->next == NULL)
 		GOTO_FAIL("Next Pkt Null\n");
 
 	clone = rte_pktmbuf_clone(mc, pktmbuf_pool);
@@ -432,7 +432,7 @@ test_pktmbuf_pool_ptr(void)
 			printf("rte_pktmbuf_alloc() failed (%u)\n", i);
 			ret = -1;
 		}
-		m[i]->pkt.data = RTE_PTR_ADD(m[i]->pkt.data, 64);
+		m[i]->data = RTE_PTR_ADD(m[i]->data, 64);
 	}
 
 	/* free them */
@@ -451,8 +451,8 @@ test_pktmbuf_pool_ptr(void)
 			printf("rte_pktmbuf_alloc() failed (%u)\n", i);
 			ret = -1;
 		}
-		if (m[i]->pkt.data != RTE_PTR_ADD(m[i]->buf_addr, RTE_PKTMBUF_HEADROOM)) {
-			printf ("pkt.data pointer not set properly\n");
+		if (m[i]->data != RTE_PTR_ADD(m[i]->buf_addr, RTE_PKTMBUF_HEADROOM)) {
+			printf ("data pointer not set properly\n");
 			ret = -1;
 		}
 	}
@@ -493,7 +493,7 @@ test_pktmbuf_free_segment(void)
 			mb = m[i];
 			while(mb != NULL) {
 				mt = mb;
-				mb = mb->pkt.next;
+				mb = mb->next;
 				rte_pktmbuf_free_seg(mt);
 			}
 		}
app/test/test_sched.c +2 -2
index d9abb51..c8f4e33 100644
@@ -147,8 +147,8 @@ prepare_pkt(struct rte_mbuf *mbuf)
 	rte_sched_port_pkt_write(mbuf, SUBPORT, PIPE, TC, QUEUE, e_RTE_METER_YELLOW);
 
 	/* 64 byte packet */
-	mbuf->pkt.pkt_len  = 60;
-	mbuf->pkt.data_len = 60;
+	mbuf->pkt_len  = 60;
+	mbuf->data_len = 60;
 }
 
 
app/test/test_table_acl.c +3 -3
index 5bcc8b8..70e2e68 100644
@@ -515,7 +515,7 @@ test_pipeline_single_filter(int expected_count)
 			struct rte_mbuf *mbuf;
 
 			mbuf = rte_pktmbuf_alloc(pool);
-			memset(mbuf->pkt.data, 0x00,
+			memset(mbuf->data, 0x00,
 				sizeof(struct ipv4_5tuple));
 
 			five_tuple.proto = j;
@@ -524,7 +524,7 @@ test_pipeline_single_filter(int expected_count)
 			five_tuple.port_src = rte_bswap16(100 + j);
 			five_tuple.port_dst = rte_bswap16(200 + j);
 
-			memcpy(mbuf->pkt.data, &five_tuple,
+			memcpy(mbuf->data, &five_tuple,
 				sizeof(struct ipv4_5tuple));
 			RTE_LOG(INFO, PIPELINE, "%s: Enqueue onto ring %d\n",
 				__func__, i);
@@ -551,7 +551,7 @@ test_pipeline_single_filter(int expected_count)
 			printf("Got %d object(s) from ring %d!\n", ret, i);
 			for (j = 0; j < ret; j++) {
 				mbuf = (struct rte_mbuf *)objs[j];
-				rte_hexdump(stdout, "mbuf", mbuf->pkt.data, 64);
+				rte_hexdump(stdout, "mbuf", mbuf->data, 64);
 				rte_pktmbuf_free(mbuf);
 			}
 			tx_count += ret;
app/test/test_table_pipeline.c +2 -2
index 35644a6..c5368ae 100644
@@ -504,8 +504,8 @@ test_pipeline_single_filter(int test_type, int expected_count)
 			printf("Got %d object(s) from ring %d!\n", ret, i);
 			for (j = 0; j < ret; j++) {
 				mbuf = (struct rte_mbuf *)objs[j];
-				rte_hexdump(stdout, "Object:", mbuf->pkt.data,
-					mbuf->pkt.data_len);
+				rte_hexdump(stdout, "Object:", mbuf->data,
+					mbuf->data_len);
 				rte_pktmbuf_free(mbuf);
 			}
 			tx_count += ret;
examples/dpdk_qat/crypto.c +11 -11
index 577ab32..318d47c 100644
@@ -183,7 +183,7 @@ struct glob_keys g_crypto_hash_keys = {
  *
  */
 #define PACKET_DATA_START_PHYS(p) \
-		((p)->buf_physaddr + ((char *)p->pkt.data - (char *)p->buf_addr))
+		((p)->buf_physaddr + ((char *)p->data - (char *)p->buf_addr))
 
 /*
  * A fixed offset to where the crypto is to be performed, which is the first
@@ -773,7 +773,7 @@ enum crypto_result
 crypto_encrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 {
 	CpaCySymDpOpData *opData =
-			(CpaCySymDpOpData *) ((char *) (rte_buff->pkt.data)
+			(CpaCySymDpOpData *) ((char *) (rte_buff->data)
 					+ CRYPTO_OFFSET_TO_OPDATA);
 	uint32_t lcore_id;
 
@@ -785,7 +785,7 @@ crypto_encrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 	bzero(opData, sizeof(CpaCySymDpOpData));
 
 	opData->srcBuffer = opData->dstBuffer = PACKET_DATA_START_PHYS(rte_buff);
-	opData->srcBufferLen = opData->dstBufferLen = rte_buff->pkt.data_len;
+	opData->srcBufferLen = opData->dstBufferLen = rte_buff->data_len;
 	opData->sessionCtx = qaCoreConf[lcore_id].encryptSessionHandleTbl[c][h];
 	opData->thisPhys = PACKET_DATA_START_PHYS(rte_buff)
 			+ CRYPTO_OFFSET_TO_OPDATA;
@@ -805,7 +805,7 @@ crypto_encrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 			opData->ivLenInBytes = IV_LENGTH_8_BYTES;
 
 		opData->cryptoStartSrcOffsetInBytes = CRYPTO_START_OFFSET;
-		opData->messageLenToCipherInBytes = rte_buff->pkt.data_len
+		opData->messageLenToCipherInBytes = rte_buff->data_len
 				- CRYPTO_START_OFFSET;
 		/*
 		 * Work around for padding, message length has to be a multiple of
@@ -818,7 +818,7 @@ crypto_encrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 	if (NO_HASH != h) {
 
 		opData->hashStartSrcOffsetInBytes = HASH_START_OFFSET;
-		opData->messageLenToHashInBytes = rte_buff->pkt.data_len
+		opData->messageLenToHashInBytes = rte_buff->data_len
 				- HASH_START_OFFSET;
 		/*
 		 * Work around for padding, message length has to be a multiple of block
@@ -831,7 +831,7 @@ crypto_encrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 		 * Assumption: Ok ignore the passed digest pointer and place HMAC at end
 		 * of packet.
 		 */
-		opData->digestResult = rte_buff->buf_physaddr + rte_buff->pkt.data_len;
+		opData->digestResult = rte_buff->buf_physaddr + rte_buff->data_len;
 	}
 
 	if (CPA_STATUS_SUCCESS != enqueueOp(opData, lcore_id)) {
@@ -848,7 +848,7 @@ enum crypto_result
 crypto_decrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 {
 
-	CpaCySymDpOpData *opData = (void*) (((char *) rte_buff->pkt.data)
+	CpaCySymDpOpData *opData = (void*) (((char *) rte_buff->data)
 			+ CRYPTO_OFFSET_TO_OPDATA);
 	uint32_t lcore_id;
 
@@ -860,7 +860,7 @@ crypto_decrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 	bzero(opData, sizeof(CpaCySymDpOpData));
 
 	opData->dstBuffer = opData->srcBuffer = PACKET_DATA_START_PHYS(rte_buff);
-	opData->dstBufferLen = opData->srcBufferLen = rte_buff->pkt.data_len;
+	opData->dstBufferLen = opData->srcBufferLen = rte_buff->data_len;
 	opData->thisPhys = PACKET_DATA_START_PHYS(rte_buff)
 			+ CRYPTO_OFFSET_TO_OPDATA;
 	opData->sessionCtx = qaCoreConf[lcore_id].decryptSessionHandleTbl[c][h];
@@ -880,7 +880,7 @@ crypto_decrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 			opData->ivLenInBytes = IV_LENGTH_8_BYTES;
 
 		opData->cryptoStartSrcOffsetInBytes = CRYPTO_START_OFFSET;
-		opData->messageLenToCipherInBytes = rte_buff->pkt.data_len
+		opData->messageLenToCipherInBytes = rte_buff->data_len
 				- CRYPTO_START_OFFSET;
 
 		/*
@@ -892,7 +892,7 @@ crypto_decrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 	}
 	if (NO_HASH != h) {
 		opData->hashStartSrcOffsetInBytes = HASH_START_OFFSET;
-		opData->messageLenToHashInBytes = rte_buff->pkt.data_len
+		opData->messageLenToHashInBytes = rte_buff->data_len
 				- HASH_START_OFFSET;
 		/*
 		 * Work around for padding, message length has to be a multiple of block
@@ -900,7 +900,7 @@ crypto_decrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 		 */
 		opData->messageLenToHashInBytes -= opData->messageLenToHashInBytes
 				% HASH_BLOCK_DEFAULT_SIZE;
-		opData->digestResult = rte_buff->buf_physaddr + rte_buff->pkt.data_len;
+		opData->digestResult = rte_buff->buf_physaddr + rte_buff->data_len;
 	}
 
 	if (CPA_STATUS_SUCCESS != enqueueOp(opData, lcore_id)) {
examples/dpdk_qat/main.c +1 -1
index d61db4c..75c9876 100644
@@ -384,7 +384,7 @@ main_loop(__attribute__((unused)) void *dummy)
 			}
 		}
 
-		port = dst_ports[pkt->pkt.in_port];
+		port = dst_ports[pkt->in_port];
 
 		/* Transmit the packet */
 		nic_tx_send_packet(pkt, (uint8_t)port);
examples/exception_path/main.c +5 -5
index 0204116..5045ef8 100644
@@ -302,16 +302,16 @@ main_loop(__attribute__((unused)) void *arg)
 			if (m == NULL)
 				continue;
 
-			ret = read(tap_fd, m->pkt.data, MAX_PACKET_SZ);
+			ret = read(tap_fd, m->data, MAX_PACKET_SZ);
 			lcore_stats[lcore_id].rx++;
 			if (unlikely(ret < 0)) {
 				FATAL_ERROR("Reading from %s interface failed",
 				            tap_name);
 			}
-			m->pkt.nb_segs = 1;
-			m->pkt.next = NULL;
-			m->pkt.pkt_len = (uint16_t)ret;
-			m->pkt.data_len = (uint16_t)ret;
+			m->nb_segs = 1;
+			m->next = NULL;
+			m->pkt_len = (uint16_t)ret;
+			m->data_len = (uint16_t)ret;
 			ret = rte_eth_tx_burst(port_ids[lcore_id], 0, &m, 1);
 			if (unlikely(ret < 1)) {
 				rte_pktmbuf_free(m);
examples/ip_fragmentation/main.c +3 -3
index 72cd2b2..ac8d4f7 100644
@@ -342,7 +342,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf,
 		}
 
 		/* if we don't need to do any fragmentation */
-		if (likely (IPV4_MTU_DEFAULT >= m->pkt.pkt_len)) {
+		if (likely (IPV4_MTU_DEFAULT >= m->pkt_len)) {
 			qconf->tx_mbufs[port_out].m_table[len] = m;
 			len2 = 1;
 		} else {
@@ -379,7 +379,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf,
 		}
 
 		/* if we don't need to do any fragmentation */
-		if (likely (IPV6_MTU_DEFAULT >= m->pkt.pkt_len)) {
+		if (likely (IPV6_MTU_DEFAULT >= m->pkt_len)) {
 			qconf->tx_mbufs[port_out].m_table[len] = m;
 			len2 = 1;
 		} else {
@@ -413,7 +413,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf,
 			rte_panic("No headroom in mbuf.\n");
 		}
 
-		m->pkt.vlan_macip.f.l2_len = sizeof(struct ether_hdr);
+		m->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
 
 		/* 02:00:00:00:00:xx */
 		d_addr_bytes = &eth_hdr->d_addr.addr_bytes[0];
examples/ip_pipeline/pipeline_rx.c +2 -2
index e43ebfa..7a8309c 100644
@@ -255,8 +255,8 @@ app_pkt_metadata_fill(struct rte_mbuf *m)
 	/* Pop Ethernet header */
 	if (app.ether_hdr_pop_push) {
 		rte_pktmbuf_adj(m, (uint16_t)sizeof(struct ether_hdr));
-		m->pkt.vlan_macip.f.l2_len = 0;
-		m->pkt.vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+		m->vlan_macip.f.l2_len = 0;
+		m->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
 	}
 }
 
examples/ip_pipeline/pipeline_tx.c +1 -1
index 3bf2c8b..b9491e3 100644
@@ -66,7 +66,7 @@ app_pkt_metadata_flush(struct rte_mbuf *pkt)
 	ether_addr_copy(&pkt_meta->nh_arp, &ether_hdr->d_addr);
 	ether_addr_copy(&local_ether_addr, &ether_hdr->s_addr);
 	ether_hdr->ether_type = rte_bswap16(ETHER_TYPE_IPv4);
-	pkt->pkt.vlan_macip.f.l2_len = sizeof(struct ether_hdr);
+	pkt->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
 }
 
 static int
examples/ip_reassembly/main.c +4 -4
index 3bb6afd..8184aad 100644
@@ -412,8 +412,8 @@ reassemble(struct rte_mbuf *m, uint8_t portid, uint32_t queue,
 			dr = &qconf->death_row;
 
 			/* prepare mbuf: setup l2_len/l3_len. */
-			m->pkt.vlan_macip.f.l2_len = sizeof(*eth_hdr);
-			m->pkt.vlan_macip.f.l3_len = sizeof(*ip_hdr);
+			m->vlan_macip.f.l2_len = sizeof(*eth_hdr);
+			m->vlan_macip.f.l3_len = sizeof(*ip_hdr);
 
 			/* process this fragment. */
 			mo = rte_ipv4_frag_reassemble_packet(tbl, dr, m, tms, ip_hdr);
@@ -455,8 +455,8 @@ reassemble(struct rte_mbuf *m, uint8_t portid, uint32_t queue,
 			dr  = &qconf->death_row;
 
 			/* prepare mbuf: setup l2_len/l3_len. */
-			m->pkt.vlan_macip.f.l2_len = sizeof(*eth_hdr);
-			m->pkt.vlan_macip.f.l3_len = sizeof(*ip_hdr) + sizeof(*frag_hdr);
+			m->vlan_macip.f.l2_len = sizeof(*eth_hdr);
+			m->vlan_macip.f.l3_len = sizeof(*ip_hdr) + sizeof(*frag_hdr);
 
 			mo = rte_ipv6_frag_reassemble_packet(tbl, dr, m, tms, ip_hdr, frag_hdr);
 			if (mo == NULL)
examples/ipv4_multicast/main.c +7 -7
index 7b53296..cc12d9d 100644
@@ -329,17 +329,17 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone)
 	}
 
 	/* prepend new header */
-	hdr->pkt.next = pkt;
+	hdr->next = pkt;
 
 
 	/* update header's fields */
-	hdr->pkt.pkt_len = (uint16_t)(hdr->pkt.data_len + pkt->pkt.pkt_len);
-	hdr->pkt.nb_segs = (uint8_t)(pkt->pkt.nb_segs + 1);
+	hdr->pkt_len = (uint16_t)(hdr->data_len + pkt->pkt_len);
+	hdr->nb_segs = (uint8_t)(pkt->nb_segs + 1);
 
 	/* copy metadata from source packet*/
-	hdr->pkt.in_port = pkt->pkt.in_port;
-	hdr->pkt.vlan_macip = pkt->pkt.vlan_macip;
-	hdr->pkt.hash = pkt->pkt.hash;
+	hdr->in_port = pkt->in_port;
+	hdr->vlan_macip = pkt->vlan_macip;
+	hdr->hash = pkt->hash;
 
 	hdr->ol_flags = pkt->ol_flags;
 
@@ -412,7 +412,7 @@ mcast_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf)
 
 	/* Should we use rte_pktmbuf_clone() or not. */
 	use_clone = (port_num <= MCAST_CLONE_PORTS &&
-	    m->pkt.nb_segs <= MCAST_CLONE_SEGS);
+	    m->nb_segs <= MCAST_CLONE_SEGS);
 
 	/* Mark all packet's segments as referenced port_num times */
 	if (use_clone == 0)
examples/l3fwd-acl/main.c +1 -1
index 9b2c21b..406611f 100644
@@ -709,7 +709,7 @@ prepare_one_packet(struct rte_mbuf **pkts_in, struct acl_search_t *acl,
 			unsigned char *) + sizeof(struct ether_hdr));
 
 		/* Check to make sure the packet is valid (RFC1812) */
-		if (is_valid_ipv4_pkt(ipv4_hdr, pkt->pkt.pkt_len) >= 0) {
+		if (is_valid_ipv4_pkt(ipv4_hdr, pkt->pkt_len) >= 0) {
 
 			/* Update time to live and header checksum */
 			--(ipv4_hdr->time_to_live);
examples/l3fwd-power/main.c +1 -1
index 57fc371..a9d5c80 100644
@@ -687,7 +687,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint8_t portid,
 
 #ifdef DO_RFC_1812_CHECKS
 		/* Check to make sure the packet is valid (RFC1812) */
-		if (is_valid_ipv4_pkt(ipv4_hdr, m->pkt.pkt_len) < 0) {
+		if (is_valid_ipv4_pkt(ipv4_hdr, m->pkt_len) < 0) {
 			rte_pktmbuf_free(m);
 			return;
 		}
examples/l3fwd-vf/main.c +1 -1
index 2ca5c21..7b1e08a 100644
@@ -489,7 +489,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint8_t portid, lookup_struct_t * l3fwd
 
 #ifdef DO_RFC_1812_CHECKS
 	/* Check to make sure the packet is valid (RFC1812) */
-	if (is_valid_ipv4_pkt(ipv4_hdr, m->pkt.pkt_len) < 0) {
+	if (is_valid_ipv4_pkt(ipv4_hdr, m->pkt_len) < 0) {
 		rte_pktmbuf_free(m);
 		return;
 	}
examples/l3fwd/main.c +5 -5
index bef409a..e3e3463 100755
@@ -809,19 +809,19 @@ simple_ipv4_fwd_4pkts(struct rte_mbuf* m[4], uint8_t portid, struct lcore_conf *
 #ifdef DO_RFC_1812_CHECKS
 	/* Check to make sure the packet is valid (RFC1812) */
 	uint8_t valid_mask = MASK_ALL_PKTS;
-	if (is_valid_ipv4_pkt(ipv4_hdr[0], m[0]->pkt.pkt_len) < 0) {
+	if (is_valid_ipv4_pkt(ipv4_hdr[0], m[0]->pkt_len) < 0) {
 		rte_pktmbuf_free(m[0]);
 		valid_mask &= EXECLUDE_1ST_PKT;
 	}
-	if (is_valid_ipv4_pkt(ipv4_hdr[1], m[1]->pkt.pkt_len) < 0) {
+	if (is_valid_ipv4_pkt(ipv4_hdr[1], m[1]->pkt_len) < 0) {
 		rte_pktmbuf_free(m[1]);
 		valid_mask &= EXECLUDE_2ND_PKT;
 	}
-	if (is_valid_ipv4_pkt(ipv4_hdr[2], m[2]->pkt.pkt_len) < 0) {
+	if (is_valid_ipv4_pkt(ipv4_hdr[2], m[2]->pkt_len) < 0) {
 		rte_pktmbuf_free(m[2]);
 		valid_mask &= EXECLUDE_3RD_PKT;
 	}
-	if (is_valid_ipv4_pkt(ipv4_hdr[3], m[3]->pkt.pkt_len) < 0) {
+	if (is_valid_ipv4_pkt(ipv4_hdr[3], m[3]->pkt_len) < 0) {
 		rte_pktmbuf_free(m[3]);
 		valid_mask &= EXECLUDE_4TH_PKT;
 	}
@@ -1009,7 +1009,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint8_t portid, struct lcore_conf *qcon
 
 #ifdef DO_RFC_1812_CHECKS
 		/* Check to make sure the packet is valid (RFC1812) */
-		if (is_valid_ipv4_pkt(ipv4_hdr, m->pkt.pkt_len) < 0) {
+		if (is_valid_ipv4_pkt(ipv4_hdr, m->pkt_len) < 0) {
 			rte_pktmbuf_free(m);
 			return;
 		}
examples/load_balancer/runtime.c +1 -1
index 9612392..b69917b 100644
@@ -540,7 +540,7 @@ app_lcore_worker(
 			ipv4_dst = rte_be_to_cpu_32(ipv4_hdr->dst_addr);
 
 			if (unlikely(rte_lpm_lookup(lp->lpm_table, ipv4_dst, &port) != 0)) {
-				port = pkt->pkt.in_port;
+				port = pkt->in_port;
 			}
 
 			pos = lp->mbuf_out[port].n_mbufs;
examples/multi_process/client_server_mp/mp_client/client.c +1 -1
index 91f70eb..71e4a48 100644
@@ -211,7 +211,7 @@ enqueue_packet(struct rte_mbuf *buf, uint8_t port)
 static void
 handle_packet(struct rte_mbuf *buf)
 {
-	const uint8_t in_port = buf->pkt.in_port;
+	const uint8_t in_port = buf->in_port;
 	const uint8_t out_port = output_ports[in_port];
 
 	enqueue_packet(buf, out_port);
examples/quota_watermark/qw/main.c +2 -2
index 579698b..c8bd62f 100644
@@ -104,8 +104,8 @@ static void send_pause_frame(uint8_t port_id, uint16_t duration)
     pause_frame->opcode = rte_cpu_to_be_16(0x0001);
     pause_frame->param  = rte_cpu_to_be_16(duration);
 
-    mbuf->pkt.pkt_len  = 60;
-    mbuf->pkt.data_len = 60;
+    mbuf->pkt_len  = 60;
+    mbuf->data_len = 60;
 
     rte_eth_tx_burst(port_id, 0, &mbuf, 1);
 }
examples/vhost/main.c +35 -35

161 lines not on this page · raw message

examples/vhost_xen/main.c +11 -11
index b275747..8162cd8 100644
@@ -677,7 +677,7 @@ virtio_dev_rx(struct virtio_net *dev, struct rte_mbuf **pkts, uint32_t count)
 		vq->used->ring[res_cur_idx & (vq->size - 1)].len = packet_len;
 
 		/* Copy mbuf data to buffer */
-		rte_memcpy((void *)(uintptr_t)buff_addr, (const void*)buff->pkt.data, rte_pktmbuf_data_len(buff));
+		rte_memcpy((void *)(uintptr_t)buff_addr, (const void*)buff->data, rte_pktmbuf_data_len(buff));
 
 		res_cur_idx++;
 		packet_success++;
@@ -808,7 +808,7 @@ virtio_tx_local(struct virtio_net *dev, struct rte_mbuf *m)
 	struct ether_hdr *pkt_hdr;
 	uint64_t ret = 0;
 
-	pkt_hdr = (struct ether_hdr *)m->pkt.data;
+	pkt_hdr = (struct ether_hdr *)m->data;
 
 	/*get the used devices list*/
 	dev_ll = ll_root_used;
@@ -879,22 +879,22 @@ virtio_tx_route(struct virtio_net* dev, struct rte_mbuf *m, struct rte_mempool *
 	if(!mbuf)
 		return;
 
-	mbuf->pkt.data_len = m->pkt.data_len + VLAN_HLEN;
-	mbuf->pkt.pkt_len = mbuf->pkt.data_len;
+	mbuf->data_len = m->data_len + VLAN_HLEN;
+	mbuf->pkt_len = mbuf->data_len;
 
 	/* Copy ethernet header to mbuf. */
-	rte_memcpy((void*)mbuf->pkt.data, (const void*)m->pkt.data, ETH_HLEN);
+	rte_memcpy((void*)mbuf->data, (const void*)m->data, ETH_HLEN);
 
 
 	/* Setup vlan header. Bytes need to be re-ordered for network with htons()*/
-	vlan_hdr = (struct vlan_ethhdr *) mbuf->pkt.data;
+	vlan_hdr = (struct vlan_ethhdr *) mbuf->data;
 	vlan_hdr->h_vlan_encapsulated_proto = vlan_hdr->h_vlan_proto;
 	vlan_hdr->h_vlan_proto = htons(ETH_P_8021Q);
 	vlan_hdr->h_vlan_TCI = htons(vlan_tag);
 
 	/* Copy the remaining packet contents to the mbuf. */
-	rte_memcpy((void*) ((uint8_t*)mbuf->pkt.data + VLAN_ETH_HLEN),
-		(const void*) ((uint8_t*)m->pkt.data + ETH_HLEN), (m->pkt.data_len - ETH_HLEN));
+	rte_memcpy((void*) ((uint8_t*)mbuf->data + VLAN_ETH_HLEN),
+		(const void*) ((uint8_t*)m->data + ETH_HLEN), (m->data_len - ETH_HLEN));
 	tx_q->m_table[len] = mbuf;
 	len++;
 	if (enable_stats) {
@@ -980,9 +980,9 @@ virtio_dev_tx(struct virtio_net* dev, struct rte_mempool *mbuf_pool)
 		rte_prefetch0((void*)(uintptr_t)buff_addr);
 
 		/* Setup dummy mbuf. This is copied to a real mbuf if transmitted out the physical port. */
-		m.pkt.data_len = desc->len;
-		m.pkt.data = (void*)(uintptr_t)buff_addr;
-		m.pkt.nb_segs = 1;
+		m.data_len = desc->len;
+		m.data = (void*)(uintptr_t)buff_addr;
+		m.nb_segs = 1;
 
 		virtio_tx_route(dev, &m, mbuf_pool, 0);
 
lib/librte_distributor/rte_distributor.c +1 -1
index 2d92e45..585ff88 100644
@@ -282,7 +282,7 @@ rte_distributor_process(struct rte_distributor *d,
 			next_mb = mbufs[next_idx++];
 			next_value = (((int64_t)(uintptr_t)next_mb)
 					<< RTE_DISTRIB_FLAG_BITS);
-			new_tag = (next_mb->pkt.hash.rss | 1);
+			new_tag = (next_mb->hash.rss | 1);
 
 			uint32_t match = 0;
 			unsigned i;
lib/librte_ip_frag/ip_frag_common.h +7 -7
index 70be949..81ca23a 100644
@@ -173,20 +173,20 @@ ip_frag_chain(struct rte_mbuf *mn, struct rte_mbuf *mp)
 	struct rte_mbuf *ms;
 
 	/* adjust start of the last fragment data. */
-	rte_pktmbuf_adj(mp, (uint16_t)(mp->pkt.vlan_macip.f.l2_len +
-		mp->pkt.vlan_macip.f.l3_len));
+	rte_pktmbuf_adj(mp, (uint16_t)(mp->vlan_macip.f.l2_len +
+		mp->vlan_macip.f.l3_len));
 
 	/* chain two fragments. */
 	ms = rte_pktmbuf_lastseg(mn);
-	ms->pkt.next = mp;
+	ms->next = mp;
 
 	/* accumulate number of segments and total length. */
-	mn->pkt.nb_segs = (uint8_t)(mn->pkt.nb_segs + mp->pkt.nb_segs);
-	mn->pkt.pkt_len += mp->pkt.pkt_len;
+	mn->nb_segs = (uint8_t)(mn->nb_segs + mp->nb_segs);
+	mn->pkt_len += mp->pkt_len;
 
 	/* reset pkt_len and nb_segs for chained fragment. */
-	mp->pkt.pkt_len = mp->pkt.data_len;
-	mp->pkt.nb_segs = 1;
+	mp->pkt_len = mp->data_len;
+	mp->nb_segs = 1;
 }
 
 
lib/librte_ip_frag/rte_ipv4_fragmentation.c +20 -20
index 9d4e1f7..0b10310 100644
@@ -109,7 +109,7 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,
 	/* Fragment size should be a multiply of 8. */
 	IP_FRAG_ASSERT((frag_size & IPV4_HDR_FO_MASK) == 0);
 
-	in_hdr = (struct ipv4_hdr *) pkt_in->pkt.data;
+	in_hdr = (struct ipv4_hdr *) pkt_in->data;
 	flag_offset = rte_cpu_to_be_16(in_hdr->fragment_offset);
 
 	/* If Don't Fragment flag is set */
@@ -118,7 +118,7 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,
 
 	/* Check that pkts_out is big enough to hold all fragments */
 	if (unlikely(frag_size * nb_pkts_out <
-	    (uint16_t)(pkt_in->pkt.pkt_len - sizeof (struct ipv4_hdr))))
+	    (uint16_t)(pkt_in->pkt_len - sizeof (struct ipv4_hdr))))
 		return -EINVAL;
 
 	in_seg = pkt_in;
@@ -140,8 +140,8 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,
 		}
 
 		/* Reserve space for the IP header that will be built later */
-		out_pkt->pkt.data_len = sizeof(struct ipv4_hdr);
-		out_pkt->pkt.pkt_len = sizeof(struct ipv4_hdr);
+		out_pkt->data_len = sizeof(struct ipv4_hdr);
+		out_pkt->pkt_len = sizeof(struct ipv4_hdr);
 
 		out_seg_prev = out_pkt;
 		more_out_segs = 1;
@@ -156,29 +156,29 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,
 				__free_fragments(pkts_out, out_pkt_pos);
 				return -ENOMEM;
 			}
-			out_seg_prev->pkt.next = out_seg;
+			out_seg_prev->next = out_seg;
 			out_seg_prev = out_seg;
 
 			/* Prepare indirect buffer */
 			rte_pktmbuf_attach(out_seg, in_seg);
-			len = mtu_size - out_pkt->pkt.pkt_len;
-			if (len > (in_seg->pkt.data_len - in_seg_data_pos)) {
-				len = in_seg->pkt.data_len - in_seg_data_pos;
+			len = mtu_size - out_pkt->pkt_len;
+			if (len > (in_seg->data_len - in_seg_data_pos)) {
+				len = in_seg->data_len - in_seg_data_pos;
 			}
-			out_seg->pkt.data = (char*) in_seg->pkt.data + (uint16_t)in_seg_data_pos;
-			out_seg->pkt.data_len = (uint16_t)len;
-			out_pkt->pkt.pkt_len = (uint16_t)(len +
-			    out_pkt->pkt.pkt_len);
-			out_pkt->pkt.nb_segs += 1;
+			out_seg->data = (char*) in_seg->data + (uint16_t)in_seg_data_pos;
+			out_seg->data_len = (uint16_t)len;
+			out_pkt->pkt_len = (uint16_t)(len +
+			    out_pkt->pkt_len);
+			out_pkt->nb_segs += 1;
 			in_seg_data_pos += len;
 
 			/* Current output packet (i.e. fragment) done ? */
-			if (unlikely(out_pkt->pkt.pkt_len >= mtu_size))
+			if (unlikely(out_pkt->pkt_len >= mtu_size))
 				more_out_segs = 0;
 
 			/* Current input segment done ? */
-			if (unlikely(in_seg_data_pos == in_seg->pkt.data_len)) {
-				in_seg = in_seg->pkt.next;
+			if (unlikely(in_seg_data_pos == in_seg->data_len)) {
+				in_seg = in_seg->next;
 				in_seg_data_pos = 0;
 
 				if (unlikely(in_seg == NULL))
@@ -188,17 +188,17 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,
 
 		/* Build the IP header */
 
-		out_hdr = (struct ipv4_hdr*) out_pkt->pkt.data;
+		out_hdr = (struct ipv4_hdr*) out_pkt->data;
 
 		__fill_ipv4hdr_frag(out_hdr, in_hdr,
-		    (uint16_t)out_pkt->pkt.pkt_len,
+		    (uint16_t)out_pkt->pkt_len,
 		    flag_offset, fragment_offset, more_in_segs);
 
 		fragment_offset = (uint16_t)(fragment_offset +
-		    out_pkt->pkt.pkt_len - sizeof(struct ipv4_hdr));
+		    out_pkt->pkt_len - sizeof(struct ipv4_hdr));
 
 		out_pkt->ol_flags |= PKT_TX_IP_CKSUM;
-		out_pkt->pkt.vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+		out_pkt->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
 
 		/* Write the fragment to the output list */
 		pkts_out[out_pkt_pos] = out_pkt;
lib/librte_ip_frag/rte_ipv4_reassembly.c +3 -3
index a27b23a..06c37af 100644
@@ -87,10 +87,10 @@ ipv4_frag_reassemble(const struct ip_frag_pkt *fp)
 
 	/* update ipv4 header for the reassmebled packet */
 	ip_hdr = (struct ipv4_hdr*)(rte_pktmbuf_mtod(m, uint8_t *) +
-		m->pkt.vlan_macip.f.l2_len);
+		m->vlan_macip.f.l2_len);
 
 	ip_hdr->total_length = rte_cpu_to_be_16((uint16_t)(fp->total_size +
-		m->pkt.vlan_macip.f.l3_len));
+		m->vlan_macip.f.l3_len));
 	ip_hdr->fragment_offset = (uint16_t)(ip_hdr->fragment_offset &
 		rte_cpu_to_be_16(IPV4_HDR_DF_FLAG));
 	ip_hdr->hdr_checksum = 0;
@@ -137,7 +137,7 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
 
 	ip_ofs *= IPV4_HDR_OFFSET_UNITS;
 	ip_len = (uint16_t)(rte_be_to_cpu_16(ip_hdr->total_length) -
-		mb->pkt.vlan_macip.f.l3_len);
+		mb->vlan_macip.f.l3_len);
 
 	IP_FRAG_LOG(DEBUG, "%s:%d:\n"
 		"mbuf: %p, tms: %" PRIu64
lib/librte_ip_frag/rte_ipv6_fragmentation.c +19 -19
index fa04991..e007662 100644
@@ -122,10 +122,10 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in,
 
 	/* Check that pkts_out is big enough to hold all fragments */
 	if (unlikely (frag_size * nb_pkts_out <
-	    (uint16_t)(pkt_in->pkt.pkt_len - sizeof (struct ipv6_hdr))))
+	    (uint16_t)(pkt_in->pkt_len - sizeof (struct ipv6_hdr))))
 		return (-EINVAL);
 
-	in_hdr = (struct ipv6_hdr *) pkt_in->pkt.data;
+	in_hdr = (struct ipv6_hdr *) pkt_in->data;
 
 	in_seg = pkt_in;
 	in_seg_data_pos = sizeof(struct ipv6_hdr);
@@ -146,8 +146,8 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in,
 		}
 
 		/* Reserve space for the IP header that will be built later */
-		out_pkt->pkt.data_len = sizeof(struct ipv6_hdr) + sizeof(struct ipv6_extension_fragment);
-		out_pkt->pkt.pkt_len  = sizeof(struct ipv6_hdr) + sizeof(struct ipv6_extension_fragment);
+		out_pkt->data_len = sizeof(struct ipv6_hdr) + sizeof(struct ipv6_extension_fragment);
+		out_pkt->pkt_len  = sizeof(struct ipv6_hdr) + sizeof(struct ipv6_extension_fragment);
 
 		out_seg_prev = out_pkt;
 		more_out_segs = 1;
@@ -162,30 +162,30 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in,
 				__free_fragments(pkts_out, out_pkt_pos);
 				return (-ENOMEM);
 			}
-			out_seg_prev->pkt.next = out_seg;
+			out_seg_prev->next = out_seg;
 			out_seg_prev = out_seg;
 
 			/* Prepare indirect buffer */
 			rte_pktmbuf_attach(out_seg, in_seg);
-			len = mtu_size - out_pkt->pkt.pkt_len;
-			if (len > (in_seg->pkt.data_len - in_seg_data_pos)) {
-				len = in_seg->pkt.data_len - in_seg_data_pos;
+			len = mtu_size - out_pkt->pkt_len;
+			if (len > (in_seg->data_len - in_seg_data_pos)) {
+				len = in_seg->data_len - in_seg_data_pos;
 			}
-			out_seg->pkt.data = (char *) in_seg->pkt.data + (uint16_t) in_seg_data_pos;
-			out_seg->pkt.data_len = (uint16_t)len;
-			out_pkt->pkt.pkt_len = (uint16_t)(len +
-			    out_pkt->pkt.pkt_len);
-			out_pkt->pkt.nb_segs += 1;
+			out_seg->data = (char *) in_seg->data + (uint16_t) in_seg_data_pos;
+			out_seg->data_len = (uint16_t)len;
+			out_pkt->pkt_len = (uint16_t)(len +
+			    out_pkt->pkt_len);
+			out_pkt->nb_segs += 1;
 			in_seg_data_pos += len;
 
 			/* Current output packet (i.e. fragment) done ? */
-			if (unlikely(out_pkt->pkt.pkt_len >= mtu_size)) {
+			if (unlikely(out_pkt->pkt_len >= mtu_size)) {
 				more_out_segs = 0;
 			}
 
 			/* Current input segment done ? */
-			if (unlikely(in_seg_data_pos == in_seg->pkt.data_len)) {
-				in_seg = in_seg->pkt.next;
+			if (unlikely(in_seg_data_pos == in_seg->data_len)) {
+				in_seg = in_seg->next;
 				in_seg_data_pos = 0;
 
 				if (unlikely(in_seg == NULL)) {
@@ -196,14 +196,14 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in,
 
 		/* Build the IP header */
 
-		out_hdr = (struct ipv6_hdr *) out_pkt->pkt.data;
+		out_hdr = (struct ipv6_hdr *) out_pkt->data;
 
 		__fill_ipv6hdr_frag(out_hdr, in_hdr,
-		    (uint16_t) out_pkt->pkt.pkt_len - sizeof(struct ipv6_hdr),
+		    (uint16_t) out_pkt->pkt_len - sizeof(struct ipv6_hdr),
 		    fragment_offset, more_in_segs);
 
 		fragment_offset = (uint16_t)(fragment_offset +
-		    out_pkt->pkt.pkt_len - sizeof(struct ipv6_hdr)
+		    out_pkt->pkt_len - sizeof(struct ipv6_hdr)
 			- sizeof(struct ipv6_extension_fragment));
 
 		/* Write the fragment to the output list */
lib/librte_ip_frag/rte_ipv6_reassembly.c +2 -2
index 3f06960..dee3425 100644
@@ -109,7 +109,7 @@ ipv6_frag_reassemble(const struct ip_frag_pkt *fp)
 
 	/* update ipv6 header for the reassembled datagram */
 	ip_hdr = (struct ipv6_hdr *) (rte_pktmbuf_mtod(m, uint8_t *) +
-								  m->pkt.vlan_macip.f.l2_len);
+								  m->vlan_macip.f.l2_len);
 
 	ip_hdr->payload_len = rte_cpu_to_be_16(payload_len);
 
@@ -120,7 +120,7 @@ ipv6_frag_reassemble(const struct ip_frag_pkt *fp)
 	 * other headers, so we assume there are no other headers and thus update
 	 * the main IPv6 header instead.
 	 */
-	move_len = m->pkt.vlan_macip.f.l2_len + m->pkt.vlan_macip.f.l3_len -
+	move_len = m->vlan_macip.f.l2_len + m->vlan_macip.f.l3_len -
 			sizeof(*frag_hdr);
 	frag_hdr = (struct ipv6_extension_fragment *) (ip_hdr + 1);
 	ip_hdr->proto = frag_hdr->next_header;
lib/librte_mbuf/rte_mbuf.c +13 -13
index 39865c1..967e4d8 100644
@@ -117,12 +117,12 @@ rte_pktmbuf_init(struct rte_mempool *mp,
 	m->buf_len = (uint16_t)buf_len;
 
 	/* keep some headroom between start of buffer and data */
-	m->pkt.data = (char*) m->buf_addr + RTE_MIN(RTE_PKTMBUF_HEADROOM, m->buf_len);
+	m->data = (char*) m->buf_addr + RTE_MIN(RTE_PKTMBUF_HEADROOM, m->buf_len);
 
 	/* init some constant fields */
 	m->pool = mp;
-	m->pkt.nb_segs = 1;
-	m->pkt.in_port = 0xff;
+	m->nb_segs = 1;
+	m->in_port = 0xff;
 }
 
 /* do some sanity checks on a mbuf: panic if it fails */
@@ -153,10 +153,10 @@ rte_mbuf_sanity_check(const struct rte_mbuf *m, int is_header)
 	if (is_header == 0)
 		return;
 
-	nb_segs = m->pkt.nb_segs;
+	nb_segs = m->nb_segs;
 	m_seg = m;
 	while (m_seg && nb_segs != 0) {
-		m_seg = m_seg->pkt.next;
+		m_seg = m_seg->next;
 		nb_segs --;
 	}
 	if (nb_segs != 0)
@@ -175,22 +175,22 @@ rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m, unsigned dump_len)
 	fprintf(f, "dump mbuf at 0x%p, phys=%"PRIx64", buf_len=%u\n",
 	       m, (uint64_t)m->buf_physaddr, (unsigned)m->buf_len);
 	fprintf(f, "  pkt_len=%"PRIu32", ol_flags=%"PRIx16", nb_segs=%u, "
-	       "in_port=%u\n", m->pkt.pkt_len, m->ol_flags,
-	       (unsigned)m->pkt.nb_segs, (unsigned)m->pkt.in_port);
-	nb_segs = m->pkt.nb_segs;
+	       "in_port=%u\n", m->pkt_len, m->ol_flags,
+	       (unsigned)m->nb_segs, (unsigned)m->in_port);
+	nb_segs = m->nb_segs;
 
 	while (m && nb_segs != 0) {
 		__rte_mbuf_sanity_check(m, 0);
 
 		fprintf(f, "  segment at 0x%p, data=0x%p, data_len=%u\n",
-		       m, m->pkt.data, (unsigned)m->pkt.data_len);
+		       m, m->data, (unsigned)m->data_len);
 		len = dump_len;
-		if (len > m->pkt.data_len)
-			len = m->pkt.data_len;
+		if (len > m->data_len)
+			len = m->data_len;
 		if (len != 0)
-			rte_hexdump(f, NULL, m->pkt.data, len);
+			rte_hexdump(f, NULL, m->data, len);
 		dump_len -= len;
-		m = m->pkt.next;
+		m = m->next;
 		nb_segs --;
 	}
 }
lib/librte_mbuf/rte_mbuf.h +70 -72

283 lines not on this page · raw message

lib/librte_pmd_bond/rte_eth_bond_pmd.c +2 -2
index d72d6ed..5979ce5 100644
@@ -198,14 +198,14 @@ xmit_slave_hash(const struct rte_mbuf *buf, uint8_t slave_count, uint8_t policy)
 
 	switch (policy) {
 	case BALANCE_XMIT_POLICY_LAYER2:
-		eth_hdr = (struct ether_hdr *)buf->pkt.data;
+		eth_hdr = (struct ether_hdr *)buf->data;
 
 		hash = ether_hash(eth_hdr);
 		hash ^= hash >> 8;
 		return hash % slave_count;
 
 	case BALANCE_XMIT_POLICY_LAYER23:
-		eth_hdr = (struct ether_hdr *)buf->pkt.data;
+		eth_hdr = (struct ether_hdr *)buf->data;
 
 		if (buf->ol_flags & PKT_RX_VLAN_PKT)
 			eth_offset = sizeof(struct ether_hdr) + sizeof(struct vlan_hdr);
lib/librte_pmd_e1000/em_rxtx.c +32 -32

156 lines not on this page · raw message

lib/librte_pmd_e1000/igb_rxtx.c +34 -34

149 lines not on this page · raw message

lib/librte_pmd_i40e/i40e_rxtx.c +49 -49

220 lines not on this page · raw message

lib/librte_pmd_ixgbe/ixgbe_rxtx.c +50 -50

227 lines not on this page · raw message

lib/librte_pmd_ixgbe/ixgbe_rxtx.h +1 -1
index 64c0695..4c9cb74 100644
@@ -47,7 +47,7 @@
 #endif
 
 #define RTE_MBUF_DATA_DMA_ADDR(mb) \
-	(uint64_t) ((mb)->buf_physaddr + (uint64_t)((char *)((mb)->pkt.data) - \
+	(uint64_t) ((mb)->buf_physaddr + (uint64_t)((char *)((mb)->data) - \
 	(char *)(mb)->buf_addr))
 
 #define RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mb) \
lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c +9 -11
index 047acf0..bafb215 100644
@@ -48,9 +48,7 @@ static inline void
 ixgbe_rxq_rearm(struct igb_rx_queue *rxq)
 {
 	static const struct rte_mbuf mb_def = {
-		.pkt = {
-			.nb_segs = 1,
-		},
+		.nb_segs = 1,
 	};
 	int i;
 	uint16_t rx_id;
@@ -68,7 +66,7 @@ ixgbe_rxq_rearm(struct igb_rx_queue *rxq)
 
 	rxdp = rxq->rx_ring + rxq->rxrearm_start;
 
-	def_low = _mm_load_si128((__m128i *)&(mb_def.pkt));
+	def_low = _mm_load_si128((__m128i *)&(mb_def.next));
 
 	/* Initialize the mbufs in vector, process 2 mbufs in one loop */
 	for (i = 0; i < RTE_IXGBE_RXQ_REARM_THRESH; i += 2, rxep += 2) {
@@ -99,8 +97,8 @@ ixgbe_rxq_rearm(struct igb_rx_queue *rxq)
 		_mm_store_si128((__m128i *)&rxdp++->read, dma_addr1);
 
 		/* flush mbuf with pkt template */
-		_mm_store_si128((__m128i *)&mb0->pkt, vaddr0);
-		_mm_store_si128((__m128i *)&mb1->pkt, vaddr1);
+		_mm_store_si128((__m128i *)&mb0->next, vaddr0);
+		_mm_store_si128((__m128i *)&mb1->next, vaddr1);
 
 		/* update refcnt per pkt */
 		rte_mbuf_refcnt_set(mb0, 1);
@@ -299,9 +297,9 @@ ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 		staterr = _mm_unpacklo_epi32(sterr_tmp1, sterr_tmp2);
 
 		/* D.3 copy final 3,4 data to rx_pkts */
-		_mm_storeu_si128((__m128i *)&(rx_pkts[pos+3]->pkt.data_len),
+		_mm_storeu_si128((__m128i *)&(rx_pkts[pos+3]->data_len),
 				pkt_mb4);
-		_mm_storeu_si128((__m128i *)&(rx_pkts[pos+2]->pkt.data_len),
+		_mm_storeu_si128((__m128i *)&(rx_pkts[pos+2]->data_len),
 				pkt_mb3);
 
 		/* D.2 pkt 1,2 set in_port/nb_seg and remove crc */
@@ -313,9 +311,9 @@ ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 		staterr = _mm_packs_epi32(staterr, zero);
 
 		/* D.3 copy final 1,2 data to rx_pkts */
-		_mm_storeu_si128((__m128i *)&(rx_pkts[pos+1]->pkt.data_len),
+		_mm_storeu_si128((__m128i *)&(rx_pkts[pos+1]->data_len),
 				pkt_mb2);
-		_mm_storeu_si128((__m128i *)&(rx_pkts[pos]->pkt.data_len),
+		_mm_storeu_si128((__m128i *)&(rx_pkts[pos]->data_len),
 				pkt_mb1);
 
 		/* C.4 calc avaialbe number of desc */
@@ -342,7 +340,7 @@ vtx1(volatile union ixgbe_adv_tx_desc *txdp,
 	/* load buf_addr/buf_physaddr in t0 */
 	t0 = _mm_loadu_si128((__m128i *)&(pkt->buf_addr));
 	/* load data, ... pkt_len in t1 */
-	t1 = _mm_loadu_si128((__m128i *)&(pkt->pkt.data));
+	t1 = _mm_loadu_si128((__m128i *)&(pkt->data));
 
 	/* calc offset = (data - buf_adr) */
 	offset = _mm_sub_epi64(t1, t0);
lib/librte_pmd_pcap/rte_eth_pcap.c +7 -7
index eebe768..121de65 100644
@@ -151,9 +151,9 @@ eth_pcap_rx(void *queue,
 
 		if (header.len <= buf_size) {
 			/* pcap packet will fit in the mbuf, go ahead and copy */
-			rte_memcpy(mbuf->pkt.data, packet, header.len);
-			mbuf->pkt.data_len = (uint16_t)header.len;
-			mbuf->pkt.pkt_len = mbuf->pkt.data_len;
+			rte_memcpy(mbuf->data, packet, header.len);
+			mbuf->data_len = (uint16_t)header.len;
+			mbuf->pkt_len = mbuf->data_len;
 			bufs[num_rx] = mbuf;
 			num_rx++;
 		} else {
@@ -200,9 +200,9 @@ eth_pcap_tx_dumper(void *queue,
 	for (i = 0; i < nb_pkts; i++) {
 		mbuf = bufs[i];
 		calculate_timestamp(&header.ts);
-		header.len = mbuf->pkt.data_len;
+		header.len = mbuf->data_len;
 		header.caplen = header.len;
-		pcap_dump((u_char*) dumper_q->dumper, &header, mbuf->pkt.data);
+		pcap_dump((u_char*) dumper_q->dumper, &header, mbuf->data);
 		rte_pktmbuf_free(mbuf);
 		num_tx++;
 	}
@@ -237,8 +237,8 @@ eth_pcap_tx(void *queue,
 
 	for (i = 0; i < nb_pkts; i++) {
 		mbuf = bufs[i];
-		ret = pcap_sendpacket(tx_queue->pcap, (u_char*) mbuf->pkt.data,
-				mbuf->pkt.data_len);
+		ret = pcap_sendpacket(tx_queue->pcap, (u_char*) mbuf->data,
+				mbuf->data_len);
 		if (unlikely(ret != 0))
 			break;
 		num_tx++;
lib/librte_pmd_virtio/virtio_rxtx.c +10 -10
index 186514d..07bc7b2 100644
@@ -118,7 +118,7 @@ virtqueue_dequeue_burst_rx(struct virtqueue *vq, struct rte_mbuf **rx_pkts,
 		}
 
 		rte_prefetch0(cookie);
-		rte_packet_prefetch(cookie->pkt.data);
+		rte_packet_prefetch(cookie->data);
 		rx_pkts[i]  = cookie;
 		vq->vq_used_cons_idx++;
 		vq_ring_free_chain(vq, desc_idx);
@@ -209,7 +209,7 @@ virtqueue_enqueue_xmit(struct virtqueue *txvq, struct rte_mbuf *cookie)
 	start_dp[idx].flags = VRING_DESC_F_NEXT;
 	idx = start_dp[idx].next;
 	start_dp[idx].addr  = RTE_MBUF_DATA_DMA_ADDR(cookie);
-	start_dp[idx].len   = cookie->pkt.data_len;
+	start_dp[idx].len   = cookie->data_len;
 	start_dp[idx].flags = 0;
 	idx = start_dp[idx].next;
 	txvq->vq_desc_head_idx = idx;
@@ -469,16 +469,16 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 			continue;
 		}
 
-		rxm->pkt.in_port = rxvq->port_id;
-		rxm->pkt.data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
-		rxm->pkt.nb_segs = 1;
-		rxm->pkt.next = NULL;
-		rxm->pkt.pkt_len  = (uint32_t)(len[i]
+		rxm->in_port = rxvq->port_id;
+		rxm->data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
+		rxm->nb_segs = 1;
+		rxm->next = NULL;
+		rxm->pkt_len  = (uint32_t)(len[i]
 					       - sizeof(struct virtio_net_hdr));
-		rxm->pkt.data_len = (uint16_t)(len[i]
+		rxm->data_len = (uint16_t)(len[i]
 					       - sizeof(struct virtio_net_hdr));
 
-		VIRTIO_DUMP_PACKET(rxm, rxm->pkt.data_len);
+		VIRTIO_DUMP_PACKET(rxm, rxm->data_len);
 
 		rx_pkts[nb_rx++] = rxm;
 		rxvq->bytes += len[i] - sizeof(struct virtio_net_hdr);
@@ -555,7 +555,7 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 				break;
 			}
 			nb_tx++;
-			txvq->bytes += txm->pkt.data_len;
+			txvq->bytes += txm->data_len;
 		} else {
 			PMD_TX_LOG(ERR, "No free tx descriptors to transmit");
 			break;
lib/librte_pmd_virtio/virtqueue.h +1 -1
index 87db35f..d777feb 100644
@@ -59,7 +59,7 @@
 #define VIRTQUEUE_MAX_NAME_SZ 32
 
 #define RTE_MBUF_DATA_DMA_ADDR(mb) \
-	(uint64_t) ((mb)->buf_physaddr + (uint64_t)((char *)((mb)->pkt.data) - \
+	(uint64_t) ((mb)->buf_physaddr + (uint64_t)((char *)((mb)->data) - \
 	(char *)(mb)->buf_addr))
 
 #define VTNET_SQ_RQ_QUEUE_IDX 0
lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c +13 -13
index 2470c8e..7dd5a98 100644
@@ -79,7 +79,7 @@
 
 
 #define RTE_MBUF_DATA_DMA_ADDR(mb) \
-	(uint64_t) ((mb)->buf_physaddr + (uint64_t)((char *)((mb)->pkt.data) - \
+	(uint64_t) ((mb)->buf_physaddr + (uint64_t)((char *)((mb)->data) - \
 	(char *)(mb)->buf_addr))
 
 #define RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mb) \
@@ -288,7 +288,7 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 
 			txm = tx_pkts[nb_tx];
 			/* Don't support scatter packets yet, free them if met */
-			if (txm->pkt.nb_segs != 1) {
+			if (txm->nb_segs != 1) {
 				PMD_TX_LOG(DEBUG, "Don't support scatter packets yet, drop!");
 				rte_pktmbuf_free(tx_pkts[nb_tx]);
 				txq->stats.drop_total++;
@@ -298,7 +298,7 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			}
 
 			/* Needs to minus ether header len */
-			if (txm->pkt.data_len > (hw->cur_mtu + ETHER_HDR_LEN)) {
+			if (txm->data_len > (hw->cur_mtu + ETHER_HDR_LEN)) {
 				PMD_TX_LOG(DEBUG, "Packet data_len higher than MTU");
 				rte_pktmbuf_free(tx_pkts[nb_tx]);
 				txq->stats.drop_total++;
@@ -313,7 +313,7 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			tbi = txq->cmd_ring.buf_info + txq->cmd_ring.next2fill;
 			tbi->bufPA = RTE_MBUF_DATA_DMA_ADDR(txm);
 			txd->addr = tbi->bufPA;
-			txd->len = txm->pkt.data_len;
+			txd->len = txm->data_len;
 
 			/* Mark the last descriptor as End of Packet. */
 			txd->cq = 1;
@@ -550,21 +550,21 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 					       rte_pktmbuf_mtod(rxm, void *));
 #endif
 				/* Copy vlan tag in packet buffer */
-				rxm->pkt.vlan_macip.f.vlan_tci =
+				rxm->vlan_macip.f.vlan_tci =
 					rte_le_to_cpu_16((uint16_t)rcd->tci);
 
 			} else
 				rxm->ol_flags = 0;
 
 			/* Initialize newly received packet buffer */
-			rxm->pkt.in_port = rxq->port_id;
-			rxm->pkt.nb_segs = 1;
-			rxm->pkt.next = NULL;
-			rxm->pkt.pkt_len = (uint16_t)rcd->len;
-			rxm->pkt.data_len = (uint16_t)rcd->len;
-			rxm->pkt.in_port = rxq->port_id;
-			rxm->pkt.vlan_macip.f.vlan_tci = 0;
-			rxm->pkt.data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
+			rxm->in_port = rxq->port_id;
+			rxm->nb_segs = 1;
+			rxm->next = NULL;
+			rxm->pkt_len = (uint16_t)rcd->len;
+			rxm->data_len = (uint16_t)rcd->len;
+			rxm->in_port = rxq->port_id;
+			rxm->vlan_macip.f.vlan_tci = 0;
+			rxm->data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
 
 			rx_pkts[nb_rx++] = rxm;
 
lib/librte_pmd_xenvirt/rte_eth_xenvirt.c +6 -6
index ba82319..c118652 100644
@@ -109,12 +109,12 @@ eth_xenvirt_rx(void *q, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 	for (i = 0; i < num ; i ++) {
 		rxm = rx_pkts[i];
 		PMD_RX_LOG(DEBUG, "packet len:%d\n", len[i]);
-		rxm->pkt.next = NULL;
-		rxm->pkt.data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
-		rxm->pkt.data_len = (uint16_t)(len[i] - sizeof(struct virtio_net_hdr));
-		rxm->pkt.nb_segs = 1;
-		rxm->pkt.in_port = pi->port_id;
-		rxm->pkt.pkt_len  = (uint32_t)(len[i] - sizeof(struct virtio_net_hdr));
+		rxm->next = NULL;
+		rxm->data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
+		rxm->data_len = (uint16_t)(len[i] - sizeof(struct virtio_net_hdr));
+		rxm->nb_segs = 1;
+		rxm->in_port = pi->port_id;
+		rxm->pkt_len  = (uint32_t)(len[i] - sizeof(struct virtio_net_hdr));
 	}
 	/* allocate new mbuf for the used descriptor */
 	while (likely(!virtqueue_full(rxvq))) {
lib/librte_pmd_xenvirt/virtqueue.h +2 -2
index 81cd938..d8717fe 100644
@@ -54,7 +54,7 @@
  * rather than gpa<->hva in virito spec.
  */
 #define RTE_MBUF_DATA_DMA_ADDR(mb) \
-	((uint64_t)((mb)->pkt.data))
+	((uint64_t)((mb)->data))
 
 enum { VTNET_RQ = 0, VTNET_TQ = 1, VTNET_CQ = 2 };
 
@@ -238,7 +238,7 @@ virtqueue_enqueue_xmit(struct virtqueue *txvq, struct rte_mbuf *cookie)
 	start_dp[idx].addr  = (uintptr_t)NULL;
 	idx = start_dp[idx].next;
 	start_dp[idx].addr  = RTE_MBUF_DATA_DMA_ADDR(cookie);
-	start_dp[idx].len   = cookie->pkt.data_len;
+	start_dp[idx].len   = cookie->data_len;
 	start_dp[idx].flags = 0;
 	idx = start_dp[idx].next;
 	txvq->vq_desc_head_idx = idx;
lib/librte_port/rte_port_frag.c +1 -1
index ce5026f..9f1bd3c 100644
@@ -159,7 +159,7 @@ rte_port_ring_reader_ipv4_frag_rx(void *port,
 		p->n_pkts--;
 
 		/* If not jumbo, pass current packet to output */
-		if (pkt->pkt.pkt_len <= IPV4_MTU_DEFAULT) {
+		if (pkt->pkt_len <= IPV4_MTU_DEFAULT) {
 			pkts[n_pkts_out++] = pkt;
 
 			n_pkts_to_provide = n_pkts - n_pkts_out;
lib/librte_sched/rte_sched.c +7 -7
index 968c2b3..ba60277 100644
@@ -1015,7 +1015,7 @@ rte_sched_port_update_subport_stats(struct rte_sched_port *port, uint32_t qindex
 {
 	struct rte_sched_subport *s = port->subport + (qindex / rte_sched_port_queues_per_subport(port));
 	uint32_t tc_index = (qindex >> 2) & 0x3;
-	uint32_t pkt_len = pkt->pkt.pkt_len;
+	uint32_t pkt_len = pkt->pkt_len;
 
 	s->stats.n_pkts_tc[tc_index] += 1;
 	s->stats.n_bytes_tc[tc_index] += pkt_len;
@@ -1026,7 +1026,7 @@ rte_sched_port_update_subport_stats_on_drop(struct rte_sched_port *port, uint32_
 {
 	struct rte_sched_subport *s = port->subport + (qindex / rte_sched_port_queues_per_subport(port));
 	uint32_t tc_index = (qindex >> 2) & 0x3;
-	uint32_t pkt_len = pkt->pkt.pkt_len;
+	uint32_t pkt_len = pkt->pkt_len;
 
 	s->stats.n_pkts_tc_dropped[tc_index] += 1;
 	s->stats.n_bytes_tc_dropped[tc_index] += pkt_len;
@@ -1036,7 +1036,7 @@ static inline void
 rte_sched_port_update_queue_stats(struct rte_sched_port *port, uint32_t qindex, struct rte_mbuf *pkt)
 {
 	struct rte_sched_queue_extra *qe = port->queue_extra + qindex;
-	uint32_t pkt_len = pkt->pkt.pkt_len;
+	uint32_t pkt_len = pkt->pkt_len;
 
 	qe->stats.n_pkts += 1;
 	qe->stats.n_bytes += pkt_len;
@@ -1046,7 +1046,7 @@ static inline void
 rte_sched_port_update_queue_stats_on_drop(struct rte_sched_port *port, uint32_t qindex, struct rte_mbuf *pkt)
 {
 	struct rte_sched_queue_extra *qe = port->queue_extra + qindex;
-	uint32_t pkt_len = pkt->pkt.pkt_len;
+	uint32_t pkt_len = pkt->pkt_len;
 
 	qe->stats.n_pkts_dropped += 1;
 	qe->stats.n_bytes_dropped += pkt_len;
@@ -1563,7 +1563,7 @@ grinder_credits_check(struct rte_sched_port *port, uint32_t pos)
 	struct rte_sched_pipe *pipe = grinder->pipe;
 	struct rte_mbuf *pkt = grinder->pkt;
 	uint32_t tc_index = grinder->tc_index;
-	uint32_t pkt_len = pkt->pkt.pkt_len + port->frame_overhead;
+	uint32_t pkt_len = pkt->pkt_len + port->frame_overhead;
 	uint32_t subport_tb_credits = subport->tb_credits;
 	uint32_t subport_tc_credits = subport->tc_credits[tc_index];
 	uint32_t pipe_tb_credits = pipe->tb_credits;
@@ -1599,7 +1599,7 @@ grinder_credits_check(struct rte_sched_port *port, uint32_t pos)
 	struct rte_sched_pipe *pipe = grinder->pipe;
 	struct rte_mbuf *pkt = grinder->pkt;
 	uint32_t tc_index = grinder->tc_index;
-	uint32_t pkt_len = pkt->pkt.pkt_len + port->frame_overhead;
+	uint32_t pkt_len = pkt->pkt_len + port->frame_overhead;
 	uint32_t subport_tb_credits = subport->tb_credits;
 	uint32_t subport_tc_credits = subport->tc_credits[tc_index];
 	uint32_t pipe_tb_credits = pipe->tb_credits;
@@ -1640,7 +1640,7 @@ grinder_schedule(struct rte_sched_port *port, uint32_t pos)
 	struct rte_sched_grinder *grinder = port->grinder + pos;
 	struct rte_sched_queue *queue = grinder->queue[grinder->qpos];
 	struct rte_mbuf *pkt = grinder->pkt;
-	uint32_t pkt_len = pkt->pkt.pkt_len + port->frame_overhead;
+	uint32_t pkt_len = pkt->pkt_len + port->frame_overhead;
 
 #if RTE_SCHED_TS_CREDITS_CHECK
 	if (!grinder_credits_check(port, pos)) {
lib/librte_sched/rte_sched.h +5 -5
index 3f27755..e6bba22 100644
@@ -106,7 +106,7 @@ extern "C" {
    2. Start of Frame Delimiter (SFD):       1 byte;
    3. Frame Check Sequence (FCS):           4 bytes;
    4. Inter Frame Gap (IFG):               12 bytes.
-The FCS is considered overhead only if not included in the packet length (field pkt.pkt_len
+The FCS is considered overhead only if not included in the packet length (field pkt_len
 of struct rte_mbuf). */
 #ifndef RTE_SCHED_FRAME_OVERHEAD_DEFAULT
 #define RTE_SCHED_FRAME_OVERHEAD_DEFAULT      24
@@ -196,7 +196,7 @@ struct rte_sched_port_params {
 };
 
 /** Path through the scheduler hierarchy used by the scheduler enqueue operation to
-identify the destination queue for the current packet. Stored in the field pkt.hash.sched
+identify the destination queue for the current packet. Stored in the field hash.sched
 of struct rte_mbuf of each packet, typically written by the classification stage and read by
 scheduler enqueue.*/
 struct rte_sched_port_hierarchy {
@@ -352,7 +352,7 @@ static inline void
 rte_sched_port_pkt_write(struct rte_mbuf *pkt,
 	uint32_t subport, uint32_t pipe, uint32_t traffic_class, uint32_t queue, enum rte_meter_color color)
 {
-	struct rte_sched_port_hierarchy *sched = (struct rte_sched_port_hierarchy *) &pkt->pkt.hash.sched;
+	struct rte_sched_port_hierarchy *sched = (struct rte_sched_port_hierarchy *) &pkt->hash.sched;
 
 	sched->color = (uint32_t) color;
 	sched->subport = subport;
@@ -381,7 +381,7 @@ rte_sched_port_pkt_write(struct rte_mbuf *pkt,
 static inline void
 rte_sched_port_pkt_read_tree_path(struct rte_mbuf *pkt, uint32_t *subport, uint32_t *pipe, uint32_t *traffic_class, uint32_t *queue)
 {
-	struct rte_sched_port_hierarchy *sched = (struct rte_sched_port_hierarchy *) &pkt->pkt.hash.sched;
+	struct rte_sched_port_hierarchy *sched = (struct rte_sched_port_hierarchy *) &pkt->hash.sched;
 
 	*subport = sched->subport;
 	*pipe = sched->pipe;
@@ -392,7 +392,7 @@ rte_sched_port_pkt_read_tree_path(struct rte_mbuf *pkt, uint32_t *subport, uint3
 static inline enum rte_meter_color
 rte_sched_port_pkt_read_color(struct rte_mbuf *pkt)
 {
-	struct rte_sched_port_hierarchy *sched = (struct rte_sched_port_hierarchy *) &pkt->pkt.hash.sched;
+	struct rte_sched_port_hierarchy *sched = (struct rte_sched_port_hierarchy *) &pkt->hash.sched;
 
 	return (enum rte_meter_color) sched->color;
 }
Signature · 1 line
1.9.3
#6 lore raw

PATCH 5/6 mbuf: rename in_port to just port

In reply to a message not in the archive

In some cases we may want to tag a packet for a particular destination or output port, so rename the "in_port" field in the mbuf to just "port" so that it can be re-used for this purpose if an application needs it.

---
 examples/dpdk_qat/main.c                                   | 2 +-
 examples/ipv4_multicast/main.c                             | 2 +-
 examples/load_balancer/runtime.c                           | 2 +-
 examples/multi_process/client_server_mp/mp_client/client.c | 2 +-
 lib/librte_mbuf/rte_mbuf.c                                 | 4 ++--
 lib/librte_mbuf/rte_mbuf.h                                 | 6 +++---
 lib/librte_pmd_e1000/em_rxtx.c                             | 4 ++--
 lib/librte_pmd_e1000/igb_rxtx.c                            | 4 ++--
 lib/librte_pmd_i40e/i40e_rxtx.c                            | 8 ++++----
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c                          | 8 ++++----
 lib/librte_pmd_virtio/virtio_rxtx.c                        | 2 +-
 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c                      | 4 ++--
 lib/librte_pmd_xenvirt/rte_eth_xenvirt.c                   | 2 +-
 13 files changed, 25 insertions(+), 25 deletions(-)
examples/dpdk_qat/main.c +1 -1
index 75c9876..1599a0a 100644
@@ -384,7 +384,7 @@ main_loop(__attribute__((unused)) void *dummy)
 			}
 		}
 
-		port = dst_ports[pkt->in_port];
+		port = dst_ports[pkt->port];
 
 		/* Transmit the packet */
 		nic_tx_send_packet(pkt, (uint8_t)port);
examples/ipv4_multicast/main.c +1 -1
index cc12d9d..2232851 100644
@@ -337,7 +337,7 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone)
 	hdr->nb_segs = (uint8_t)(pkt->nb_segs + 1);
 
 	/* copy metadata from source packet*/
-	hdr->in_port = pkt->in_port;
+	hdr->port = pkt->port;
 	hdr->vlan_macip = pkt->vlan_macip;
 	hdr->hash = pkt->hash;
 
examples/load_balancer/runtime.c +1 -1
index b69917b..a53f33f 100644
@@ -540,7 +540,7 @@ app_lcore_worker(
 			ipv4_dst = rte_be_to_cpu_32(ipv4_hdr->dst_addr);
 
 			if (unlikely(rte_lpm_lookup(lp->lpm_table, ipv4_dst, &port) != 0)) {
-				port = pkt->in_port;
+				port = pkt->port;
 			}
 
 			pos = lp->mbuf_out[port].n_mbufs;
examples/multi_process/client_server_mp/mp_client/client.c +1 -1
index 71e4a48..ee2338c 100644
@@ -211,7 +211,7 @@ enqueue_packet(struct rte_mbuf *buf, uint8_t port)
 static void
 handle_packet(struct rte_mbuf *buf)
 {
-	const uint8_t in_port = buf->in_port;
+	const uint8_t in_port = buf->port;
 	const uint8_t out_port = output_ports[in_port];
 
 	enqueue_packet(buf, out_port);
lib/librte_mbuf/rte_mbuf.c +2 -2
index 967e4d8..b8b6bbe 100644
@@ -122,7 +122,7 @@ rte_pktmbuf_init(struct rte_mempool *mp,
 	/* init some constant fields */
 	m->pool = mp;
 	m->nb_segs = 1;
-	m->in_port = 0xff;
+	m->port = 0xff;
 }
 
 /* do some sanity checks on a mbuf: panic if it fails */
@@ -176,7 +176,7 @@ rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m, unsigned dump_len)
 	       m, (uint64_t)m->buf_physaddr, (unsigned)m->buf_len);
 	fprintf(f, "  pkt_len=%"PRIu32", ol_flags=%"PRIx16", nb_segs=%u, "
 	       "in_port=%u\n", m->pkt_len, m->ol_flags,
-	       (unsigned)m->nb_segs, (unsigned)m->in_port);
+	       (unsigned)m->nb_segs, (unsigned)m->port);
 	nb_segs = m->nb_segs;
 
 	while (m && nb_segs != 0) {
lib/librte_mbuf/rte_mbuf.h +3 -3
index d5b9a50..fc35006 100644
@@ -166,7 +166,7 @@ struct rte_mbuf {
 
 	/* these fields are valid for first segment only */
 	uint8_t nb_segs;        /**< Number of segments. */
-	uint8_t in_port;        /**< Input port. */
+	uint8_t port;           /**< Input port. */
 	uint32_t pkt_len;       /**< Total pkt len: sum of all segment data_len. */
 
 	/* offload features, valid for first segment only */
@@ -542,7 +542,7 @@ static inline void rte_pktmbuf_reset(struct rte_mbuf *m)
 	m->pkt_len = 0;
 	m->vlan_macip.data = 0;
 	m->nb_segs = 1;
-	m->in_port = 0xff;
+	m->port = 0xff;
 
 	m->ol_flags = 0;
 	buf_ofs = (RTE_PKTMBUF_HEADROOM <= m->buf_len) ?
@@ -606,7 +606,7 @@ static inline void rte_pktmbuf_attach(struct rte_mbuf *mi, struct rte_mbuf *md)
 	mi->next = md->next;
 	mi->data = md->data;
 	mi->data_len = md->data_len;
-	mi->in_port = md->in_port;
+	mi->port = md->port;
 	mi->vlan_macip = md->vlan_macip;
 	mi->hash = md->hash;
 
lib/librte_pmd_e1000/em_rxtx.c +2 -2
index 058e1bd..074c9b3 100644
@@ -777,7 +777,7 @@ eth_em_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		rxm->next = NULL;
 		rxm->pkt_len = pkt_len;
 		rxm->data_len = pkt_len;
-		rxm->in_port = rxq->port_id;
+		rxm->port = rxq->port_id;
 
 		rxm->ol_flags = rx_desc_status_to_pkt_flags(status);
 		rxm->ol_flags = (uint16_t)(rxm->ol_flags |
@@ -1003,7 +1003,7 @@ eth_em_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		 *      - IP checksum flag,
 		 *      - error flags.
 		 */
-		first_seg->in_port = rxq->port_id;
+		first_seg->port = rxq->port_id;
 
 		first_seg->ol_flags = rx_desc_status_to_pkt_flags(status);
 		first_seg->ol_flags = (uint16_t)(first_seg->ol_flags |
lib/librte_pmd_e1000/igb_rxtx.c +2 -2
index 99bb9d9..8b33b6d 100644
@@ -759,7 +759,7 @@ eth_igb_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		rxm->next = NULL;
 		rxm->pkt_len = pkt_len;
 		rxm->data_len = pkt_len;
-		rxm->in_port = rxq->port_id;
+		rxm->port = rxq->port_id;
 
 		rxm->hash.rss = rxd.wb.lower.hi_dword.rss;
 		hlen_type_rss = rte_le_to_cpu_32(rxd.wb.lower.lo_dword.data);
@@ -994,7 +994,7 @@ eth_igb_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		 *      - VLAN TCI, if any,
 		 *      - error flags.
 		 */
-		first_seg->in_port = rxq->port_id;
+		first_seg->port = rxq->port_id;
 		first_seg->hash.rss = rxd.wb.lower.hi_dword.rss;
 
 		/*
lib/librte_pmd_i40e/i40e_rxtx.c +4 -4
index faf6095..9b84edb 100644
@@ -690,7 +690,7 @@ i40e_rx_alloc_bufs(struct i40e_rx_queue *rxq)
 		mb->next = NULL;
 		mb->data = (char *)mb->buf_addr + RTE_PKTMBUF_HEADROOM;
 		mb->nb_segs = 1;
-		mb->in_port = rxq->port_id;
+		mb->port = rxq->port_id;
 		dma_addr = rte_cpu_to_le_64(\
 			RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mb));
 		rxdp[i].read.hdr_addr = dma_addr;
@@ -851,7 +851,7 @@ i40e_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 		rxm->next = NULL;
 		rxm->pkt_len = rx_packet_len;
 		rxm->data_len = rx_packet_len;
-		rxm->in_port = rxq->port_id;
+		rxm->port = rxq->port_id;
 
 		rxm->vlan_macip.f.vlan_tci = rx_status &
 			(1 << I40E_RX_DESC_STATUS_L2TAG1P_SHIFT) ?
@@ -1005,7 +1005,7 @@ i40e_recv_scattered_pkts(void *rx_queue,
 								ETHER_CRC_LEN);
 		}
 
-		first_seg->in_port = rxq->port_id;
+		first_seg->port = rxq->port_id;
 		first_seg->vlan_macip.f.vlan_tci = (rx_status &
 			(1 << I40E_RX_DESC_STATUS_L2TAG1P_SHIFT)) ?
 			rte_le_to_cpu_16(rxd.wb.qword0.lo_dword.l2tag1) : 0;
@@ -2022,7 +2022,7 @@ i40e_alloc_rx_queue_mbufs(struct i40e_rx_queue *rxq)
 		mbuf->next = NULL;
 		mbuf->data = (char *)mbuf->buf_addr + RTE_PKTMBUF_HEADROOM;
 		mbuf->nb_segs = 1;
-		mbuf->in_port = rxq->port_id;
+		mbuf->port = rxq->port_id;
 
 		dma_addr =
 			rte_cpu_to_le_64(RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mbuf));
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +4 -4
index c95e117..eec1458 100644
@@ -998,7 +998,7 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
 		mb->next = NULL;
 		mb->data = (char *)mb->buf_addr + RTE_PKTMBUF_HEADROOM;
 		mb->nb_segs = 1;
-		mb->in_port = rxq->port_id;
+		mb->port = rxq->port_id;
 
 		/* populate the descriptors */
 		dma_addr = (uint64_t)mb->buf_physaddr + RTE_PKTMBUF_HEADROOM;
@@ -1253,7 +1253,7 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		rxm->next = NULL;
 		rxm->pkt_len = pkt_len;
 		rxm->data_len = pkt_len;
-		rxm->in_port = rxq->port_id;
+		rxm->port = rxq->port_id;
 
 		hlen_type_rss = rte_le_to_cpu_32(rxd.wb.lower.lo_dword.data);
 		/* Only valid if PKT_RX_VLAN_PKT set in pkt_flags */
@@ -1496,7 +1496,7 @@ ixgbe_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		 *      - VLAN TCI, if any,
 		 *      - error flags.
 		 */
-		first_seg->in_port = rxq->port_id;
+		first_seg->port = rxq->port_id;
 
 		/*
 		 * The vlan_tci field is only valid when PKT_RX_VLAN_PKT is
@@ -3215,7 +3215,7 @@ ixgbe_alloc_rx_queue_mbufs(struct igb_rx_queue *rxq)
 		mbuf->next = NULL;
 		mbuf->data = (char *)mbuf->buf_addr + RTE_PKTMBUF_HEADROOM;
 		mbuf->nb_segs = 1;
-		mbuf->in_port = rxq->port_id;
+		mbuf->port = rxq->port_id;
 
 		dma_addr =
 			rte_cpu_to_le_64(RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mbuf));
lib/librte_pmd_virtio/virtio_rxtx.c +1 -1
index 07bc7b2..2d043cb 100644
@@ -469,7 +469,7 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 			continue;
 		}
 
-		rxm->in_port = rxvq->port_id;
+		rxm->port = rxvq->port_id;
 		rxm->data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
 		rxm->nb_segs = 1;
 		rxm->next = NULL;
lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c +2 -2
index 7dd5a98..3536765 100644
@@ -557,12 +557,12 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 				rxm->ol_flags = 0;
 
 			/* Initialize newly received packet buffer */
-			rxm->in_port = rxq->port_id;
+			rxm->port = rxq->port_id;
 			rxm->nb_segs = 1;
 			rxm->next = NULL;
 			rxm->pkt_len = (uint16_t)rcd->len;
 			rxm->data_len = (uint16_t)rcd->len;
-			rxm->in_port = rxq->port_id;
+			rxm->port = rxq->port_id;
 			rxm->vlan_macip.f.vlan_tci = 0;
 			rxm->data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
 
lib/librte_pmd_xenvirt/rte_eth_xenvirt.c +1 -1
index c118652..22215ed 100644
@@ -113,7 +113,7 @@ eth_xenvirt_rx(void *q, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 		rxm->data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
 		rxm->data_len = (uint16_t)(len[i] - sizeof(struct virtio_net_hdr));
 		rxm->nb_segs = 1;
-		rxm->in_port = pi->port_id;
+		rxm->port = pi->port_id;
 		rxm->pkt_len  = (uint32_t)(len[i] - sizeof(struct virtio_net_hdr));
 	}
 	/* allocate new mbuf for the used descriptor */
Signature · 1 line
1.9.3
#7 lore raw

PATCH 6/6 mbuf: flatten struct vlan_macip into mbuf struct

In reply to a message not in the archive

The vlan_macip structure combined a vlan tag id with l2 and l3 headers lengths for tracking offloads. However, this structure was only used as a unit by the e1000 and ixgbe drivers, not generally.

This patch removes the structure from the mbuf header and places the fields into the mbuf structure directly at the required point, without any net effect on the structure layout. This allows us to treat the vlan tags and header length fields as separate for future mbuf changes. The drivers which were written to use the combined structure still do so, using a driver-local definition of it.

---
 app/test-pmd/csumonly.c                     |  4 +--
 app/test-pmd/flowgen.c                      | 14 +++++-----
 app/test-pmd/macfwd.c                       |  6 ++---
 app/test-pmd/macswap.c                      |  6 ++---
 app/test-pmd/rxonly.c                       |  3 +--
 app/test-pmd/testpmd.c                      |  4 ++-
 app/test-pmd/txonly.c                       |  6 ++---
 app/test/packet_burst_generator.c           | 10 ++++----
 examples/ip_fragmentation/main.c            |  2 +-
 examples/ip_pipeline/pipeline_rx.c          |  4 +--
 examples/ip_pipeline/pipeline_tx.c          |  2 +-
 examples/ip_reassembly/main.c               |  8 +++---
 examples/ipv4_multicast/main.c              |  4 ++-
 examples/vhost/main.c                       |  6 ++---
 lib/librte_ip_frag/ip_frag_common.h         |  3 +--
 lib/librte_ip_frag/rte_ipv4_fragmentation.c |  2 +-
 lib/librte_ip_frag/rte_ipv4_reassembly.c    |  6 ++---
 lib/librte_ip_frag/rte_ipv6_reassembly.c    |  5 ++--
 lib/librte_mbuf/rte_mbuf.h                  | 33 +++++++-----------------
 lib/librte_pmd_e1000/em_rxtx.c              | 40 ++++++++++++++++++++++-------
 lib/librte_pmd_e1000/igb_rxtx.c             | 39 +++++++++++++++++++++-------
 lib/librte_pmd_i40e/i40e_rxtx.c             | 14 +++++-----
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c           | 18 ++++++-------
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h           | 23 ++++++++++++++++-
 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c       |  6 ++---
 25 files changed, 159 insertions(+), 109 deletions(-)
app/test-pmd/csumonly.c +2 -2
index 655b6d8..28b66f5 100644
@@ -432,8 +432,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 		}
 
 		/* Combine the packet header write. VLAN is not consider here */
-		mb->vlan_macip.f.l2_len = l2_len;
-		mb->vlan_macip.f.l3_len = l3_len;
+		mb->l2_len = l2_len;
+		mb->l3_len = l3_len;
 		mb->ol_flags = ol_flags;
 	}
 	nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx);
app/test-pmd/flowgen.c +7 -7
index 17dbf83..b091b6d 100644
@@ -205,13 +205,13 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
 		udp_hdr->dgram_len	= RTE_CPU_TO_BE_16(pkt_size -
 							   sizeof(*eth_hdr) -
 							   sizeof(*ip_hdr));
-		pkt->nb_segs			= 1;
-		pkt->pkt_len			= pkt_size;
-		pkt->ol_flags			= ol_flags;
-		pkt->vlan_macip.f.vlan_tci	= vlan_tci;
-		pkt->vlan_macip.f.l2_len	= sizeof(struct ether_hdr);
-		pkt->vlan_macip.f.l3_len	= sizeof(struct ipv4_hdr);
-		pkts_burst[nb_pkt]		= pkt;
+		pkt->nb_segs		= 1;
+		pkt->pkt_len		= pkt_size;
+		pkt->ol_flags		= ol_flags;
+		pkt->vlan_tci		= vlan_tci;
+		pkt->l2_len		= sizeof(struct ether_hdr);
+		pkt->l3_len		= sizeof(struct ipv4_hdr);
+		pkts_burst[nb_pkt]	= pkt;
 
 		next_flow = (next_flow + 1) % cfg_n_flows;
 	}
app/test-pmd/macfwd.c +3 -3
index 999c8e3..4b905cd 100644
@@ -116,9 +116,9 @@ pkt_burst_mac_forward(struct fwd_stream *fs)
 		ether_addr_copy(&ports[fs->tx_port].eth_addr,
 				&eth_hdr->s_addr);
 		mb->ol_flags = txp->tx_ol_flags;
-		mb->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
-		mb->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
-		mb->vlan_macip.f.vlan_tci = txp->tx_vlan_id;
+		mb->l2_len = sizeof(struct ether_hdr);
+		mb->l3_len = sizeof(struct ipv4_hdr);
+		mb->vlan_tci = txp->tx_vlan_id;
 	}
 	nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx);
 	fs->tx_packets += nb_tx;
app/test-pmd/macswap.c +3 -3
index 731f487..c5b3a0c 100644
@@ -118,9 +118,9 @@ pkt_burst_mac_swap(struct fwd_stream *fs)
 		ether_addr_copy(&addr, &eth_hdr->s_addr);
 
 		mb->ol_flags = txp->tx_ol_flags;
-		mb->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
-		mb->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
-		mb->vlan_macip.f.vlan_tci = txp->tx_vlan_id;
+		mb->l2_len = sizeof(struct ether_hdr);
+		mb->l3_len = sizeof(struct ipv4_hdr);
+		mb->vlan_tci = txp->tx_vlan_id;
 	}
 	nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx);
 	fs->tx_packets += nb_tx;
app/test-pmd/rxonly.c +1 -2
index c34a5e1..5bc74da 100644
@@ -165,8 +165,7 @@ pkt_burst_receive(struct fwd_stream *fs)
 			printf(" - FDIR hash=0x%x - FDIR id=0x%x ",
 			       mb->hash.fdir.hash, mb->hash.fdir.id);
 		if (ol_flags & PKT_RX_VLAN_PKT)
-			printf(" - VLAN tci=0x%x",
-				mb->vlan_macip.f.vlan_tci);
+			printf(" - VLAN tci=0x%x", mb->vlan_tci);
 		printf("\n");
 		if (ol_flags != 0) {
 			int rxf;
app/test-pmd/testpmd.c +3 -1
index 81272a0..4c09a09 100644
@@ -406,7 +406,9 @@ testpmd_mbuf_ctor(struct rte_mempool *mp,
 	mb->ol_flags     = 0;
 	mb->data         = (char *) mb->buf_addr + RTE_PKTMBUF_HEADROOM;
 	mb->nb_segs      = 1;
-	mb->vlan_macip.data = 0;
+	mb->l2_len       = 0;
+	mb->l3_len       = 0;
+	mb->vlan_tci     = 0;
 	mb->hash.rss     = 0;
 }
 
app/test-pmd/txonly.c +3 -3
index 1b2f661..8135264 100644
@@ -263,9 +263,9 @@ pkt_burst_transmit(struct fwd_stream *fs)
 		pkt->nb_segs = tx_pkt_nb_segs;
 		pkt->pkt_len = tx_pkt_length;
 		pkt->ol_flags = ol_flags;
-		pkt->vlan_macip.f.vlan_tci  = vlan_tci;
-		pkt->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
-		pkt->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+		pkt->vlan_tci  = vlan_tci;
+		pkt->l2_len = sizeof(struct ether_hdr);
+		pkt->l3_len = sizeof(struct ipv4_hdr);
 		pkts_burst[nb_pkt] = pkt;
 	}
 	nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_pkt);
app/test/packet_burst_generator.c +5 -5
index 8740348..db7f023 100644
@@ -260,19 +260,19 @@ nomore_mbuf:
 		 */
 		pkt->nb_segs = tx_pkt_nb_segs;
 		pkt->pkt_len = tx_pkt_length;
-		pkt->vlan_macip.f.l2_len = eth_hdr_size;
+		pkt->l2_len = eth_hdr_size;
 
 		if (ipv4) {
-			pkt->vlan_macip.f.vlan_tci  = ETHER_TYPE_IPv4;
-			pkt->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+			pkt->vlan_tci  = ETHER_TYPE_IPv4;
+			pkt->l3_len = sizeof(struct ipv4_hdr);
 
 			if (vlan_enabled)
 				pkt->ol_flags = PKT_RX_IPV4_HDR | PKT_RX_VLAN_PKT;
 			else
 				pkt->ol_flags = PKT_RX_IPV4_HDR;
 		} else {
-			pkt->vlan_macip.f.vlan_tci  = ETHER_TYPE_IPv6;
-			pkt->vlan_macip.f.l3_len = sizeof(struct ipv6_hdr);
+			pkt->vlan_tci  = ETHER_TYPE_IPv6;
+			pkt->l3_len = sizeof(struct ipv6_hdr);
 
 			if (vlan_enabled)
 				pkt->ol_flags = PKT_RX_IPV6_HDR | PKT_RX_VLAN_PKT;
examples/ip_fragmentation/main.c +1 -1
index ac8d4f7..6d309b5 100644
@@ -413,7 +413,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf,
 			rte_panic("No headroom in mbuf.\n");
 		}
 
-		m->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
+		m->l2_len = sizeof(struct ether_hdr);
 
 		/* 02:00:00:00:00:xx */
 		d_addr_bytes = &eth_hdr->d_addr.addr_bytes[0];
examples/ip_pipeline/pipeline_rx.c +2 -2
index 7a8309c..8f1f781 100644
@@ -255,8 +255,8 @@ app_pkt_metadata_fill(struct rte_mbuf *m)
 	/* Pop Ethernet header */
 	if (app.ether_hdr_pop_push) {
 		rte_pktmbuf_adj(m, (uint16_t)sizeof(struct ether_hdr));
-		m->vlan_macip.f.l2_len = 0;
-		m->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+		m->l2_len = 0;
+		m->l3_len = sizeof(struct ipv4_hdr);
 	}
 }
 
examples/ip_pipeline/pipeline_tx.c +1 -1
index b9491e3..64904b2 100644
@@ -66,7 +66,7 @@ app_pkt_metadata_flush(struct rte_mbuf *pkt)
 	ether_addr_copy(&pkt_meta->nh_arp, &ether_hdr->d_addr);
 	ether_addr_copy(&local_ether_addr, &ether_hdr->s_addr);
 	ether_hdr->ether_type = rte_bswap16(ETHER_TYPE_IPv4);
-	pkt->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
+	pkt->l2_len = sizeof(struct ether_hdr);
 }
 
 static int
examples/ip_reassembly/main.c +4 -4
index 8184aad..b6b4f59 100644
@@ -412,8 +412,8 @@ reassemble(struct rte_mbuf *m, uint8_t portid, uint32_t queue,
 			dr = &qconf->death_row;
 
 			/* prepare mbuf: setup l2_len/l3_len. */
-			m->vlan_macip.f.l2_len = sizeof(*eth_hdr);
-			m->vlan_macip.f.l3_len = sizeof(*ip_hdr);
+			m->l2_len = sizeof(*eth_hdr);
+			m->l3_len = sizeof(*ip_hdr);
 
 			/* process this fragment. */
 			mo = rte_ipv4_frag_reassemble_packet(tbl, dr, m, tms, ip_hdr);
@@ -455,8 +455,8 @@ reassemble(struct rte_mbuf *m, uint8_t portid, uint32_t queue,
 			dr  = &qconf->death_row;
 
 			/* prepare mbuf: setup l2_len/l3_len. */
-			m->vlan_macip.f.l2_len = sizeof(*eth_hdr);
-			m->vlan_macip.f.l3_len = sizeof(*ip_hdr) + sizeof(*frag_hdr);
+			m->l2_len = sizeof(*eth_hdr);
+			m->l3_len = sizeof(*ip_hdr) + sizeof(*frag_hdr);
 
 			mo = rte_ipv6_frag_reassemble_packet(tbl, dr, m, tms, ip_hdr, frag_hdr);
 			if (mo == NULL)
examples/ipv4_multicast/main.c +3 -1
index 2232851..4233d33 100644
@@ -338,7 +338,9 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone)
 
 	/* copy metadata from source packet*/
 	hdr->port = pkt->port;
-	hdr->vlan_macip = pkt->vlan_macip;
+	hdr->vlan_tci = pkt->vlan_tci;
+	hdr->l2_len = pkt->l2_len;
+	hdr->l3_len = pkt->l3_len;
 	hdr->hash = pkt->hash;
 
 	hdr->ol_flags = pkt->ol_flags;
examples/vhost/main.c +3 -3
index afbab31..6f08916 100644
@@ -2070,9 +2070,9 @@ virtio_tx_route_zcp(struct virtio_net *dev, struct rte_mbuf *m,
 		mbuf->buf_addr = m->buf_addr;
 	}
 	mbuf->ol_flags = PKT_TX_VLAN_PKT;
-	mbuf->vlan_macip.f.vlan_tci = vlan_tag;
-	mbuf->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
-	mbuf->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+	mbuf->vlan_tci = vlan_tag;
+	mbuf->l2_len = sizeof(struct ether_hdr);
+	mbuf->l3_len = sizeof(struct ipv4_hdr);
 	MBUF_HEADROOM_UINT32(mbuf) = (uint32_t)desc_idx;
 
 	tx_q->m_table[len] = mbuf;
lib/librte_ip_frag/ip_frag_common.h +1 -2
index 81ca23a..210f409 100644
@@ -173,8 +173,7 @@ ip_frag_chain(struct rte_mbuf *mn, struct rte_mbuf *mp)
 	struct rte_mbuf *ms;
 
 	/* adjust start of the last fragment data. */
-	rte_pktmbuf_adj(mp, (uint16_t)(mp->vlan_macip.f.l2_len +
-		mp->vlan_macip.f.l3_len));
+	rte_pktmbuf_adj(mp, (uint16_t)(mp->l2_len + mp->l3_len));
 
 	/* chain two fragments. */
 	ms = rte_pktmbuf_lastseg(mn);
lib/librte_ip_frag/rte_ipv4_fragmentation.c +1 -1
index 0b10310..6b9f07d 100644
@@ -198,7 +198,7 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,
 		    out_pkt->pkt_len - sizeof(struct ipv4_hdr));
 
 		out_pkt->ol_flags |= PKT_TX_IP_CKSUM;
-		out_pkt->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+		out_pkt->l3_len = sizeof(struct ipv4_hdr);
 
 		/* Write the fragment to the output list */
 		pkts_out[out_pkt_pos] = out_pkt;
lib/librte_ip_frag/rte_ipv4_reassembly.c +3 -3
index 06c37af..0b8ceeb 100644
@@ -87,10 +87,10 @@ ipv4_frag_reassemble(const struct ip_frag_pkt *fp)
 
 	/* update ipv4 header for the reassmebled packet */
 	ip_hdr = (struct ipv4_hdr*)(rte_pktmbuf_mtod(m, uint8_t *) +
-		m->vlan_macip.f.l2_len);
+		m->l2_len);
 
 	ip_hdr->total_length = rte_cpu_to_be_16((uint16_t)(fp->total_size +
-		m->vlan_macip.f.l3_len));
+		m->l3_len));
 	ip_hdr->fragment_offset = (uint16_t)(ip_hdr->fragment_offset &
 		rte_cpu_to_be_16(IPV4_HDR_DF_FLAG));
 	ip_hdr->hdr_checksum = 0;
@@ -137,7 +137,7 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
 
 	ip_ofs *= IPV4_HDR_OFFSET_UNITS;
 	ip_len = (uint16_t)(rte_be_to_cpu_16(ip_hdr->total_length) -
-		mb->vlan_macip.f.l3_len);
+		mb->l3_len);
 
 	IP_FRAG_LOG(DEBUG, "%s:%d:\n"
 		"mbuf: %p, tms: %" PRIu64
lib/librte_ip_frag/rte_ipv6_reassembly.c +2 -3
index dee3425..71cf721 100644
@@ -109,7 +109,7 @@ ipv6_frag_reassemble(const struct ip_frag_pkt *fp)
 
 	/* update ipv6 header for the reassembled datagram */
 	ip_hdr = (struct ipv6_hdr *) (rte_pktmbuf_mtod(m, uint8_t *) +
-								  m->vlan_macip.f.l2_len);
+								  m->l2_len);
 
 	ip_hdr->payload_len = rte_cpu_to_be_16(payload_len);
 
@@ -120,8 +120,7 @@ ipv6_frag_reassemble(const struct ip_frag_pkt *fp)
 	 * other headers, so we assume there are no other headers and thus update
 	 * the main IPv6 header instead.
 	 */
-	move_len = m->vlan_macip.f.l2_len + m->vlan_macip.f.l3_len -
-			sizeof(*frag_hdr);
+	move_len = m->l2_len + m->l3_len - sizeof(*frag_hdr);
 	frag_hdr = (struct ipv6_extension_fragment *) (ip_hdr + 1);
 	ip_hdr->proto = frag_hdr->next_header;
 
lib/librte_mbuf/rte_mbuf.h +9 -24
index fc35006..f00f3c6 100644
@@ -111,27 +111,6 @@ extern "C" {
  */
 #define PKT_TX_OFFLOAD_MASK (PKT_TX_VLAN_PKT | PKT_TX_IP_CKSUM | PKT_TX_L4_MASK)
 
-/** Offload features */
-union rte_vlan_macip {
-	uint32_t data;
-	struct {
-		uint16_t l3_len:9; /**< L3 (IP) Header Length. */
-		uint16_t l2_len:7; /**< L2 (MAC) Header Length. */
-		uint16_t vlan_tci;
-		/**< VLAN Tag Control Identifier (CPU order). */
-	} f;
-};
-
-/*
- * Compare mask for vlan_macip_len.data,
- * should be in sync with rte_vlan_macip.f layout.
- * */
-#define TX_VLAN_CMP_MASK        0xFFFF0000  /**< VLAN length - 16-bits. */
-#define TX_MAC_LEN_CMP_MASK     0x0000FE00  /**< MAC length - 7-bits. */
-#define TX_IP_LEN_CMP_MASK      0x000001FF  /**< IP  length - 9-bits. */
-/**< MAC+IP  length. */
-#define TX_MACIP_LEN_CMP_MASK   (TX_MAC_LEN_CMP_MASK | TX_IP_LEN_CMP_MASK)
-
 /**
  * The generic rte_mbuf, containing a packet mbuf.
  */
@@ -170,7 +149,9 @@ struct rte_mbuf {
 	uint32_t pkt_len;       /**< Total pkt len: sum of all segment data_len. */
 
 	/* offload features, valid for first segment only */
-	union rte_vlan_macip vlan_macip;
+	uint16_t l3_len:9;      /**< L3 (IP) Header Length. */
+	uint16_t l2_len:7;      /**< L2 (MAC) Header Length. */
+	uint16_t vlan_tci;      /**< VLAN Tag Control Identifier (CPU order). */
 	union {
 		uint32_t rss;       /**< RSS hash result if RSS enabled */
 		struct {
@@ -540,7 +521,9 @@ static inline void rte_pktmbuf_reset(struct rte_mbuf *m)
 
 	m->next = NULL;
 	m->pkt_len = 0;
-	m->vlan_macip.data = 0;
+	m->l2_len = 0;
+	m->l3_len = 0;
+	m->vlan_tci = 0;
 	m->nb_segs = 1;
 	m->port = 0xff;
 
@@ -607,7 +590,9 @@ static inline void rte_pktmbuf_attach(struct rte_mbuf *mi, struct rte_mbuf *md)
 	mi->data = md->data;
 	mi->data_len = md->data_len;
 	mi->port = md->port;
-	mi->vlan_macip = md->vlan_macip;
+	mi->vlan_tci = md->vlan_tci;
+	mi->l2_len = md->l2_len;
+	mi->l3_len = md->l3_len;
 	mi->hash = md->hash;
 
 	mi->next = NULL;
lib/librte_pmd_e1000/em_rxtx.c +31 -9
index 074c9b3..4f46bdf 100644
@@ -144,13 +144,34 @@ enum {
 	EM_CTX_NUM  = 1, /**< CTX NUM */
 };
 
+/** Offload features */
+union em_vlan_macip {
+	uint32_t data;
+	struct {
+		uint16_t l3_len:9; /**< L3 (IP) Header Length. */
+		uint16_t l2_len:7; /**< L2 (MAC) Header Length. */
+		uint16_t vlan_tci;
+		/**< VLAN Tag Control Identifier (CPU order). */
+	} f;
+};
+
+/*
+ * Compare mask for vlan_macip_len.data,
+ * should be in sync with em_vlan_macip.f layout.
+ * */
+#define TX_VLAN_CMP_MASK        0xFFFF0000  /**< VLAN length - 16-bits. */
+#define TX_MAC_LEN_CMP_MASK     0x0000FE00  /**< MAC length - 7-bits. */
+#define TX_IP_LEN_CMP_MASK      0x000001FF  /**< IP  length - 9-bits. */
+/**< MAC+IP  length. */
+#define TX_MACIP_LEN_CMP_MASK   (TX_MAC_LEN_CMP_MASK | TX_IP_LEN_CMP_MASK)
+
 /**
  * Structure to check if new context need be built
  */
 struct em_ctx_info {
 	uint16_t flags;               /**< ol_flags related to context build. */
 	uint32_t cmp_mask;            /**< compare mask */
-	union rte_vlan_macip hdrlen;  /**< L2 and L3 header lenghts */
+	union em_vlan_macip hdrlen;  /**< L2 and L3 header lenghts */
 };
 
 /**
@@ -219,7 +240,7 @@ static inline void
 em_set_xmit_ctx(struct em_tx_queue* txq,
 		volatile struct e1000_context_desc *ctx_txd,
 		uint16_t flags,
-		union rte_vlan_macip hdrlen)
+		union em_vlan_macip hdrlen)
 {
 	uint32_t cmp_mask, cmd_len;
 	uint16_t ipcse, l2len;
@@ -285,7 +306,7 @@ em_set_xmit_ctx(struct em_tx_queue* txq,
  */
 static inline uint32_t
 what_ctx_update(struct em_tx_queue *txq, uint16_t flags,
-		union rte_vlan_macip hdrlen)
+		union em_vlan_macip hdrlen)
 {
 	/* If match with the current context */
 	if (likely (txq->ctx_cache.flags == flags &&
@@ -391,7 +412,7 @@ eth_em_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	uint16_t tx_ol_req;
 	uint32_t ctx;
 	uint32_t new_ctx;
-	union rte_vlan_macip hdrlen;
+	union em_vlan_macip hdrlen;
 
 	txq = tx_queue;
 	sw_ring = txq->sw_ring;
@@ -421,7 +442,9 @@ eth_em_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		tx_ol_req = (uint16_t)(ol_flags & (PKT_TX_IP_CKSUM |
 							PKT_TX_L4_MASK));
 		if (tx_ol_req) {
-			hdrlen = tx_pkt->vlan_macip;
+			hdrlen.f.vlan_tci = tx_pkt->vlan_tci;
+			hdrlen.f.l2_len = tx_pkt->l2_len;
+			hdrlen.f.l3_len = tx_pkt->l3_len;
 			/* If new context to be built or reuse the exist ctx. */
 			ctx = what_ctx_update(txq, tx_ol_req, hdrlen);
 
@@ -516,8 +539,7 @@ eth_em_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		/* Set VLAN Tag offload fields. */
 		if (ol_flags & PKT_TX_VLAN_PKT) {
 			cmd_type_len |= E1000_TXD_CMD_VLE;
-			popts_spec = tx_pkt->vlan_macip.f.vlan_tci <<
-				E1000_TXD_VLAN_SHIFT;
+			popts_spec = tx_pkt->vlan_tci << E1000_TXD_VLAN_SHIFT;
 		}
 
 		if (tx_ol_req) {
@@ -784,7 +806,7 @@ eth_em_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 				rx_desc_error_to_pkt_flags(rxd.errors));
 
 		/* Only valid if PKT_RX_VLAN_PKT set in pkt_flags */
-		rxm->vlan_macip.f.vlan_tci = rte_le_to_cpu_16(rxd.special);
+		rxm->vlan_tci = rte_le_to_cpu_16(rxd.special);
 
 		/*
 		 * Store the mbuf address into the next entry of the array
@@ -1010,7 +1032,7 @@ eth_em_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 					rx_desc_error_to_pkt_flags(rxd.errors));
 
 		/* Only valid if PKT_RX_VLAN_PKT set in pkt_flags */
-		rxm->vlan_macip.f.vlan_tci = rte_le_to_cpu_16(rxd.special);
+		rxm->vlan_tci = rte_le_to_cpu_16(rxd.special);
 
 		/* Prefetch data of first segment, if configured to do so. */
 		rte_packet_prefetch(first_seg->data);
lib/librte_pmd_e1000/igb_rxtx.c +30 -9
index 8b33b6d..4e9f42e 100644
@@ -153,13 +153,34 @@ enum igb_advctx_num {
 	IGB_CTX_NUM  = 2, /**< CTX_NUM */
 };
 
+/** Offload features */
+union igb_vlan_macip {
+	uint32_t data;
+	struct {
+		uint16_t l3_len:9; /**< L3 (IP) Header Length. */
+		uint16_t l2_len:7; /**< L2 (MAC) Header Length. */
+		uint16_t vlan_tci;
+		/**< VLAN Tag Control Identifier (CPU order). */
+	} f;
+};
+
+/*
+ * Compare mask for vlan_macip_len.data,
+ * should be in sync with igb_vlan_macip.f layout.
+ * */
+#define TX_VLAN_CMP_MASK        0xFFFF0000  /**< VLAN length - 16-bits. */
+#define TX_MAC_LEN_CMP_MASK     0x0000FE00  /**< MAC length - 7-bits. */
+#define TX_IP_LEN_CMP_MASK      0x000001FF  /**< IP  length - 9-bits. */
+/**< MAC+IP  length. */
+#define TX_MACIP_LEN_CMP_MASK   (TX_MAC_LEN_CMP_MASK | TX_IP_LEN_CMP_MASK)
+
 /**
  * Strucutre to check if new context need be built
  */
 struct igb_advctx_info {
 	uint16_t flags;           /**< ol_flags related to context build. */
 	uint32_t cmp_mask;        /**< compare mask for vlan_macip_lens */
-	union rte_vlan_macip vlan_macip_lens; /**< vlan, mac & ip length. */
+	union igb_vlan_macip vlan_macip_lens; /**< vlan, mac & ip length. */
 };
 
 /**
@@ -342,6 +363,7 @@ eth_igb_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	volatile union e1000_adv_tx_desc *txd;
 	struct rte_mbuf     *tx_pkt;
 	struct rte_mbuf     *m_seg;
+	union igb_vlan_macip vlan_macip_lens;
 	uint64_t buf_dma_addr;
 	uint32_t olinfo_status;
 	uint32_t cmd_type_len;
@@ -355,7 +377,6 @@ eth_igb_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	uint16_t tx_ol_req;
 	uint32_t new_ctx = 0;
 	uint32_t ctx = 0;
-	uint32_t vlan_macip_lens;
 
 	txq = tx_queue;
 	sw_ring = txq->sw_ring;
@@ -380,13 +401,15 @@ eth_igb_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		tx_last = (uint16_t) (tx_id + tx_pkt->nb_segs - 1);
 
 		ol_flags = tx_pkt->ol_flags;
-		vlan_macip_lens = tx_pkt->vlan_macip.data;
+		vlan_macip_lens.f.vlan_tci = tx_pkt->vlan_tci;
+		vlan_macip_lens.f.l2_len = tx_pkt->l2_len;
+		vlan_macip_lens.f.l3_len = tx_pkt->l3_len;
 		tx_ol_req = (uint16_t)(ol_flags & PKT_TX_OFFLOAD_MASK);
 
 		/* If a Context Descriptor need be built . */
 		if (tx_ol_req) {
 			ctx = what_advctx_update(txq, tx_ol_req,
-				vlan_macip_lens);
+				vlan_macip_lens.data);
 			/* Only allocate context descriptor if required*/
 			new_ctx = (ctx == IGB_CTX_NUM);
 			ctx = txq->ctx_curr;
@@ -502,7 +525,7 @@ eth_igb_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 				}
 
 				igbe_set_xmit_ctx(txq, ctx_txd, tx_ol_req,
-				    vlan_macip_lens);
+				    vlan_macip_lens.data);
 
 				txe->last_id = tx_last;
 				tx_id = txe->next_id;
@@ -764,8 +787,7 @@ eth_igb_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		rxm->hash.rss = rxd.wb.lower.hi_dword.rss;
 		hlen_type_rss = rte_le_to_cpu_32(rxd.wb.lower.lo_dword.data);
 		/* Only valid if PKT_RX_VLAN_PKT set in pkt_flags */
-		rxm->vlan_macip.f.vlan_tci =
-			rte_le_to_cpu_16(rxd.wb.upper.vlan);
+		rxm->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan);
 
 		pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(hlen_type_rss);
 		pkt_flags = (uint16_t)(pkt_flags |
@@ -1001,8 +1023,7 @@ eth_igb_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		 * The vlan_tci field is only valid when PKT_RX_VLAN_PKT is
 		 * set in the pkt_flags field.
 		 */
-		first_seg->vlan_macip.f.vlan_tci =
-			rte_le_to_cpu_16(rxd.wb.upper.vlan);
+		first_seg->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan);
 		hlen_type_rss = rte_le_to_cpu_32(rxd.wb.lower.lo_dword.data);
 		pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(hlen_type_rss);
 		pkt_flags = (uint16_t)(pkt_flags |
lib/librte_pmd_i40e/i40e_rxtx.c +7 -7
index 9b84edb..c7cc00f 100644
@@ -616,7 +616,7 @@ i40e_rx_scan_hw_ring(struct i40e_rx_queue *rxq)
 				I40E_RXD_QW1_LENGTH_PBUF_SHIFT) - rxq->crc_len;
 			mb->data_len = pkt_len;
 			mb->pkt_len = pkt_len;
-			mb->vlan_macip.f.vlan_tci = rx_status &
+			mb->vlan_tci = rx_status &
 				(1 << I40E_RX_DESC_STATUS_L2TAG1P_SHIFT) ?
 			rte_le_to_cpu_16(\
 				rxdp[j].wb.qword0.lo_dword.l2tag1) : 0;
@@ -853,7 +853,7 @@ i40e_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 		rxm->data_len = rx_packet_len;
 		rxm->port = rxq->port_id;
 
-		rxm->vlan_macip.f.vlan_tci = rx_status &
+		rxm->vlan_tci = rx_status &
 			(1 << I40E_RX_DESC_STATUS_L2TAG1P_SHIFT) ?
 			rte_le_to_cpu_16(rxd.wb.qword0.lo_dword.l2tag1) : 0;
 		pkt_flags = i40e_rxd_status_to_pkt_flags(qword1);
@@ -1006,7 +1006,7 @@ i40e_recv_scattered_pkts(void *rx_queue,
 		}
 
 		first_seg->port = rxq->port_id;
-		first_seg->vlan_macip.f.vlan_tci = (rx_status &
+		first_seg->vlan_tci = (rx_status &
 			(1 << I40E_RX_DESC_STATUS_L2TAG1P_SHIFT)) ?
 			rte_le_to_cpu_16(rxd.wb.qword0.lo_dword.l2tag1) : 0;
 		pkt_flags = i40e_rxd_status_to_pkt_flags(qword1);
@@ -1108,8 +1108,8 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		RTE_MBUF_PREFETCH_TO_FREE(txe->mbuf);
 
 		ol_flags = tx_pkt->ol_flags;
-		l2_len = tx_pkt->vlan_macip.f.l2_len;
-		l3_len = tx_pkt->vlan_macip.f.l3_len;
+		l2_len = tx_pkt->l2_len;
+		l3_len = tx_pkt->l3_len;
 
 		/* Calculate the number of context descriptors needed. */
 		nb_ctx = i40e_calc_context_desc(ol_flags);
@@ -1145,8 +1145,8 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
 		/* Descriptor based VLAN insertion */
 		if (ol_flags & PKT_TX_VLAN_PKT) {
-			tx_flags |= tx_pkt->vlan_macip.f.vlan_tci <<
-						I40E_TX_FLAG_L2TAG1_SHIFT;
+			tx_flags |= tx_pkt->vlan_tci <<
+					I40E_TX_FLAG_L2TAG1_SHIFT;
 			tx_flags |= I40E_TX_FLAG_INSERT_VLAN;
 			td_cmd |= I40E_TX_DESC_CMD_IL2TAG1;
 			td_tag = (tx_flags & I40E_TX_FLAG_L2TAG1_MASK) >>
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +9 -9
index eec1458..b897b1e 100644
@@ -540,6 +540,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	volatile union ixgbe_adv_tx_desc *txd;
 	struct rte_mbuf     *tx_pkt;
 	struct rte_mbuf     *m_seg;
+	union ixgbe_vlan_macip vlan_macip_lens;
 	uint64_t buf_dma_addr;
 	uint32_t olinfo_status;
 	uint32_t cmd_type_len;
@@ -551,7 +552,6 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	uint16_t nb_tx;
 	uint16_t nb_used;
 	uint16_t tx_ol_req;
-	uint32_t vlan_macip_lens;
 	uint32_t ctx = 0;
 	uint32_t new_ctx;
 
@@ -579,14 +579,16 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		 * are needed for offload functionality.
 		 */
 		ol_flags = tx_pkt->ol_flags;
-		vlan_macip_lens = tx_pkt->vlan_macip.data;
+		vlan_macip_lens.f.vlan_tci = tx_pkt->vlan_tci;
+		vlan_macip_lens.f.l2_len = tx_pkt->l2_len;
+		vlan_macip_lens.f.l3_len = tx_pkt->l3_len;
 
 		/* If hardware offload required */
 		tx_ol_req = (uint16_t)(ol_flags & PKT_TX_OFFLOAD_MASK);
 		if (tx_ol_req) {
 			/* If new context need be built or reuse the exist ctx. */
 			ctx = what_advctx_update(txq, tx_ol_req,
-				vlan_macip_lens);
+				vlan_macip_lens.data);
 			/* Only allocate context descriptor if required*/
 			new_ctx = (ctx == IXGBE_CTX_NUM);
 			ctx = txq->ctx_curr;
@@ -728,7 +730,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 				}
 
 				ixgbe_set_xmit_ctx(txq, ctx_txd, tx_ol_req,
-				    vlan_macip_lens);
+				    vlan_macip_lens.data);
 
 				txe->last_id = tx_last;
 				tx_id = txe->next_id;
@@ -939,7 +941,7 @@ ixgbe_rx_scan_hw_ring(struct igb_rx_queue *rxq)
 							rxq->crc_len);
 			mb->data_len = pkt_len;
 			mb->pkt_len = pkt_len;
-			mb->vlan_macip.f.vlan_tci = rxdp[j].wb.upper.vlan;
+			mb->vlan_tci = rxdp[j].wb.upper.vlan;
 			mb->hash.rss = rxdp[j].wb.lower.hi_dword.rss;
 
 			/* convert descriptor fields to rte mbuf flags */
@@ -1257,8 +1259,7 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 		hlen_type_rss = rte_le_to_cpu_32(rxd.wb.lower.lo_dword.data);
 		/* Only valid if PKT_RX_VLAN_PKT set in pkt_flags */
-		rxm->vlan_macip.f.vlan_tci =
-			rte_le_to_cpu_16(rxd.wb.upper.vlan);
+		rxm->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan);
 
 		pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(hlen_type_rss);
 		pkt_flags = (uint16_t)(pkt_flags |
@@ -1502,8 +1503,7 @@ ixgbe_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		 * The vlan_tci field is only valid when PKT_RX_VLAN_PKT is
 		 * set in the pkt_flags field.
 		 */
-		first_seg->vlan_macip.f.vlan_tci =
-				rte_le_to_cpu_16(rxd.wb.upper.vlan);
+		first_seg->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan);
 		hlen_type_rss = rte_le_to_cpu_32(rxd.wb.lower.lo_dword.data);
 		pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(hlen_type_rss);
 		pkt_flags = (uint16_t)(pkt_flags |
lib/librte_pmd_ixgbe/ixgbe_rxtx.h +22 -1
index 4c9cb74..2f1f40c 100644
@@ -153,6 +153,27 @@ enum ixgbe_advctx_num {
 	IXGBE_CTX_NUM  = 2, /**< CTX NUMBER  */
 };
 
+/** Offload features */
+union ixgbe_vlan_macip {
+	uint32_t data;
+	struct {
+		uint16_t l3_len:9; /**< L3 (IP) Header Length. */
+		uint16_t l2_len:7; /**< L2 (MAC) Header Length. */
+		uint16_t vlan_tci;
+		/**< VLAN Tag Control Identifier (CPU order). */
+	} f;
+};
+
+/*
+ * Compare mask for vlan_macip_len.data,
+ * should be in sync with ixgbe_vlan_macip.f layout.
+ * */
+#define TX_VLAN_CMP_MASK        0xFFFF0000  /**< VLAN length - 16-bits. */
+#define TX_MAC_LEN_CMP_MASK     0x0000FE00  /**< MAC length - 7-bits. */
+#define TX_IP_LEN_CMP_MASK      0x000001FF  /**< IP  length - 9-bits. */
+/**< MAC+IP  length. */
+#define TX_MACIP_LEN_CMP_MASK   (TX_MAC_LEN_CMP_MASK | TX_IP_LEN_CMP_MASK)
+
 /**
  * Structure to check if new context need be built
  */
@@ -160,7 +181,7 @@ enum ixgbe_advctx_num {
 struct ixgbe_advctx_info {
 	uint16_t flags;           /**< ol_flags for context build. */
 	uint32_t cmp_mask;        /**< compare mask for vlan_macip_lens */
-	union rte_vlan_macip vlan_macip_lens; /**< vlan, mac ip length. */
+	union ixgbe_vlan_macip vlan_macip_lens; /**< vlan, mac ip length. */
 };
 
 /**
lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c +3 -3
index 3536765..90325e1 100644
@@ -550,8 +550,8 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 					       rte_pktmbuf_mtod(rxm, void *));
 #endif
 				/* Copy vlan tag in packet buffer */
-				rxm->vlan_macip.f.vlan_tci =
-					rte_le_to_cpu_16((uint16_t)rcd->tci);
+				rxm->vlan_tci = rte_le_to_cpu_16(
+						(uint16_t)rcd->tci);
 
 			} else
 				rxm->ol_flags = 0;
@@ -563,7 +563,7 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 			rxm->pkt_len = (uint16_t)rcd->len;
 			rxm->data_len = (uint16_t)rcd->len;
 			rxm->port = rxq->port_id;
-			rxm->vlan_macip.f.vlan_tci = 0;
+			rxm->vlan_tci = 0;
 			rxm->data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
 
 			rx_pkts[nb_rx++] = rxm;
Signature · 1 line
1.9.3
#8 lore raw

v2 cover Mbuf structure Rework, part 1

In reply to a message not in the archive

This patch set does some initial pre-work to prepare the mbuf data structure (and ixgbe vector driver to a lesser extent) for more major changes which will follow on in a subsequent patch set. [See previous RFC patch set for more indications of the future coming changes].

The main changes here are the flattening out of the mbuf data structure, with much of it based off work by Olivier. The ctrlmbuf and pktmbuf structures are now gone, as is the vlan_macip structure. However, in this set, the concept of having a separate ctrl mbuf type is kept around. The plan is in a later set when we expand the flags field to 64-bits, we can use a single bit in the flags to indicate a control packet. For now, though, the ctrlmbuf functions and macros just are aliases for the pktmbuf equivalents as much as possible.

Changes in V2:
* Fix newly-introduced style issues flagged by checkpatch
* Update to apply cleanly to latest head

Bruce Richardson (3):
ixgbe: put only non-zero initializer in definition
mbuf: rename in_port to just port
mbuf: flatten struct vlan_macip into mbuf struct

Olivier Matz (3):
mbuf: rename RTE_MBUF_SCATTER_GATHER into RTE_MBUF_REFCNT
mbuf: remove rte_ctrlmbuf
mbuf: remove the rte_pktmbuf structure

 app/test-pmd/cmdline.c                             |   2 -
 app/test-pmd/csumonly.c                            |   6 +-
 app/test-pmd/flowgen.c                             |  22 +-
 app/test-pmd/icmpecho.c                            |   4 +-
 app/test-pmd/ieee1588fwd.c                         |   6 +-
 app/test-pmd/macfwd-retry.c                        |   2 +-
 app/test-pmd/macfwd.c                              |   8 +-
 app/test-pmd/macswap.c                             |   8 +-
 app/test-pmd/rxonly.c                              |  13 +-
 app/test-pmd/testpmd.c                             |  12 +-
 app/test-pmd/testpmd.h                             |   2 +-
 app/test-pmd/txonly.c                              |  44 +--
 app/test/commands.c                                |   2 -
 app/test/packet_burst_generator.c                  |  46 +--
 app/test/test_distributor.c                        |  18 +-
 app/test/test_distributor_perf.c                   |   4 +-
 app/test/test_mbuf.c                               | 100 ++-----
 app/test/test_sched.c                              |   4 +-
 app/test/test_table_acl.c                          |   6 +-
 app/test/test_table_pipeline.c                     |   4 +-
 config/common_bsdapp                               |   2 +-
 config/common_linuxapp                             |   2 +-
 doc/doxy-api.conf                                  |   2 +-
 examples/Makefile                                  |   4 +-
 examples/dpdk_qat/crypto.c                         |  22 +-
 examples/dpdk_qat/main.c                           |   2 +-
 examples/exception_path/main.c                     |  10 +-
 examples/ip_fragmentation/Makefile                 |   4 +-
 examples/ip_fragmentation/main.c                   |   6 +-
 examples/ip_pipeline/Makefile                      |   2 +-
 examples/ip_pipeline/cmdline.c                     |  44 +--
 examples/ip_pipeline/init.c                        |   2 +-
 examples/ip_pipeline/main.c                        |   2 +-
 examples/ip_pipeline/pipeline_firewall.c           |   4 +-
 .../ip_pipeline/pipeline_flow_classification.c     |   4 +-
 examples/ip_pipeline/pipeline_routing.c            |   4 +-
 examples/ip_pipeline/pipeline_rx.c                 |   8 +-
 examples/ip_pipeline/pipeline_tx.c                 |   2 +-
 examples/ip_reassembly/main.c                      |   8 +-
 examples/ipv4_multicast/Makefile                   |   4 +-
 examples/ipv4_multicast/main.c                     |  18 +-
 examples/l3fwd-acl/main.c                          |   2 +-
 examples/l3fwd-power/main.c                        |   2 +-
 examples/l3fwd-vf/main.c                           |   2 +-
 examples/l3fwd/main.c                              |  10 +-
 examples/load_balancer/runtime.c                   |   2 +-
 .../client_server_mp/mp_client/client.c            |   2 +-
 examples/quota_watermark/qw/main.c                 |   4 +-
 examples/vhost/main.c                              |  74 ++---
 examples/vhost_xen/main.c                          |  22 +-
 lib/librte_distributor/rte_distributor.c           |   2 +-
 lib/librte_ip_frag/ip_frag_common.h                |  13 +-
 lib/librte_ip_frag/rte_ipv4_fragmentation.c        |  40 +--
 lib/librte_ip_frag/rte_ipv4_reassembly.c           |   6 +-
 lib/librte_ip_frag/rte_ipv6_fragmentation.c        |  38 +--
 lib/librte_ip_frag/rte_ipv6_reassembly.c           |   5 +-
 lib/librte_mbuf/rte_mbuf.c                         |  84 ++----
 lib/librte_mbuf/rte_mbuf.h                         | 311 +++++++++------------
 lib/librte_pmd_bond/rte_eth_bond_pmd.c             |   4 +-
 lib/librte_pmd_e1000/em_rxtx.c                     |  98 ++++---
 lib/librte_pmd_e1000/igb_rxtx.c                    | 103 ++++---
 lib/librte_pmd_i40e/i40e_rxtx.c                    | 104 ++++---
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c                  | 114 ++++----
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h                  |  25 +-
 lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c              |  47 +---
 lib/librte_pmd_pcap/rte_eth_pcap.c                 |  14 +-
 lib/librte_pmd_virtio/virtio_rxtx.c                |  22 +-
 lib/librte_pmd_virtio/virtqueue.h                  |   2 +-
 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c              |  30 +-
 lib/librte_pmd_xenvirt/rte_eth_xenvirt.c           |  14 +-
 lib/librte_pmd_xenvirt/virtqueue.h                 |   4 +-
 lib/librte_port/Makefile                           |   4 +-
 lib/librte_port/rte_port_frag.c                    |   2 +-
 lib/librte_sched/rte_sched.c                       |  14 +-
 lib/librte_sched/rte_sched.h                       |  10 +-
 75 files changed, 790 insertions(+), 909 deletions(-)
Signature · 1 line
1.9.3

A message that is not in the archive (sent off-list or not yet received): 1409240559-14447-1-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#10 lore raw

2014-08-28 16:42, Bruce Richardson:

Quoted 22 lines

This patch set does some initial pre-work to prepare the mbuf data structure (and ixgbe vector driver to a lesser extent) for more major changes which will follow on in a subsequent patch set. [See previous RFC patch set for more indications of the future coming changes].

The main changes here are the flattening out of the mbuf data structure, with much of it based off work by Olivier. The ctrlmbuf and pktmbuf structures are now gone, as is the vlan_macip structure. However, in this set, the concept of having a separate ctrl mbuf type is kept around. The plan is in a later set when we expand the flags field to 64-bits, we can use a single bit in the flags to indicate a control packet. For now, though, the ctrlmbuf functions and macros just are aliases for the pktmbuf equivalents as much as possible.

Changes in V2:
* Fix newly-introduced style issues flagged by checkpatch
* Update to apply cleanly to latest head

Bruce Richardson (3):
ixgbe: put only non-zero initializer in definition
mbuf: rename in_port to just port
mbuf: flatten struct vlan_macip into mbuf struct

Quoted 4 lines

Olivier Matz (3):
mbuf: rename RTE_MBUF_SCATTER_GATHER into RTE_MBUF_REFCNT
mbuf: remove rte_ctrlmbuf
mbuf: remove the rte_pktmbuf structure

Applied for version 1.8.0.

Thanks

Signature · 1 line
Thomas
#11 lore raw

PATCH v2 1/6 ixgbe: put only non-zero initializer in definition

In reply to a message not in the archive

Since all unspecified fields in an initializer are assumed to be zero we can simplify the empty mbuf definition in the vector driver to only use the fields that are non-zero, i.e. just nb_segs = 1. This makes things shorter and means that the structure doesn't need as many updates for other fields being renamed or moved.

The variable itself is never modified and only used by a single function so it can be made const and local to the using function.

Changes in v2:
* None

---
 lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 29 +++++------------------------
 1 file changed, 5 insertions(+), 24 deletions(-)
lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c +5 -24
index 92e07de..56dce23 100644
@@ -44,33 +44,14 @@
 #pragma GCC diagnostic ignored "-Wcast-qual"
 #endif
 
-static struct rte_mbuf mb_def = {
-
-	.ol_flags = 0,
-	{
-		.pkt = {
-			.data_len = 0,
-			.pkt_len = 0,
-
-			.vlan_macip = {
-				.data = 0,
-			},
-			.hash = {
-				.rss = 0,
-			},
-
-			.nb_segs = 1,
-			.in_port = 0,
-
-			.next = NULL,
-			.data = NULL,
-		},
-	},
-};
-
 static inline void
 ixgbe_rxq_rearm(struct igb_rx_queue *rxq)
 {
+	static const struct rte_mbuf mb_def = {
+		.pkt = {
+			.nb_segs = 1,
+		},
+	};
 	int i;
 	uint16_t rx_id;
 	volatile union ixgbe_adv_rx_desc *rxdp;
Signature · 1 line
1.9.3

A message that is not in the archive (sent off-list or not yet received): 1409240559-14447-2-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#13 lore raw

Re: [PATCH v2 1/6] ixgbe: put only non-zero initializer in definition

Quoted 15 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Thursday, August 28, 2014 4:43 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH v2 1/6] ixgbe: put only non-zero initializer in definition

Since all unspecified fields in an initializer are assumed to be zero we can simplify the empty mbuf definition in the vector driver to only use the fields that are non-zero, i.e. just nb_segs = 1. This makes things shorter and means that the structure doesn't need as many updates for other fields being renamed or moved.

Quoted 7 lines

The variable itself is never modified and only used by a single function so it can be made const and local to the using function.

Changes in v2:
* None

Acked-by Pablo de Lara <[email protected]>

Acked-by
#14 lore raw

Re: [PATCH v2 1/6] ixgbe: put only non-zero initializer in definition

In reply to a message not in the archive

Hello Bruce,

Quoted 6 lines · Bruce Richardson

Since all unspecified fields in an initializer are assumed to be zero we can simplify the empty mbuf definition in the vector driver to only use the fields that are non-zero, i.e. just nb_segs = 1. This makes things shorter and means that the structure doesn't need as many updates for other fields being renamed or moved.

Quoted 7 lines

The variable itself is never modified and only used by a single function so it can be made const and local to the using function.

Changes in v2:
* None

#15 lore raw

PATCH v2 2/6 mbuf: rename RTE_MBUF_SCATTER_GATHER into RTE_MBUF_REFCNT

In reply to a message not in the archive

From: Olivier Matz <[email protected]>

It seems that RTE_MBUF_SCATTER_GATHER is not the proper name for the feature it provides. "Scatter gather" means that data is stored using several buffers. RTE_MBUF_REFCNT seems to be a better name for that feature as it provides a reference counter for mbufs.

The macro RTE_MBUF_SCATTER_GATHER is poisoned to ensure this modification is seen by drivers or applications using it.

Changes in V2:
* None

---
 app/test/test_mbuf.c                  | 16 ++++++++--------
 config/common_bsdapp                  |  2 +-
 config/common_linuxapp                |  2 +-
 doc/doxy-api.conf                     |  2 +-
 examples/Makefile                     |  4 ++--
 examples/ip_fragmentation/Makefile    |  4 ++--
 examples/ip_pipeline/Makefile         |  2 +-
 examples/ip_pipeline/main.c           |  2 +-
 examples/ipv4_multicast/Makefile      |  4 ++--
 examples/vhost/main.c                 |  4 ++--
 lib/librte_mbuf/rte_mbuf.c            |  2 +-
 lib/librte_mbuf/rte_mbuf.h            | 35 +++++++++++++++++++----------------
 lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c |  4 ++--
 lib/librte_port/Makefile              |  4 ++--
 14 files changed, 45 insertions(+), 42 deletions(-)
app/test/test_mbuf.c +8 -8
index 2b87521..678c382 100644
@@ -82,7 +82,7 @@
 static struct rte_mempool *pktmbuf_pool = NULL;
 static struct rte_mempool *ctrlmbuf_pool = NULL;
 
-#if defined RTE_MBUF_SCATTER_GATHER  && defined RTE_MBUF_REFCNT_ATOMIC
+#if defined RTE_MBUF_REFCNT  && defined RTE_MBUF_REFCNT_ATOMIC
 
 static struct rte_mempool *refcnt_pool = NULL;
 static struct rte_ring *refcnt_mbuf_ring = NULL;
@@ -365,7 +365,7 @@ fail:
 static int
 testclone_testupdate_testdetach(void)
 {
-#ifndef RTE_MBUF_SCATTER_GATHER
+#ifndef RTE_MBUF_REFCNT
 	return 0;
 #else
 	struct rte_mbuf *mc = NULL;
@@ -406,7 +406,7 @@ fail:
 	if (mc)
 		rte_pktmbuf_free(mc);
 	return -1;
-#endif /* RTE_MBUF_SCATTER_GATHER */
+#endif /* RTE_MBUF_REFCNT */
 }
 #undef GOTO_FAIL
 
@@ -439,7 +439,7 @@ test_pktmbuf_pool(void)
 		printf("Error pool not empty");
 		ret = -1;
 	}
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 	extra = rte_pktmbuf_clone(m[0], pktmbuf_pool);
 	if(extra != NULL) {
 		printf("Error pool not empty");
@@ -548,11 +548,11 @@ test_pktmbuf_free_segment(void)
 /*
  * Stress test for rte_mbuf atomic refcnt.
  * Implies that:
- * RTE_MBUF_SCATTER_GATHER and RTE_MBUF_REFCNT_ATOMIC are both defined.
+ * RTE_MBUF_REFCNT and RTE_MBUF_REFCNT_ATOMIC are both defined.
  * For more efficency, recomended to run with RTE_LIBRTE_MBUF_DEBUG defined.
  */
 
-#if defined RTE_MBUF_SCATTER_GATHER  && defined RTE_MBUF_REFCNT_ATOMIC
+#if defined RTE_MBUF_REFCNT  && defined RTE_MBUF_REFCNT_ATOMIC
 
 static int
 test_refcnt_slave(__attribute__((unused)) void *arg)
@@ -657,7 +657,7 @@ test_refcnt_master(void)
 static int
 test_refcnt_mbuf(void)
 {
-#if defined RTE_MBUF_SCATTER_GATHER  && defined RTE_MBUF_REFCNT_ATOMIC
+#if defined RTE_MBUF_REFCNT  && defined RTE_MBUF_REFCNT_ATOMIC
 
 	unsigned lnum, master, slave, tref;
 
@@ -808,7 +808,7 @@ test_failing_mbuf_sanity_check(void)
 		return -1;
 	}
 
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 	badbuf = *buf;
 	badbuf.refcnt = 0;
 	if (verify_mbuf_check_panics(&badbuf)) {
config/common_bsdapp +1 -1
index bf6d8a0..645949f 100644
@@ -249,7 +249,7 @@ CONFIG_RTE_LIBRTE_MEMPOOL_DEBUG=n
 #
 CONFIG_RTE_LIBRTE_MBUF=y
 CONFIG_RTE_LIBRTE_MBUF_DEBUG=n
-CONFIG_RTE_MBUF_SCATTER_GATHER=y
+CONFIG_RTE_MBUF_REFCNT=y
 CONFIG_RTE_MBUF_REFCNT_ATOMIC=y
 CONFIG_RTE_PKTMBUF_HEADROOM=128
 
config/common_linuxapp +1 -1
index 9047975..5bee910 100644
@@ -277,7 +277,7 @@ CONFIG_RTE_LIBRTE_MEMPOOL_DEBUG=n
 #
 CONFIG_RTE_LIBRTE_MBUF=y
 CONFIG_RTE_LIBRTE_MBUF_DEBUG=n
-CONFIG_RTE_MBUF_SCATTER_GATHER=y
+CONFIG_RTE_MBUF_REFCNT=y
 CONFIG_RTE_MBUF_REFCNT_ATOMIC=y
 CONFIG_RTE_PKTMBUF_HEADROOM=128
 
doc/doxy-api.conf +1 -1
index 1fd4492..63dc64d 100644
@@ -56,7 +56,7 @@ FILE_PATTERNS           = rte_*.h \
                           cmdline.h
 PREDEFINED              = __DOXYGEN__ \
                           __attribute__(x)= \
-                          RTE_MBUF_SCATTER_GATHER
+                          RTE_MBUF_REFCNT
 
 OPTIMIZE_OUTPUT_FOR_C   = YES
 ENABLE_PREPROCESSING    = YES
examples/Makefile +2 -2
index dc85cf3..6245f83 100644
@@ -45,8 +45,8 @@ DIRS-y += exception_path
 DIRS-y += helloworld
 DIRS-y += ip_pipeline
 DIRS-y += ip_reassembly
-DIRS-$(CONFIG_RTE_MBUF_SCATTER_GATHER) += ip_fragmentation
-DIRS-$(CONFIG_RTE_MBUF_SCATTER_GATHER) += ipv4_multicast
+DIRS-$(CONFIG_RTE_MBUF_REFCNT) += ip_fragmentation
+DIRS-$(CONFIG_RTE_MBUF_REFCNT) += ipv4_multicast
 DIRS-$(CONFIG_RTE_LIBRTE_KNI) += kni
 DIRS-y += l2fwd
 DIRS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += l2fwd-ivshmem
examples/ip_fragmentation/Makefile +2 -2
index 6d729f0..ea0e11f 100644
@@ -39,8 +39,8 @@ RTE_TARGET ?= x86_64-native-linuxapp-gcc
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
-ifneq ($(CONFIG_RTE_MBUF_SCATTER_GATHER),y)
-$(error This application requires RTE_MBUF_SCATTER_GATHER to be enabled)
+ifneq ($(CONFIG_RTE_MBUF_REFCNT),y)
+$(error This application requires RTE_MBUF_REFCNT to be enabled)
 endif
 
 # binary name
examples/ip_pipeline/Makefile +1 -1
index a807ee8..b0a4106 100644
@@ -52,7 +52,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_flow_classification.c
 SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_routing.c
 SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough.c
 
-ifeq ($(CONFIG_RTE_MBUF_SCATTER_GATHER),y)
+ifeq ($(CONFIG_RTE_MBUF_REFCNT),y)
 SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_ipv4_frag.c
 SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_ipv4_ras.c
 endif
examples/ip_pipeline/main.c +1 -1
index f773958..e19412f 100644
@@ -148,7 +148,7 @@ app_lcore_main_loop(__attribute__((unused)) void *arg)
 			rte_exit(EXIT_FAILURE, "ACL not present in build\n");
 #endif
 
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 		case APP_CORE_IPV4_FRAG:
 			app_main_loop_pipeline_ipv4_frag();
 			return 0;
examples/ipv4_multicast/Makefile +2 -2
index 191574b..604cebe 100644
@@ -39,8 +39,8 @@ RTE_TARGET ?= x86_64-native-linuxapp-gcc
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
-ifneq ($(CONFIG_RTE_MBUF_SCATTER_GATHER),y)
-$(error This application requires RTE_MBUF_SCATTER_GATHER to be enabled)
+ifneq ($(CONFIG_RTE_MBUF_REFCNT),y)
+$(error This application requires RTE_MBUF_REFCNT to be enabled)
 endif
 
 # binary name
examples/vhost/main.c +2 -2
index 193aa25..fe28912 100644
@@ -727,10 +727,10 @@ us_vhost_parse_args(int argc, char **argv)
 					zero_copy = ret;
 
 				if (zero_copy) {
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 					RTE_LOG(ERR, VHOST_CONFIG, "Before running "
 					"zero copy vhost APP, please "
-					"disable RTE_MBUF_SCATTER_GATHER\n"
+					"disable RTE_MBUF_REFCNT\n"
 					"in config file and then rebuild DPDK "
 					"core lib!\n"
 					"Otherwise please disable zero copy "
lib/librte_mbuf/rte_mbuf.c +1 -1
index 09d8934..a4967e3 100644
@@ -160,7 +160,7 @@ rte_mbuf_sanity_check(const struct rte_mbuf *m, enum rte_mbuf_type t,
 	if (m->buf_addr == NULL)
 		rte_panic("bad virt addr\n");
 
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 	uint16_t cnt = rte_mbuf_refcnt_read(m);
 	if ((cnt == 0) || (cnt == UINT16_MAX))
 		rte_panic("bad ref cnt\n");
lib/librte_mbuf/rte_mbuf.h +19 -16
index 2735f37..fbd1c7b 100644
@@ -67,6 +67,9 @@
 extern "C" {
 #endif
 
+/* deprecated feature, renamed in RTE_MBUF_REFCNT */
+#pragma GCC poison RTE_MBUF_SCATTER_GATHER
+
 /**
  * A control message buffer.
  */
@@ -185,7 +188,7 @@ struct rte_mbuf {
 	void *buf_addr;           /**< Virtual address of segment buffer. */
 	phys_addr_t buf_physaddr; /**< Physical address of segment buffer. */
 	uint16_t buf_len;         /**< Length of segment buffer. */
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 	/**
 	 * 16-bit Reference counter.
 	 * It should only be accessed using the following functions:
@@ -298,7 +301,7 @@ if (!(exp)) {                                                        \
 
 #endif /*  RTE_LIBRTE_MBUF_DEBUG */
 
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 #ifdef RTE_MBUF_REFCNT_ATOMIC
 
 /**
@@ -380,14 +383,14 @@ rte_mbuf_refcnt_set(struct rte_mbuf *m, uint16_t new_value)
 		rte_prefetch0(m);               \
 } while (0)
 
-#else /* ! RTE_MBUF_SCATTER_GATHER */
+#else /* ! RTE_MBUF_REFCNT */
 
 /** Mbuf prefetch */
 #define RTE_MBUF_PREFETCH_TO_FREE(m) do { } while(0)
 
 #define rte_mbuf_refcnt_set(m,v) do { } while(0)
 
-#endif /* RTE_MBUF_SCATTER_GATHER */
+#endif /* RTE_MBUF_REFCNT */
 
 
 /**
@@ -426,10 +429,10 @@ static inline struct rte_mbuf *__rte_mbuf_raw_alloc(struct rte_mempool *mp)
 	if (rte_mempool_get(mp, &mb) < 0)
 		return NULL;
 	m = (struct rte_mbuf *)mb;
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 	RTE_MBUF_ASSERT(rte_mbuf_refcnt_read(m) == 0);
 	rte_mbuf_refcnt_set(m, 1);
-#endif /* RTE_MBUF_SCATTER_GATHER */
+#endif /* RTE_MBUF_REFCNT */
 	return (m);
 }
 
@@ -444,9 +447,9 @@ static inline struct rte_mbuf *__rte_mbuf_raw_alloc(struct rte_mempool *mp)
 static inline void __attribute__((always_inline))
 __rte_mbuf_raw_free(struct rte_mbuf *m)
 {
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 	RTE_MBUF_ASSERT(rte_mbuf_refcnt_read(m) == 0);
-#endif /* RTE_MBUF_SCATTER_GATHER */
+#endif /* RTE_MBUF_REFCNT */
 	rte_mempool_put(m->pool, m);
 }
 
@@ -506,9 +509,9 @@ static inline struct rte_mbuf *rte_ctrlmbuf_alloc(struct rte_mempool *mp)
 static inline void rte_ctrlmbuf_free(struct rte_mbuf *m)
 {
 	__rte_mbuf_sanity_check(m, RTE_MBUF_CTRL, 0);
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 	if (rte_mbuf_refcnt_update(m, -1) == 0)
-#endif /* RTE_MBUF_SCATTER_GATHER */
+#endif /* RTE_MBUF_REFCNT */
 		__rte_mbuf_raw_free(m);
 }
 
@@ -623,7 +626,7 @@ static inline struct rte_mbuf *rte_pktmbuf_alloc(struct rte_mempool *mp)
 	return (m);
 }
 
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 
 /**
  * Attach packet mbuf to another packet mbuf.
@@ -691,7 +694,7 @@ static inline void rte_pktmbuf_detach(struct rte_mbuf *m)
 	m->pkt.data_len = 0;
 }
 
-#endif /* RTE_MBUF_SCATTER_GATHER */
+#endif /* RTE_MBUF_REFCNT */
 
 
 static inline struct rte_mbuf* __attribute__((always_inline))
@@ -699,7 +702,7 @@ __rte_pktmbuf_prefree_seg(struct rte_mbuf *m)
 {
 	__rte_mbuf_sanity_check(m, RTE_MBUF_PKT, 0);
 
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 	if (likely (rte_mbuf_refcnt_read(m) == 1) ||
 			likely (rte_mbuf_refcnt_update(m, -1) == 0)) {
 		struct rte_mbuf *md = RTE_MBUF_FROM_BADDR(m->buf_addr);
@@ -717,7 +720,7 @@ __rte_pktmbuf_prefree_seg(struct rte_mbuf *m)
 		}
 #endif
 		return(m);
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 	}
 	return (NULL);
 #endif
@@ -761,7 +764,7 @@ static inline void rte_pktmbuf_free(struct rte_mbuf *m)
 	}
 }
 
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 
 /**
  * Creates a "clone" of the given packet mbuf.
@@ -837,7 +840,7 @@ static inline void rte_pktmbuf_refcnt_update(struct rte_mbuf *m, int16_t v)
 	} while ((m = m->pkt.next) != NULL);
 }
 
-#endif /* RTE_MBUF_SCATTER_GATHER */
+#endif /* RTE_MBUF_REFCNT */
 
 /**
  * Get the headroom in a packet mbuf.
lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c +2 -2
index 56dce23..047acf0 100644
@@ -385,7 +385,7 @@ ixgbe_tx_free_bufs(struct igb_tx_queue *txq)
 	struct igb_tx_entry_seq *txsp;
 	uint32_t status;
 	uint32_t n, k;
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 	uint32_t i;
 	int nb_free = 0;
 	struct rte_mbuf *m, *free[RTE_IXGBE_TX_MAX_FREE_BUF_SZ];
@@ -408,7 +408,7 @@ ixgbe_tx_free_bufs(struct igb_tx_queue *txq)
 
 	while (n > 0) {
 		k = RTE_MIN(n, txsp[n-1].same_pool);
-#ifdef RTE_MBUF_SCATTER_GATHER
+#ifdef RTE_MBUF_REFCNT
 		for (i = 0; i < k; i++) {
 			m = __rte_pktmbuf_prefree_seg((txep+n-k+i)->mbuf);
 			if (m != NULL)
lib/librte_port/Makefile +2 -2
index 28793a5..82b5192 100644
@@ -45,7 +45,7 @@ CFLAGS += $(WERROR_FLAGS)
 SRCS-$(CONFIG_RTE_LIBRTE_PORT) += rte_port_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_PORT) += rte_port_ring.c
 ifeq ($(CONFIG_RTE_LIBRTE_IP_FRAG),y)
-ifeq ($(CONFIG_RTE_MBUF_SCATTER_GATHER),y)
+ifeq ($(CONFIG_RTE_MBUF_REFCNT),y)
 SRCS-$(CONFIG_RTE_LIBRTE_PORT) += rte_port_frag.c
 endif
 SRCS-$(CONFIG_RTE_LIBRTE_PORT) += rte_port_ras.c
@@ -58,7 +58,7 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_PORT)-include += rte_port.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_PORT)-include += rte_port_ethdev.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_PORT)-include += rte_port_ring.h
 ifeq ($(CONFIG_RTE_LIBRTE_IP_FRAG),y)
-ifeq ($(CONFIG_RTE_MBUF_SCATTER_GATHER),y)
+ifeq ($(CONFIG_RTE_MBUF_REFCNT),y)
 SYMLINK-$(CONFIG_RTE_LIBRTE_PORT)-include += rte_port_frag.h
 endif
 SYMLINK-$(CONFIG_RTE_LIBRTE_PORT)-include += rte_port_ras.h
Signature · 1 line
1.9.3

A message that is not in the archive (sent off-list or not yet received): 1409240559-14447-3-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#17 lore raw

Re: [PATCH v2 2/6] mbuf: rename RTE_MBUF_SCATTER_GATHER into RTE_MBUF_REFCNT

Quoted 16 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Thursday, August 28, 2014 4:43 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH v2 2/6] mbuf: rename
RTE_MBUF_SCATTER_GATHER into RTE_MBUF_REFCNT

From: Olivier Matz <[email protected]>

It seems that RTE_MBUF_SCATTER_GATHER is not the proper name for the feature it provides. "Scatter gather" means that data is stored using several buffers. RTE_MBUF_REFCNT seems to be a better name for that feature as it provides a reference counter for mbufs.

Quoted 8 lines

The macro RTE_MBUF_SCATTER_GATHER is poisoned to ensure this modification is seen by drivers or applications using it.

Changes in V2:
* None

Acked-by Pablo de Lara <[email protected]>

Acked-by
#18 lore raw

Re: [PATCH v2 2/6] mbuf: rename RTE_MBUF_SCATTER_GATHER into RTE_MBUF_REFCNT

In reply to a message not in the archive
Quoted 7 lines · Bruce Richardson

From: Olivier Matz <[email protected]>

It seems that RTE_MBUF_SCATTER_GATHER is not the proper name for the feature it provides. "Scatter gather" means that data is stored using several buffers. RTE_MBUF_REFCNT seems to be a better name for that feature as it provides a reference counter for mbufs.

Quoted 8 lines

The macro RTE_MBUF_SCATTER_GATHER is poisoned to ensure this modification is seen by drivers or applications using it.

Changes in V2:
* None

#19 lore raw

PATCH v2 3/6 mbuf: remove rte_ctrlmbuf

In reply to a message not in the archive

From: Olivier Matz <[email protected]>

The initial role of rte_ctrlmbuf is to carry generic messages (data pointer + data length) but it's not used by the DPDK or it applications. Keeping it implies:
- loosing 1 byte in the rte_mbuf structure
- having some dead code rte_mbuf.[ch]

This patch removes this feature. Thanks to it, it is now possible to simplify the rte_mbuf structure by merging the rte_pktmbuf structure in it. This is done in next commit.

* Updated patch to HEAD.
* Modified patch to retain the old function names for ctrl mbufs as macros. This helps with app compatibility, and allows the concept of a control mbuf to be reintroduced via a single-bit flag in a future change.
* Updated the packet framework ip_pipeline example application to work following this change.

Changes in v2:
* Fixed whitespace errors introduced by this patch flagged by checkpatch

---
 app/test-pmd/cmdline.c                             |   1 -
 app/test-pmd/flowgen.c                             |   2 +-
 app/test-pmd/testpmd.c                             |   2 -
 app/test-pmd/txonly.c                              |   2 +-
 app/test/commands.c                                |   1 -
 app/test/test_mbuf.c                               |  72 +------------
 examples/ip_pipeline/cmdline.c                     |  44 ++++----
 examples/ip_pipeline/init.c                        |   2 +-
 examples/ip_pipeline/pipeline_firewall.c           |   4 +-
 .../ip_pipeline/pipeline_flow_classification.c     |   4 +-
 examples/ip_pipeline/pipeline_routing.c            |   4 +-
 examples/ip_pipeline/pipeline_rx.c                 |   4 +-
 examples/ipv4_multicast/main.c                     |   2 +-
 lib/librte_mbuf/rte_mbuf.c                         |  60 +++--------
 lib/librte_mbuf/rte_mbuf.h                         | 119 +++++++--------------
 lib/librte_pmd_e1000/em_rxtx.c                     |   2 +-
 lib/librte_pmd_e1000/igb_rxtx.c                    |   2 +-
 lib/librte_pmd_i40e/i40e_rxtx.c                    |   4 +-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c                  |   4 +-
 lib/librte_pmd_virtio/virtio_rxtx.c                |   2 +-
 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c              |   2 +-
 lib/librte_pmd_xenvirt/rte_eth_xenvirt.c           |   2 +-
 22 files changed, 97 insertions(+), 244 deletions(-)
app/test-pmd/cmdline.c +0 -1
index 345be11..6dd576a 100644
@@ -6377,7 +6377,6 @@ dump_struct_sizes(void)
 #define DUMP_SIZE(t) printf("sizeof(" #t ") = %u\n", (unsigned)sizeof(t));
 	DUMP_SIZE(struct rte_mbuf);
 	DUMP_SIZE(struct rte_pktmbuf);
-	DUMP_SIZE(struct rte_ctrlmbuf);
 	DUMP_SIZE(struct rte_mempool);
 	DUMP_SIZE(struct rte_ring);
 #undef DUMP_SIZE
app/test-pmd/flowgen.c +1 -1
index 04911ff..a8f2a65 100644
@@ -96,7 +96,7 @@ tx_mbuf_alloc(struct rte_mempool *mp)
 	struct rte_mbuf *m;
 
 	m = __rte_mbuf_raw_alloc(mp);
-	__rte_mbuf_sanity_check_raw(m, RTE_MBUF_PKT, 0);
+	__rte_mbuf_sanity_check_raw(m, 0);
 	return (m);
 }
 
app/test-pmd/testpmd.c +0 -2
index e8a4b45..5368d01 100644
@@ -398,13 +398,11 @@ testpmd_mbuf_ctor(struct rte_mempool *mp,
 	mb_ctor_arg = (struct mbuf_ctor_arg *) opaque_arg;
 	mb = (struct rte_mbuf *) raw_mbuf;
 
-	mb->type         = RTE_MBUF_PKT;
 	mb->pool         = mp;
 	mb->buf_addr     = (void *) ((char *)mb + mb_ctor_arg->seg_buf_offset);
 	mb->buf_physaddr = (uint64_t) (rte_mempool_virt2phy(mp, mb) +
 			mb_ctor_arg->seg_buf_offset);
 	mb->buf_len      = mb_ctor_arg->seg_buf_size;
-	mb->type         = RTE_MBUF_PKT;
 	mb->ol_flags     = 0;
 	mb->pkt.data     = (char *) mb->buf_addr + RTE_PKTMBUF_HEADROOM;
 	mb->pkt.nb_segs  = 1;
app/test-pmd/txonly.c +1 -1
index ef93741..d634096 100644
@@ -93,7 +93,7 @@ tx_mbuf_alloc(struct rte_mempool *mp)
 	struct rte_mbuf *m;
 
 	m = __rte_mbuf_raw_alloc(mp);
-	__rte_mbuf_sanity_check_raw(m, RTE_MBUF_PKT, 0);
+	__rte_mbuf_sanity_check_raw(m, 0);
 	return (m);
 }
 
app/test/commands.c +0 -1
index 5f23420..f38d419 100644
@@ -276,7 +276,6 @@ dump_struct_sizes(void)
 #define DUMP_SIZE(t) printf("sizeof(" #t ") = %u\n", (unsigned)sizeof(t));
 	DUMP_SIZE(struct rte_mbuf);
 	DUMP_SIZE(struct rte_pktmbuf);
-	DUMP_SIZE(struct rte_ctrlmbuf);
 	DUMP_SIZE(struct rte_mempool);
 	DUMP_SIZE(struct rte_ring);
 #undef DUMP_SIZE
app/test/test_mbuf.c +3 -69

108 lines not on this page · raw message

examples/ip_pipeline/cmdline.c +22 -22

176 lines not on this page · raw message

examples/ip_pipeline/init.c +1 -1
index d00027f..e3ebd46 100644
@@ -561,7 +561,7 @@ app_ping(void)
 			rte_panic("Unable to allocate new message\n");
 
 		req = (struct app_msg_req *)
-			((struct rte_mbuf *)msg)->ctrl.data;
+				rte_ctrlmbuf_data((struct rte_mbuf *)msg);
 		req->type = APP_MSG_REQ_PING;
 
 		/* Send request */
examples/ip_pipeline/pipeline_firewall.c +2 -2
index ecc15a7..b70260e 100644
@@ -264,7 +264,7 @@ app_message_handle(struct app_core_firewall_message_handle_params *params)
 	table_id = params->table_id;
 
 	/* Handle request */
-	req = (struct app_msg_req *) msg->ctrl.data;
+	req = (struct app_msg_req *)rte_ctrlmbuf_data(msg);
 	switch (req->type) {
 	case APP_MSG_REQ_PING:
 	{
@@ -303,7 +303,7 @@ app_message_handle(struct app_core_firewall_message_handle_params *params)
 	}
 
 	/* Fill in response message */
-	resp = (struct app_msg_resp *) msg->ctrl.data;
+	resp = (struct app_msg_resp *)rte_ctrlmbuf_data(msg);
 	resp->result = result;
 
 	/* Send response */
examples/ip_pipeline/pipeline_flow_classification.c +2 -2
index 68d4f93..cc0cbf1 100644
@@ -250,7 +250,7 @@ app_message_handle(struct app_core_fc_message_handle_params *params)
 	table_id = params->table_id;
 
 	/* Handle request */
-	req = (struct app_msg_req *) ((struct rte_mbuf *)msg)->ctrl.data;
+	req = (struct app_msg_req *)rte_ctrlmbuf_data((struct rte_mbuf *)msg);
 	switch (req->type) {
 	case APP_MSG_REQ_PING:
 	{
@@ -296,7 +296,7 @@ app_message_handle(struct app_core_fc_message_handle_params *params)
 	}
 
 	/* Fill in response message */
-	resp = (struct app_msg_resp *) ((struct rte_mbuf *)msg)->ctrl.data;
+	resp = (struct app_msg_resp *)rte_ctrlmbuf_data((struct rte_mbuf *)msg);
 	resp->result = result;
 
 	/* Send response */
examples/ip_pipeline/pipeline_routing.c +2 -2
index f19506d..b1ce624 100644
@@ -370,7 +370,7 @@ app_message_handle(struct app_core_routing_message_handle_params *params)
 	arp_table_id = params->arp_table_id;
 
 	/* Handle request */
-	req = (struct app_msg_req *) ((struct rte_mbuf *)msg)->ctrl.data;
+	req = (struct app_msg_req *)rte_ctrlmbuf_data((struct rte_mbuf *)msg);
 	switch (req->type) {
 	case APP_MSG_REQ_PING:
 	{
@@ -464,7 +464,7 @@ app_message_handle(struct app_core_routing_message_handle_params *params)
 	}
 
 	/* Fill in response message */
-	resp = (struct app_msg_resp *) ((struct rte_mbuf *)msg)->ctrl.data;
+	resp = (struct app_msg_resp *)rte_ctrlmbuf_data((struct rte_mbuf *)msg);
 	resp->result = result;
 
 	/* Send response */
examples/ip_pipeline/pipeline_rx.c +2 -2
index ba5fa0a..e43ebfa 100644
@@ -348,7 +348,7 @@ app_message_handle(struct app_core_rx_message_handle_params *params)
 	port_in_id = params->port_in_id;
 
 	/* Handle request */
-	req = (struct app_msg_req *) ((struct rte_mbuf *)msg)->ctrl.data;
+	req = (struct app_msg_req *)rte_ctrlmbuf_data((struct rte_mbuf *)msg);
 	switch (req->type) {
 	case APP_MSG_REQ_PING:
 	{
@@ -375,7 +375,7 @@ app_message_handle(struct app_core_rx_message_handle_params *params)
 	}
 
 	/* Fill in response message */
-	resp = (struct app_msg_resp *) ((struct rte_mbuf *)msg)->ctrl.data;
+	resp = (struct app_msg_resp *)rte_ctrlmbuf_data((struct rte_mbuf *)msg);
 	resp->result = result;
 
 	/* Send response */
examples/ipv4_multicast/main.c +1 -1
index dfa0075..7b53296 100644
@@ -343,7 +343,7 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone)
 
 	hdr->ol_flags = pkt->ol_flags;
 
-	__rte_mbuf_sanity_check(hdr, RTE_MBUF_PKT, 1);
+	__rte_mbuf_sanity_check(hdr, 1);
 	return (hdr);
 }
 
lib/librte_mbuf/rte_mbuf.c +16 -44

106 lines not on this page · raw message

lib/librte_mbuf/rte_mbuf.h +37 -82

313 lines not on this page · raw message

lib/librte_pmd_e1000/em_rxtx.c +1 -1
index f254858..3304f50 100644
@@ -85,7 +85,7 @@ rte_rxmbuf_alloc(struct rte_mempool *mp)
 	struct rte_mbuf *m;
 
 	m = __rte_mbuf_raw_alloc(mp);
-	__rte_mbuf_sanity_check_raw(m, RTE_MBUF_PKT, 0);
+	__rte_mbuf_sanity_check_raw(m, 0);
 	return (m);
 }
 
lib/librte_pmd_e1000/igb_rxtx.c +1 -1
index 977c4a2..b0112be 100644
@@ -90,7 +90,7 @@ rte_rxmbuf_alloc(struct rte_mempool *mp)
 	struct rte_mbuf *m;
 
 	m = __rte_mbuf_raw_alloc(mp);
-	__rte_mbuf_sanity_check_raw(m, RTE_MBUF_PKT, 0);
+	__rte_mbuf_sanity_check_raw(m, 0);
 	return (m);
 }
 
lib/librte_pmd_i40e/i40e_rxtx.c +1 -3
index 83b9462..76ff019 100644
@@ -473,7 +473,7 @@ rte_rxmbuf_alloc(struct rte_mempool *mp)
 	struct rte_mbuf *m;
 
 	m = __rte_mbuf_raw_alloc(mp);
-	__rte_mbuf_sanity_check_raw(m, RTE_MBUF_PKT, 0);
+	__rte_mbuf_sanity_check_raw(m, 0);
 
 	return m;
 }
@@ -687,7 +687,6 @@ i40e_rx_alloc_bufs(struct i40e_rx_queue *rxq)
 	for (i = 0; i < rxq->rx_free_thresh; i++) {
 		mb = rxep[i].mbuf;
 		rte_mbuf_refcnt_set(mb, 1);
-		mb->type = RTE_MBUF_PKT;
 		mb->pkt.next = NULL;
 		mb->pkt.data = (char *)mb->buf_addr + RTE_PKTMBUF_HEADROOM;
 		mb->pkt.nb_segs = 1;
@@ -2020,7 +2019,6 @@ i40e_alloc_rx_queue_mbufs(struct i40e_rx_queue *rxq)
 		}
 
 		rte_mbuf_refcnt_set(mbuf, 1);
-		mbuf->type = RTE_MBUF_PKT;
 		mbuf->pkt.next = NULL;
 		mbuf->pkt.data = (char *)mbuf->buf_addr + RTE_PKTMBUF_HEADROOM;
 		mbuf->pkt.nb_segs = 1;
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +1 -3
index dfc2076..40ea4f8 100644
@@ -96,7 +96,7 @@ rte_rxmbuf_alloc(struct rte_mempool *mp)
 	struct rte_mbuf *m;
 
 	m = __rte_mbuf_raw_alloc(mp);
-	__rte_mbuf_sanity_check_raw(m, RTE_MBUF_PKT, 0);
+	__rte_mbuf_sanity_check_raw(m, 0);
 	return (m);
 }
 
@@ -995,7 +995,6 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
 		/* populate the static rte mbuf fields */
 		mb = rxep[i].mbuf;
 		rte_mbuf_refcnt_set(mb, 1);
-		mb->type = RTE_MBUF_PKT;
 		mb->pkt.next = NULL;
 		mb->pkt.data = (char *)mb->buf_addr + RTE_PKTMBUF_HEADROOM;
 		mb->pkt.nb_segs = 1;
@@ -3213,7 +3212,6 @@ ixgbe_alloc_rx_queue_mbufs(struct igb_rx_queue *rxq)
 		}
 
 		rte_mbuf_refcnt_set(mbuf, 1);
-		mbuf->type = RTE_MBUF_PKT;
 		mbuf->pkt.next = NULL;
 		mbuf->pkt.data = (char *)mbuf->buf_addr + RTE_PKTMBUF_HEADROOM;
 		mbuf->pkt.nb_segs = 1;
lib/librte_pmd_virtio/virtio_rxtx.c +1 -1
index fcd8bd1..186514d 100644
@@ -227,7 +227,7 @@ rte_rxmbuf_alloc(struct rte_mempool *mp)
 	struct rte_mbuf *m;
 
 	m = __rte_mbuf_raw_alloc(mp);
-	__rte_mbuf_sanity_check_raw(m, RTE_MBUF_PKT, 0);
+	__rte_mbuf_sanity_check_raw(m, 0);
 
 	return m;
 }
lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c +1 -1
index 2d9f5e0..2470c8e 100644
@@ -100,7 +100,7 @@ rte_rxmbuf_alloc(struct rte_mempool *mp)
 	struct rte_mbuf *m;
 
 	m = __rte_mbuf_raw_alloc(mp);
-	__rte_mbuf_sanity_check_raw(m, RTE_MBUF_PKT, 0);
+	__rte_mbuf_sanity_check_raw(m, 0);
 	return m;
 }
 
lib/librte_pmd_xenvirt/rte_eth_xenvirt.c +1 -1
index 450332a..ba82319 100644
@@ -81,7 +81,7 @@ rte_rxmbuf_alloc(struct rte_mempool *mp)
 	struct rte_mbuf *m;
 
 	m = __rte_mbuf_raw_alloc(mp);
-	__rte_mbuf_sanity_check_raw(m, RTE_MBUF_PKT, 0);
+	__rte_mbuf_sanity_check_raw(m, 0);
 
 	return m;
 }
Signature · 1 line
1.9.3

A message that is not in the archive (sent off-list or not yet received): 1409240559-14447-4-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#21 lore raw

Re: [PATCH v2 3/6] mbuf: remove rte_ctrlmbuf

Quoted 30 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Thursday, August 28, 2014 4:43 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH v2 3/6] mbuf: remove rte_ctrlmbuf

From: Olivier Matz <[email protected]>

The initial role of rte_ctrlmbuf is to carry generic messages (data pointer + data length) but it's not used by the DPDK or it applications. Keeping it implies:
- loosing 1 byte in the rte_mbuf structure
- having some dead code rte_mbuf.[ch]

This patch removes this feature. Thanks to it, it is now possible to simplify the rte_mbuf structure by merging the rte_pktmbuf structure in it. This is done in next commit.

* Updated patch to HEAD.
* Modified patch to retain the old function names for ctrl mbufs as macros. This helps with app compatibility, and allows the concept of a control mbuf to be reintroduced via a single-bit flag in a future change.
* Updated the packet framework ip_pipeline example application to work following this change.

Quoted 4 lines

Changes in v2:
* Fixed whitespace errors introduced by this patch flagged by checkpatch

Acked-by Pablo de Lara <[email protected]>

Acked-by
#22 lore raw

Re: [PATCH v2 3/6] mbuf: remove rte_ctrlmbuf

In reply to a message not in the archive

Hi Bruce,

Quoted 22 lines · Bruce Richardson

From: Olivier Matz <[email protected]>

The initial role of rte_ctrlmbuf is to carry generic messages (data pointer + data length) but it's not used by the DPDK or it applications. Keeping it implies:
- loosing 1 byte in the rte_mbuf structure
- having some dead code rte_mbuf.[ch]

This patch removes this feature. Thanks to it, it is now possible to simplify the rte_mbuf structure by merging the rte_pktmbuf structure in it. This is done in next commit.

* Updated patch to HEAD.
* Modified patch to retain the old function names for ctrl mbufs as macros. This helps with app compatibility, and allows the concept of a control mbuf to be reintroduced via a single-bit flag in a future change.
* Updated the packet framework ip_pipeline example application to work following this change.

Quoted 4 lines

Changes in v2:
* Fixed whitespace errors introduced by this patch flagged by checkpatch

To be honest, I'm not convinced that keeping the old function names is really required, but I suppose you had good reasons to reintroduce them. Just for information, is it for compatibility purpose or is there a real wish to reintroduce a sort of control mbuf in the future ?

A message that is not in the archive (sent off-list or not yet received): [email protected]

#24 lore raw

Re: [PATCH v2 3/6] mbuf: remove rte_ctrlmbuf

Quoted 34 lines

-----Original Message-----
From: Olivier MATZ [mailto:[email protected]]
Sent: Monday, September 08, 2014 9:22 AM
To: Richardson, Bruce; [email protected]
Subject: Re: [PATCH v2 3/6] mbuf: remove rte_ctrlmbuf

Hi Bruce,

Quoted 25 lines · Bruce Richardson

From: Olivier Matz <[email protected]>

The initial role of rte_ctrlmbuf is to carry generic messages (data pointer + data length) but it's not used by the DPDK or it applications. Keeping it implies:
- loosing 1 byte in the rte_mbuf structure
- having some dead code rte_mbuf.[ch]

This patch removes this feature. Thanks to it, it is now possible to simplify the rte_mbuf structure by merging the rte_pktmbuf structure in it. This is done in next commit.

* Updated patch to HEAD.
* Modified patch to retain the old function names for ctrl mbufs as macros. This helps with app compatibility, and allows the concept of a control mbuf to be reintroduced via a single-bit flag in a future change.
* Updated the packet framework ip_pipeline example application to work following this change.

Changes in v2:
* Fixed whitespace errors introduced by this patch flagged by checkpatch

Quoted 8 lines
Quoted 1 line

To be honest, I'm not convinced that keeping the old function names is really required, but I suppose you had good reasons to reintroduce them. Just for information, is it for compatibility purpose or is there a real wish to reintroduce a sort of control mbuf in the future ?

Compatibility primarily. However, it's a useful enough concept, and can be controlled by having a single-bit flag as done in my second patch set.

/Bruce

#25 lore raw

PATCH v2 4/6 mbuf: remove the rte_pktmbuf structure

In reply to a message not in the archive

From: Olivier Matz <[email protected]>

The rte_pktmbuf structure was initially included in the rte_mbuf structure. This was needed when there was 2 types of mbuf (ctrl and packet). As the control mbuf has been removed, we can merge the rte_pktmbuf into the rte_mbuf structure.

Advantages of doing this:
- the access to mbuf fields is easier (ex: m->data instead of m->pkt.data)
- make the structure more consistent: for instance, there was no reason to have the ol_flags field in rte_mbuf
- it will allow a deeper reorganization of the rte_mbuf structure in the next commits, allowing to gain several bytes in it

Updated to work with latest code, and to include new example apps.

Changes in V2:
* Further updates to apply to latest HEAD on master

---
 app/test-pmd/cmdline.c                             |   1 -
 app/test-pmd/csumonly.c                            |   6 +-
 app/test-pmd/flowgen.c                             |  16 +--
 app/test-pmd/icmpecho.c                            |   4 +-
 app/test-pmd/ieee1588fwd.c                         |   6 +-
 app/test-pmd/macfwd-retry.c                        |   2 +-
 app/test-pmd/macfwd.c                              |   8 +-
 app/test-pmd/macswap.c                             |   8 +-
 app/test-pmd/rxonly.c                              |  12 +-
 app/test-pmd/testpmd.c                             |   8 +-
 app/test-pmd/testpmd.h                             |   2 +-
 app/test-pmd/txonly.c                              |  42 +++---
 app/test/commands.c                                |   1 -
 app/test/packet_burst_generator.c                  |  46 +++----
 app/test/test_distributor.c                        |  18 +--
 app/test/test_distributor_perf.c                   |   4 +-
 app/test/test_mbuf.c                               |  12 +-
 app/test/test_sched.c                              |   4 +-
 app/test/test_table_acl.c                          |   6 +-
 app/test/test_table_pipeline.c                     |   4 +-
 examples/dpdk_qat/crypto.c                         |  22 ++--
 examples/dpdk_qat/main.c                           |   2 +-
 examples/exception_path/main.c                     |  10 +-
 examples/ip_fragmentation/main.c                   |   6 +-
 examples/ip_pipeline/pipeline_rx.c                 |   4 +-
 examples/ip_pipeline/pipeline_tx.c                 |   2 +-
 examples/ip_reassembly/main.c                      |   8 +-
 examples/ipv4_multicast/main.c                     |  14 +-
 examples/l3fwd-acl/main.c                          |   2 +-
 examples/l3fwd-power/main.c                        |   2 +-
 examples/l3fwd-vf/main.c                           |   2 +-
 examples/l3fwd/main.c                              |  10 +-
 examples/load_balancer/runtime.c                   |   2 +-
 .../client_server_mp/mp_client/client.c            |   2 +-
 examples/quota_watermark/qw/main.c                 |   4 +-
 examples/vhost/main.c                              | 100 +++++++--------
 examples/vhost_xen/main.c                          |  22 ++--
 lib/librte_distributor/rte_distributor.c           |   2 +-
 lib/librte_ip_frag/ip_frag_common.h                |  14 +-
 lib/librte_ip_frag/rte_ipv4_fragmentation.c        |  40 +++---
 lib/librte_ip_frag/rte_ipv4_reassembly.c           |   6 +-
 lib/librte_ip_frag/rte_ipv6_fragmentation.c        |  38 +++---
 lib/librte_ip_frag/rte_ipv6_reassembly.c           |   4 +-
 lib/librte_mbuf/rte_mbuf.c                         |  26 ++--
 lib/librte_mbuf/rte_mbuf.h                         | 142 ++++++++++-----------
 lib/librte_pmd_bond/rte_eth_bond_pmd.c             |   4 +-
 lib/librte_pmd_e1000/em_rxtx.c                     |  64 +++++-----
 lib/librte_pmd_e1000/igb_rxtx.c                    |  68 +++++-----
 lib/librte_pmd_i40e/i40e_rxtx.c                    |  98 +++++++-------
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c                  | 100 +++++++--------
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h                  |   2 +-
 lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c              |  20 ++-
 lib/librte_pmd_pcap/rte_eth_pcap.c                 |  14 +-
 lib/librte_pmd_virtio/virtio_rxtx.c                |  58 ++++-----
 lib/librte_pmd_virtio/virtqueue.h                  |   2 +-
 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c              |  26 ++--
 lib/librte_pmd_xenvirt/rte_eth_xenvirt.c           |  12 +-
 lib/librte_pmd_xenvirt/virtqueue.h                 |   4 +-
 lib/librte_port/rte_port_frag.c                    |   2 +-
 lib/librte_sched/rte_sched.c                       |  14 +-
 lib/librte_sched/rte_sched.h                       |  10 +-
 61 files changed, 594 insertions(+), 600 deletions(-)
app/test-pmd/cmdline.c +0 -1
index 6de38e6..67321f7 100644
@@ -6475,7 +6475,6 @@ dump_struct_sizes(void)
 {
 #define DUMP_SIZE(t) printf("sizeof(" #t ") = %u\n", (unsigned)sizeof(t));
 	DUMP_SIZE(struct rte_mbuf);
-	DUMP_SIZE(struct rte_pktmbuf);
 	DUMP_SIZE(struct rte_mempool);
 	DUMP_SIZE(struct rte_ring);
 #undef DUMP_SIZE
app/test-pmd/csumonly.c +3 -3
index e5a1f52..655b6d8 100644
@@ -263,7 +263,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 		pkt_ol_flags = mb->ol_flags;
 		ol_flags = (uint16_t) (pkt_ol_flags & (~PKT_TX_L4_MASK));
 
-		eth_hdr = (struct ether_hdr *) mb->pkt.data;
+		eth_hdr = (struct ether_hdr *) mb->data;
 		eth_type = rte_be_to_cpu_16(eth_hdr->ether_type);
 		if (eth_type == ETHER_TYPE_VLAN) {
 			/* Only allow single VLAN label here */
@@ -432,8 +432,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 		}
 
 		/* Combine the packet header write. VLAN is not consider here */
-		mb->pkt.vlan_macip.f.l2_len = l2_len;
-		mb->pkt.vlan_macip.f.l3_len = l3_len;
+		mb->vlan_macip.f.l2_len = l2_len;
+		mb->vlan_macip.f.l3_len = l3_len;
 		mb->ol_flags = ol_flags;
 	}
 	nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx);
app/test-pmd/flowgen.c +8 -8
index a8f2a65..17dbf83 100644
@@ -171,11 +171,11 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
 		if (!pkt)
 			break;
 
-		pkt->pkt.data_len = pkt_size;
-		pkt->pkt.next = NULL;
+		pkt->data_len = pkt_size;
+		pkt->next = NULL;
 
 		/* Initialize Ethernet header. */
-		eth_hdr = (struct ether_hdr *)pkt->pkt.data;
+		eth_hdr = (struct ether_hdr *)pkt->data;
 		ether_addr_copy(&cfg_ether_dst, &eth_hdr->d_addr);
 		ether_addr_copy(&cfg_ether_src, &eth_hdr->s_addr);
 		eth_hdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4);
@@ -205,12 +205,12 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
 		udp_hdr->dgram_len	= RTE_CPU_TO_BE_16(pkt_size -
 							   sizeof(*eth_hdr) -
 							   sizeof(*ip_hdr));
-		pkt->pkt.nb_segs		= 1;
-		pkt->pkt.pkt_len		= pkt_size;
+		pkt->nb_segs			= 1;
+		pkt->pkt_len			= pkt_size;
 		pkt->ol_flags			= ol_flags;
-		pkt->pkt.vlan_macip.f.vlan_tci	= vlan_tci;
-		pkt->pkt.vlan_macip.f.l2_len	= sizeof(struct ether_hdr);
-		pkt->pkt.vlan_macip.f.l3_len	= sizeof(struct ipv4_hdr);
+		pkt->vlan_macip.f.vlan_tci	= vlan_tci;
+		pkt->vlan_macip.f.l2_len	= sizeof(struct ether_hdr);
+		pkt->vlan_macip.f.l3_len	= sizeof(struct ipv4_hdr);
 		pkts_burst[nb_pkt]		= pkt;
 
 		next_flow = (next_flow + 1) % cfg_n_flows;
app/test-pmd/icmpecho.c +2 -2
index c28ff5a..4a277b8 100644
@@ -330,12 +330,12 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs)
 	nb_replies = 0;
 	for (i = 0; i < nb_rx; i++) {
 		pkt = pkts_burst[i];
-		eth_h = (struct ether_hdr *) pkt->pkt.data;
+		eth_h = (struct ether_hdr *) pkt->data;
 		eth_type = RTE_BE_TO_CPU_16(eth_h->ether_type);
 		l2_len = sizeof(struct ether_hdr);
 		if (verbose_level > 0) {
 			printf("\nPort %d pkt-len=%u nb-segs=%u\n",
-			       fs->rx_port, pkt->pkt.pkt_len, pkt->pkt.nb_segs);
+			       fs->rx_port, pkt->pkt_len, pkt->nb_segs);
 			ether_addr_dump("  ETH:  src=", &eth_h->s_addr);
 			ether_addr_dump(" dst=", &eth_h->d_addr);
 		}
app/test-pmd/ieee1588fwd.c +3 -3
index 3ce9979..ab5e06e 100644
@@ -546,7 +546,7 @@ ieee1588_packet_fwd(struct fwd_stream *fs)
 	 * Check that the received packet is a PTP packet that was detected
 	 * by the hardware.
 	 */
-	eth_hdr = (struct ether_hdr *)mb->pkt.data;
+	eth_hdr = (struct ether_hdr *)mb->data;
 	eth_type = rte_be_to_cpu_16(eth_hdr->ether_type);
 	if (! (mb->ol_flags & PKT_RX_IEEE1588_PTP)) {
 		if (eth_type == ETHER_TYPE_1588) {
@@ -557,7 +557,7 @@ ieee1588_packet_fwd(struct fwd_stream *fs)
 			printf("Port %u Received non PTP packet type=0x%4x "
 			       "len=%u\n",
 			       (unsigned) fs->rx_port, eth_type,
-			       (unsigned) mb->pkt.pkt_len);
+			       (unsigned) mb->pkt_len);
 		}
 		rte_pktmbuf_free(mb);
 		return;
@@ -574,7 +574,7 @@ ieee1588_packet_fwd(struct fwd_stream *fs)
 	 * Check that the received PTP packet is a PTP V2 packet of type
 	 * PTP_SYNC_MESSAGE.
 	 */
-	ptp_hdr = (struct ptpv2_msg *) ((char *) mb->pkt.data +
+	ptp_hdr = (struct ptpv2_msg *) ((char *) mb->data +
 					sizeof(struct ether_hdr));
 	if (ptp_hdr->version != 0x02) {
 		printf("Port %u Received PTP V2 Ethernet frame with wrong PTP"
app/test-pmd/macfwd-retry.c +1 -1
index f4e06c4..5122983 100644
@@ -119,7 +119,7 @@ pkt_burst_mac_retry_forward(struct fwd_stream *fs)
 	fs->rx_packets += nb_rx;
 	for (i = 0; i < nb_rx; i++) {
 		mb = pkts_burst[i];
-		eth_hdr = (struct ether_hdr *) mb->pkt.data;
+		eth_hdr = (struct ether_hdr *) mb->data;
 		ether_addr_copy(&peer_eth_addrs[fs->peer_addr],
 				&eth_hdr->d_addr);
 		ether_addr_copy(&ports[fs->tx_port].eth_addr,
app/test-pmd/macfwd.c +4 -4
index fc8f749..999c8e3 100644
@@ -110,15 +110,15 @@ pkt_burst_mac_forward(struct fwd_stream *fs)
 	txp = &ports[fs->tx_port];
 	for (i = 0; i < nb_rx; i++) {
 		mb = pkts_burst[i];
-		eth_hdr = (struct ether_hdr *) mb->pkt.data;
+		eth_hdr = (struct ether_hdr *) mb->data;
 		ether_addr_copy(&peer_eth_addrs[fs->peer_addr],
 				&eth_hdr->d_addr);
 		ether_addr_copy(&ports[fs->tx_port].eth_addr,
 				&eth_hdr->s_addr);
 		mb->ol_flags = txp->tx_ol_flags;
-		mb->pkt.vlan_macip.f.l2_len = sizeof(struct ether_hdr);
-		mb->pkt.vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
-		mb->pkt.vlan_macip.f.vlan_tci = txp->tx_vlan_id;
+		mb->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
+		mb->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+		mb->vlan_macip.f.vlan_tci = txp->tx_vlan_id;
 	}
 	nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx);
 	fs->tx_packets += nb_tx;
app/test-pmd/macswap.c +4 -4
index 4ed6096..731f487 100644
@@ -110,7 +110,7 @@ pkt_burst_mac_swap(struct fwd_stream *fs)
 	txp = &ports[fs->tx_port];
 	for (i = 0; i < nb_rx; i++) {
 		mb = pkts_burst[i];
-		eth_hdr = (struct ether_hdr *) mb->pkt.data;
+		eth_hdr = (struct ether_hdr *) mb->data;
 
 		/* Swap dest and src mac addresses. */
 		ether_addr_copy(&eth_hdr->d_addr, &addr);
@@ -118,9 +118,9 @@ pkt_burst_mac_swap(struct fwd_stream *fs)
 		ether_addr_copy(&addr, &eth_hdr->s_addr);
 
 		mb->ol_flags = txp->tx_ol_flags;
-		mb->pkt.vlan_macip.f.l2_len = sizeof(struct ether_hdr);
-		mb->pkt.vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
-		mb->pkt.vlan_macip.f.vlan_tci = txp->tx_vlan_id;
+		mb->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
+		mb->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+		mb->vlan_macip.f.vlan_tci = txp->tx_vlan_id;
 	}
 	nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx);
 	fs->tx_packets += nb_tx;
app/test-pmd/rxonly.c +6 -6
index 5f21a3e..c34a5e1 100644
@@ -149,24 +149,24 @@ pkt_burst_receive(struct fwd_stream *fs)
 			rte_pktmbuf_free(mb);
 			continue;
 		}
-		eth_hdr = (struct ether_hdr *) mb->pkt.data;
+		eth_hdr = (struct ether_hdr *) mb->data;
 		eth_type = RTE_BE_TO_CPU_16(eth_hdr->ether_type);
 		ol_flags = mb->ol_flags;
 		print_ether_addr("  src=", &eth_hdr->s_addr);
 		print_ether_addr(" - dst=", &eth_hdr->d_addr);
 		printf(" - type=0x%04x - length=%u - nb_segs=%d",
-		       eth_type, (unsigned) mb->pkt.pkt_len,
-		       (int)mb->pkt.nb_segs);
+		       eth_type, (unsigned) mb->pkt_len,
+		       (int)mb->nb_segs);
 		if (ol_flags & PKT_RX_RSS_HASH) {
-			printf(" - RSS hash=0x%x", (unsigned) mb->pkt.hash.rss);
+			printf(" - RSS hash=0x%x", (unsigned) mb->hash.rss);
 			printf(" - RSS queue=0x%x",(unsigned) fs->rx_queue);
 		}
 		else if (ol_flags & PKT_RX_FDIR)
 			printf(" - FDIR hash=0x%x - FDIR id=0x%x ",
-			       mb->pkt.hash.fdir.hash, mb->pkt.hash.fdir.id);
+			       mb->hash.fdir.hash, mb->hash.fdir.id);
 		if (ol_flags & PKT_RX_VLAN_PKT)
 			printf(" - VLAN tci=0x%x",
-				mb->pkt.vlan_macip.f.vlan_tci);
+				mb->vlan_macip.f.vlan_tci);
 		printf("\n");
 		if (ol_flags != 0) {
 			int rxf;
app/test-pmd/testpmd.c +4 -4
index 250f0c2..2a5eb83 100644
@@ -404,10 +404,10 @@ testpmd_mbuf_ctor(struct rte_mempool *mp,
 			mb_ctor_arg->seg_buf_offset);
 	mb->buf_len      = mb_ctor_arg->seg_buf_size;
 	mb->ol_flags     = 0;
-	mb->pkt.data     = (char *) mb->buf_addr + RTE_PKTMBUF_HEADROOM;
-	mb->pkt.nb_segs  = 1;
-	mb->pkt.vlan_macip.data = 0;
-	mb->pkt.hash.rss = 0;
+	mb->data         = (char *) mb->buf_addr + RTE_PKTMBUF_HEADROOM;
+	mb->nb_segs      = 1;
+	mb->vlan_macip.data = 0;
+	mb->hash.rss     = 0;
 }
 
 static void
app/test-pmd/testpmd.h +1 -1
index b8322a2..09923a8 100644
@@ -60,7 +60,7 @@ int main(int argc, char **argv);
  * The maximum number of segments per packet is used when creating
  * scattered transmit packets composed of a list of mbufs.
  */
-#define RTE_MAX_SEGS_PER_PKT 255 /**< pkt.nb_segs is a 8-bit unsigned char. */
+#define RTE_MAX_SEGS_PER_PKT 255 /**< nb_segs is a 8-bit unsigned char. */
 
 #define MAX_PKT_BURST 512
 #define DEF_PKT_BURST 32
app/test-pmd/txonly.c +21 -21

78 lines not on this page · raw message

app/test/commands.c +0 -1
index 9ea3c62..a9e36b1 100644
@@ -136,7 +136,6 @@ dump_struct_sizes(void)
 {
 #define DUMP_SIZE(t) printf("sizeof(" #t ") = %u\n", (unsigned)sizeof(t));
 	DUMP_SIZE(struct rte_mbuf);
-	DUMP_SIZE(struct rte_pktmbuf);
 	DUMP_SIZE(struct rte_mempool);
 	DUMP_SIZE(struct rte_ring);
 #undef DUMP_SIZE
app/test/packet_burst_generator.c +23 -23

89 lines not on this page · raw message

app/test/test_distributor.c +9 -9
index eca974d..ce06436 100644
@@ -120,7 +120,7 @@ sanity_test(struct rte_distributor *d, struct rte_mempool *p)
 	/* now set all hash values in all buffers to zero, so all pkts go to the
 	 * one worker thread */
 	for (i = 0; i < BURST; i++)
-		bufs[i]->pkt.hash.rss = 0;
+		bufs[i]->hash.rss = 0;
 
 	rte_distributor_process(d, bufs, BURST);
 	rte_distributor_flush(d);
@@ -142,7 +142,7 @@ sanity_test(struct rte_distributor *d, struct rte_mempool *p)
 	if (rte_lcore_count() >= 3) {
 		clear_packet_count();
 		for (i = 0; i < BURST; i++)
-			bufs[i]->pkt.hash.rss = (i & 1) << 8;
+			bufs[i]->hash.rss = (i & 1) << 8;
 
 		rte_distributor_process(d, bufs, BURST);
 		rte_distributor_flush(d);
@@ -167,7 +167,7 @@ sanity_test(struct rte_distributor *d, struct rte_mempool *p)
 	 * so load gets distributed */
 	clear_packet_count();
 	for (i = 0; i < BURST; i++)
-		bufs[i]->pkt.hash.rss = i;
+		bufs[i]->hash.rss = i;
 
 	rte_distributor_process(d, bufs, BURST);
 	rte_distributor_flush(d);
@@ -199,7 +199,7 @@ sanity_test(struct rte_distributor *d, struct rte_mempool *p)
 		return -1;
 	}
 	for (i = 0; i < BIG_BATCH; i++)
-		many_bufs[i]->pkt.hash.rss = i << 2;
+		many_bufs[i]->hash.rss = i << 2;
 
 	for (i = 0; i < BIG_BATCH/BURST; i++) {
 		rte_distributor_process(d, &many_bufs[i*BURST], BURST);
@@ -280,7 +280,7 @@ sanity_test_with_mbuf_alloc(struct rte_distributor *d, struct rte_mempool *p)
 		while (rte_mempool_get_bulk(p, (void *)bufs, BURST) < 0)
 			rte_distributor_process(d, NULL, 0);
 		for (j = 0; j < BURST; j++) {
-			bufs[j]->pkt.hash.rss = (i+j) << 1;
+			bufs[j]->hash.rss = (i+j) << 1;
 			rte_mbuf_refcnt_set(bufs[j], 1);
 		}
 
@@ -359,7 +359,7 @@ sanity_test_with_worker_shutdown(struct rte_distributor *d,
 	/* now set all hash values in all buffers to zero, so all pkts go to the
 	 * one worker thread */
 	for (i = 0; i < BURST; i++)
-		bufs[i]->pkt.hash.rss = 0;
+		bufs[i]->hash.rss = 0;
 
 	rte_distributor_process(d, bufs, BURST);
 	/* at this point, we will have processed some packets and have a full
@@ -372,7 +372,7 @@ sanity_test_with_worker_shutdown(struct rte_distributor *d,
 		return -1;
 	}
 	for (i = 0; i < BURST; i++)
-		bufs[i]->pkt.hash.rss = 0;
+		bufs[i]->hash.rss = 0;
 
 	/* get worker zero to quit */
 	zero_quit = 1;
@@ -416,7 +416,7 @@ test_flush_with_worker_shutdown(struct rte_distributor *d,
 	/* now set all hash values in all buffers to zero, so all pkts go to the
 	 * one worker thread */
 	for (i = 0; i < BURST; i++)
-		bufs[i]->pkt.hash.rss = 0;
+		bufs[i]->hash.rss = 0;
 
 	rte_distributor_process(d, bufs, BURST);
 	/* at this point, we will have processed some packets and have a full
@@ -488,7 +488,7 @@ quit_workers(struct rte_distributor *d, struct rte_mempool *p)
 	zero_quit = 0;
 	quit = 1;
 	for (i = 0; i < num_workers; i++)
-		bufs[i]->pkt.hash.rss = i << 1;
+		bufs[i]->hash.rss = i << 1;
 	rte_distributor_process(d, bufs, num_workers);
 
 	rte_mempool_put_bulk(p, (void *)bufs, num_workers);
app/test/test_distributor_perf.c +2 -2
index 849387d..b04864c 100644
@@ -159,7 +159,7 @@ perf_test(struct rte_distributor *d, struct rte_mempool *p)
 	}
 	/* ensure we have different hash value for each pkt */
 	for (i = 0; i < BURST; i++)
-		bufs[i]->pkt.hash.rss = i;
+		bufs[i]->hash.rss = i;
 
 	start = rte_rdtsc();
 	for (i = 0; i < (1<<ITER_POWER); i++)
@@ -198,7 +198,7 @@ quit_workers(struct rte_distributor *d, struct rte_mempool *p)
 
 	quit = 1;
 	for (i = 0; i < num_workers; i++)
-		bufs[i]->pkt.hash.rss = i << 1;
+		bufs[i]->hash.rss = i << 1;
 	rte_distributor_process(d, bufs, num_workers);
 
 	rte_mempool_put_bulk(p, (void *)bufs, num_workers);
app/test/test_mbuf.c +6 -6
index 280b1ab..b81e622 100644
@@ -344,8 +344,8 @@ testclone_testupdate_testdetach(void)
 		GOTO_FAIL("cannot clone data\n");
 	rte_pktmbuf_free(clone);
 
-	mc->pkt.next = rte_pktmbuf_alloc(pktmbuf_pool);
-	if(mc->pkt.next == NULL)
+	mc->next = rte_pktmbuf_alloc(pktmbuf_pool);
+	if(mc->next == NULL)
 		GOTO_FAIL("Next Pkt Null\n");
 
 	clone = rte_pktmbuf_clone(mc, pktmbuf_pool);
@@ -432,7 +432,7 @@ test_pktmbuf_pool_ptr(void)
 			printf("rte_pktmbuf_alloc() failed (%u)\n", i);
 			ret = -1;
 		}
-		m[i]->pkt.data = RTE_PTR_ADD(m[i]->pkt.data, 64);
+		m[i]->data = RTE_PTR_ADD(m[i]->data, 64);
 	}
 
 	/* free them */
@@ -451,8 +451,8 @@ test_pktmbuf_pool_ptr(void)
 			printf("rte_pktmbuf_alloc() failed (%u)\n", i);
 			ret = -1;
 		}
-		if (m[i]->pkt.data != RTE_PTR_ADD(m[i]->buf_addr, RTE_PKTMBUF_HEADROOM)) {
-			printf ("pkt.data pointer not set properly\n");
+		if (m[i]->data != RTE_PTR_ADD(m[i]->buf_addr, RTE_PKTMBUF_HEADROOM)) {
+			printf ("data pointer not set properly\n");
 			ret = -1;
 		}
 	}
@@ -493,7 +493,7 @@ test_pktmbuf_free_segment(void)
 			mb = m[i];
 			while(mb != NULL) {
 				mt = mb;
-				mb = mb->pkt.next;
+				mb = mb->next;
 				rte_pktmbuf_free_seg(mt);
 			}
 		}
app/test/test_sched.c +2 -2
index ce47084..c957d80 100644
@@ -145,8 +145,8 @@ prepare_pkt(struct rte_mbuf *mbuf)
 	rte_sched_port_pkt_write(mbuf, SUBPORT, PIPE, TC, QUEUE, e_RTE_METER_YELLOW);
 
 	/* 64 byte packet */
-	mbuf->pkt.pkt_len  = 60;
-	mbuf->pkt.data_len = 60;
+	mbuf->pkt_len  = 60;
+	mbuf->data_len = 60;
 }
 
 
app/test/test_table_acl.c +3 -3
index dda0570..4db680a 100644
@@ -513,7 +513,7 @@ test_pipeline_single_filter(int expected_count)
 			struct rte_mbuf *mbuf;
 
 			mbuf = rte_pktmbuf_alloc(pool);
-			memset(mbuf->pkt.data, 0x00,
+			memset(mbuf->data, 0x00,
 				sizeof(struct ipv4_5tuple));
 
 			five_tuple.proto = j;
@@ -522,7 +522,7 @@ test_pipeline_single_filter(int expected_count)
 			five_tuple.port_src = rte_bswap16(100 + j);
 			five_tuple.port_dst = rte_bswap16(200 + j);
 
-			memcpy(mbuf->pkt.data, &five_tuple,
+			memcpy(mbuf->data, &five_tuple,
 				sizeof(struct ipv4_5tuple));
 			RTE_LOG(INFO, PIPELINE, "%s: Enqueue onto ring %d\n",
 				__func__, i);
@@ -549,7 +549,7 @@ test_pipeline_single_filter(int expected_count)
 			printf("Got %d object(s) from ring %d!\n", ret, i);
 			for (j = 0; j < ret; j++) {
 				mbuf = (struct rte_mbuf *)objs[j];
-				rte_hexdump(stdout, "mbuf", mbuf->pkt.data, 64);
+				rte_hexdump(stdout, "mbuf", mbuf->data, 64);
 				rte_pktmbuf_free(mbuf);
 			}
 			tx_count += ret;
app/test/test_table_pipeline.c +2 -2
index 70b1015..15a038b 100644
@@ -498,8 +498,8 @@ test_pipeline_single_filter(int test_type, int expected_count)
 			printf("Got %d object(s) from ring %d!\n", ret, i);
 			for (j = 0; j < ret; j++) {
 				mbuf = (struct rte_mbuf *)objs[j];
-				rte_hexdump(stdout, "Object:", mbuf->pkt.data,
-					mbuf->pkt.data_len);
+				rte_hexdump(stdout, "Object:", mbuf->data,
+					mbuf->data_len);
 				rte_pktmbuf_free(mbuf);
 			}
 			tx_count += ret;
examples/dpdk_qat/crypto.c +11 -11
index 577ab32..318d47c 100644
@@ -183,7 +183,7 @@ struct glob_keys g_crypto_hash_keys = {
  *
  */
 #define PACKET_DATA_START_PHYS(p) \
-		((p)->buf_physaddr + ((char *)p->pkt.data - (char *)p->buf_addr))
+		((p)->buf_physaddr + ((char *)p->data - (char *)p->buf_addr))
 
 /*
  * A fixed offset to where the crypto is to be performed, which is the first
@@ -773,7 +773,7 @@ enum crypto_result
 crypto_encrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 {
 	CpaCySymDpOpData *opData =
-			(CpaCySymDpOpData *) ((char *) (rte_buff->pkt.data)
+			(CpaCySymDpOpData *) ((char *) (rte_buff->data)
 					+ CRYPTO_OFFSET_TO_OPDATA);
 	uint32_t lcore_id;
 
@@ -785,7 +785,7 @@ crypto_encrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 	bzero(opData, sizeof(CpaCySymDpOpData));
 
 	opData->srcBuffer = opData->dstBuffer = PACKET_DATA_START_PHYS(rte_buff);
-	opData->srcBufferLen = opData->dstBufferLen = rte_buff->pkt.data_len;
+	opData->srcBufferLen = opData->dstBufferLen = rte_buff->data_len;
 	opData->sessionCtx = qaCoreConf[lcore_id].encryptSessionHandleTbl[c][h];
 	opData->thisPhys = PACKET_DATA_START_PHYS(rte_buff)
 			+ CRYPTO_OFFSET_TO_OPDATA;
@@ -805,7 +805,7 @@ crypto_encrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 			opData->ivLenInBytes = IV_LENGTH_8_BYTES;
 
 		opData->cryptoStartSrcOffsetInBytes = CRYPTO_START_OFFSET;
-		opData->messageLenToCipherInBytes = rte_buff->pkt.data_len
+		opData->messageLenToCipherInBytes = rte_buff->data_len
 				- CRYPTO_START_OFFSET;
 		/*
 		 * Work around for padding, message length has to be a multiple of
@@ -818,7 +818,7 @@ crypto_encrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 	if (NO_HASH != h) {
 
 		opData->hashStartSrcOffsetInBytes = HASH_START_OFFSET;
-		opData->messageLenToHashInBytes = rte_buff->pkt.data_len
+		opData->messageLenToHashInBytes = rte_buff->data_len
 				- HASH_START_OFFSET;
 		/*
 		 * Work around for padding, message length has to be a multiple of block
@@ -831,7 +831,7 @@ crypto_encrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 		 * Assumption: Ok ignore the passed digest pointer and place HMAC at end
 		 * of packet.
 		 */
-		opData->digestResult = rte_buff->buf_physaddr + rte_buff->pkt.data_len;
+		opData->digestResult = rte_buff->buf_physaddr + rte_buff->data_len;
 	}
 
 	if (CPA_STATUS_SUCCESS != enqueueOp(opData, lcore_id)) {
@@ -848,7 +848,7 @@ enum crypto_result
 crypto_decrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 {
 
-	CpaCySymDpOpData *opData = (void*) (((char *) rte_buff->pkt.data)
+	CpaCySymDpOpData *opData = (void*) (((char *) rte_buff->data)
 			+ CRYPTO_OFFSET_TO_OPDATA);
 	uint32_t lcore_id;
 
@@ -860,7 +860,7 @@ crypto_decrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 	bzero(opData, sizeof(CpaCySymDpOpData));
 
 	opData->dstBuffer = opData->srcBuffer = PACKET_DATA_START_PHYS(rte_buff);
-	opData->dstBufferLen = opData->srcBufferLen = rte_buff->pkt.data_len;
+	opData->dstBufferLen = opData->srcBufferLen = rte_buff->data_len;
 	opData->thisPhys = PACKET_DATA_START_PHYS(rte_buff)
 			+ CRYPTO_OFFSET_TO_OPDATA;
 	opData->sessionCtx = qaCoreConf[lcore_id].decryptSessionHandleTbl[c][h];
@@ -880,7 +880,7 @@ crypto_decrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 			opData->ivLenInBytes = IV_LENGTH_8_BYTES;
 
 		opData->cryptoStartSrcOffsetInBytes = CRYPTO_START_OFFSET;
-		opData->messageLenToCipherInBytes = rte_buff->pkt.data_len
+		opData->messageLenToCipherInBytes = rte_buff->data_len
 				- CRYPTO_START_OFFSET;
 
 		/*
@@ -892,7 +892,7 @@ crypto_decrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 	}
 	if (NO_HASH != h) {
 		opData->hashStartSrcOffsetInBytes = HASH_START_OFFSET;
-		opData->messageLenToHashInBytes = rte_buff->pkt.data_len
+		opData->messageLenToHashInBytes = rte_buff->data_len
 				- HASH_START_OFFSET;
 		/*
 		 * Work around for padding, message length has to be a multiple of block
@@ -900,7 +900,7 @@ crypto_decrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 		 */
 		opData->messageLenToHashInBytes -= opData->messageLenToHashInBytes
 				% HASH_BLOCK_DEFAULT_SIZE;
-		opData->digestResult = rte_buff->buf_physaddr + rte_buff->pkt.data_len;
+		opData->digestResult = rte_buff->buf_physaddr + rte_buff->data_len;
 	}
 
 	if (CPA_STATUS_SUCCESS != enqueueOp(opData, lcore_id)) {
examples/dpdk_qat/main.c +1 -1
index d61db4c..75c9876 100644
@@ -384,7 +384,7 @@ main_loop(__attribute__((unused)) void *dummy)
 			}
 		}
 
-		port = dst_ports[pkt->pkt.in_port];
+		port = dst_ports[pkt->in_port];
 
 		/* Transmit the packet */
 		nic_tx_send_packet(pkt, (uint8_t)port);
examples/exception_path/main.c +5 -5
index 0204116..5045ef8 100644
@@ -302,16 +302,16 @@ main_loop(__attribute__((unused)) void *arg)
 			if (m == NULL)
 				continue;
 
-			ret = read(tap_fd, m->pkt.data, MAX_PACKET_SZ);
+			ret = read(tap_fd, m->data, MAX_PACKET_SZ);
 			lcore_stats[lcore_id].rx++;
 			if (unlikely(ret < 0)) {
 				FATAL_ERROR("Reading from %s interface failed",
 				            tap_name);
 			}
-			m->pkt.nb_segs = 1;
-			m->pkt.next = NULL;
-			m->pkt.pkt_len = (uint16_t)ret;
-			m->pkt.data_len = (uint16_t)ret;
+			m->nb_segs = 1;
+			m->next = NULL;
+			m->pkt_len = (uint16_t)ret;
+			m->data_len = (uint16_t)ret;
 			ret = rte_eth_tx_burst(port_ids[lcore_id], 0, &m, 1);
 			if (unlikely(ret < 1)) {
 				rte_pktmbuf_free(m);
examples/ip_fragmentation/main.c +3 -3
index 72cd2b2..ac8d4f7 100644
@@ -342,7 +342,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf,
 		}
 
 		/* if we don't need to do any fragmentation */
-		if (likely (IPV4_MTU_DEFAULT >= m->pkt.pkt_len)) {
+		if (likely (IPV4_MTU_DEFAULT >= m->pkt_len)) {
 			qconf->tx_mbufs[port_out].m_table[len] = m;
 			len2 = 1;
 		} else {
@@ -379,7 +379,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf,
 		}
 
 		/* if we don't need to do any fragmentation */
-		if (likely (IPV6_MTU_DEFAULT >= m->pkt.pkt_len)) {
+		if (likely (IPV6_MTU_DEFAULT >= m->pkt_len)) {
 			qconf->tx_mbufs[port_out].m_table[len] = m;
 			len2 = 1;
 		} else {
@@ -413,7 +413,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf,
 			rte_panic("No headroom in mbuf.\n");
 		}
 
-		m->pkt.vlan_macip.f.l2_len = sizeof(struct ether_hdr);
+		m->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
 
 		/* 02:00:00:00:00:xx */
 		d_addr_bytes = &eth_hdr->d_addr.addr_bytes[0];
examples/ip_pipeline/pipeline_rx.c +2 -2
index e43ebfa..7a8309c 100644
@@ -255,8 +255,8 @@ app_pkt_metadata_fill(struct rte_mbuf *m)
 	/* Pop Ethernet header */
 	if (app.ether_hdr_pop_push) {
 		rte_pktmbuf_adj(m, (uint16_t)sizeof(struct ether_hdr));
-		m->pkt.vlan_macip.f.l2_len = 0;
-		m->pkt.vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+		m->vlan_macip.f.l2_len = 0;
+		m->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
 	}
 }
 
examples/ip_pipeline/pipeline_tx.c +1 -1
index 3bf2c8b..b9491e3 100644
@@ -66,7 +66,7 @@ app_pkt_metadata_flush(struct rte_mbuf *pkt)
 	ether_addr_copy(&pkt_meta->nh_arp, &ether_hdr->d_addr);
 	ether_addr_copy(&local_ether_addr, &ether_hdr->s_addr);
 	ether_hdr->ether_type = rte_bswap16(ETHER_TYPE_IPv4);
-	pkt->pkt.vlan_macip.f.l2_len = sizeof(struct ether_hdr);
+	pkt->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
 }
 
 static int
examples/ip_reassembly/main.c +4 -4
index 3bb6afd..8184aad 100644
@@ -412,8 +412,8 @@ reassemble(struct rte_mbuf *m, uint8_t portid, uint32_t queue,
 			dr = &qconf->death_row;
 
 			/* prepare mbuf: setup l2_len/l3_len. */
-			m->pkt.vlan_macip.f.l2_len = sizeof(*eth_hdr);
-			m->pkt.vlan_macip.f.l3_len = sizeof(*ip_hdr);
+			m->vlan_macip.f.l2_len = sizeof(*eth_hdr);
+			m->vlan_macip.f.l3_len = sizeof(*ip_hdr);
 
 			/* process this fragment. */
 			mo = rte_ipv4_frag_reassemble_packet(tbl, dr, m, tms, ip_hdr);
@@ -455,8 +455,8 @@ reassemble(struct rte_mbuf *m, uint8_t portid, uint32_t queue,
 			dr  = &qconf->death_row;
 
 			/* prepare mbuf: setup l2_len/l3_len. */
-			m->pkt.vlan_macip.f.l2_len = sizeof(*eth_hdr);
-			m->pkt.vlan_macip.f.l3_len = sizeof(*ip_hdr) + sizeof(*frag_hdr);
+			m->vlan_macip.f.l2_len = sizeof(*eth_hdr);
+			m->vlan_macip.f.l3_len = sizeof(*ip_hdr) + sizeof(*frag_hdr);
 
 			mo = rte_ipv6_frag_reassemble_packet(tbl, dr, m, tms, ip_hdr, frag_hdr);
 			if (mo == NULL)
examples/ipv4_multicast/main.c +7 -7
index 7b53296..cc12d9d 100644
@@ -329,17 +329,17 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone)
 	}
 
 	/* prepend new header */
-	hdr->pkt.next = pkt;
+	hdr->next = pkt;
 
 
 	/* update header's fields */
-	hdr->pkt.pkt_len = (uint16_t)(hdr->pkt.data_len + pkt->pkt.pkt_len);
-	hdr->pkt.nb_segs = (uint8_t)(pkt->pkt.nb_segs + 1);
+	hdr->pkt_len = (uint16_t)(hdr->data_len + pkt->pkt_len);
+	hdr->nb_segs = (uint8_t)(pkt->nb_segs + 1);
 
 	/* copy metadata from source packet*/
-	hdr->pkt.in_port = pkt->pkt.in_port;
-	hdr->pkt.vlan_macip = pkt->pkt.vlan_macip;
-	hdr->pkt.hash = pkt->pkt.hash;
+	hdr->in_port = pkt->in_port;
+	hdr->vlan_macip = pkt->vlan_macip;
+	hdr->hash = pkt->hash;
 
 	hdr->ol_flags = pkt->ol_flags;
 
@@ -412,7 +412,7 @@ mcast_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf)
 
 	/* Should we use rte_pktmbuf_clone() or not. */
 	use_clone = (port_num <= MCAST_CLONE_PORTS &&
-	    m->pkt.nb_segs <= MCAST_CLONE_SEGS);
+	    m->nb_segs <= MCAST_CLONE_SEGS);
 
 	/* Mark all packet's segments as referenced port_num times */
 	if (use_clone == 0)
examples/l3fwd-acl/main.c +1 -1
index 9b2c21b..406611f 100644
@@ -709,7 +709,7 @@ prepare_one_packet(struct rte_mbuf **pkts_in, struct acl_search_t *acl,
 			unsigned char *) + sizeof(struct ether_hdr));
 
 		/* Check to make sure the packet is valid (RFC1812) */
-		if (is_valid_ipv4_pkt(ipv4_hdr, pkt->pkt.pkt_len) >= 0) {
+		if (is_valid_ipv4_pkt(ipv4_hdr, pkt->pkt_len) >= 0) {
 
 			/* Update time to live and header checksum */
 			--(ipv4_hdr->time_to_live);
examples/l3fwd-power/main.c +1 -1
index 57fc371..a9d5c80 100644
@@ -687,7 +687,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint8_t portid,
 
 #ifdef DO_RFC_1812_CHECKS
 		/* Check to make sure the packet is valid (RFC1812) */
-		if (is_valid_ipv4_pkt(ipv4_hdr, m->pkt.pkt_len) < 0) {
+		if (is_valid_ipv4_pkt(ipv4_hdr, m->pkt_len) < 0) {
 			rte_pktmbuf_free(m);
 			return;
 		}
examples/l3fwd-vf/main.c +1 -1
index 2ca5c21..7b1e08a 100644
@@ -489,7 +489,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint8_t portid, lookup_struct_t * l3fwd
 
 #ifdef DO_RFC_1812_CHECKS
 	/* Check to make sure the packet is valid (RFC1812) */
-	if (is_valid_ipv4_pkt(ipv4_hdr, m->pkt.pkt_len) < 0) {
+	if (is_valid_ipv4_pkt(ipv4_hdr, m->pkt_len) < 0) {
 		rte_pktmbuf_free(m);
 		return;
 	}
examples/l3fwd/main.c +5 -5
index bef409a..e3e3463 100755
@@ -809,19 +809,19 @@ simple_ipv4_fwd_4pkts(struct rte_mbuf* m[4], uint8_t portid, struct lcore_conf *
 #ifdef DO_RFC_1812_CHECKS
 	/* Check to make sure the packet is valid (RFC1812) */
 	uint8_t valid_mask = MASK_ALL_PKTS;
-	if (is_valid_ipv4_pkt(ipv4_hdr[0], m[0]->pkt.pkt_len) < 0) {
+	if (is_valid_ipv4_pkt(ipv4_hdr[0], m[0]->pkt_len) < 0) {
 		rte_pktmbuf_free(m[0]);
 		valid_mask &= EXECLUDE_1ST_PKT;
 	}
-	if (is_valid_ipv4_pkt(ipv4_hdr[1], m[1]->pkt.pkt_len) < 0) {
+	if (is_valid_ipv4_pkt(ipv4_hdr[1], m[1]->pkt_len) < 0) {
 		rte_pktmbuf_free(m[1]);
 		valid_mask &= EXECLUDE_2ND_PKT;
 	}
-	if (is_valid_ipv4_pkt(ipv4_hdr[2], m[2]->pkt.pkt_len) < 0) {
+	if (is_valid_ipv4_pkt(ipv4_hdr[2], m[2]->pkt_len) < 0) {
 		rte_pktmbuf_free(m[2]);
 		valid_mask &= EXECLUDE_3RD_PKT;
 	}
-	if (is_valid_ipv4_pkt(ipv4_hdr[3], m[3]->pkt.pkt_len) < 0) {
+	if (is_valid_ipv4_pkt(ipv4_hdr[3], m[3]->pkt_len) < 0) {
 		rte_pktmbuf_free(m[3]);
 		valid_mask &= EXECLUDE_4TH_PKT;
 	}
@@ -1009,7 +1009,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint8_t portid, struct lcore_conf *qcon
 
 #ifdef DO_RFC_1812_CHECKS
 		/* Check to make sure the packet is valid (RFC1812) */
-		if (is_valid_ipv4_pkt(ipv4_hdr, m->pkt.pkt_len) < 0) {
+		if (is_valid_ipv4_pkt(ipv4_hdr, m->pkt_len) < 0) {
 			rte_pktmbuf_free(m);
 			return;
 		}
examples/load_balancer/runtime.c +1 -1
index 9612392..b69917b 100644
@@ -540,7 +540,7 @@ app_lcore_worker(
 			ipv4_dst = rte_be_to_cpu_32(ipv4_hdr->dst_addr);
 
 			if (unlikely(rte_lpm_lookup(lp->lpm_table, ipv4_dst, &port) != 0)) {
-				port = pkt->pkt.in_port;
+				port = pkt->in_port;
 			}
 
 			pos = lp->mbuf_out[port].n_mbufs;
examples/multi_process/client_server_mp/mp_client/client.c +1 -1
index 91f70eb..71e4a48 100644
@@ -211,7 +211,7 @@ enqueue_packet(struct rte_mbuf *buf, uint8_t port)
 static void
 handle_packet(struct rte_mbuf *buf)
 {
-	const uint8_t in_port = buf->pkt.in_port;
+	const uint8_t in_port = buf->in_port;
 	const uint8_t out_port = output_ports[in_port];
 
 	enqueue_packet(buf, out_port);
examples/quota_watermark/qw/main.c +2 -2
index 579698b..c8bd62f 100644
@@ -104,8 +104,8 @@ static void send_pause_frame(uint8_t port_id, uint16_t duration)
     pause_frame->opcode = rte_cpu_to_be_16(0x0001);
     pause_frame->param  = rte_cpu_to_be_16(duration);
 
-    mbuf->pkt.pkt_len  = 60;
-    mbuf->pkt.data_len = 60;
+    mbuf->pkt_len  = 60;
+    mbuf->data_len = 60;
 
     rte_eth_tx_burst(port_id, 0, &mbuf, 1);
 }
examples/vhost/main.c +50 -50

246 lines not on this page · raw message

examples/vhost_xen/main.c +11 -11
index b275747..8162cd8 100644
@@ -677,7 +677,7 @@ virtio_dev_rx(struct virtio_net *dev, struct rte_mbuf **pkts, uint32_t count)
 		vq->used->ring[res_cur_idx & (vq->size - 1)].len = packet_len;
 
 		/* Copy mbuf data to buffer */
-		rte_memcpy((void *)(uintptr_t)buff_addr, (const void*)buff->pkt.data, rte_pktmbuf_data_len(buff));
+		rte_memcpy((void *)(uintptr_t)buff_addr, (const void*)buff->data, rte_pktmbuf_data_len(buff));
 
 		res_cur_idx++;
 		packet_success++;
@@ -808,7 +808,7 @@ virtio_tx_local(struct virtio_net *dev, struct rte_mbuf *m)
 	struct ether_hdr *pkt_hdr;
 	uint64_t ret = 0;
 
-	pkt_hdr = (struct ether_hdr *)m->pkt.data;
+	pkt_hdr = (struct ether_hdr *)m->data;
 
 	/*get the used devices list*/
 	dev_ll = ll_root_used;
@@ -879,22 +879,22 @@ virtio_tx_route(struct virtio_net* dev, struct rte_mbuf *m, struct rte_mempool *
 	if(!mbuf)
 		return;
 
-	mbuf->pkt.data_len = m->pkt.data_len + VLAN_HLEN;
-	mbuf->pkt.pkt_len = mbuf->pkt.data_len;
+	mbuf->data_len = m->data_len + VLAN_HLEN;
+	mbuf->pkt_len = mbuf->data_len;
 
 	/* Copy ethernet header to mbuf. */
-	rte_memcpy((void*)mbuf->pkt.data, (const void*)m->pkt.data, ETH_HLEN);
+	rte_memcpy((void*)mbuf->data, (const void*)m->data, ETH_HLEN);
 
 
 	/* Setup vlan header. Bytes need to be re-ordered for network with htons()*/
-	vlan_hdr = (struct vlan_ethhdr *) mbuf->pkt.data;
+	vlan_hdr = (struct vlan_ethhdr *) mbuf->data;
 	vlan_hdr->h_vlan_encapsulated_proto = vlan_hdr->h_vlan_proto;
 	vlan_hdr->h_vlan_proto = htons(ETH_P_8021Q);
 	vlan_hdr->h_vlan_TCI = htons(vlan_tag);
 
 	/* Copy the remaining packet contents to the mbuf. */
-	rte_memcpy((void*) ((uint8_t*)mbuf->pkt.data + VLAN_ETH_HLEN),
-		(const void*) ((uint8_t*)m->pkt.data + ETH_HLEN), (m->pkt.data_len - ETH_HLEN));
+	rte_memcpy((void*) ((uint8_t*)mbuf->data + VLAN_ETH_HLEN),
+		(const void*) ((uint8_t*)m->data + ETH_HLEN), (m->data_len - ETH_HLEN));
 	tx_q->m_table[len] = mbuf;
 	len++;
 	if (enable_stats) {
@@ -980,9 +980,9 @@ virtio_dev_tx(struct virtio_net* dev, struct rte_mempool *mbuf_pool)
 		rte_prefetch0((void*)(uintptr_t)buff_addr);
 
 		/* Setup dummy mbuf. This is copied to a real mbuf if transmitted out the physical port. */
-		m.pkt.data_len = desc->len;
-		m.pkt.data = (void*)(uintptr_t)buff_addr;
-		m.pkt.nb_segs = 1;
+		m.data_len = desc->len;
+		m.data = (void*)(uintptr_t)buff_addr;
+		m.nb_segs = 1;
 
 		virtio_tx_route(dev, &m, mbuf_pool, 0);
 
lib/librte_distributor/rte_distributor.c +1 -1
index 2d92e45..585ff88 100644
@@ -282,7 +282,7 @@ rte_distributor_process(struct rte_distributor *d,
 			next_mb = mbufs[next_idx++];
 			next_value = (((int64_t)(uintptr_t)next_mb)
 					<< RTE_DISTRIB_FLAG_BITS);
-			new_tag = (next_mb->pkt.hash.rss | 1);
+			new_tag = (next_mb->hash.rss | 1);
 
 			uint32_t match = 0;
 			unsigned i;
lib/librte_ip_frag/ip_frag_common.h +7 -7
index 70be949..81ca23a 100644
@@ -173,20 +173,20 @@ ip_frag_chain(struct rte_mbuf *mn, struct rte_mbuf *mp)
 	struct rte_mbuf *ms;
 
 	/* adjust start of the last fragment data. */
-	rte_pktmbuf_adj(mp, (uint16_t)(mp->pkt.vlan_macip.f.l2_len +
-		mp->pkt.vlan_macip.f.l3_len));
+	rte_pktmbuf_adj(mp, (uint16_t)(mp->vlan_macip.f.l2_len +
+		mp->vlan_macip.f.l3_len));
 
 	/* chain two fragments. */
 	ms = rte_pktmbuf_lastseg(mn);
-	ms->pkt.next = mp;
+	ms->next = mp;
 
 	/* accumulate number of segments and total length. */
-	mn->pkt.nb_segs = (uint8_t)(mn->pkt.nb_segs + mp->pkt.nb_segs);
-	mn->pkt.pkt_len += mp->pkt.pkt_len;
+	mn->nb_segs = (uint8_t)(mn->nb_segs + mp->nb_segs);
+	mn->pkt_len += mp->pkt_len;
 
 	/* reset pkt_len and nb_segs for chained fragment. */
-	mp->pkt.pkt_len = mp->pkt.data_len;
-	mp->pkt.nb_segs = 1;
+	mp->pkt_len = mp->data_len;
+	mp->nb_segs = 1;
 }
 
 
lib/librte_ip_frag/rte_ipv4_fragmentation.c +20 -20
index 9d4e1f7..0b10310 100644
@@ -109,7 +109,7 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,
 	/* Fragment size should be a multiply of 8. */
 	IP_FRAG_ASSERT((frag_size & IPV4_HDR_FO_MASK) == 0);
 
-	in_hdr = (struct ipv4_hdr *) pkt_in->pkt.data;
+	in_hdr = (struct ipv4_hdr *) pkt_in->data;
 	flag_offset = rte_cpu_to_be_16(in_hdr->fragment_offset);
 
 	/* If Don't Fragment flag is set */
@@ -118,7 +118,7 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,
 
 	/* Check that pkts_out is big enough to hold all fragments */
 	if (unlikely(frag_size * nb_pkts_out <
-	    (uint16_t)(pkt_in->pkt.pkt_len - sizeof (struct ipv4_hdr))))
+	    (uint16_t)(pkt_in->pkt_len - sizeof (struct ipv4_hdr))))
 		return -EINVAL;
 
 	in_seg = pkt_in;
@@ -140,8 +140,8 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,
 		}
 
 		/* Reserve space for the IP header that will be built later */
-		out_pkt->pkt.data_len = sizeof(struct ipv4_hdr);
-		out_pkt->pkt.pkt_len = sizeof(struct ipv4_hdr);
+		out_pkt->data_len = sizeof(struct ipv4_hdr);
+		out_pkt->pkt_len = sizeof(struct ipv4_hdr);
 
 		out_seg_prev = out_pkt;
 		more_out_segs = 1;
@@ -156,29 +156,29 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,
 				__free_fragments(pkts_out, out_pkt_pos);
 				return -ENOMEM;
 			}
-			out_seg_prev->pkt.next = out_seg;
+			out_seg_prev->next = out_seg;
 			out_seg_prev = out_seg;
 
 			/* Prepare indirect buffer */
 			rte_pktmbuf_attach(out_seg, in_seg);
-			len = mtu_size - out_pkt->pkt.pkt_len;
-			if (len > (in_seg->pkt.data_len - in_seg_data_pos)) {
-				len = in_seg->pkt.data_len - in_seg_data_pos;
+			len = mtu_size - out_pkt->pkt_len;
+			if (len > (in_seg->data_len - in_seg_data_pos)) {
+				len = in_seg->data_len - in_seg_data_pos;
 			}
-			out_seg->pkt.data = (char*) in_seg->pkt.data + (uint16_t)in_seg_data_pos;
-			out_seg->pkt.data_len = (uint16_t)len;
-			out_pkt->pkt.pkt_len = (uint16_t)(len +
-			    out_pkt->pkt.pkt_len);
-			out_pkt->pkt.nb_segs += 1;
+			out_seg->data = (char*) in_seg->data + (uint16_t)in_seg_data_pos;
+			out_seg->data_len = (uint16_t)len;
+			out_pkt->pkt_len = (uint16_t)(len +
+			    out_pkt->pkt_len);
+			out_pkt->nb_segs += 1;
 			in_seg_data_pos += len;
 
 			/* Current output packet (i.e. fragment) done ? */
-			if (unlikely(out_pkt->pkt.pkt_len >= mtu_size))
+			if (unlikely(out_pkt->pkt_len >= mtu_size))
 				more_out_segs = 0;
 
 			/* Current input segment done ? */
-			if (unlikely(in_seg_data_pos == in_seg->pkt.data_len)) {
-				in_seg = in_seg->pkt.next;
+			if (unlikely(in_seg_data_pos == in_seg->data_len)) {
+				in_seg = in_seg->next;
 				in_seg_data_pos = 0;
 
 				if (unlikely(in_seg == NULL))
@@ -188,17 +188,17 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,
 
 		/* Build the IP header */
 
-		out_hdr = (struct ipv4_hdr*) out_pkt->pkt.data;
+		out_hdr = (struct ipv4_hdr*) out_pkt->data;
 
 		__fill_ipv4hdr_frag(out_hdr, in_hdr,
-		    (uint16_t)out_pkt->pkt.pkt_len,
+		    (uint16_t)out_pkt->pkt_len,
 		    flag_offset, fragment_offset, more_in_segs);
 
 		fragment_offset = (uint16_t)(fragment_offset +
-		    out_pkt->pkt.pkt_len - sizeof(struct ipv4_hdr));
+		    out_pkt->pkt_len - sizeof(struct ipv4_hdr));
 
 		out_pkt->ol_flags |= PKT_TX_IP_CKSUM;
-		out_pkt->pkt.vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+		out_pkt->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
 
 		/* Write the fragment to the output list */
 		pkts_out[out_pkt_pos] = out_pkt;
lib/librte_ip_frag/rte_ipv4_reassembly.c +3 -3
index a27b23a..06c37af 100644
@@ -87,10 +87,10 @@ ipv4_frag_reassemble(const struct ip_frag_pkt *fp)
 
 	/* update ipv4 header for the reassmebled packet */
 	ip_hdr = (struct ipv4_hdr*)(rte_pktmbuf_mtod(m, uint8_t *) +
-		m->pkt.vlan_macip.f.l2_len);
+		m->vlan_macip.f.l2_len);
 
 	ip_hdr->total_length = rte_cpu_to_be_16((uint16_t)(fp->total_size +
-		m->pkt.vlan_macip.f.l3_len));
+		m->vlan_macip.f.l3_len));
 	ip_hdr->fragment_offset = (uint16_t)(ip_hdr->fragment_offset &
 		rte_cpu_to_be_16(IPV4_HDR_DF_FLAG));
 	ip_hdr->hdr_checksum = 0;
@@ -137,7 +137,7 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
 
 	ip_ofs *= IPV4_HDR_OFFSET_UNITS;
 	ip_len = (uint16_t)(rte_be_to_cpu_16(ip_hdr->total_length) -
-		mb->pkt.vlan_macip.f.l3_len);
+		mb->vlan_macip.f.l3_len);
 
 	IP_FRAG_LOG(DEBUG, "%s:%d:\n"
 		"mbuf: %p, tms: %" PRIu64
lib/librte_ip_frag/rte_ipv6_fragmentation.c +19 -19
index fa04991..e007662 100644
@@ -122,10 +122,10 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in,
 
 	/* Check that pkts_out is big enough to hold all fragments */
 	if (unlikely (frag_size * nb_pkts_out <
-	    (uint16_t)(pkt_in->pkt.pkt_len - sizeof (struct ipv6_hdr))))
+	    (uint16_t)(pkt_in->pkt_len - sizeof (struct ipv6_hdr))))
 		return (-EINVAL);
 
-	in_hdr = (struct ipv6_hdr *) pkt_in->pkt.data;
+	in_hdr = (struct ipv6_hdr *) pkt_in->data;
 
 	in_seg = pkt_in;
 	in_seg_data_pos = sizeof(struct ipv6_hdr);
@@ -146,8 +146,8 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in,
 		}
 
 		/* Reserve space for the IP header that will be built later */
-		out_pkt->pkt.data_len = sizeof(struct ipv6_hdr) + sizeof(struct ipv6_extension_fragment);
-		out_pkt->pkt.pkt_len  = sizeof(struct ipv6_hdr) + sizeof(struct ipv6_extension_fragment);
+		out_pkt->data_len = sizeof(struct ipv6_hdr) + sizeof(struct ipv6_extension_fragment);
+		out_pkt->pkt_len  = sizeof(struct ipv6_hdr) + sizeof(struct ipv6_extension_fragment);
 
 		out_seg_prev = out_pkt;
 		more_out_segs = 1;
@@ -162,30 +162,30 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in,
 				__free_fragments(pkts_out, out_pkt_pos);
 				return (-ENOMEM);
 			}
-			out_seg_prev->pkt.next = out_seg;
+			out_seg_prev->next = out_seg;
 			out_seg_prev = out_seg;
 
 			/* Prepare indirect buffer */
 			rte_pktmbuf_attach(out_seg, in_seg);
-			len = mtu_size - out_pkt->pkt.pkt_len;
-			if (len > (in_seg->pkt.data_len - in_seg_data_pos)) {
-				len = in_seg->pkt.data_len - in_seg_data_pos;
+			len = mtu_size - out_pkt->pkt_len;
+			if (len > (in_seg->data_len - in_seg_data_pos)) {
+				len = in_seg->data_len - in_seg_data_pos;
 			}
-			out_seg->pkt.data = (char *) in_seg->pkt.data + (uint16_t) in_seg_data_pos;
-			out_seg->pkt.data_len = (uint16_t)len;
-			out_pkt->pkt.pkt_len = (uint16_t)(len +
-			    out_pkt->pkt.pkt_len);
-			out_pkt->pkt.nb_segs += 1;
+			out_seg->data = (char *) in_seg->data + (uint16_t) in_seg_data_pos;
+			out_seg->data_len = (uint16_t)len;
+			out_pkt->pkt_len = (uint16_t)(len +
+			    out_pkt->pkt_len);
+			out_pkt->nb_segs += 1;
 			in_seg_data_pos += len;
 
 			/* Current output packet (i.e. fragment) done ? */
-			if (unlikely(out_pkt->pkt.pkt_len >= mtu_size)) {
+			if (unlikely(out_pkt->pkt_len >= mtu_size)) {
 				more_out_segs = 0;
 			}
 
 			/* Current input segment done ? */
-			if (unlikely(in_seg_data_pos == in_seg->pkt.data_len)) {
-				in_seg = in_seg->pkt.next;
+			if (unlikely(in_seg_data_pos == in_seg->data_len)) {
+				in_seg = in_seg->next;
 				in_seg_data_pos = 0;
 
 				if (unlikely(in_seg == NULL)) {
@@ -196,14 +196,14 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in,
 
 		/* Build the IP header */
 
-		out_hdr = (struct ipv6_hdr *) out_pkt->pkt.data;
+		out_hdr = (struct ipv6_hdr *) out_pkt->data;
 
 		__fill_ipv6hdr_frag(out_hdr, in_hdr,
-		    (uint16_t) out_pkt->pkt.pkt_len - sizeof(struct ipv6_hdr),
+		    (uint16_t) out_pkt->pkt_len - sizeof(struct ipv6_hdr),
 		    fragment_offset, more_in_segs);
 
 		fragment_offset = (uint16_t)(fragment_offset +
-		    out_pkt->pkt.pkt_len - sizeof(struct ipv6_hdr)
+		    out_pkt->pkt_len - sizeof(struct ipv6_hdr)
 			- sizeof(struct ipv6_extension_fragment));
 
 		/* Write the fragment to the output list */
lib/librte_ip_frag/rte_ipv6_reassembly.c +2 -2
index 3f06960..dee3425 100644
@@ -109,7 +109,7 @@ ipv6_frag_reassemble(const struct ip_frag_pkt *fp)
 
 	/* update ipv6 header for the reassembled datagram */
 	ip_hdr = (struct ipv6_hdr *) (rte_pktmbuf_mtod(m, uint8_t *) +
-								  m->pkt.vlan_macip.f.l2_len);
+								  m->vlan_macip.f.l2_len);
 
 	ip_hdr->payload_len = rte_cpu_to_be_16(payload_len);
 
@@ -120,7 +120,7 @@ ipv6_frag_reassemble(const struct ip_frag_pkt *fp)
 	 * other headers, so we assume there are no other headers and thus update
 	 * the main IPv6 header instead.
 	 */
-	move_len = m->pkt.vlan_macip.f.l2_len + m->pkt.vlan_macip.f.l3_len -
+	move_len = m->vlan_macip.f.l2_len + m->vlan_macip.f.l3_len -
 			sizeof(*frag_hdr);
 	frag_hdr = (struct ipv6_extension_fragment *) (ip_hdr + 1);
 	ip_hdr->proto = frag_hdr->next_header;
lib/librte_mbuf/rte_mbuf.c +13 -13
index 3e72a70..d12a0bf 100644
@@ -117,12 +117,12 @@ rte_pktmbuf_init(struct rte_mempool *mp,
 	m->buf_len = (uint16_t)buf_len;
 
 	/* keep some headroom between start of buffer and data */
-	m->pkt.data = (char*) m->buf_addr + RTE_MIN(RTE_PKTMBUF_HEADROOM, m->buf_len);
+	m->data = (char*) m->buf_addr + RTE_MIN(RTE_PKTMBUF_HEADROOM, m->buf_len);
 
 	/* init some constant fields */
 	m->pool = mp;
-	m->pkt.nb_segs = 1;
-	m->pkt.in_port = 0xff;
+	m->nb_segs = 1;
+	m->in_port = 0xff;
 }
 
 /* do some sanity checks on a mbuf: panic if it fails */
@@ -153,10 +153,10 @@ rte_mbuf_sanity_check(const struct rte_mbuf *m, int is_header)
 	if (is_header == 0)
 		return;
 
-	nb_segs = m->pkt.nb_segs;
+	nb_segs = m->nb_segs;
 	m_seg = m;
 	while (m_seg && nb_segs != 0) {
-		m_seg = m_seg->pkt.next;
+		m_seg = m_seg->next;
 		nb_segs--;
 	}
 	if (nb_segs != 0)
@@ -175,22 +175,22 @@ rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m, unsigned dump_len)
 	fprintf(f, "dump mbuf at 0x%p, phys=%"PRIx64", buf_len=%u\n",
 	       m, (uint64_t)m->buf_physaddr, (unsigned)m->buf_len);
 	fprintf(f, "  pkt_len=%"PRIu32", ol_flags=%"PRIx16", nb_segs=%u, "
-	       "in_port=%u\n", m->pkt.pkt_len, m->ol_flags,
-	       (unsigned)m->pkt.nb_segs, (unsigned)m->pkt.in_port);
-	nb_segs = m->pkt.nb_segs;
+	       "in_port=%u\n", m->pkt_len, m->ol_flags,
+	       (unsigned)m->nb_segs, (unsigned)m->in_port);
+	nb_segs = m->nb_segs;
 
 	while (m && nb_segs != 0) {
 		__rte_mbuf_sanity_check(m, 0);
 
 		fprintf(f, "  segment at 0x%p, data=0x%p, data_len=%u\n",
-		       m, m->pkt.data, (unsigned)m->pkt.data_len);
+		       m, m->data, (unsigned)m->data_len);
 		len = dump_len;
-		if (len > m->pkt.data_len)
-			len = m->pkt.data_len;
+		if (len > m->data_len)
+			len = m->data_len;
 		if (len != 0)
-			rte_hexdump(f, NULL, m->pkt.data, len);
+			rte_hexdump(f, NULL, m->data, len);
 		dump_len -= len;
-		m = m->pkt.next;
+		m = m->next;
 		nb_segs --;
 	}
 }
lib/librte_mbuf/rte_mbuf.h +70 -72

283 lines not on this page · raw message

lib/librte_pmd_bond/rte_eth_bond_pmd.c +2 -2
index d72d6ed..5979ce5 100644
@@ -198,14 +198,14 @@ xmit_slave_hash(const struct rte_mbuf *buf, uint8_t slave_count, uint8_t policy)
 
 	switch (policy) {
 	case BALANCE_XMIT_POLICY_LAYER2:
-		eth_hdr = (struct ether_hdr *)buf->pkt.data;
+		eth_hdr = (struct ether_hdr *)buf->data;
 
 		hash = ether_hash(eth_hdr);
 		hash ^= hash >> 8;
 		return hash % slave_count;
 
 	case BALANCE_XMIT_POLICY_LAYER23:
-		eth_hdr = (struct ether_hdr *)buf->pkt.data;
+		eth_hdr = (struct ether_hdr *)buf->data;
 
 		if (buf->ol_flags & PKT_RX_VLAN_PKT)
 			eth_offset = sizeof(struct ether_hdr) + sizeof(struct vlan_hdr);
lib/librte_pmd_e1000/em_rxtx.c +32 -32

156 lines not on this page · raw message

lib/librte_pmd_e1000/igb_rxtx.c +34 -34

149 lines not on this page · raw message

lib/librte_pmd_i40e/i40e_rxtx.c +49 -49

220 lines not on this page · raw message

lib/librte_pmd_ixgbe/ixgbe_rxtx.c +50 -50

227 lines not on this page · raw message

lib/librte_pmd_ixgbe/ixgbe_rxtx.h +1 -1
index 64c0695..4c9cb74 100644
@@ -47,7 +47,7 @@
 #endif
 
 #define RTE_MBUF_DATA_DMA_ADDR(mb) \
-	(uint64_t) ((mb)->buf_physaddr + (uint64_t)((char *)((mb)->pkt.data) - \
+	(uint64_t) ((mb)->buf_physaddr + (uint64_t)((char *)((mb)->data) - \
 	(char *)(mb)->buf_addr))
 
 #define RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mb) \
lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c +9 -11
index 7bb7006..826e085 100644
@@ -48,9 +48,7 @@ static inline void
 ixgbe_rxq_rearm(struct igb_rx_queue *rxq)
 {
 	static const struct rte_mbuf mb_def = {
-		.pkt = {
-			.nb_segs = 1,
-		},
+		.nb_segs = 1,
 	};
 	int i;
 	uint16_t rx_id;
@@ -68,7 +66,7 @@ ixgbe_rxq_rearm(struct igb_rx_queue *rxq)
 
 	rxdp = rxq->rx_ring + rxq->rxrearm_start;
 
-	def_low = _mm_load_si128((__m128i *)&(mb_def.pkt));
+	def_low = _mm_load_si128((__m128i *)&(mb_def.next));
 
 	/* Initialize the mbufs in vector, process 2 mbufs in one loop */
 	for (i = 0; i < RTE_IXGBE_RXQ_REARM_THRESH; i += 2, rxep += 2) {
@@ -99,8 +97,8 @@ ixgbe_rxq_rearm(struct igb_rx_queue *rxq)
 		_mm_store_si128((__m128i *)&rxdp++->read, dma_addr1);
 
 		/* flush mbuf with pkt template */
-		_mm_store_si128((__m128i *)&mb0->pkt, vaddr0);
-		_mm_store_si128((__m128i *)&mb1->pkt, vaddr1);
+		_mm_store_si128((__m128i *)&mb0->next, vaddr0);
+		_mm_store_si128((__m128i *)&mb1->next, vaddr1);
 
 		/* update refcnt per pkt */
 		rte_mbuf_refcnt_set(mb0, 1);
@@ -299,9 +297,9 @@ ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 		staterr = _mm_unpacklo_epi32(sterr_tmp1, sterr_tmp2);
 
 		/* D.3 copy final 3,4 data to rx_pkts */
-		_mm_storeu_si128((__m128i *)&(rx_pkts[pos+3]->pkt.data_len),
+		_mm_storeu_si128((__m128i *)&(rx_pkts[pos+3]->data_len),
 				pkt_mb4);
-		_mm_storeu_si128((__m128i *)&(rx_pkts[pos+2]->pkt.data_len),
+		_mm_storeu_si128((__m128i *)&(rx_pkts[pos+2]->data_len),
 				pkt_mb3);
 
 		/* D.2 pkt 1,2 set in_port/nb_seg and remove crc */
@@ -313,9 +311,9 @@ ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 		staterr = _mm_packs_epi32(staterr, zero);
 
 		/* D.3 copy final 1,2 data to rx_pkts */
-		_mm_storeu_si128((__m128i *)&(rx_pkts[pos+1]->pkt.data_len),
+		_mm_storeu_si128((__m128i *)&(rx_pkts[pos+1]->data_len),
 				pkt_mb2);
-		_mm_storeu_si128((__m128i *)&(rx_pkts[pos]->pkt.data_len),
+		_mm_storeu_si128((__m128i *)&(rx_pkts[pos]->data_len),
 				pkt_mb1);
 
 		/* C.4 calc avaialbe number of desc */
@@ -342,7 +340,7 @@ vtx1(volatile union ixgbe_adv_tx_desc *txdp,
 	/* load buf_addr/buf_physaddr in t0 */
 	t0 = _mm_loadu_si128((__m128i *)&(pkt->buf_addr));
 	/* load data, ... pkt_len in t1 */
-	t1 = _mm_loadu_si128((__m128i *)&(pkt->pkt.data));
+	t1 = _mm_loadu_si128((__m128i *)&(pkt->data));
 
 	/* calc offset = (data - buf_adr) */
 	offset = _mm_sub_epi64(t1, t0);
lib/librte_pmd_pcap/rte_eth_pcap.c +7 -7
index eebe768..121de65 100644
@@ -151,9 +151,9 @@ eth_pcap_rx(void *queue,
 
 		if (header.len <= buf_size) {
 			/* pcap packet will fit in the mbuf, go ahead and copy */
-			rte_memcpy(mbuf->pkt.data, packet, header.len);
-			mbuf->pkt.data_len = (uint16_t)header.len;
-			mbuf->pkt.pkt_len = mbuf->pkt.data_len;
+			rte_memcpy(mbuf->data, packet, header.len);
+			mbuf->data_len = (uint16_t)header.len;
+			mbuf->pkt_len = mbuf->data_len;
 			bufs[num_rx] = mbuf;
 			num_rx++;
 		} else {
@@ -200,9 +200,9 @@ eth_pcap_tx_dumper(void *queue,
 	for (i = 0; i < nb_pkts; i++) {
 		mbuf = bufs[i];
 		calculate_timestamp(&header.ts);
-		header.len = mbuf->pkt.data_len;
+		header.len = mbuf->data_len;
 		header.caplen = header.len;
-		pcap_dump((u_char*) dumper_q->dumper, &header, mbuf->pkt.data);
+		pcap_dump((u_char*) dumper_q->dumper, &header, mbuf->data);
 		rte_pktmbuf_free(mbuf);
 		num_tx++;
 	}
@@ -237,8 +237,8 @@ eth_pcap_tx(void *queue,
 
 	for (i = 0; i < nb_pkts; i++) {
 		mbuf = bufs[i];
-		ret = pcap_sendpacket(tx_queue->pcap, (u_char*) mbuf->pkt.data,
-				mbuf->pkt.data_len);
+		ret = pcap_sendpacket(tx_queue->pcap, (u_char*) mbuf->data,
+				mbuf->data_len);
 		if (unlikely(ret != 0))
 			break;
 		num_tx++;
lib/librte_pmd_virtio/virtio_rxtx.c +29 -29

131 lines not on this page · raw message

lib/librte_pmd_virtio/virtqueue.h +1 -1
index 87db35f..d777feb 100644
@@ -59,7 +59,7 @@
 #define VIRTQUEUE_MAX_NAME_SZ 32
 
 #define RTE_MBUF_DATA_DMA_ADDR(mb) \
-	(uint64_t) ((mb)->buf_physaddr + (uint64_t)((char *)((mb)->pkt.data) - \
+	(uint64_t) ((mb)->buf_physaddr + (uint64_t)((char *)((mb)->data) - \
 	(char *)(mb)->buf_addr))
 
 #define VTNET_SQ_RQ_QUEUE_IDX 0
lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c +13 -13
index 2470c8e..7dd5a98 100644
@@ -79,7 +79,7 @@
 
 
 #define RTE_MBUF_DATA_DMA_ADDR(mb) \
-	(uint64_t) ((mb)->buf_physaddr + (uint64_t)((char *)((mb)->pkt.data) - \
+	(uint64_t) ((mb)->buf_physaddr + (uint64_t)((char *)((mb)->data) - \
 	(char *)(mb)->buf_addr))
 
 #define RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mb) \
@@ -288,7 +288,7 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 
 			txm = tx_pkts[nb_tx];
 			/* Don't support scatter packets yet, free them if met */
-			if (txm->pkt.nb_segs != 1) {
+			if (txm->nb_segs != 1) {
 				PMD_TX_LOG(DEBUG, "Don't support scatter packets yet, drop!");
 				rte_pktmbuf_free(tx_pkts[nb_tx]);
 				txq->stats.drop_total++;
@@ -298,7 +298,7 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			}
 
 			/* Needs to minus ether header len */
-			if (txm->pkt.data_len > (hw->cur_mtu + ETHER_HDR_LEN)) {
+			if (txm->data_len > (hw->cur_mtu + ETHER_HDR_LEN)) {
 				PMD_TX_LOG(DEBUG, "Packet data_len higher than MTU");
 				rte_pktmbuf_free(tx_pkts[nb_tx]);
 				txq->stats.drop_total++;
@@ -313,7 +313,7 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			tbi = txq->cmd_ring.buf_info + txq->cmd_ring.next2fill;
 			tbi->bufPA = RTE_MBUF_DATA_DMA_ADDR(txm);
 			txd->addr = tbi->bufPA;
-			txd->len = txm->pkt.data_len;
+			txd->len = txm->data_len;
 
 			/* Mark the last descriptor as End of Packet. */
 			txd->cq = 1;
@@ -550,21 +550,21 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 					       rte_pktmbuf_mtod(rxm, void *));
 #endif
 				/* Copy vlan tag in packet buffer */
-				rxm->pkt.vlan_macip.f.vlan_tci =
+				rxm->vlan_macip.f.vlan_tci =
 					rte_le_to_cpu_16((uint16_t)rcd->tci);
 
 			} else
 				rxm->ol_flags = 0;
 
 			/* Initialize newly received packet buffer */
-			rxm->pkt.in_port = rxq->port_id;
-			rxm->pkt.nb_segs = 1;
-			rxm->pkt.next = NULL;
-			rxm->pkt.pkt_len = (uint16_t)rcd->len;
-			rxm->pkt.data_len = (uint16_t)rcd->len;
-			rxm->pkt.in_port = rxq->port_id;
-			rxm->pkt.vlan_macip.f.vlan_tci = 0;
-			rxm->pkt.data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
+			rxm->in_port = rxq->port_id;
+			rxm->nb_segs = 1;
+			rxm->next = NULL;
+			rxm->pkt_len = (uint16_t)rcd->len;
+			rxm->data_len = (uint16_t)rcd->len;
+			rxm->in_port = rxq->port_id;
+			rxm->vlan_macip.f.vlan_tci = 0;
+			rxm->data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
 
 			rx_pkts[nb_rx++] = rxm;
 
lib/librte_pmd_xenvirt/rte_eth_xenvirt.c +6 -6
index ba82319..c118652 100644
@@ -109,12 +109,12 @@ eth_xenvirt_rx(void *q, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 	for (i = 0; i < num ; i ++) {
 		rxm = rx_pkts[i];
 		PMD_RX_LOG(DEBUG, "packet len:%d\n", len[i]);
-		rxm->pkt.next = NULL;
-		rxm->pkt.data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
-		rxm->pkt.data_len = (uint16_t)(len[i] - sizeof(struct virtio_net_hdr));
-		rxm->pkt.nb_segs = 1;
-		rxm->pkt.in_port = pi->port_id;
-		rxm->pkt.pkt_len  = (uint32_t)(len[i] - sizeof(struct virtio_net_hdr));
+		rxm->next = NULL;
+		rxm->data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
+		rxm->data_len = (uint16_t)(len[i] - sizeof(struct virtio_net_hdr));
+		rxm->nb_segs = 1;
+		rxm->in_port = pi->port_id;
+		rxm->pkt_len  = (uint32_t)(len[i] - sizeof(struct virtio_net_hdr));
 	}
 	/* allocate new mbuf for the used descriptor */
 	while (likely(!virtqueue_full(rxvq))) {
lib/librte_pmd_xenvirt/virtqueue.h +2 -2
index 81cd938..d8717fe 100644
@@ -54,7 +54,7 @@
  * rather than gpa<->hva in virito spec.
  */
 #define RTE_MBUF_DATA_DMA_ADDR(mb) \
-	((uint64_t)((mb)->pkt.data))
+	((uint64_t)((mb)->data))
 
 enum { VTNET_RQ = 0, VTNET_TQ = 1, VTNET_CQ = 2 };
 
@@ -238,7 +238,7 @@ virtqueue_enqueue_xmit(struct virtqueue *txvq, struct rte_mbuf *cookie)
 	start_dp[idx].addr  = (uintptr_t)NULL;
 	idx = start_dp[idx].next;
 	start_dp[idx].addr  = RTE_MBUF_DATA_DMA_ADDR(cookie);
-	start_dp[idx].len   = cookie->pkt.data_len;
+	start_dp[idx].len   = cookie->data_len;
 	start_dp[idx].flags = 0;
 	idx = start_dp[idx].next;
 	txvq->vq_desc_head_idx = idx;
lib/librte_port/rte_port_frag.c +1 -1
index ce5026f..9f1bd3c 100644
@@ -159,7 +159,7 @@ rte_port_ring_reader_ipv4_frag_rx(void *port,
 		p->n_pkts--;
 
 		/* If not jumbo, pass current packet to output */
-		if (pkt->pkt.pkt_len <= IPV4_MTU_DEFAULT) {
+		if (pkt->pkt_len <= IPV4_MTU_DEFAULT) {
 			pkts[n_pkts_out++] = pkt;
 
 			n_pkts_to_provide = n_pkts - n_pkts_out;
lib/librte_sched/rte_sched.c +7 -7
index 968c2b3..ba60277 100644
@@ -1015,7 +1015,7 @@ rte_sched_port_update_subport_stats(struct rte_sched_port *port, uint32_t qindex
 {
 	struct rte_sched_subport *s = port->subport + (qindex / rte_sched_port_queues_per_subport(port));
 	uint32_t tc_index = (qindex >> 2) & 0x3;
-	uint32_t pkt_len = pkt->pkt.pkt_len;
+	uint32_t pkt_len = pkt->pkt_len;
 
 	s->stats.n_pkts_tc[tc_index] += 1;
 	s->stats.n_bytes_tc[tc_index] += pkt_len;
@@ -1026,7 +1026,7 @@ rte_sched_port_update_subport_stats_on_drop(struct rte_sched_port *port, uint32_
 {
 	struct rte_sched_subport *s = port->subport + (qindex / rte_sched_port_queues_per_subport(port));
 	uint32_t tc_index = (qindex >> 2) & 0x3;
-	uint32_t pkt_len = pkt->pkt.pkt_len;
+	uint32_t pkt_len = pkt->pkt_len;
 
 	s->stats.n_pkts_tc_dropped[tc_index] += 1;
 	s->stats.n_bytes_tc_dropped[tc_index] += pkt_len;
@@ -1036,7 +1036,7 @@ static inline void
 rte_sched_port_update_queue_stats(struct rte_sched_port *port, uint32_t qindex, struct rte_mbuf *pkt)
 {
 	struct rte_sched_queue_extra *qe = port->queue_extra + qindex;
-	uint32_t pkt_len = pkt->pkt.pkt_len;
+	uint32_t pkt_len = pkt->pkt_len;
 
 	qe->stats.n_pkts += 1;
 	qe->stats.n_bytes += pkt_len;
@@ -1046,7 +1046,7 @@ static inline void
 rte_sched_port_update_queue_stats_on_drop(struct rte_sched_port *port, uint32_t qindex, struct rte_mbuf *pkt)
 {
 	struct rte_sched_queue_extra *qe = port->queue_extra + qindex;
-	uint32_t pkt_len = pkt->pkt.pkt_len;
+	uint32_t pkt_len = pkt->pkt_len;
 
 	qe->stats.n_pkts_dropped += 1;
 	qe->stats.n_bytes_dropped += pkt_len;
@@ -1563,7 +1563,7 @@ grinder_credits_check(struct rte_sched_port *port, uint32_t pos)
 	struct rte_sched_pipe *pipe = grinder->pipe;
 	struct rte_mbuf *pkt = grinder->pkt;
 	uint32_t tc_index = grinder->tc_index;
-	uint32_t pkt_len = pkt->pkt.pkt_len + port->frame_overhead;
+	uint32_t pkt_len = pkt->pkt_len + port->frame_overhead;
 	uint32_t subport_tb_credits = subport->tb_credits;
 	uint32_t subport_tc_credits = subport->tc_credits[tc_index];
 	uint32_t pipe_tb_credits = pipe->tb_credits;
@@ -1599,7 +1599,7 @@ grinder_credits_check(struct rte_sched_port *port, uint32_t pos)
 	struct rte_sched_pipe *pipe = grinder->pipe;
 	struct rte_mbuf *pkt = grinder->pkt;
 	uint32_t tc_index = grinder->tc_index;
-	uint32_t pkt_len = pkt->pkt.pkt_len + port->frame_overhead;
+	uint32_t pkt_len = pkt->pkt_len + port->frame_overhead;
 	uint32_t subport_tb_credits = subport->tb_credits;
 	uint32_t subport_tc_credits = subport->tc_credits[tc_index];
 	uint32_t pipe_tb_credits = pipe->tb_credits;
@@ -1640,7 +1640,7 @@ grinder_schedule(struct rte_sched_port *port, uint32_t pos)
 	struct rte_sched_grinder *grinder = port->grinder + pos;
 	struct rte_sched_queue *queue = grinder->queue[grinder->qpos];
 	struct rte_mbuf *pkt = grinder->pkt;
-	uint32_t pkt_len = pkt->pkt.pkt_len + port->frame_overhead;
+	uint32_t pkt_len = pkt->pkt_len + port->frame_overhead;
 
 #if RTE_SCHED_TS_CREDITS_CHECK
 	if (!grinder_credits_check(port, pos)) {
lib/librte_sched/rte_sched.h +5 -5
index 3f27755..e6bba22 100644
@@ -106,7 +106,7 @@ extern "C" {
    2. Start of Frame Delimiter (SFD):       1 byte;
    3. Frame Check Sequence (FCS):           4 bytes;
    4. Inter Frame Gap (IFG):               12 bytes.
-The FCS is considered overhead only if not included in the packet length (field pkt.pkt_len
+The FCS is considered overhead only if not included in the packet length (field pkt_len
 of struct rte_mbuf). */
 #ifndef RTE_SCHED_FRAME_OVERHEAD_DEFAULT
 #define RTE_SCHED_FRAME_OVERHEAD_DEFAULT      24
@@ -196,7 +196,7 @@ struct rte_sched_port_params {
 };
 
 /** Path through the scheduler hierarchy used by the scheduler enqueue operation to
-identify the destination queue for the current packet. Stored in the field pkt.hash.sched
+identify the destination queue for the current packet. Stored in the field hash.sched
 of struct rte_mbuf of each packet, typically written by the classification stage and read by
 scheduler enqueue.*/
 struct rte_sched_port_hierarchy {
@@ -352,7 +352,7 @@ static inline void
 rte_sched_port_pkt_write(struct rte_mbuf *pkt,
 	uint32_t subport, uint32_t pipe, uint32_t traffic_class, uint32_t queue, enum rte_meter_color color)
 {
-	struct rte_sched_port_hierarchy *sched = (struct rte_sched_port_hierarchy *) &pkt->pkt.hash.sched;
+	struct rte_sched_port_hierarchy *sched = (struct rte_sched_port_hierarchy *) &pkt->hash.sched;
 
 	sched->color = (uint32_t) color;
 	sched->subport = subport;
@@ -381,7 +381,7 @@ rte_sched_port_pkt_write(struct rte_mbuf *pkt,
 static inline void
 rte_sched_port_pkt_read_tree_path(struct rte_mbuf *pkt, uint32_t *subport, uint32_t *pipe, uint32_t *traffic_class, uint32_t *queue)
 {
-	struct rte_sched_port_hierarchy *sched = (struct rte_sched_port_hierarchy *) &pkt->pkt.hash.sched;
+	struct rte_sched_port_hierarchy *sched = (struct rte_sched_port_hierarchy *) &pkt->hash.sched;
 
 	*subport = sched->subport;
 	*pipe = sched->pipe;
@@ -392,7 +392,7 @@ rte_sched_port_pkt_read_tree_path(struct rte_mbuf *pkt, uint32_t *subport, uint3
 static inline enum rte_meter_color
 rte_sched_port_pkt_read_color(struct rte_mbuf *pkt)
 {
-	struct rte_sched_port_hierarchy *sched = (struct rte_sched_port_hierarchy *) &pkt->pkt.hash.sched;
+	struct rte_sched_port_hierarchy *sched = (struct rte_sched_port_hierarchy *) &pkt->hash.sched;
 
 	return (enum rte_meter_color) sched->color;
 }
Signature · 1 line
1.9.3

A message that is not in the archive (sent off-list or not yet received): 1409240559-14447-5-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#27 lore raw

PATCH v3 4/6 mbuf: remove the rte_pktmbuf structure

From: Olivier Matz <[email protected]>

The rte_pktmbuf structure was initially included in the rte_mbuf structure. This was needed when there was 2 types of mbuf (ctrl and packet). As the control mbuf has been removed, we can merge the rte_pktmbuf into the rte_mbuf structure.

Advantages of doing this:
- the access to mbuf fields is easier (ex: m->data instead of m->pkt.data)
- make the structure more consistent: for instance, there was no reason to have the ol_flags field in rte_mbuf
- it will allow a deeper reorganization of the rte_mbuf structure in the next commits, allowing to gain several bytes in it

Updated to work with latest code, and to include new example apps.

Changes in V2:
* Further updates to apply to latest HEAD on master

Changes in V3:
* Updated to compile cleanly on 1.7.1

---
 app/test-pmd/cmdline.c                             |   1 -
 app/test-pmd/csumonly.c                            |   6 +-
 app/test-pmd/flowgen.c                             |  16 +--
 app/test-pmd/icmpecho.c                            |   4 +-
 app/test-pmd/ieee1588fwd.c                         |   6 +-
 app/test-pmd/macfwd-retry.c                        |   2 +-
 app/test-pmd/macfwd.c                              |   8 +-
 app/test-pmd/macswap.c                             |   8 +-
 app/test-pmd/rxonly.c                              |  12 +-
 app/test-pmd/testpmd.c                             |   8 +-
 app/test-pmd/testpmd.h                             |   2 +-
 app/test-pmd/txonly.c                              |  42 +++---
 app/test/commands.c                                |   1 -
 app/test/packet_burst_generator.c                  |  46 +++----
 app/test/test_distributor.c                        |  18 +--
 app/test/test_distributor_perf.c                   |   4 +-
 app/test/test_mbuf.c                               |  12 +-
 app/test/test_sched.c                              |   4 +-
 app/test/test_table_acl.c                          |   6 +-
 app/test/test_table_pipeline.c                     |   4 +-
 examples/dpdk_qat/crypto.c                         |  22 ++--
 examples/dpdk_qat/main.c                           |   2 +-
 examples/exception_path/main.c                     |  10 +-
 examples/ip_fragmentation/main.c                   |   6 +-
 examples/ip_pipeline/pipeline_rx.c                 |   4 +-
 examples/ip_pipeline/pipeline_tx.c                 |   2 +-
 examples/ip_reassembly/main.c                      |   8 +-
 examples/ipv4_multicast/main.c                     |  14 +-
 examples/l3fwd-acl/main.c                          |   2 +-
 examples/l3fwd-power/main.c                        |   2 +-
 examples/l3fwd-vf/main.c                           |   2 +-
 examples/l3fwd/main.c                              |  10 +-
 examples/load_balancer/runtime.c                   |   2 +-
 .../client_server_mp/mp_client/client.c            |   2 +-
 examples/quota_watermark/qw/main.c                 |   4 +-
 examples/vhost/main.c                              | 106 +++++++--------
 examples/vhost_xen/main.c                          |  22 ++--
 lib/librte_distributor/rte_distributor.c           |   2 +-
 lib/librte_ip_frag/ip_frag_common.h                |  14 +-
 lib/librte_ip_frag/rte_ipv4_fragmentation.c        |  40 +++---
 lib/librte_ip_frag/rte_ipv4_reassembly.c           |   6 +-
 lib/librte_ip_frag/rte_ipv6_fragmentation.c        |  38 +++---
 lib/librte_ip_frag/rte_ipv6_reassembly.c           |   4 +-
 lib/librte_mbuf/rte_mbuf.c                         |  26 ++--
 lib/librte_mbuf/rte_mbuf.h                         | 142 ++++++++++-----------
 lib/librte_pmd_bond/rte_eth_bond_pmd.c             |   4 +-
 lib/librte_pmd_e1000/em_rxtx.c                     |  64 +++++-----
 lib/librte_pmd_e1000/igb_rxtx.c                    |  68 +++++-----
 lib/librte_pmd_i40e/i40e_rxtx.c                    |  98 +++++++-------
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c                  | 100 +++++++--------
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h                  |   2 +-
 lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c              |  20 ++-
 lib/librte_pmd_pcap/rte_eth_pcap.c                 |  14 +-
 lib/librte_pmd_virtio/virtio_rxtx.c                |  58 ++++-----
 lib/librte_pmd_virtio/virtqueue.h                  |   2 +-
 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c              |  26 ++--
 lib/librte_pmd_xenvirt/rte_eth_xenvirt.c           |  12 +-
 lib/librte_pmd_xenvirt/virtqueue.h                 |   4 +-
 lib/librte_port/rte_port_frag.c                    |   2 +-
 lib/librte_sched/rte_sched.c                       |  14 +-
 lib/librte_sched/rte_sched.h                       |  10 +-
 61 files changed, 597 insertions(+), 603 deletions(-)
app/test-pmd/cmdline.c +0 -1
index 6de38e6..67321f7 100644
@@ -6475,7 +6475,6 @@ dump_struct_sizes(void)
 {
 #define DUMP_SIZE(t) printf("sizeof(" #t ") = %u\n", (unsigned)sizeof(t));
 	DUMP_SIZE(struct rte_mbuf);
-	DUMP_SIZE(struct rte_pktmbuf);
 	DUMP_SIZE(struct rte_mempool);
 	DUMP_SIZE(struct rte_ring);
 #undef DUMP_SIZE
app/test-pmd/csumonly.c +3 -3
index e5a1f52..655b6d8 100644
@@ -263,7 +263,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 		pkt_ol_flags = mb->ol_flags;
 		ol_flags = (uint16_t) (pkt_ol_flags & (~PKT_TX_L4_MASK));
 
-		eth_hdr = (struct ether_hdr *) mb->pkt.data;
+		eth_hdr = (struct ether_hdr *) mb->data;
 		eth_type = rte_be_to_cpu_16(eth_hdr->ether_type);
 		if (eth_type == ETHER_TYPE_VLAN) {
 			/* Only allow single VLAN label here */
@@ -432,8 +432,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 		}
 
 		/* Combine the packet header write. VLAN is not consider here */
-		mb->pkt.vlan_macip.f.l2_len = l2_len;
-		mb->pkt.vlan_macip.f.l3_len = l3_len;
+		mb->vlan_macip.f.l2_len = l2_len;
+		mb->vlan_macip.f.l3_len = l3_len;
 		mb->ol_flags = ol_flags;
 	}
 	nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx);
app/test-pmd/flowgen.c +8 -8
index a8f2a65..17dbf83 100644
@@ -171,11 +171,11 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
 		if (!pkt)
 			break;
 
-		pkt->pkt.data_len = pkt_size;
-		pkt->pkt.next = NULL;
+		pkt->data_len = pkt_size;
+		pkt->next = NULL;
 
 		/* Initialize Ethernet header. */
-		eth_hdr = (struct ether_hdr *)pkt->pkt.data;
+		eth_hdr = (struct ether_hdr *)pkt->data;
 		ether_addr_copy(&cfg_ether_dst, &eth_hdr->d_addr);
 		ether_addr_copy(&cfg_ether_src, &eth_hdr->s_addr);
 		eth_hdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4);
@@ -205,12 +205,12 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
 		udp_hdr->dgram_len	= RTE_CPU_TO_BE_16(pkt_size -
 							   sizeof(*eth_hdr) -
 							   sizeof(*ip_hdr));
-		pkt->pkt.nb_segs		= 1;
-		pkt->pkt.pkt_len		= pkt_size;
+		pkt->nb_segs			= 1;
+		pkt->pkt_len			= pkt_size;
 		pkt->ol_flags			= ol_flags;
-		pkt->pkt.vlan_macip.f.vlan_tci	= vlan_tci;
-		pkt->pkt.vlan_macip.f.l2_len	= sizeof(struct ether_hdr);
-		pkt->pkt.vlan_macip.f.l3_len	= sizeof(struct ipv4_hdr);
+		pkt->vlan_macip.f.vlan_tci	= vlan_tci;
+		pkt->vlan_macip.f.l2_len	= sizeof(struct ether_hdr);
+		pkt->vlan_macip.f.l3_len	= sizeof(struct ipv4_hdr);
 		pkts_burst[nb_pkt]		= pkt;
 
 		next_flow = (next_flow + 1) % cfg_n_flows;
app/test-pmd/icmpecho.c +2 -2
index c28ff5a..4a277b8 100644
@@ -330,12 +330,12 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs)
 	nb_replies = 0;
 	for (i = 0; i < nb_rx; i++) {
 		pkt = pkts_burst[i];
-		eth_h = (struct ether_hdr *) pkt->pkt.data;
+		eth_h = (struct ether_hdr *) pkt->data;
 		eth_type = RTE_BE_TO_CPU_16(eth_h->ether_type);
 		l2_len = sizeof(struct ether_hdr);
 		if (verbose_level > 0) {
 			printf("\nPort %d pkt-len=%u nb-segs=%u\n",
-			       fs->rx_port, pkt->pkt.pkt_len, pkt->pkt.nb_segs);
+			       fs->rx_port, pkt->pkt_len, pkt->nb_segs);
 			ether_addr_dump("  ETH:  src=", &eth_h->s_addr);
 			ether_addr_dump(" dst=", &eth_h->d_addr);
 		}
app/test-pmd/ieee1588fwd.c +3 -3
index 3ce9979..ab5e06e 100644
@@ -546,7 +546,7 @@ ieee1588_packet_fwd(struct fwd_stream *fs)
 	 * Check that the received packet is a PTP packet that was detected
 	 * by the hardware.
 	 */
-	eth_hdr = (struct ether_hdr *)mb->pkt.data;
+	eth_hdr = (struct ether_hdr *)mb->data;
 	eth_type = rte_be_to_cpu_16(eth_hdr->ether_type);
 	if (! (mb->ol_flags & PKT_RX_IEEE1588_PTP)) {
 		if (eth_type == ETHER_TYPE_1588) {
@@ -557,7 +557,7 @@ ieee1588_packet_fwd(struct fwd_stream *fs)
 			printf("Port %u Received non PTP packet type=0x%4x "
 			       "len=%u\n",
 			       (unsigned) fs->rx_port, eth_type,
-			       (unsigned) mb->pkt.pkt_len);
+			       (unsigned) mb->pkt_len);
 		}
 		rte_pktmbuf_free(mb);
 		return;
@@ -574,7 +574,7 @@ ieee1588_packet_fwd(struct fwd_stream *fs)
 	 * Check that the received PTP packet is a PTP V2 packet of type
 	 * PTP_SYNC_MESSAGE.
 	 */
-	ptp_hdr = (struct ptpv2_msg *) ((char *) mb->pkt.data +
+	ptp_hdr = (struct ptpv2_msg *) ((char *) mb->data +
 					sizeof(struct ether_hdr));
 	if (ptp_hdr->version != 0x02) {
 		printf("Port %u Received PTP V2 Ethernet frame with wrong PTP"
app/test-pmd/macfwd-retry.c +1 -1
index f4e06c4..5122983 100644
@@ -119,7 +119,7 @@ pkt_burst_mac_retry_forward(struct fwd_stream *fs)
 	fs->rx_packets += nb_rx;
 	for (i = 0; i < nb_rx; i++) {
 		mb = pkts_burst[i];
-		eth_hdr = (struct ether_hdr *) mb->pkt.data;
+		eth_hdr = (struct ether_hdr *) mb->data;
 		ether_addr_copy(&peer_eth_addrs[fs->peer_addr],
 				&eth_hdr->d_addr);
 		ether_addr_copy(&ports[fs->tx_port].eth_addr,
app/test-pmd/macfwd.c +4 -4
index fc8f749..999c8e3 100644
@@ -110,15 +110,15 @@ pkt_burst_mac_forward(struct fwd_stream *fs)
 	txp = &ports[fs->tx_port];
 	for (i = 0; i < nb_rx; i++) {
 		mb = pkts_burst[i];
-		eth_hdr = (struct ether_hdr *) mb->pkt.data;
+		eth_hdr = (struct ether_hdr *) mb->data;
 		ether_addr_copy(&peer_eth_addrs[fs->peer_addr],
 				&eth_hdr->d_addr);
 		ether_addr_copy(&ports[fs->tx_port].eth_addr,
 				&eth_hdr->s_addr);
 		mb->ol_flags = txp->tx_ol_flags;
-		mb->pkt.vlan_macip.f.l2_len = sizeof(struct ether_hdr);
-		mb->pkt.vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
-		mb->pkt.vlan_macip.f.vlan_tci = txp->tx_vlan_id;
+		mb->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
+		mb->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+		mb->vlan_macip.f.vlan_tci = txp->tx_vlan_id;
 	}
 	nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx);
 	fs->tx_packets += nb_tx;
app/test-pmd/macswap.c +4 -4
index 4ed6096..731f487 100644
@@ -110,7 +110,7 @@ pkt_burst_mac_swap(struct fwd_stream *fs)
 	txp = &ports[fs->tx_port];
 	for (i = 0; i < nb_rx; i++) {
 		mb = pkts_burst[i];
-		eth_hdr = (struct ether_hdr *) mb->pkt.data;
+		eth_hdr = (struct ether_hdr *) mb->data;
 
 		/* Swap dest and src mac addresses. */
 		ether_addr_copy(&eth_hdr->d_addr, &addr);
@@ -118,9 +118,9 @@ pkt_burst_mac_swap(struct fwd_stream *fs)
 		ether_addr_copy(&addr, &eth_hdr->s_addr);
 
 		mb->ol_flags = txp->tx_ol_flags;
-		mb->pkt.vlan_macip.f.l2_len = sizeof(struct ether_hdr);
-		mb->pkt.vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
-		mb->pkt.vlan_macip.f.vlan_tci = txp->tx_vlan_id;
+		mb->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
+		mb->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+		mb->vlan_macip.f.vlan_tci = txp->tx_vlan_id;
 	}
 	nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx);
 	fs->tx_packets += nb_tx;
app/test-pmd/rxonly.c +6 -6
index 5f21a3e..c34a5e1 100644
@@ -149,24 +149,24 @@ pkt_burst_receive(struct fwd_stream *fs)
 			rte_pktmbuf_free(mb);
 			continue;
 		}
-		eth_hdr = (struct ether_hdr *) mb->pkt.data;
+		eth_hdr = (struct ether_hdr *) mb->data;
 		eth_type = RTE_BE_TO_CPU_16(eth_hdr->ether_type);
 		ol_flags = mb->ol_flags;
 		print_ether_addr("  src=", &eth_hdr->s_addr);
 		print_ether_addr(" - dst=", &eth_hdr->d_addr);
 		printf(" - type=0x%04x - length=%u - nb_segs=%d",
-		       eth_type, (unsigned) mb->pkt.pkt_len,
-		       (int)mb->pkt.nb_segs);
+		       eth_type, (unsigned) mb->pkt_len,
+		       (int)mb->nb_segs);
 		if (ol_flags & PKT_RX_RSS_HASH) {
-			printf(" - RSS hash=0x%x", (unsigned) mb->pkt.hash.rss);
+			printf(" - RSS hash=0x%x", (unsigned) mb->hash.rss);
 			printf(" - RSS queue=0x%x",(unsigned) fs->rx_queue);
 		}
 		else if (ol_flags & PKT_RX_FDIR)
 			printf(" - FDIR hash=0x%x - FDIR id=0x%x ",
-			       mb->pkt.hash.fdir.hash, mb->pkt.hash.fdir.id);
+			       mb->hash.fdir.hash, mb->hash.fdir.id);
 		if (ol_flags & PKT_RX_VLAN_PKT)
 			printf(" - VLAN tci=0x%x",
-				mb->pkt.vlan_macip.f.vlan_tci);
+				mb->vlan_macip.f.vlan_tci);
 		printf("\n");
 		if (ol_flags != 0) {
 			int rxf;
app/test-pmd/testpmd.c +4 -4
index 2d74c5c..d13a53a 100644
@@ -404,10 +404,10 @@ testpmd_mbuf_ctor(struct rte_mempool *mp,
 			mb_ctor_arg->seg_buf_offset);
 	mb->buf_len      = mb_ctor_arg->seg_buf_size;
 	mb->ol_flags     = 0;
-	mb->pkt.data     = (char *) mb->buf_addr + RTE_PKTMBUF_HEADROOM;
-	mb->pkt.nb_segs  = 1;
-	mb->pkt.vlan_macip.data = 0;
-	mb->pkt.hash.rss = 0;
+	mb->data         = (char *) mb->buf_addr + RTE_PKTMBUF_HEADROOM;
+	mb->nb_segs      = 1;
+	mb->vlan_macip.data = 0;
+	mb->hash.rss     = 0;
 }
 
 static void
app/test-pmd/testpmd.h +1 -1
index b8322a2..09923a8 100644
@@ -60,7 +60,7 @@ int main(int argc, char **argv);
  * The maximum number of segments per packet is used when creating
  * scattered transmit packets composed of a list of mbufs.
  */
-#define RTE_MAX_SEGS_PER_PKT 255 /**< pkt.nb_segs is a 8-bit unsigned char. */
+#define RTE_MAX_SEGS_PER_PKT 255 /**< nb_segs is a 8-bit unsigned char. */
 
 #define MAX_PKT_BURST 512
 #define DEF_PKT_BURST 32
app/test-pmd/txonly.c +21 -21

78 lines not on this page · raw message

app/test/commands.c +0 -1
index 9ea3c62..a9e36b1 100644
@@ -136,7 +136,6 @@ dump_struct_sizes(void)
 {
 #define DUMP_SIZE(t) printf("sizeof(" #t ") = %u\n", (unsigned)sizeof(t));
 	DUMP_SIZE(struct rte_mbuf);
-	DUMP_SIZE(struct rte_pktmbuf);
 	DUMP_SIZE(struct rte_mempool);
 	DUMP_SIZE(struct rte_ring);
 #undef DUMP_SIZE
app/test/packet_burst_generator.c +23 -23

89 lines not on this page · raw message

app/test/test_distributor.c +9 -9
index eca974d..ce06436 100644
@@ -120,7 +120,7 @@ sanity_test(struct rte_distributor *d, struct rte_mempool *p)
 	/* now set all hash values in all buffers to zero, so all pkts go to the
 	 * one worker thread */
 	for (i = 0; i < BURST; i++)
-		bufs[i]->pkt.hash.rss = 0;
+		bufs[i]->hash.rss = 0;
 
 	rte_distributor_process(d, bufs, BURST);
 	rte_distributor_flush(d);
@@ -142,7 +142,7 @@ sanity_test(struct rte_distributor *d, struct rte_mempool *p)
 	if (rte_lcore_count() >= 3) {
 		clear_packet_count();
 		for (i = 0; i < BURST; i++)
-			bufs[i]->pkt.hash.rss = (i & 1) << 8;
+			bufs[i]->hash.rss = (i & 1) << 8;
 
 		rte_distributor_process(d, bufs, BURST);
 		rte_distributor_flush(d);
@@ -167,7 +167,7 @@ sanity_test(struct rte_distributor *d, struct rte_mempool *p)
 	 * so load gets distributed */
 	clear_packet_count();
 	for (i = 0; i < BURST; i++)
-		bufs[i]->pkt.hash.rss = i;
+		bufs[i]->hash.rss = i;
 
 	rte_distributor_process(d, bufs, BURST);
 	rte_distributor_flush(d);
@@ -199,7 +199,7 @@ sanity_test(struct rte_distributor *d, struct rte_mempool *p)
 		return -1;
 	}
 	for (i = 0; i < BIG_BATCH; i++)
-		many_bufs[i]->pkt.hash.rss = i << 2;
+		many_bufs[i]->hash.rss = i << 2;
 
 	for (i = 0; i < BIG_BATCH/BURST; i++) {
 		rte_distributor_process(d, &many_bufs[i*BURST], BURST);
@@ -280,7 +280,7 @@ sanity_test_with_mbuf_alloc(struct rte_distributor *d, struct rte_mempool *p)
 		while (rte_mempool_get_bulk(p, (void *)bufs, BURST) < 0)
 			rte_distributor_process(d, NULL, 0);
 		for (j = 0; j < BURST; j++) {
-			bufs[j]->pkt.hash.rss = (i+j) << 1;
+			bufs[j]->hash.rss = (i+j) << 1;
 			rte_mbuf_refcnt_set(bufs[j], 1);
 		}
 
@@ -359,7 +359,7 @@ sanity_test_with_worker_shutdown(struct rte_distributor *d,
 	/* now set all hash values in all buffers to zero, so all pkts go to the
 	 * one worker thread */
 	for (i = 0; i < BURST; i++)
-		bufs[i]->pkt.hash.rss = 0;
+		bufs[i]->hash.rss = 0;
 
 	rte_distributor_process(d, bufs, BURST);
 	/* at this point, we will have processed some packets and have a full
@@ -372,7 +372,7 @@ sanity_test_with_worker_shutdown(struct rte_distributor *d,
 		return -1;
 	}
 	for (i = 0; i < BURST; i++)
-		bufs[i]->pkt.hash.rss = 0;
+		bufs[i]->hash.rss = 0;
 
 	/* get worker zero to quit */
 	zero_quit = 1;
@@ -416,7 +416,7 @@ test_flush_with_worker_shutdown(struct rte_distributor *d,
 	/* now set all hash values in all buffers to zero, so all pkts go to the
 	 * one worker thread */
 	for (i = 0; i < BURST; i++)
-		bufs[i]->pkt.hash.rss = 0;
+		bufs[i]->hash.rss = 0;
 
 	rte_distributor_process(d, bufs, BURST);
 	/* at this point, we will have processed some packets and have a full
@@ -488,7 +488,7 @@ quit_workers(struct rte_distributor *d, struct rte_mempool *p)
 	zero_quit = 0;
 	quit = 1;
 	for (i = 0; i < num_workers; i++)
-		bufs[i]->pkt.hash.rss = i << 1;
+		bufs[i]->hash.rss = i << 1;
 	rte_distributor_process(d, bufs, num_workers);
 
 	rte_mempool_put_bulk(p, (void *)bufs, num_workers);
app/test/test_distributor_perf.c +2 -2
index 849387d..b04864c 100644
@@ -159,7 +159,7 @@ perf_test(struct rte_distributor *d, struct rte_mempool *p)
 	}
 	/* ensure we have different hash value for each pkt */
 	for (i = 0; i < BURST; i++)
-		bufs[i]->pkt.hash.rss = i;
+		bufs[i]->hash.rss = i;
 
 	start = rte_rdtsc();
 	for (i = 0; i < (1<<ITER_POWER); i++)
@@ -198,7 +198,7 @@ quit_workers(struct rte_distributor *d, struct rte_mempool *p)
 
 	quit = 1;
 	for (i = 0; i < num_workers; i++)
-		bufs[i]->pkt.hash.rss = i << 1;
+		bufs[i]->hash.rss = i << 1;
 	rte_distributor_process(d, bufs, num_workers);
 
 	rte_mempool_put_bulk(p, (void *)bufs, num_workers);
app/test/test_mbuf.c +6 -6
index 280b1ab..b81e622 100644
@@ -344,8 +344,8 @@ testclone_testupdate_testdetach(void)
 		GOTO_FAIL("cannot clone data\n");
 	rte_pktmbuf_free(clone);
 
-	mc->pkt.next = rte_pktmbuf_alloc(pktmbuf_pool);
-	if(mc->pkt.next == NULL)
+	mc->next = rte_pktmbuf_alloc(pktmbuf_pool);
+	if(mc->next == NULL)
 		GOTO_FAIL("Next Pkt Null\n");
 
 	clone = rte_pktmbuf_clone(mc, pktmbuf_pool);
@@ -432,7 +432,7 @@ test_pktmbuf_pool_ptr(void)
 			printf("rte_pktmbuf_alloc() failed (%u)\n", i);
 			ret = -1;
 		}
-		m[i]->pkt.data = RTE_PTR_ADD(m[i]->pkt.data, 64);
+		m[i]->data = RTE_PTR_ADD(m[i]->data, 64);
 	}
 
 	/* free them */
@@ -451,8 +451,8 @@ test_pktmbuf_pool_ptr(void)
 			printf("rte_pktmbuf_alloc() failed (%u)\n", i);
 			ret = -1;
 		}
-		if (m[i]->pkt.data != RTE_PTR_ADD(m[i]->buf_addr, RTE_PKTMBUF_HEADROOM)) {
-			printf ("pkt.data pointer not set properly\n");
+		if (m[i]->data != RTE_PTR_ADD(m[i]->buf_addr, RTE_PKTMBUF_HEADROOM)) {
+			printf ("data pointer not set properly\n");
 			ret = -1;
 		}
 	}
@@ -493,7 +493,7 @@ test_pktmbuf_free_segment(void)
 			mb = m[i];
 			while(mb != NULL) {
 				mt = mb;
-				mb = mb->pkt.next;
+				mb = mb->next;
 				rte_pktmbuf_free_seg(mt);
 			}
 		}
app/test/test_sched.c +2 -2
index ce47084..c957d80 100644
@@ -145,8 +145,8 @@ prepare_pkt(struct rte_mbuf *mbuf)
 	rte_sched_port_pkt_write(mbuf, SUBPORT, PIPE, TC, QUEUE, e_RTE_METER_YELLOW);
 
 	/* 64 byte packet */
-	mbuf->pkt.pkt_len  = 60;
-	mbuf->pkt.data_len = 60;
+	mbuf->pkt_len  = 60;
+	mbuf->data_len = 60;
 }
 
 
app/test/test_table_acl.c +3 -3
index dda0570..4db680a 100644
@@ -513,7 +513,7 @@ test_pipeline_single_filter(int expected_count)
 			struct rte_mbuf *mbuf;
 
 			mbuf = rte_pktmbuf_alloc(pool);
-			memset(mbuf->pkt.data, 0x00,
+			memset(mbuf->data, 0x00,
 				sizeof(struct ipv4_5tuple));
 
 			five_tuple.proto = j;
@@ -522,7 +522,7 @@ test_pipeline_single_filter(int expected_count)
 			five_tuple.port_src = rte_bswap16(100 + j);
 			five_tuple.port_dst = rte_bswap16(200 + j);
 
-			memcpy(mbuf->pkt.data, &five_tuple,
+			memcpy(mbuf->data, &five_tuple,
 				sizeof(struct ipv4_5tuple));
 			RTE_LOG(INFO, PIPELINE, "%s: Enqueue onto ring %d\n",
 				__func__, i);
@@ -549,7 +549,7 @@ test_pipeline_single_filter(int expected_count)
 			printf("Got %d object(s) from ring %d!\n", ret, i);
 			for (j = 0; j < ret; j++) {
 				mbuf = (struct rte_mbuf *)objs[j];
-				rte_hexdump(stdout, "mbuf", mbuf->pkt.data, 64);
+				rte_hexdump(stdout, "mbuf", mbuf->data, 64);
 				rte_pktmbuf_free(mbuf);
 			}
 			tx_count += ret;
app/test/test_table_pipeline.c +2 -2
index 70b1015..15a038b 100644
@@ -498,8 +498,8 @@ test_pipeline_single_filter(int test_type, int expected_count)
 			printf("Got %d object(s) from ring %d!\n", ret, i);
 			for (j = 0; j < ret; j++) {
 				mbuf = (struct rte_mbuf *)objs[j];
-				rte_hexdump(stdout, "Object:", mbuf->pkt.data,
-					mbuf->pkt.data_len);
+				rte_hexdump(stdout, "Object:", mbuf->data,
+					mbuf->data_len);
 				rte_pktmbuf_free(mbuf);
 			}
 			tx_count += ret;
examples/dpdk_qat/crypto.c +11 -11
index 577ab32..318d47c 100644
@@ -183,7 +183,7 @@ struct glob_keys g_crypto_hash_keys = {
  *
  */
 #define PACKET_DATA_START_PHYS(p) \
-		((p)->buf_physaddr + ((char *)p->pkt.data - (char *)p->buf_addr))
+		((p)->buf_physaddr + ((char *)p->data - (char *)p->buf_addr))
 
 /*
  * A fixed offset to where the crypto is to be performed, which is the first
@@ -773,7 +773,7 @@ enum crypto_result
 crypto_encrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 {
 	CpaCySymDpOpData *opData =
-			(CpaCySymDpOpData *) ((char *) (rte_buff->pkt.data)
+			(CpaCySymDpOpData *) ((char *) (rte_buff->data)
 					+ CRYPTO_OFFSET_TO_OPDATA);
 	uint32_t lcore_id;
 
@@ -785,7 +785,7 @@ crypto_encrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 	bzero(opData, sizeof(CpaCySymDpOpData));
 
 	opData->srcBuffer = opData->dstBuffer = PACKET_DATA_START_PHYS(rte_buff);
-	opData->srcBufferLen = opData->dstBufferLen = rte_buff->pkt.data_len;
+	opData->srcBufferLen = opData->dstBufferLen = rte_buff->data_len;
 	opData->sessionCtx = qaCoreConf[lcore_id].encryptSessionHandleTbl[c][h];
 	opData->thisPhys = PACKET_DATA_START_PHYS(rte_buff)
 			+ CRYPTO_OFFSET_TO_OPDATA;
@@ -805,7 +805,7 @@ crypto_encrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 			opData->ivLenInBytes = IV_LENGTH_8_BYTES;
 
 		opData->cryptoStartSrcOffsetInBytes = CRYPTO_START_OFFSET;
-		opData->messageLenToCipherInBytes = rte_buff->pkt.data_len
+		opData->messageLenToCipherInBytes = rte_buff->data_len
 				- CRYPTO_START_OFFSET;
 		/*
 		 * Work around for padding, message length has to be a multiple of
@@ -818,7 +818,7 @@ crypto_encrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 	if (NO_HASH != h) {
 
 		opData->hashStartSrcOffsetInBytes = HASH_START_OFFSET;
-		opData->messageLenToHashInBytes = rte_buff->pkt.data_len
+		opData->messageLenToHashInBytes = rte_buff->data_len
 				- HASH_START_OFFSET;
 		/*
 		 * Work around for padding, message length has to be a multiple of block
@@ -831,7 +831,7 @@ crypto_encrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 		 * Assumption: Ok ignore the passed digest pointer and place HMAC at end
 		 * of packet.
 		 */
-		opData->digestResult = rte_buff->buf_physaddr + rte_buff->pkt.data_len;
+		opData->digestResult = rte_buff->buf_physaddr + rte_buff->data_len;
 	}
 
 	if (CPA_STATUS_SUCCESS != enqueueOp(opData, lcore_id)) {
@@ -848,7 +848,7 @@ enum crypto_result
 crypto_decrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 {
 
-	CpaCySymDpOpData *opData = (void*) (((char *) rte_buff->pkt.data)
+	CpaCySymDpOpData *opData = (void*) (((char *) rte_buff->data)
 			+ CRYPTO_OFFSET_TO_OPDATA);
 	uint32_t lcore_id;
 
@@ -860,7 +860,7 @@ crypto_decrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 	bzero(opData, sizeof(CpaCySymDpOpData));
 
 	opData->dstBuffer = opData->srcBuffer = PACKET_DATA_START_PHYS(rte_buff);
-	opData->dstBufferLen = opData->srcBufferLen = rte_buff->pkt.data_len;
+	opData->dstBufferLen = opData->srcBufferLen = rte_buff->data_len;
 	opData->thisPhys = PACKET_DATA_START_PHYS(rte_buff)
 			+ CRYPTO_OFFSET_TO_OPDATA;
 	opData->sessionCtx = qaCoreConf[lcore_id].decryptSessionHandleTbl[c][h];
@@ -880,7 +880,7 @@ crypto_decrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 			opData->ivLenInBytes = IV_LENGTH_8_BYTES;
 
 		opData->cryptoStartSrcOffsetInBytes = CRYPTO_START_OFFSET;
-		opData->messageLenToCipherInBytes = rte_buff->pkt.data_len
+		opData->messageLenToCipherInBytes = rte_buff->data_len
 				- CRYPTO_START_OFFSET;
 
 		/*
@@ -892,7 +892,7 @@ crypto_decrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 	}
 	if (NO_HASH != h) {
 		opData->hashStartSrcOffsetInBytes = HASH_START_OFFSET;
-		opData->messageLenToHashInBytes = rte_buff->pkt.data_len
+		opData->messageLenToHashInBytes = rte_buff->data_len
 				- HASH_START_OFFSET;
 		/*
 		 * Work around for padding, message length has to be a multiple of block
@@ -900,7 +900,7 @@ crypto_decrypt(struct rte_mbuf *rte_buff, enum cipher_alg c, enum hash_alg h)
 		 */
 		opData->messageLenToHashInBytes -= opData->messageLenToHashInBytes
 				% HASH_BLOCK_DEFAULT_SIZE;
-		opData->digestResult = rte_buff->buf_physaddr + rte_buff->pkt.data_len;
+		opData->digestResult = rte_buff->buf_physaddr + rte_buff->data_len;
 	}
 
 	if (CPA_STATUS_SUCCESS != enqueueOp(opData, lcore_id)) {
examples/dpdk_qat/main.c +1 -1
index d61db4c..75c9876 100644
@@ -384,7 +384,7 @@ main_loop(__attribute__((unused)) void *dummy)
 			}
 		}
 
-		port = dst_ports[pkt->pkt.in_port];
+		port = dst_ports[pkt->in_port];
 
 		/* Transmit the packet */
 		nic_tx_send_packet(pkt, (uint8_t)port);
examples/exception_path/main.c +5 -5
index 0204116..5045ef8 100644
@@ -302,16 +302,16 @@ main_loop(__attribute__((unused)) void *arg)
 			if (m == NULL)
 				continue;
 
-			ret = read(tap_fd, m->pkt.data, MAX_PACKET_SZ);
+			ret = read(tap_fd, m->data, MAX_PACKET_SZ);
 			lcore_stats[lcore_id].rx++;
 			if (unlikely(ret < 0)) {
 				FATAL_ERROR("Reading from %s interface failed",
 				            tap_name);
 			}
-			m->pkt.nb_segs = 1;
-			m->pkt.next = NULL;
-			m->pkt.pkt_len = (uint16_t)ret;
-			m->pkt.data_len = (uint16_t)ret;
+			m->nb_segs = 1;
+			m->next = NULL;
+			m->pkt_len = (uint16_t)ret;
+			m->data_len = (uint16_t)ret;
 			ret = rte_eth_tx_burst(port_ids[lcore_id], 0, &m, 1);
 			if (unlikely(ret < 1)) {
 				rte_pktmbuf_free(m);
examples/ip_fragmentation/main.c +3 -3
index 72cd2b2..ac8d4f7 100644
@@ -342,7 +342,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf,
 		}
 
 		/* if we don't need to do any fragmentation */
-		if (likely (IPV4_MTU_DEFAULT >= m->pkt.pkt_len)) {
+		if (likely (IPV4_MTU_DEFAULT >= m->pkt_len)) {
 			qconf->tx_mbufs[port_out].m_table[len] = m;
 			len2 = 1;
 		} else {
@@ -379,7 +379,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf,
 		}
 
 		/* if we don't need to do any fragmentation */
-		if (likely (IPV6_MTU_DEFAULT >= m->pkt.pkt_len)) {
+		if (likely (IPV6_MTU_DEFAULT >= m->pkt_len)) {
 			qconf->tx_mbufs[port_out].m_table[len] = m;
 			len2 = 1;
 		} else {
@@ -413,7 +413,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf,
 			rte_panic("No headroom in mbuf.\n");
 		}
 
-		m->pkt.vlan_macip.f.l2_len = sizeof(struct ether_hdr);
+		m->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
 
 		/* 02:00:00:00:00:xx */
 		d_addr_bytes = &eth_hdr->d_addr.addr_bytes[0];
examples/ip_pipeline/pipeline_rx.c +2 -2
index e43ebfa..7a8309c 100644
@@ -255,8 +255,8 @@ app_pkt_metadata_fill(struct rte_mbuf *m)
 	/* Pop Ethernet header */
 	if (app.ether_hdr_pop_push) {
 		rte_pktmbuf_adj(m, (uint16_t)sizeof(struct ether_hdr));
-		m->pkt.vlan_macip.f.l2_len = 0;
-		m->pkt.vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+		m->vlan_macip.f.l2_len = 0;
+		m->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
 	}
 }
 
examples/ip_pipeline/pipeline_tx.c +1 -1
index 3bf2c8b..b9491e3 100644
@@ -66,7 +66,7 @@ app_pkt_metadata_flush(struct rte_mbuf *pkt)
 	ether_addr_copy(&pkt_meta->nh_arp, &ether_hdr->d_addr);
 	ether_addr_copy(&local_ether_addr, &ether_hdr->s_addr);
 	ether_hdr->ether_type = rte_bswap16(ETHER_TYPE_IPv4);
-	pkt->pkt.vlan_macip.f.l2_len = sizeof(struct ether_hdr);
+	pkt->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
 }
 
 static int
examples/ip_reassembly/main.c +4 -4
index 3bb6afd..8184aad 100644
@@ -412,8 +412,8 @@ reassemble(struct rte_mbuf *m, uint8_t portid, uint32_t queue,
 			dr = &qconf->death_row;
 
 			/* prepare mbuf: setup l2_len/l3_len. */
-			m->pkt.vlan_macip.f.l2_len = sizeof(*eth_hdr);
-			m->pkt.vlan_macip.f.l3_len = sizeof(*ip_hdr);
+			m->vlan_macip.f.l2_len = sizeof(*eth_hdr);
+			m->vlan_macip.f.l3_len = sizeof(*ip_hdr);
 
 			/* process this fragment. */
 			mo = rte_ipv4_frag_reassemble_packet(tbl, dr, m, tms, ip_hdr);
@@ -455,8 +455,8 @@ reassemble(struct rte_mbuf *m, uint8_t portid, uint32_t queue,
 			dr  = &qconf->death_row;
 
 			/* prepare mbuf: setup l2_len/l3_len. */
-			m->pkt.vlan_macip.f.l2_len = sizeof(*eth_hdr);
-			m->pkt.vlan_macip.f.l3_len = sizeof(*ip_hdr) + sizeof(*frag_hdr);
+			m->vlan_macip.f.l2_len = sizeof(*eth_hdr);
+			m->vlan_macip.f.l3_len = sizeof(*ip_hdr) + sizeof(*frag_hdr);
 
 			mo = rte_ipv6_frag_reassemble_packet(tbl, dr, m, tms, ip_hdr, frag_hdr);
 			if (mo == NULL)
examples/ipv4_multicast/main.c +7 -7
index 7b53296..cc12d9d 100644
@@ -329,17 +329,17 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone)
 	}
 
 	/* prepend new header */
-	hdr->pkt.next = pkt;
+	hdr->next = pkt;
 
 
 	/* update header's fields */
-	hdr->pkt.pkt_len = (uint16_t)(hdr->pkt.data_len + pkt->pkt.pkt_len);
-	hdr->pkt.nb_segs = (uint8_t)(pkt->pkt.nb_segs + 1);
+	hdr->pkt_len = (uint16_t)(hdr->data_len + pkt->pkt_len);
+	hdr->nb_segs = (uint8_t)(pkt->nb_segs + 1);
 
 	/* copy metadata from source packet*/
-	hdr->pkt.in_port = pkt->pkt.in_port;
-	hdr->pkt.vlan_macip = pkt->pkt.vlan_macip;
-	hdr->pkt.hash = pkt->pkt.hash;
+	hdr->in_port = pkt->in_port;
+	hdr->vlan_macip = pkt->vlan_macip;
+	hdr->hash = pkt->hash;
 
 	hdr->ol_flags = pkt->ol_flags;
 
@@ -412,7 +412,7 @@ mcast_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf)
 
 	/* Should we use rte_pktmbuf_clone() or not. */
 	use_clone = (port_num <= MCAST_CLONE_PORTS &&
-	    m->pkt.nb_segs <= MCAST_CLONE_SEGS);
+	    m->nb_segs <= MCAST_CLONE_SEGS);
 
 	/* Mark all packet's segments as referenced port_num times */
 	if (use_clone == 0)
examples/l3fwd-acl/main.c +1 -1
index eac0eab..bafd26a 100644
@@ -700,7 +700,7 @@ prepare_one_packet(struct rte_mbuf **pkts_in, struct acl_search_t *acl,
 			unsigned char *) + sizeof(struct ether_hdr));
 
 		/* Check to make sure the packet is valid (RFC1812) */
-		if (is_valid_ipv4_pkt(ipv4_hdr, pkt->pkt.pkt_len) >= 0) {
+		if (is_valid_ipv4_pkt(ipv4_hdr, pkt->pkt_len) >= 0) {
 
 			/* Update time to live and header checksum */
 			--(ipv4_hdr->time_to_live);
examples/l3fwd-power/main.c +1 -1
index 57fc371..a9d5c80 100644
@@ -687,7 +687,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint8_t portid,
 
 #ifdef DO_RFC_1812_CHECKS
 		/* Check to make sure the packet is valid (RFC1812) */
-		if (is_valid_ipv4_pkt(ipv4_hdr, m->pkt.pkt_len) < 0) {
+		if (is_valid_ipv4_pkt(ipv4_hdr, m->pkt_len) < 0) {
 			rte_pktmbuf_free(m);
 			return;
 		}
examples/l3fwd-vf/main.c +1 -1
index 2ca5c21..7b1e08a 100644
@@ -489,7 +489,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint8_t portid, lookup_struct_t * l3fwd
 
 #ifdef DO_RFC_1812_CHECKS
 	/* Check to make sure the packet is valid (RFC1812) */
-	if (is_valid_ipv4_pkt(ipv4_hdr, m->pkt.pkt_len) < 0) {
+	if (is_valid_ipv4_pkt(ipv4_hdr, m->pkt_len) < 0) {
 		rte_pktmbuf_free(m);
 		return;
 	}
examples/l3fwd/main.c +5 -5
index bef409a..e3e3463 100644
@@ -809,19 +809,19 @@ simple_ipv4_fwd_4pkts(struct rte_mbuf* m[4], uint8_t portid, struct lcore_conf *
 #ifdef DO_RFC_1812_CHECKS
 	/* Check to make sure the packet is valid (RFC1812) */
 	uint8_t valid_mask = MASK_ALL_PKTS;
-	if (is_valid_ipv4_pkt(ipv4_hdr[0], m[0]->pkt.pkt_len) < 0) {
+	if (is_valid_ipv4_pkt(ipv4_hdr[0], m[0]->pkt_len) < 0) {
 		rte_pktmbuf_free(m[0]);
 		valid_mask &= EXECLUDE_1ST_PKT;
 	}
-	if (is_valid_ipv4_pkt(ipv4_hdr[1], m[1]->pkt.pkt_len) < 0) {
+	if (is_valid_ipv4_pkt(ipv4_hdr[1], m[1]->pkt_len) < 0) {
 		rte_pktmbuf_free(m[1]);
 		valid_mask &= EXECLUDE_2ND_PKT;
 	}
-	if (is_valid_ipv4_pkt(ipv4_hdr[2], m[2]->pkt.pkt_len) < 0) {
+	if (is_valid_ipv4_pkt(ipv4_hdr[2], m[2]->pkt_len) < 0) {
 		rte_pktmbuf_free(m[2]);
 		valid_mask &= EXECLUDE_3RD_PKT;
 	}
-	if (is_valid_ipv4_pkt(ipv4_hdr[3], m[3]->pkt.pkt_len) < 0) {
+	if (is_valid_ipv4_pkt(ipv4_hdr[3], m[3]->pkt_len) < 0) {
 		rte_pktmbuf_free(m[3]);
 		valid_mask &= EXECLUDE_4TH_PKT;
 	}
@@ -1009,7 +1009,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint8_t portid, struct lcore_conf *qcon
 
 #ifdef DO_RFC_1812_CHECKS
 		/* Check to make sure the packet is valid (RFC1812) */
-		if (is_valid_ipv4_pkt(ipv4_hdr, m->pkt.pkt_len) < 0) {
+		if (is_valid_ipv4_pkt(ipv4_hdr, m->pkt_len) < 0) {
 			rte_pktmbuf_free(m);
 			return;
 		}
examples/load_balancer/runtime.c +1 -1
index 9612392..b69917b 100644
@@ -540,7 +540,7 @@ app_lcore_worker(
 			ipv4_dst = rte_be_to_cpu_32(ipv4_hdr->dst_addr);
 
 			if (unlikely(rte_lpm_lookup(lp->lpm_table, ipv4_dst, &port) != 0)) {
-				port = pkt->pkt.in_port;
+				port = pkt->in_port;
 			}
 
 			pos = lp->mbuf_out[port].n_mbufs;
examples/multi_process/client_server_mp/mp_client/client.c +1 -1
index 91f70eb..71e4a48 100644
@@ -211,7 +211,7 @@ enqueue_packet(struct rte_mbuf *buf, uint8_t port)
 static void
 handle_packet(struct rte_mbuf *buf)
 {
-	const uint8_t in_port = buf->pkt.in_port;
+	const uint8_t in_port = buf->in_port;
 	const uint8_t out_port = output_ports[in_port];
 
 	enqueue_packet(buf, out_port);
examples/quota_watermark/qw/main.c +2 -2
index 579698b..c8bd62f 100644
@@ -104,8 +104,8 @@ static void send_pause_frame(uint8_t port_id, uint16_t duration)
     pause_frame->opcode = rte_cpu_to_be_16(0x0001);
     pause_frame->param  = rte_cpu_to_be_16(duration);
 
-    mbuf->pkt.pkt_len  = 60;
-    mbuf->pkt.data_len = 60;
+    mbuf->pkt_len  = 60;
+    mbuf->data_len = 60;
 
     rte_eth_tx_burst(port_id, 0, &mbuf, 1);
 }
examples/vhost/main.c +53 -53

258 lines not on this page · raw message

examples/vhost_xen/main.c +11 -11
index b275747..8162cd8 100644
@@ -677,7 +677,7 @@ virtio_dev_rx(struct virtio_net *dev, struct rte_mbuf **pkts, uint32_t count)
 		vq->used->ring[res_cur_idx & (vq->size - 1)].len = packet_len;
 
 		/* Copy mbuf data to buffer */
-		rte_memcpy((void *)(uintptr_t)buff_addr, (const void*)buff->pkt.data, rte_pktmbuf_data_len(buff));
+		rte_memcpy((void *)(uintptr_t)buff_addr, (const void*)buff->data, rte_pktmbuf_data_len(buff));
 
 		res_cur_idx++;
 		packet_success++;
@@ -808,7 +808,7 @@ virtio_tx_local(struct virtio_net *dev, struct rte_mbuf *m)
 	struct ether_hdr *pkt_hdr;
 	uint64_t ret = 0;
 
-	pkt_hdr = (struct ether_hdr *)m->pkt.data;
+	pkt_hdr = (struct ether_hdr *)m->data;
 
 	/*get the used devices list*/
 	dev_ll = ll_root_used;
@@ -879,22 +879,22 @@ virtio_tx_route(struct virtio_net* dev, struct rte_mbuf *m, struct rte_mempool *
 	if(!mbuf)
 		return;
 
-	mbuf->pkt.data_len = m->pkt.data_len + VLAN_HLEN;
-	mbuf->pkt.pkt_len = mbuf->pkt.data_len;
+	mbuf->data_len = m->data_len + VLAN_HLEN;
+	mbuf->pkt_len = mbuf->data_len;
 
 	/* Copy ethernet header to mbuf. */
-	rte_memcpy((void*)mbuf->pkt.data, (const void*)m->pkt.data, ETH_HLEN);
+	rte_memcpy((void*)mbuf->data, (const void*)m->data, ETH_HLEN);
 
 
 	/* Setup vlan header. Bytes need to be re-ordered for network with htons()*/
-	vlan_hdr = (struct vlan_ethhdr *) mbuf->pkt.data;
+	vlan_hdr = (struct vlan_ethhdr *) mbuf->data;
 	vlan_hdr->h_vlan_encapsulated_proto = vlan_hdr->h_vlan_proto;
 	vlan_hdr->h_vlan_proto = htons(ETH_P_8021Q);
 	vlan_hdr->h_vlan_TCI = htons(vlan_tag);
 
 	/* Copy the remaining packet contents to the mbuf. */
-	rte_memcpy((void*) ((uint8_t*)mbuf->pkt.data + VLAN_ETH_HLEN),
-		(const void*) ((uint8_t*)m->pkt.data + ETH_HLEN), (m->pkt.data_len - ETH_HLEN));
+	rte_memcpy((void*) ((uint8_t*)mbuf->data + VLAN_ETH_HLEN),
+		(const void*) ((uint8_t*)m->data + ETH_HLEN), (m->data_len - ETH_HLEN));
 	tx_q->m_table[len] = mbuf;
 	len++;
 	if (enable_stats) {
@@ -980,9 +980,9 @@ virtio_dev_tx(struct virtio_net* dev, struct rte_mempool *mbuf_pool)
 		rte_prefetch0((void*)(uintptr_t)buff_addr);
 
 		/* Setup dummy mbuf. This is copied to a real mbuf if transmitted out the physical port. */
-		m.pkt.data_len = desc->len;
-		m.pkt.data = (void*)(uintptr_t)buff_addr;
-		m.pkt.nb_segs = 1;
+		m.data_len = desc->len;
+		m.data = (void*)(uintptr_t)buff_addr;
+		m.nb_segs = 1;
 
 		virtio_tx_route(dev, &m, mbuf_pool, 0);
 
lib/librte_distributor/rte_distributor.c +1 -1
index 2d92e45..585ff88 100644
@@ -282,7 +282,7 @@ rte_distributor_process(struct rte_distributor *d,
 			next_mb = mbufs[next_idx++];
 			next_value = (((int64_t)(uintptr_t)next_mb)
 					<< RTE_DISTRIB_FLAG_BITS);
-			new_tag = (next_mb->pkt.hash.rss | 1);
+			new_tag = (next_mb->hash.rss | 1);
 
 			uint32_t match = 0;
 			unsigned i;
lib/librte_ip_frag/ip_frag_common.h +7 -7
index 70be949..81ca23a 100644
@@ -173,20 +173,20 @@ ip_frag_chain(struct rte_mbuf *mn, struct rte_mbuf *mp)
 	struct rte_mbuf *ms;
 
 	/* adjust start of the last fragment data. */
-	rte_pktmbuf_adj(mp, (uint16_t)(mp->pkt.vlan_macip.f.l2_len +
-		mp->pkt.vlan_macip.f.l3_len));
+	rte_pktmbuf_adj(mp, (uint16_t)(mp->vlan_macip.f.l2_len +
+		mp->vlan_macip.f.l3_len));
 
 	/* chain two fragments. */
 	ms = rte_pktmbuf_lastseg(mn);
-	ms->pkt.next = mp;
+	ms->next = mp;
 
 	/* accumulate number of segments and total length. */
-	mn->pkt.nb_segs = (uint8_t)(mn->pkt.nb_segs + mp->pkt.nb_segs);
-	mn->pkt.pkt_len += mp->pkt.pkt_len;
+	mn->nb_segs = (uint8_t)(mn->nb_segs + mp->nb_segs);
+	mn->pkt_len += mp->pkt_len;
 
 	/* reset pkt_len and nb_segs for chained fragment. */
-	mp->pkt.pkt_len = mp->pkt.data_len;
-	mp->pkt.nb_segs = 1;
+	mp->pkt_len = mp->data_len;
+	mp->nb_segs = 1;
 }
 
 
lib/librte_ip_frag/rte_ipv4_fragmentation.c +20 -20
index 9d4e1f7..0b10310 100644
@@ -109,7 +109,7 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,
 	/* Fragment size should be a multiply of 8. */
 	IP_FRAG_ASSERT((frag_size & IPV4_HDR_FO_MASK) == 0);
 
-	in_hdr = (struct ipv4_hdr *) pkt_in->pkt.data;
+	in_hdr = (struct ipv4_hdr *) pkt_in->data;
 	flag_offset = rte_cpu_to_be_16(in_hdr->fragment_offset);
 
 	/* If Don't Fragment flag is set */
@@ -118,7 +118,7 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,
 
 	/* Check that pkts_out is big enough to hold all fragments */
 	if (unlikely(frag_size * nb_pkts_out <
-	    (uint16_t)(pkt_in->pkt.pkt_len - sizeof (struct ipv4_hdr))))
+	    (uint16_t)(pkt_in->pkt_len - sizeof (struct ipv4_hdr))))
 		return -EINVAL;
 
 	in_seg = pkt_in;
@@ -140,8 +140,8 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,
 		}
 
 		/* Reserve space for the IP header that will be built later */
-		out_pkt->pkt.data_len = sizeof(struct ipv4_hdr);
-		out_pkt->pkt.pkt_len = sizeof(struct ipv4_hdr);
+		out_pkt->data_len = sizeof(struct ipv4_hdr);
+		out_pkt->pkt_len = sizeof(struct ipv4_hdr);
 
 		out_seg_prev = out_pkt;
 		more_out_segs = 1;
@@ -156,29 +156,29 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,
 				__free_fragments(pkts_out, out_pkt_pos);
 				return -ENOMEM;
 			}
-			out_seg_prev->pkt.next = out_seg;
+			out_seg_prev->next = out_seg;
 			out_seg_prev = out_seg;
 
 			/* Prepare indirect buffer */
 			rte_pktmbuf_attach(out_seg, in_seg);
-			len = mtu_size - out_pkt->pkt.pkt_len;
-			if (len > (in_seg->pkt.data_len - in_seg_data_pos)) {
-				len = in_seg->pkt.data_len - in_seg_data_pos;
+			len = mtu_size - out_pkt->pkt_len;
+			if (len > (in_seg->data_len - in_seg_data_pos)) {
+				len = in_seg->data_len - in_seg_data_pos;
 			}
-			out_seg->pkt.data = (char*) in_seg->pkt.data + (uint16_t)in_seg_data_pos;
-			out_seg->pkt.data_len = (uint16_t)len;
-			out_pkt->pkt.pkt_len = (uint16_t)(len +
-			    out_pkt->pkt.pkt_len);
-			out_pkt->pkt.nb_segs += 1;
+			out_seg->data = (char*) in_seg->data + (uint16_t)in_seg_data_pos;
+			out_seg->data_len = (uint16_t)len;
+			out_pkt->pkt_len = (uint16_t)(len +
+			    out_pkt->pkt_len);
+			out_pkt->nb_segs += 1;
 			in_seg_data_pos += len;
 
 			/* Current output packet (i.e. fragment) done ? */
-			if (unlikely(out_pkt->pkt.pkt_len >= mtu_size))
+			if (unlikely(out_pkt->pkt_len >= mtu_size))
 				more_out_segs = 0;
 
 			/* Current input segment done ? */
-			if (unlikely(in_seg_data_pos == in_seg->pkt.data_len)) {
-				in_seg = in_seg->pkt.next;
+			if (unlikely(in_seg_data_pos == in_seg->data_len)) {
+				in_seg = in_seg->next;
 				in_seg_data_pos = 0;
 
 				if (unlikely(in_seg == NULL))
@@ -188,17 +188,17 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,
 
 		/* Build the IP header */
 
-		out_hdr = (struct ipv4_hdr*) out_pkt->pkt.data;
+		out_hdr = (struct ipv4_hdr*) out_pkt->data;
 
 		__fill_ipv4hdr_frag(out_hdr, in_hdr,
-		    (uint16_t)out_pkt->pkt.pkt_len,
+		    (uint16_t)out_pkt->pkt_len,
 		    flag_offset, fragment_offset, more_in_segs);
 
 		fragment_offset = (uint16_t)(fragment_offset +
-		    out_pkt->pkt.pkt_len - sizeof(struct ipv4_hdr));
+		    out_pkt->pkt_len - sizeof(struct ipv4_hdr));
 
 		out_pkt->ol_flags |= PKT_TX_IP_CKSUM;
-		out_pkt->pkt.vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+		out_pkt->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
 
 		/* Write the fragment to the output list */
 		pkts_out[out_pkt_pos] = out_pkt;
lib/librte_ip_frag/rte_ipv4_reassembly.c +3 -3
index a27b23a..06c37af 100644
@@ -87,10 +87,10 @@ ipv4_frag_reassemble(const struct ip_frag_pkt *fp)
 
 	/* update ipv4 header for the reassmebled packet */
 	ip_hdr = (struct ipv4_hdr*)(rte_pktmbuf_mtod(m, uint8_t *) +
-		m->pkt.vlan_macip.f.l2_len);
+		m->vlan_macip.f.l2_len);
 
 	ip_hdr->total_length = rte_cpu_to_be_16((uint16_t)(fp->total_size +
-		m->pkt.vlan_macip.f.l3_len));
+		m->vlan_macip.f.l3_len));
 	ip_hdr->fragment_offset = (uint16_t)(ip_hdr->fragment_offset &
 		rte_cpu_to_be_16(IPV4_HDR_DF_FLAG));
 	ip_hdr->hdr_checksum = 0;
@@ -137,7 +137,7 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
 
 	ip_ofs *= IPV4_HDR_OFFSET_UNITS;
 	ip_len = (uint16_t)(rte_be_to_cpu_16(ip_hdr->total_length) -
-		mb->pkt.vlan_macip.f.l3_len);
+		mb->vlan_macip.f.l3_len);
 
 	IP_FRAG_LOG(DEBUG, "%s:%d:\n"
 		"mbuf: %p, tms: %" PRIu64
lib/librte_ip_frag/rte_ipv6_fragmentation.c +19 -19
index fa04991..e007662 100644
@@ -122,10 +122,10 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in,
 
 	/* Check that pkts_out is big enough to hold all fragments */
 	if (unlikely (frag_size * nb_pkts_out <
-	    (uint16_t)(pkt_in->pkt.pkt_len - sizeof (struct ipv6_hdr))))
+	    (uint16_t)(pkt_in->pkt_len - sizeof (struct ipv6_hdr))))
 		return (-EINVAL);
 
-	in_hdr = (struct ipv6_hdr *) pkt_in->pkt.data;
+	in_hdr = (struct ipv6_hdr *) pkt_in->data;
 
 	in_seg = pkt_in;
 	in_seg_data_pos = sizeof(struct ipv6_hdr);
@@ -146,8 +146,8 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in,
 		}
 
 		/* Reserve space for the IP header that will be built later */
-		out_pkt->pkt.data_len = sizeof(struct ipv6_hdr) + sizeof(struct ipv6_extension_fragment);
-		out_pkt->pkt.pkt_len  = sizeof(struct ipv6_hdr) + sizeof(struct ipv6_extension_fragment);
+		out_pkt->data_len = sizeof(struct ipv6_hdr) + sizeof(struct ipv6_extension_fragment);
+		out_pkt->pkt_len  = sizeof(struct ipv6_hdr) + sizeof(struct ipv6_extension_fragment);
 
 		out_seg_prev = out_pkt;
 		more_out_segs = 1;
@@ -162,30 +162,30 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in,
 				__free_fragments(pkts_out, out_pkt_pos);
 				return (-ENOMEM);
 			}
-			out_seg_prev->pkt.next = out_seg;
+			out_seg_prev->next = out_seg;
 			out_seg_prev = out_seg;
 
 			/* Prepare indirect buffer */
 			rte_pktmbuf_attach(out_seg, in_seg);
-			len = mtu_size - out_pkt->pkt.pkt_len;
-			if (len > (in_seg->pkt.data_len - in_seg_data_pos)) {
-				len = in_seg->pkt.data_len - in_seg_data_pos;
+			len = mtu_size - out_pkt->pkt_len;
+			if (len > (in_seg->data_len - in_seg_data_pos)) {
+				len = in_seg->data_len - in_seg_data_pos;
 			}
-			out_seg->pkt.data = (char *) in_seg->pkt.data + (uint16_t) in_seg_data_pos;
-			out_seg->pkt.data_len = (uint16_t)len;
-			out_pkt->pkt.pkt_len = (uint16_t)(len +
-			    out_pkt->pkt.pkt_len);
-			out_pkt->pkt.nb_segs += 1;
+			out_seg->data = (char *) in_seg->data + (uint16_t) in_seg_data_pos;
+			out_seg->data_len = (uint16_t)len;
+			out_pkt->pkt_len = (uint16_t)(len +
+			    out_pkt->pkt_len);
+			out_pkt->nb_segs += 1;
 			in_seg_data_pos += len;
 
 			/* Current output packet (i.e. fragment) done ? */
-			if (unlikely(out_pkt->pkt.pkt_len >= mtu_size)) {
+			if (unlikely(out_pkt->pkt_len >= mtu_size)) {
 				more_out_segs = 0;
 			}
 
 			/* Current input segment done ? */
-			if (unlikely(in_seg_data_pos == in_seg->pkt.data_len)) {
-				in_seg = in_seg->pkt.next;
+			if (unlikely(in_seg_data_pos == in_seg->data_len)) {
+				in_seg = in_seg->next;
 				in_seg_data_pos = 0;
 
 				if (unlikely(in_seg == NULL)) {
@@ -196,14 +196,14 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in,
 
 		/* Build the IP header */
 
-		out_hdr = (struct ipv6_hdr *) out_pkt->pkt.data;
+		out_hdr = (struct ipv6_hdr *) out_pkt->data;
 
 		__fill_ipv6hdr_frag(out_hdr, in_hdr,
-		    (uint16_t) out_pkt->pkt.pkt_len - sizeof(struct ipv6_hdr),
+		    (uint16_t) out_pkt->pkt_len - sizeof(struct ipv6_hdr),
 		    fragment_offset, more_in_segs);
 
 		fragment_offset = (uint16_t)(fragment_offset +
-		    out_pkt->pkt.pkt_len - sizeof(struct ipv6_hdr)
+		    out_pkt->pkt_len - sizeof(struct ipv6_hdr)
 			- sizeof(struct ipv6_extension_fragment));
 
 		/* Write the fragment to the output list */
lib/librte_ip_frag/rte_ipv6_reassembly.c +2 -2
index 3f06960..dee3425 100644
@@ -109,7 +109,7 @@ ipv6_frag_reassemble(const struct ip_frag_pkt *fp)
 
 	/* update ipv6 header for the reassembled datagram */
 	ip_hdr = (struct ipv6_hdr *) (rte_pktmbuf_mtod(m, uint8_t *) +
-								  m->pkt.vlan_macip.f.l2_len);
+								  m->vlan_macip.f.l2_len);
 
 	ip_hdr->payload_len = rte_cpu_to_be_16(payload_len);
 
@@ -120,7 +120,7 @@ ipv6_frag_reassemble(const struct ip_frag_pkt *fp)
 	 * other headers, so we assume there are no other headers and thus update
 	 * the main IPv6 header instead.
 	 */
-	move_len = m->pkt.vlan_macip.f.l2_len + m->pkt.vlan_macip.f.l3_len -
+	move_len = m->vlan_macip.f.l2_len + m->vlan_macip.f.l3_len -
 			sizeof(*frag_hdr);
 	frag_hdr = (struct ipv6_extension_fragment *) (ip_hdr + 1);
 	ip_hdr->proto = frag_hdr->next_header;
lib/librte_mbuf/rte_mbuf.c +13 -13
index 3e72a70..d12a0bf 100644
@@ -117,12 +117,12 @@ rte_pktmbuf_init(struct rte_mempool *mp,
 	m->buf_len = (uint16_t)buf_len;
 
 	/* keep some headroom between start of buffer and data */
-	m->pkt.data = (char*) m->buf_addr + RTE_MIN(RTE_PKTMBUF_HEADROOM, m->buf_len);
+	m->data = (char*) m->buf_addr + RTE_MIN(RTE_PKTMBUF_HEADROOM, m->buf_len);
 
 	/* init some constant fields */
 	m->pool = mp;
-	m->pkt.nb_segs = 1;
-	m->pkt.in_port = 0xff;
+	m->nb_segs = 1;
+	m->in_port = 0xff;
 }
 
 /* do some sanity checks on a mbuf: panic if it fails */
@@ -153,10 +153,10 @@ rte_mbuf_sanity_check(const struct rte_mbuf *m, int is_header)
 	if (is_header == 0)
 		return;
 
-	nb_segs = m->pkt.nb_segs;
+	nb_segs = m->nb_segs;
 	m_seg = m;
 	while (m_seg && nb_segs != 0) {
-		m_seg = m_seg->pkt.next;
+		m_seg = m_seg->next;
 		nb_segs--;
 	}
 	if (nb_segs != 0)
@@ -175,22 +175,22 @@ rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m, unsigned dump_len)
 	fprintf(f, "dump mbuf at 0x%p, phys=%"PRIx64", buf_len=%u\n",
 	       m, (uint64_t)m->buf_physaddr, (unsigned)m->buf_len);
 	fprintf(f, "  pkt_len=%"PRIu32", ol_flags=%"PRIx16", nb_segs=%u, "
-	       "in_port=%u\n", m->pkt.pkt_len, m->ol_flags,
-	       (unsigned)m->pkt.nb_segs, (unsigned)m->pkt.in_port);
-	nb_segs = m->pkt.nb_segs;
+	       "in_port=%u\n", m->pkt_len, m->ol_flags,
+	       (unsigned)m->nb_segs, (unsigned)m->in_port);
+	nb_segs = m->nb_segs;
 
 	while (m && nb_segs != 0) {
 		__rte_mbuf_sanity_check(m, 0);
 
 		fprintf(f, "  segment at 0x%p, data=0x%p, data_len=%u\n",
-		       m, m->pkt.data, (unsigned)m->pkt.data_len);
+		       m, m->data, (unsigned)m->data_len);
 		len = dump_len;
-		if (len > m->pkt.data_len)
-			len = m->pkt.data_len;
+		if (len > m->data_len)
+			len = m->data_len;
 		if (len != 0)
-			rte_hexdump(f, NULL, m->pkt.data, len);
+			rte_hexdump(f, NULL, m->data, len);
 		dump_len -= len;
-		m = m->pkt.next;
+		m = m->next;
 		nb_segs --;
 	}
 }
lib/librte_mbuf/rte_mbuf.h +70 -72

283 lines not on this page · raw message

lib/librte_pmd_bond/rte_eth_bond_pmd.c +2 -2
index d72d6ed..5979ce5 100644
@@ -198,14 +198,14 @@ xmit_slave_hash(const struct rte_mbuf *buf, uint8_t slave_count, uint8_t policy)
 
 	switch (policy) {
 	case BALANCE_XMIT_POLICY_LAYER2:
-		eth_hdr = (struct ether_hdr *)buf->pkt.data;
+		eth_hdr = (struct ether_hdr *)buf->data;
 
 		hash = ether_hash(eth_hdr);
 		hash ^= hash >> 8;
 		return hash % slave_count;
 
 	case BALANCE_XMIT_POLICY_LAYER23:
-		eth_hdr = (struct ether_hdr *)buf->pkt.data;
+		eth_hdr = (struct ether_hdr *)buf->data;
 
 		if (buf->ol_flags & PKT_RX_VLAN_PKT)
 			eth_offset = sizeof(struct ether_hdr) + sizeof(struct vlan_hdr);
lib/librte_pmd_e1000/em_rxtx.c +32 -32

156 lines not on this page · raw message

lib/librte_pmd_e1000/igb_rxtx.c +34 -34

149 lines not on this page · raw message

lib/librte_pmd_i40e/i40e_rxtx.c +49 -49

220 lines not on this page · raw message

lib/librte_pmd_ixgbe/ixgbe_rxtx.c +50 -50

227 lines not on this page · raw message

lib/librte_pmd_ixgbe/ixgbe_rxtx.h +1 -1
index 64c0695..4c9cb74 100644
@@ -47,7 +47,7 @@
 #endif
 
 #define RTE_MBUF_DATA_DMA_ADDR(mb) \
-	(uint64_t) ((mb)->buf_physaddr + (uint64_t)((char *)((mb)->pkt.data) - \
+	(uint64_t) ((mb)->buf_physaddr + (uint64_t)((char *)((mb)->data) - \
 	(char *)(mb)->buf_addr))
 
 #define RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mb) \
lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c +9 -11
index 047acf0..bafb215 100644
@@ -48,9 +48,7 @@ static inline void
 ixgbe_rxq_rearm(struct igb_rx_queue *rxq)
 {
 	static const struct rte_mbuf mb_def = {
-		.pkt = {
-			.nb_segs = 1,
-		},
+		.nb_segs = 1,
 	};
 	int i;
 	uint16_t rx_id;
@@ -68,7 +66,7 @@ ixgbe_rxq_rearm(struct igb_rx_queue *rxq)
 
 	rxdp = rxq->rx_ring + rxq->rxrearm_start;
 
-	def_low = _mm_load_si128((__m128i *)&(mb_def.pkt));
+	def_low = _mm_load_si128((__m128i *)&(mb_def.next));
 
 	/* Initialize the mbufs in vector, process 2 mbufs in one loop */
 	for (i = 0; i < RTE_IXGBE_RXQ_REARM_THRESH; i += 2, rxep += 2) {
@@ -99,8 +97,8 @@ ixgbe_rxq_rearm(struct igb_rx_queue *rxq)
 		_mm_store_si128((__m128i *)&rxdp++->read, dma_addr1);
 
 		/* flush mbuf with pkt template */
-		_mm_store_si128((__m128i *)&mb0->pkt, vaddr0);
-		_mm_store_si128((__m128i *)&mb1->pkt, vaddr1);
+		_mm_store_si128((__m128i *)&mb0->next, vaddr0);
+		_mm_store_si128((__m128i *)&mb1->next, vaddr1);
 
 		/* update refcnt per pkt */
 		rte_mbuf_refcnt_set(mb0, 1);
@@ -299,9 +297,9 @@ ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 		staterr = _mm_unpacklo_epi32(sterr_tmp1, sterr_tmp2);
 
 		/* D.3 copy final 3,4 data to rx_pkts */
-		_mm_storeu_si128((__m128i *)&(rx_pkts[pos+3]->pkt.data_len),
+		_mm_storeu_si128((__m128i *)&(rx_pkts[pos+3]->data_len),
 				pkt_mb4);
-		_mm_storeu_si128((__m128i *)&(rx_pkts[pos+2]->pkt.data_len),
+		_mm_storeu_si128((__m128i *)&(rx_pkts[pos+2]->data_len),
 				pkt_mb3);
 
 		/* D.2 pkt 1,2 set in_port/nb_seg and remove crc */
@@ -313,9 +311,9 @@ ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 		staterr = _mm_packs_epi32(staterr, zero);
 
 		/* D.3 copy final 1,2 data to rx_pkts */
-		_mm_storeu_si128((__m128i *)&(rx_pkts[pos+1]->pkt.data_len),
+		_mm_storeu_si128((__m128i *)&(rx_pkts[pos+1]->data_len),
 				pkt_mb2);
-		_mm_storeu_si128((__m128i *)&(rx_pkts[pos]->pkt.data_len),
+		_mm_storeu_si128((__m128i *)&(rx_pkts[pos]->data_len),
 				pkt_mb1);
 
 		/* C.4 calc avaialbe number of desc */
@@ -342,7 +340,7 @@ vtx1(volatile union ixgbe_adv_tx_desc *txdp,
 	/* load buf_addr/buf_physaddr in t0 */
 	t0 = _mm_loadu_si128((__m128i *)&(pkt->buf_addr));
 	/* load data, ... pkt_len in t1 */
-	t1 = _mm_loadu_si128((__m128i *)&(pkt->pkt.data));
+	t1 = _mm_loadu_si128((__m128i *)&(pkt->data));
 
 	/* calc offset = (data - buf_adr) */
 	offset = _mm_sub_epi64(t1, t0);
lib/librte_pmd_pcap/rte_eth_pcap.c +7 -7
index eebe768..121de65 100644
@@ -151,9 +151,9 @@ eth_pcap_rx(void *queue,
 
 		if (header.len <= buf_size) {
 			/* pcap packet will fit in the mbuf, go ahead and copy */
-			rte_memcpy(mbuf->pkt.data, packet, header.len);
-			mbuf->pkt.data_len = (uint16_t)header.len;
-			mbuf->pkt.pkt_len = mbuf->pkt.data_len;
+			rte_memcpy(mbuf->data, packet, header.len);
+			mbuf->data_len = (uint16_t)header.len;
+			mbuf->pkt_len = mbuf->data_len;
 			bufs[num_rx] = mbuf;
 			num_rx++;
 		} else {
@@ -200,9 +200,9 @@ eth_pcap_tx_dumper(void *queue,
 	for (i = 0; i < nb_pkts; i++) {
 		mbuf = bufs[i];
 		calculate_timestamp(&header.ts);
-		header.len = mbuf->pkt.data_len;
+		header.len = mbuf->data_len;
 		header.caplen = header.len;
-		pcap_dump((u_char*) dumper_q->dumper, &header, mbuf->pkt.data);
+		pcap_dump((u_char*) dumper_q->dumper, &header, mbuf->data);
 		rte_pktmbuf_free(mbuf);
 		num_tx++;
 	}
@@ -237,8 +237,8 @@ eth_pcap_tx(void *queue,
 
 	for (i = 0; i < nb_pkts; i++) {
 		mbuf = bufs[i];
-		ret = pcap_sendpacket(tx_queue->pcap, (u_char*) mbuf->pkt.data,
-				mbuf->pkt.data_len);
+		ret = pcap_sendpacket(tx_queue->pcap, (u_char*) mbuf->data,
+				mbuf->data_len);
 		if (unlikely(ret != 0))
 			break;
 		num_tx++;
lib/librte_pmd_virtio/virtio_rxtx.c +29 -29

131 lines not on this page · raw message

lib/librte_pmd_virtio/virtqueue.h +1 -1
index 87db35f..d777feb 100644
@@ -59,7 +59,7 @@
 #define VIRTQUEUE_MAX_NAME_SZ 32
 
 #define RTE_MBUF_DATA_DMA_ADDR(mb) \
-	(uint64_t) ((mb)->buf_physaddr + (uint64_t)((char *)((mb)->pkt.data) - \
+	(uint64_t) ((mb)->buf_physaddr + (uint64_t)((char *)((mb)->data) - \
 	(char *)(mb)->buf_addr))
 
 #define VTNET_SQ_RQ_QUEUE_IDX 0
lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c +13 -13
index 9a9918d..04fc1e3 100644
@@ -79,7 +79,7 @@
 
 
 #define RTE_MBUF_DATA_DMA_ADDR(mb) \
-	(uint64_t) ((mb)->buf_physaddr + (uint64_t)((char *)((mb)->pkt.data) - \
+	(uint64_t) ((mb)->buf_physaddr + (uint64_t)((char *)((mb)->data) - \
 	(char *)(mb)->buf_addr))
 
 #define RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mb) \
@@ -289,7 +289,7 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 
 			txm = tx_pkts[nb_tx];
 			/* Don't support scatter packets yet, free them if met */
-			if (txm->pkt.nb_segs != 1) {
+			if (txm->nb_segs != 1) {
 				PMD_TX_LOG(DEBUG, "Don't support scatter packets yet, drop!");
 				rte_pktmbuf_free(tx_pkts[nb_tx]);
 				txq->stats.drop_total++;
@@ -299,7 +299,7 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			}
 
 			/* Needs to minus ether header len */
-			if (txm->pkt.data_len > (hw->cur_mtu + ETHER_HDR_LEN)) {
+			if (txm->data_len > (hw->cur_mtu + ETHER_HDR_LEN)) {
 				PMD_TX_LOG(DEBUG, "Packet data_len higher than MTU");
 				rte_pktmbuf_free(tx_pkts[nb_tx]);
 				txq->stats.drop_total++;
@@ -314,7 +314,7 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			tbi = txq->cmd_ring.buf_info + txq->cmd_ring.next2fill;
 			tbi->bufPA = RTE_MBUF_DATA_DMA_ADDR(txm);
 			txd->addr = tbi->bufPA;
-			txd->len = txm->pkt.data_len;
+			txd->len = txm->data_len;
 
 			/* Mark the last descriptor as End of Packet. */
 			txd->cq = 1;
@@ -551,21 +551,21 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 					       rte_pktmbuf_mtod(rxm, void *));
 #endif
 				/* Copy vlan tag in packet buffer */
-				rxm->pkt.vlan_macip.f.vlan_tci =
+				rxm->vlan_macip.f.vlan_tci =
 					rte_le_to_cpu_16((uint16_t)rcd->tci);
 
 			} else
 				rxm->ol_flags = 0;
 
 			/* Initialize newly received packet buffer */
-			rxm->pkt.in_port = rxq->port_id;
-			rxm->pkt.nb_segs = 1;
-			rxm->pkt.next = NULL;
-			rxm->pkt.pkt_len = (uint16_t)rcd->len;
-			rxm->pkt.data_len = (uint16_t)rcd->len;
-			rxm->pkt.in_port = rxq->port_id;
-			rxm->pkt.vlan_macip.f.vlan_tci = 0;
-			rxm->pkt.data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
+			rxm->in_port = rxq->port_id;
+			rxm->nb_segs = 1;
+			rxm->next = NULL;
+			rxm->pkt_len = (uint16_t)rcd->len;
+			rxm->data_len = (uint16_t)rcd->len;
+			rxm->in_port = rxq->port_id;
+			rxm->vlan_macip.f.vlan_tci = 0;
+			rxm->data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
 
 			rx_pkts[nb_rx++] = rxm;
 
lib/librte_pmd_xenvirt/rte_eth_xenvirt.c +6 -6
index ba82319..c118652 100644
@@ -109,12 +109,12 @@ eth_xenvirt_rx(void *q, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 	for (i = 0; i < num ; i ++) {
 		rxm = rx_pkts[i];
 		PMD_RX_LOG(DEBUG, "packet len:%d\n", len[i]);
-		rxm->pkt.next = NULL;
-		rxm->pkt.data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
-		rxm->pkt.data_len = (uint16_t)(len[i] - sizeof(struct virtio_net_hdr));
-		rxm->pkt.nb_segs = 1;
-		rxm->pkt.in_port = pi->port_id;
-		rxm->pkt.pkt_len  = (uint32_t)(len[i] - sizeof(struct virtio_net_hdr));
+		rxm->next = NULL;
+		rxm->data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
+		rxm->data_len = (uint16_t)(len[i] - sizeof(struct virtio_net_hdr));
+		rxm->nb_segs = 1;
+		rxm->in_port = pi->port_id;
+		rxm->pkt_len  = (uint32_t)(len[i] - sizeof(struct virtio_net_hdr));
 	}
 	/* allocate new mbuf for the used descriptor */
 	while (likely(!virtqueue_full(rxvq))) {
lib/librte_pmd_xenvirt/virtqueue.h +2 -2
index 81cd938..d8717fe 100644
@@ -54,7 +54,7 @@
  * rather than gpa<->hva in virito spec.
  */
 #define RTE_MBUF_DATA_DMA_ADDR(mb) \
-	((uint64_t)((mb)->pkt.data))
+	((uint64_t)((mb)->data))
 
 enum { VTNET_RQ = 0, VTNET_TQ = 1, VTNET_CQ = 2 };
 
@@ -238,7 +238,7 @@ virtqueue_enqueue_xmit(struct virtqueue *txvq, struct rte_mbuf *cookie)
 	start_dp[idx].addr  = (uintptr_t)NULL;
 	idx = start_dp[idx].next;
 	start_dp[idx].addr  = RTE_MBUF_DATA_DMA_ADDR(cookie);
-	start_dp[idx].len   = cookie->pkt.data_len;
+	start_dp[idx].len   = cookie->data_len;
 	start_dp[idx].flags = 0;
 	idx = start_dp[idx].next;
 	txvq->vq_desc_head_idx = idx;
lib/librte_port/rte_port_frag.c +1 -1
index ce5026f..9f1bd3c 100644
@@ -159,7 +159,7 @@ rte_port_ring_reader_ipv4_frag_rx(void *port,
 		p->n_pkts--;
 
 		/* If not jumbo, pass current packet to output */
-		if (pkt->pkt.pkt_len <= IPV4_MTU_DEFAULT) {
+		if (pkt->pkt_len <= IPV4_MTU_DEFAULT) {
 			pkts[n_pkts_out++] = pkt;
 
 			n_pkts_to_provide = n_pkts - n_pkts_out;
lib/librte_sched/rte_sched.c +7 -7
index 968c2b3..ba60277 100644
@@ -1015,7 +1015,7 @@ rte_sched_port_update_subport_stats(struct rte_sched_port *port, uint32_t qindex
 {
 	struct rte_sched_subport *s = port->subport + (qindex / rte_sched_port_queues_per_subport(port));
 	uint32_t tc_index = (qindex >> 2) & 0x3;
-	uint32_t pkt_len = pkt->pkt.pkt_len;
+	uint32_t pkt_len = pkt->pkt_len;
 
 	s->stats.n_pkts_tc[tc_index] += 1;
 	s->stats.n_bytes_tc[tc_index] += pkt_len;
@@ -1026,7 +1026,7 @@ rte_sched_port_update_subport_stats_on_drop(struct rte_sched_port *port, uint32_
 {
 	struct rte_sched_subport *s = port->subport + (qindex / rte_sched_port_queues_per_subport(port));
 	uint32_t tc_index = (qindex >> 2) & 0x3;
-	uint32_t pkt_len = pkt->pkt.pkt_len;
+	uint32_t pkt_len = pkt->pkt_len;
 
 	s->stats.n_pkts_tc_dropped[tc_index] += 1;
 	s->stats.n_bytes_tc_dropped[tc_index] += pkt_len;
@@ -1036,7 +1036,7 @@ static inline void
 rte_sched_port_update_queue_stats(struct rte_sched_port *port, uint32_t qindex, struct rte_mbuf *pkt)
 {
 	struct rte_sched_queue_extra *qe = port->queue_extra + qindex;
-	uint32_t pkt_len = pkt->pkt.pkt_len;
+	uint32_t pkt_len = pkt->pkt_len;
 
 	qe->stats.n_pkts += 1;
 	qe->stats.n_bytes += pkt_len;
@@ -1046,7 +1046,7 @@ static inline void
 rte_sched_port_update_queue_stats_on_drop(struct rte_sched_port *port, uint32_t qindex, struct rte_mbuf *pkt)
 {
 	struct rte_sched_queue_extra *qe = port->queue_extra + qindex;
-	uint32_t pkt_len = pkt->pkt.pkt_len;
+	uint32_t pkt_len = pkt->pkt_len;
 
 	qe->stats.n_pkts_dropped += 1;
 	qe->stats.n_bytes_dropped += pkt_len;
@@ -1563,7 +1563,7 @@ grinder_credits_check(struct rte_sched_port *port, uint32_t pos)
 	struct rte_sched_pipe *pipe = grinder->pipe;
 	struct rte_mbuf *pkt = grinder->pkt;
 	uint32_t tc_index = grinder->tc_index;
-	uint32_t pkt_len = pkt->pkt.pkt_len + port->frame_overhead;
+	uint32_t pkt_len = pkt->pkt_len + port->frame_overhead;
 	uint32_t subport_tb_credits = subport->tb_credits;
 	uint32_t subport_tc_credits = subport->tc_credits[tc_index];
 	uint32_t pipe_tb_credits = pipe->tb_credits;
@@ -1599,7 +1599,7 @@ grinder_credits_check(struct rte_sched_port *port, uint32_t pos)
 	struct rte_sched_pipe *pipe = grinder->pipe;
 	struct rte_mbuf *pkt = grinder->pkt;
 	uint32_t tc_index = grinder->tc_index;
-	uint32_t pkt_len = pkt->pkt.pkt_len + port->frame_overhead;
+	uint32_t pkt_len = pkt->pkt_len + port->frame_overhead;
 	uint32_t subport_tb_credits = subport->tb_credits;
 	uint32_t subport_tc_credits = subport->tc_credits[tc_index];
 	uint32_t pipe_tb_credits = pipe->tb_credits;
@@ -1640,7 +1640,7 @@ grinder_schedule(struct rte_sched_port *port, uint32_t pos)
 	struct rte_sched_grinder *grinder = port->grinder + pos;
 	struct rte_sched_queue *queue = grinder->queue[grinder->qpos];
 	struct rte_mbuf *pkt = grinder->pkt;
-	uint32_t pkt_len = pkt->pkt.pkt_len + port->frame_overhead;
+	uint32_t pkt_len = pkt->pkt_len + port->frame_overhead;
 
 #if RTE_SCHED_TS_CREDITS_CHECK
 	if (!grinder_credits_check(port, pos)) {
lib/librte_sched/rte_sched.h +5 -5
index 3f27755..e6bba22 100644
@@ -106,7 +106,7 @@ extern "C" {
    2. Start of Frame Delimiter (SFD):       1 byte;
    3. Frame Check Sequence (FCS):           4 bytes;
    4. Inter Frame Gap (IFG):               12 bytes.
-The FCS is considered overhead only if not included in the packet length (field pkt.pkt_len
+The FCS is considered overhead only if not included in the packet length (field pkt_len
 of struct rte_mbuf). */
 #ifndef RTE_SCHED_FRAME_OVERHEAD_DEFAULT
 #define RTE_SCHED_FRAME_OVERHEAD_DEFAULT      24
@@ -196,7 +196,7 @@ struct rte_sched_port_params {
 };
 
 /** Path through the scheduler hierarchy used by the scheduler enqueue operation to
-identify the destination queue for the current packet. Stored in the field pkt.hash.sched
+identify the destination queue for the current packet. Stored in the field hash.sched
 of struct rte_mbuf of each packet, typically written by the classification stage and read by
 scheduler enqueue.*/
 struct rte_sched_port_hierarchy {
@@ -352,7 +352,7 @@ static inline void
 rte_sched_port_pkt_write(struct rte_mbuf *pkt,
 	uint32_t subport, uint32_t pipe, uint32_t traffic_class, uint32_t queue, enum rte_meter_color color)
 {
-	struct rte_sched_port_hierarchy *sched = (struct rte_sched_port_hierarchy *) &pkt->pkt.hash.sched;
+	struct rte_sched_port_hierarchy *sched = (struct rte_sched_port_hierarchy *) &pkt->hash.sched;
 
 	sched->color = (uint32_t) color;
 	sched->subport = subport;
@@ -381,7 +381,7 @@ rte_sched_port_pkt_write(struct rte_mbuf *pkt,
 static inline void
 rte_sched_port_pkt_read_tree_path(struct rte_mbuf *pkt, uint32_t *subport, uint32_t *pipe, uint32_t *traffic_class, uint32_t *queue)
 {
-	struct rte_sched_port_hierarchy *sched = (struct rte_sched_port_hierarchy *) &pkt->pkt.hash.sched;
+	struct rte_sched_port_hierarchy *sched = (struct rte_sched_port_hierarchy *) &pkt->hash.sched;
 
 	*subport = sched->subport;
 	*pipe = sched->pipe;
@@ -392,7 +392,7 @@ rte_sched_port_pkt_read_tree_path(struct rte_mbuf *pkt, uint32_t *subport, uint3
 static inline enum rte_meter_color
 rte_sched_port_pkt_read_color(struct rte_mbuf *pkt)
 {
-	struct rte_sched_port_hierarchy *sched = (struct rte_sched_port_hierarchy *) &pkt->pkt.hash.sched;
+	struct rte_sched_port_hierarchy *sched = (struct rte_sched_port_hierarchy *) &pkt->hash.sched;
 
 	return (enum rte_meter_color) sched->color;
 }
Signature · 1 line
1.9.3

A message that is not in the archive (sent off-list or not yet received): 1409837138-4401-1-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#29 lore raw

Re: [PATCH v3 4/6] mbuf: remove the rte_pktmbuf structure

Quoted 27 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Thursday, September 04, 2014 2:26 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH v3 4/6] mbuf: remove the rte_pktmbuf
structure

From: Olivier Matz <[email protected]>

The rte_pktmbuf structure was initially included in the rte_mbuf structure. This was needed when there was 2 types of mbuf (ctrl and packet). As the control mbuf has been removed, we can merge the rte_pktmbuf into the rte_mbuf structure.

Advantages of doing this:
- the access to mbuf fields is easier (ex: m->data instead of m->pkt.data)
- make the structure more consistent: for instance, there was no reason to have the ol_flags field in rte_mbuf
- it will allow a deeper reorganization of the rte_mbuf structure in the next commits, allowing to gain several bytes in it

Updated to work with latest code, and to include new example apps.

Quoted 7 lines

Changes in V2:
* Further updates to apply to latest HEAD on master

Changes in V3:
* Updated to compile cleanly on 1.7.1

Acked-by Pablo de Lara <[email protected]>

Acked-by
#30 lore raw

Re: [PATCH v3 4/6] mbuf: remove the rte_pktmbuf structure

In reply to a message not in the archive
Quoted 18 lines · Bruce Richardson

From: Olivier Matz <[email protected]>

The rte_pktmbuf structure was initially included in the rte_mbuf structure. This was needed when there was 2 types of mbuf (ctrl and packet). As the control mbuf has been removed, we can merge the rte_pktmbuf into the rte_mbuf structure.

Advantages of doing this:
- the access to mbuf fields is easier (ex: m->data instead of m->pkt.data)
- make the structure more consistent: for instance, there was no reason to have the ol_flags field in rte_mbuf
- it will allow a deeper reorganization of the rte_mbuf structure in the next commits, allowing to gain several bytes in it

Updated to work with latest code, and to include new example apps.

Quoted 7 lines

Changes in V2:
* Further updates to apply to latest HEAD on master

Changes in V3:
* Updated to compile cleanly on 1.7.1

In app/test/packet_burst_generator.c, there is one remaining reference to "pkt." in a comment:

#define RTE_MAX_SEGS_PER_PKT 255 /**< pkt.nb_segs is a 8-bit unsigned
char. */

#31 lore raw

Re: [PATCH v2 4/6] mbuf: remove the rte_pktmbuf structure

In reply to a message not in the archive
Quoted 23 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Thursday, August 28, 2014 4:43 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH v2 4/6] mbuf: remove the rte_pktmbuf
structure

From: Olivier Matz <[email protected]>

The rte_pktmbuf structure was initially included in the rte_mbuf structure. This was needed when there was 2 types of mbuf (ctrl and packet). As the control mbuf has been removed, we can merge the rte_pktmbuf into the rte_mbuf structure.

Advantages of doing this:
- the access to mbuf fields is easier (ex: m->data instead of m->pkt.data)
- make the structure more consistent: for instance, there was no reason to have the ol_flags field in rte_mbuf
- it will allow a deeper reorganization of the rte_mbuf structure in the next commits, allowing to gain several bytes in it

Quoted 8 lines

Updated to work with latest code, and to include new example apps.

Changes in V2:
* Further updates to apply to latest HEAD on master

Acked-by Pablo de Lara <[email protected]>

#32 lore raw

PATCH v2 5/6 mbuf: rename in_port to just port

In reply to a message not in the archive

In some cases we may want to tag a packet for a particular destination or output port, so rename the "in_port" field in the mbuf to just "port" so that it can be re-used for this purpose if an application needs it.

Changes in V2:
* Further updates to apply to latest HEAD on master

---
 examples/dpdk_qat/main.c                                   | 2 +-
 examples/ipv4_multicast/main.c                             | 2 +-
 examples/load_balancer/runtime.c                           | 2 +-
 examples/multi_process/client_server_mp/mp_client/client.c | 2 +-
 lib/librte_mbuf/rte_mbuf.c                                 | 4 ++--
 lib/librte_mbuf/rte_mbuf.h                                 | 6 +++---
 lib/librte_pmd_e1000/em_rxtx.c                             | 4 ++--
 lib/librte_pmd_e1000/igb_rxtx.c                            | 4 ++--
 lib/librte_pmd_i40e/i40e_rxtx.c                            | 8 ++++----
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c                          | 8 ++++----
 lib/librte_pmd_virtio/virtio_rxtx.c                        | 4 ++--
 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c                      | 4 ++--
 lib/librte_pmd_xenvirt/rte_eth_xenvirt.c                   | 2 +-
 13 files changed, 26 insertions(+), 26 deletions(-)
examples/dpdk_qat/main.c +1 -1
index 75c9876..1599a0a 100644
@@ -384,7 +384,7 @@ main_loop(__attribute__((unused)) void *dummy)
 			}
 		}
 
-		port = dst_ports[pkt->in_port];
+		port = dst_ports[pkt->port];
 
 		/* Transmit the packet */
 		nic_tx_send_packet(pkt, (uint8_t)port);
examples/ipv4_multicast/main.c +1 -1
index cc12d9d..2232851 100644
@@ -337,7 +337,7 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone)
 	hdr->nb_segs = (uint8_t)(pkt->nb_segs + 1);
 
 	/* copy metadata from source packet*/
-	hdr->in_port = pkt->in_port;
+	hdr->port = pkt->port;
 	hdr->vlan_macip = pkt->vlan_macip;
 	hdr->hash = pkt->hash;
 
examples/load_balancer/runtime.c +1 -1
index b69917b..a53f33f 100644
@@ -540,7 +540,7 @@ app_lcore_worker(
 			ipv4_dst = rte_be_to_cpu_32(ipv4_hdr->dst_addr);
 
 			if (unlikely(rte_lpm_lookup(lp->lpm_table, ipv4_dst, &port) != 0)) {
-				port = pkt->in_port;
+				port = pkt->port;
 			}
 
 			pos = lp->mbuf_out[port].n_mbufs;
examples/multi_process/client_server_mp/mp_client/client.c +1 -1
index 71e4a48..ee2338c 100644
@@ -211,7 +211,7 @@ enqueue_packet(struct rte_mbuf *buf, uint8_t port)
 static void
 handle_packet(struct rte_mbuf *buf)
 {
-	const uint8_t in_port = buf->in_port;
+	const uint8_t in_port = buf->port;
 	const uint8_t out_port = output_ports[in_port];
 
 	enqueue_packet(buf, out_port);
lib/librte_mbuf/rte_mbuf.c +2 -2
index d12a0bf..c1b2176 100644
@@ -122,7 +122,7 @@ rte_pktmbuf_init(struct rte_mempool *mp,
 	/* init some constant fields */
 	m->pool = mp;
 	m->nb_segs = 1;
-	m->in_port = 0xff;
+	m->port = 0xff;
 }
 
 /* do some sanity checks on a mbuf: panic if it fails */
@@ -176,7 +176,7 @@ rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m, unsigned dump_len)
 	       m, (uint64_t)m->buf_physaddr, (unsigned)m->buf_len);
 	fprintf(f, "  pkt_len=%"PRIu32", ol_flags=%"PRIx16", nb_segs=%u, "
 	       "in_port=%u\n", m->pkt_len, m->ol_flags,
-	       (unsigned)m->nb_segs, (unsigned)m->in_port);
+	       (unsigned)m->nb_segs, (unsigned)m->port);
 	nb_segs = m->nb_segs;
 
 	while (m && nb_segs != 0) {
lib/librte_mbuf/rte_mbuf.h +3 -3
index d66b9bd..047a5a7 100644
@@ -166,7 +166,7 @@ struct rte_mbuf {
 
 	/* these fields are valid for first segment only */
 	uint8_t nb_segs;        /**< Number of segments. */
-	uint8_t in_port;        /**< Input port. */
+	uint8_t port;           /**< Input port. */
 	uint32_t pkt_len;       /**< Total pkt len: sum of all segment data_len. */
 
 	/* offload features, valid for first segment only */
@@ -542,7 +542,7 @@ static inline void rte_pktmbuf_reset(struct rte_mbuf *m)
 	m->pkt_len = 0;
 	m->vlan_macip.data = 0;
 	m->nb_segs = 1;
-	m->in_port = 0xff;
+	m->port = 0xff;
 
 	m->ol_flags = 0;
 	buf_ofs = (RTE_PKTMBUF_HEADROOM <= m->buf_len) ?
@@ -606,7 +606,7 @@ static inline void rte_pktmbuf_attach(struct rte_mbuf *mi, struct rte_mbuf *md)
 	mi->next = md->next;
 	mi->data = md->data;
 	mi->data_len = md->data_len;
-	mi->in_port = md->in_port;
+	mi->port = md->port;
 	mi->vlan_macip = md->vlan_macip;
 	mi->hash = md->hash;
 
lib/librte_pmd_e1000/em_rxtx.c +2 -2
index 058e1bd..074c9b3 100644
@@ -777,7 +777,7 @@ eth_em_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		rxm->next = NULL;
 		rxm->pkt_len = pkt_len;
 		rxm->data_len = pkt_len;
-		rxm->in_port = rxq->port_id;
+		rxm->port = rxq->port_id;
 
 		rxm->ol_flags = rx_desc_status_to_pkt_flags(status);
 		rxm->ol_flags = (uint16_t)(rxm->ol_flags |
@@ -1003,7 +1003,7 @@ eth_em_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		 *      - IP checksum flag,
 		 *      - error flags.
 		 */
-		first_seg->in_port = rxq->port_id;
+		first_seg->port = rxq->port_id;
 
 		first_seg->ol_flags = rx_desc_status_to_pkt_flags(status);
 		first_seg->ol_flags = (uint16_t)(first_seg->ol_flags |
lib/librte_pmd_e1000/igb_rxtx.c +2 -2
index 99bb9d9..8b33b6d 100644
@@ -759,7 +759,7 @@ eth_igb_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		rxm->next = NULL;
 		rxm->pkt_len = pkt_len;
 		rxm->data_len = pkt_len;
-		rxm->in_port = rxq->port_id;
+		rxm->port = rxq->port_id;
 
 		rxm->hash.rss = rxd.wb.lower.hi_dword.rss;
 		hlen_type_rss = rte_le_to_cpu_32(rxd.wb.lower.lo_dword.data);
@@ -994,7 +994,7 @@ eth_igb_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		 *      - VLAN TCI, if any,
 		 *      - error flags.
 		 */
-		first_seg->in_port = rxq->port_id;
+		first_seg->port = rxq->port_id;
 		first_seg->hash.rss = rxd.wb.lower.hi_dword.rss;
 
 		/*
lib/librte_pmd_i40e/i40e_rxtx.c +4 -4
index 08a42ac..c481976 100644
@@ -687,7 +687,7 @@ i40e_rx_alloc_bufs(struct i40e_rx_queue *rxq)
 		mb->next = NULL;
 		mb->data = (char *)mb->buf_addr + RTE_PKTMBUF_HEADROOM;
 		mb->nb_segs = 1;
-		mb->in_port = rxq->port_id;
+		mb->port = rxq->port_id;
 		dma_addr = rte_cpu_to_le_64(\
 			RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mb));
 		rxdp[i].read.hdr_addr = dma_addr;
@@ -848,7 +848,7 @@ i40e_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 		rxm->next = NULL;
 		rxm->pkt_len = rx_packet_len;
 		rxm->data_len = rx_packet_len;
-		rxm->in_port = rxq->port_id;
+		rxm->port = rxq->port_id;
 
 		rxm->vlan_macip.f.vlan_tci = rx_status &
 			(1 << I40E_RX_DESC_STATUS_L2TAG1P_SHIFT) ?
@@ -1002,7 +1002,7 @@ i40e_recv_scattered_pkts(void *rx_queue,
 								ETHER_CRC_LEN);
 		}
 
-		first_seg->in_port = rxq->port_id;
+		first_seg->port = rxq->port_id;
 		first_seg->vlan_macip.f.vlan_tci = (rx_status &
 			(1 << I40E_RX_DESC_STATUS_L2TAG1P_SHIFT)) ?
 			rte_le_to_cpu_16(rxd.wb.qword0.lo_dword.l2tag1) : 0;
@@ -2133,7 +2133,7 @@ i40e_alloc_rx_queue_mbufs(struct i40e_rx_queue *rxq)
 		mbuf->next = NULL;
 		mbuf->data = (char *)mbuf->buf_addr + RTE_PKTMBUF_HEADROOM;
 		mbuf->nb_segs = 1;
-		mbuf->in_port = rxq->port_id;
+		mbuf->port = rxq->port_id;
 
 		dma_addr =
 			rte_cpu_to_le_64(RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mbuf));
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +4 -4
index c95e117..eec1458 100644
@@ -998,7 +998,7 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
 		mb->next = NULL;
 		mb->data = (char *)mb->buf_addr + RTE_PKTMBUF_HEADROOM;
 		mb->nb_segs = 1;
-		mb->in_port = rxq->port_id;
+		mb->port = rxq->port_id;
 
 		/* populate the descriptors */
 		dma_addr = (uint64_t)mb->buf_physaddr + RTE_PKTMBUF_HEADROOM;
@@ -1253,7 +1253,7 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		rxm->next = NULL;
 		rxm->pkt_len = pkt_len;
 		rxm->data_len = pkt_len;
-		rxm->in_port = rxq->port_id;
+		rxm->port = rxq->port_id;
 
 		hlen_type_rss = rte_le_to_cpu_32(rxd.wb.lower.lo_dword.data);
 		/* Only valid if PKT_RX_VLAN_PKT set in pkt_flags */
@@ -1496,7 +1496,7 @@ ixgbe_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		 *      - VLAN TCI, if any,
 		 *      - error flags.
 		 */
-		first_seg->in_port = rxq->port_id;
+		first_seg->port = rxq->port_id;
 
 		/*
 		 * The vlan_tci field is only valid when PKT_RX_VLAN_PKT is
@@ -3215,7 +3215,7 @@ ixgbe_alloc_rx_queue_mbufs(struct igb_rx_queue *rxq)
 		mbuf->next = NULL;
 		mbuf->data = (char *)mbuf->buf_addr + RTE_PKTMBUF_HEADROOM;
 		mbuf->nb_segs = 1;
-		mbuf->in_port = rxq->port_id;
+		mbuf->port = rxq->port_id;
 
 		dma_addr =
 			rte_cpu_to_le_64(RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mbuf));
lib/librte_pmd_virtio/virtio_rxtx.c +2 -2
index 55beceb..132ee45 100644
@@ -479,7 +479,7 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 			continue;
 		}
 
-		rxm->in_port = rxvq->port_id;
+		rxm->port = rxvq->port_id;
 		rxm->data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
 
 		rxm->nb_segs = 1;
@@ -590,7 +590,7 @@ virtio_recv_mergeable_pkts(void *rx_queue,
 		rxm->pkt_len = (uint32_t)(len[0] - hdr_size);
 		rxm->data_len = (uint16_t)(len[0] - hdr_size);
 
-		rxm->in_port = rxvq->port_id;
+		rxm->port = rxvq->port_id;
 		rx_pkts[nb_rx] = rxm;
 		prev = rxm;
 
lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c +2 -2
index 7dd5a98..3536765 100644
@@ -557,12 +557,12 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 				rxm->ol_flags = 0;
 
 			/* Initialize newly received packet buffer */
-			rxm->in_port = rxq->port_id;
+			rxm->port = rxq->port_id;
 			rxm->nb_segs = 1;
 			rxm->next = NULL;
 			rxm->pkt_len = (uint16_t)rcd->len;
 			rxm->data_len = (uint16_t)rcd->len;
-			rxm->in_port = rxq->port_id;
+			rxm->port = rxq->port_id;
 			rxm->vlan_macip.f.vlan_tci = 0;
 			rxm->data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
 
lib/librte_pmd_xenvirt/rte_eth_xenvirt.c +1 -1
index c118652..22215ed 100644
@@ -113,7 +113,7 @@ eth_xenvirt_rx(void *q, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 		rxm->data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
 		rxm->data_len = (uint16_t)(len[i] - sizeof(struct virtio_net_hdr));
 		rxm->nb_segs = 1;
-		rxm->in_port = pi->port_id;
+		rxm->port = pi->port_id;
 		rxm->pkt_len  = (uint32_t)(len[i] - sizeof(struct virtio_net_hdr));
 	}
 	/* allocate new mbuf for the used descriptor */
Signature · 1 line
1.9.3

A message that is not in the archive (sent off-list or not yet received): 1409240559-14447-6-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#34 lore raw

Re: [PATCH v2 5/6] mbuf: rename in_port to just port

Quoted 8 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Thursday, August 28, 2014 4:43 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH v2 5/6] mbuf: rename in_port to just port

Quoted 8 lines

In some cases we may want to tag a packet for a particular destination or output port, so rename the "in_port" field in the mbuf to just "port" so that it can be re-used for this purpose if an application needs it.

Changes in V2:
* Further updates to apply to latest HEAD on master

Acked-by Pablo de Lara <[email protected]>

Acked-by
#35 lore raw

Re: [PATCH v2 5/6] mbuf: rename in_port to just port

In reply to a message not in the archive
Quoted 8 lines · Bruce Richardson

In some cases we may want to tag a packet for a particular destination or output port, so rename the "in_port" field in the mbuf to just "port" so that it can be re-used for this purpose if an application needs it.

Changes in V2:
* Further updates to apply to latest HEAD on master

#36 lore raw

PATCH v2 6/6 mbuf: flatten struct vlan_macip into mbuf struct

In reply to a message not in the archive

The vlan_macip structure combined a vlan tag id with l2 and l3 headers lengths for tracking offloads. However, this structure was only used as a unit by the e1000 and ixgbe drivers, not generally.

This patch removes the structure from the mbuf header and places the fields into the mbuf structure directly at the required point, without any net effect on the structure layout. This allows us to treat the vlan tags and header length fields as separate for future mbuf changes. The drivers which were written to use the combined structure still do so, using a driver-local definition of it.

Changes in V2:
* None

---
 app/test-pmd/csumonly.c                     |  4 +--
 app/test-pmd/flowgen.c                      | 14 +++++-----
 app/test-pmd/macfwd.c                       |  6 ++---
 app/test-pmd/macswap.c                      |  6 ++---
 app/test-pmd/rxonly.c                       |  3 +--
 app/test-pmd/testpmd.c                      |  4 ++-
 app/test-pmd/txonly.c                       |  6 ++---
 app/test/packet_burst_generator.c           | 10 ++++----
 examples/ip_fragmentation/main.c            |  2 +-
 examples/ip_pipeline/pipeline_rx.c          |  4 +--
 examples/ip_pipeline/pipeline_tx.c          |  2 +-
 examples/ip_reassembly/main.c               |  8 +++---
 examples/ipv4_multicast/main.c              |  4 ++-
 examples/vhost/main.c                       |  6 ++---
 lib/librte_ip_frag/ip_frag_common.h         |  3 +--
 lib/librte_ip_frag/rte_ipv4_fragmentation.c |  2 +-
 lib/librte_ip_frag/rte_ipv4_reassembly.c    |  6 ++---
 lib/librte_ip_frag/rte_ipv6_reassembly.c    |  5 ++--
 lib/librte_mbuf/rte_mbuf.h                  | 33 +++++++-----------------
 lib/librte_pmd_e1000/em_rxtx.c              | 40 ++++++++++++++++++++++-------
 lib/librte_pmd_e1000/igb_rxtx.c             | 39 +++++++++++++++++++++-------
 lib/librte_pmd_i40e/i40e_rxtx.c             | 14 +++++-----
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c           | 18 ++++++-------
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h           | 23 ++++++++++++++++-
 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c       |  6 ++---
 25 files changed, 159 insertions(+), 109 deletions(-)
app/test-pmd/csumonly.c +2 -2
index 655b6d8..28b66f5 100644
@@ -432,8 +432,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 		}
 
 		/* Combine the packet header write. VLAN is not consider here */
-		mb->vlan_macip.f.l2_len = l2_len;
-		mb->vlan_macip.f.l3_len = l3_len;
+		mb->l2_len = l2_len;
+		mb->l3_len = l3_len;
 		mb->ol_flags = ol_flags;
 	}
 	nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx);
app/test-pmd/flowgen.c +7 -7
index 17dbf83..b091b6d 100644
@@ -205,13 +205,13 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
 		udp_hdr->dgram_len	= RTE_CPU_TO_BE_16(pkt_size -
 							   sizeof(*eth_hdr) -
 							   sizeof(*ip_hdr));
-		pkt->nb_segs			= 1;
-		pkt->pkt_len			= pkt_size;
-		pkt->ol_flags			= ol_flags;
-		pkt->vlan_macip.f.vlan_tci	= vlan_tci;
-		pkt->vlan_macip.f.l2_len	= sizeof(struct ether_hdr);
-		pkt->vlan_macip.f.l3_len	= sizeof(struct ipv4_hdr);
-		pkts_burst[nb_pkt]		= pkt;
+		pkt->nb_segs		= 1;
+		pkt->pkt_len		= pkt_size;
+		pkt->ol_flags		= ol_flags;
+		pkt->vlan_tci		= vlan_tci;
+		pkt->l2_len		= sizeof(struct ether_hdr);
+		pkt->l3_len		= sizeof(struct ipv4_hdr);
+		pkts_burst[nb_pkt]	= pkt;
 
 		next_flow = (next_flow + 1) % cfg_n_flows;
 	}
app/test-pmd/macfwd.c +3 -3
index 999c8e3..4b905cd 100644
@@ -116,9 +116,9 @@ pkt_burst_mac_forward(struct fwd_stream *fs)
 		ether_addr_copy(&ports[fs->tx_port].eth_addr,
 				&eth_hdr->s_addr);
 		mb->ol_flags = txp->tx_ol_flags;
-		mb->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
-		mb->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
-		mb->vlan_macip.f.vlan_tci = txp->tx_vlan_id;
+		mb->l2_len = sizeof(struct ether_hdr);
+		mb->l3_len = sizeof(struct ipv4_hdr);
+		mb->vlan_tci = txp->tx_vlan_id;
 	}
 	nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx);
 	fs->tx_packets += nb_tx;
app/test-pmd/macswap.c +3 -3
index 731f487..c5b3a0c 100644
@@ -118,9 +118,9 @@ pkt_burst_mac_swap(struct fwd_stream *fs)
 		ether_addr_copy(&addr, &eth_hdr->s_addr);
 
 		mb->ol_flags = txp->tx_ol_flags;
-		mb->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
-		mb->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
-		mb->vlan_macip.f.vlan_tci = txp->tx_vlan_id;
+		mb->l2_len = sizeof(struct ether_hdr);
+		mb->l3_len = sizeof(struct ipv4_hdr);
+		mb->vlan_tci = txp->tx_vlan_id;
 	}
 	nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx);
 	fs->tx_packets += nb_tx;
app/test-pmd/rxonly.c +1 -2
index c34a5e1..5bc74da 100644
@@ -165,8 +165,7 @@ pkt_burst_receive(struct fwd_stream *fs)
 			printf(" - FDIR hash=0x%x - FDIR id=0x%x ",
 			       mb->hash.fdir.hash, mb->hash.fdir.id);
 		if (ol_flags & PKT_RX_VLAN_PKT)
-			printf(" - VLAN tci=0x%x",
-				mb->vlan_macip.f.vlan_tci);
+			printf(" - VLAN tci=0x%x", mb->vlan_tci);
 		printf("\n");
 		if (ol_flags != 0) {
 			int rxf;
app/test-pmd/testpmd.c +3 -1
index 2a5eb83..b6596f8 100644
@@ -406,7 +406,9 @@ testpmd_mbuf_ctor(struct rte_mempool *mp,
 	mb->ol_flags     = 0;
 	mb->data         = (char *) mb->buf_addr + RTE_PKTMBUF_HEADROOM;
 	mb->nb_segs      = 1;
-	mb->vlan_macip.data = 0;
+	mb->l2_len       = 0;
+	mb->l3_len       = 0;
+	mb->vlan_tci     = 0;
 	mb->hash.rss     = 0;
 }
 
app/test-pmd/txonly.c +3 -3
index 1b2f661..8135264 100644
@@ -263,9 +263,9 @@ pkt_burst_transmit(struct fwd_stream *fs)
 		pkt->nb_segs = tx_pkt_nb_segs;
 		pkt->pkt_len = tx_pkt_length;
 		pkt->ol_flags = ol_flags;
-		pkt->vlan_macip.f.vlan_tci  = vlan_tci;
-		pkt->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
-		pkt->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+		pkt->vlan_tci  = vlan_tci;
+		pkt->l2_len = sizeof(struct ether_hdr);
+		pkt->l3_len = sizeof(struct ipv4_hdr);
 		pkts_burst[nb_pkt] = pkt;
 	}
 	nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_pkt);
app/test/packet_burst_generator.c +5 -5
index 8740348..db7f023 100644
@@ -260,19 +260,19 @@ nomore_mbuf:
 		 */
 		pkt->nb_segs = tx_pkt_nb_segs;
 		pkt->pkt_len = tx_pkt_length;
-		pkt->vlan_macip.f.l2_len = eth_hdr_size;
+		pkt->l2_len = eth_hdr_size;
 
 		if (ipv4) {
-			pkt->vlan_macip.f.vlan_tci  = ETHER_TYPE_IPv4;
-			pkt->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+			pkt->vlan_tci  = ETHER_TYPE_IPv4;
+			pkt->l3_len = sizeof(struct ipv4_hdr);
 
 			if (vlan_enabled)
 				pkt->ol_flags = PKT_RX_IPV4_HDR | PKT_RX_VLAN_PKT;
 			else
 				pkt->ol_flags = PKT_RX_IPV4_HDR;
 		} else {
-			pkt->vlan_macip.f.vlan_tci  = ETHER_TYPE_IPv6;
-			pkt->vlan_macip.f.l3_len = sizeof(struct ipv6_hdr);
+			pkt->vlan_tci  = ETHER_TYPE_IPv6;
+			pkt->l3_len = sizeof(struct ipv6_hdr);
 
 			if (vlan_enabled)
 				pkt->ol_flags = PKT_RX_IPV6_HDR | PKT_RX_VLAN_PKT;
examples/ip_fragmentation/main.c +1 -1
index ac8d4f7..6d309b5 100644
@@ -413,7 +413,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf,
 			rte_panic("No headroom in mbuf.\n");
 		}
 
-		m->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
+		m->l2_len = sizeof(struct ether_hdr);
 
 		/* 02:00:00:00:00:xx */
 		d_addr_bytes = &eth_hdr->d_addr.addr_bytes[0];
examples/ip_pipeline/pipeline_rx.c +2 -2
index 7a8309c..8f1f781 100644
@@ -255,8 +255,8 @@ app_pkt_metadata_fill(struct rte_mbuf *m)
 	/* Pop Ethernet header */
 	if (app.ether_hdr_pop_push) {
 		rte_pktmbuf_adj(m, (uint16_t)sizeof(struct ether_hdr));
-		m->vlan_macip.f.l2_len = 0;
-		m->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+		m->l2_len = 0;
+		m->l3_len = sizeof(struct ipv4_hdr);
 	}
 }
 
examples/ip_pipeline/pipeline_tx.c +1 -1
index b9491e3..64904b2 100644
@@ -66,7 +66,7 @@ app_pkt_metadata_flush(struct rte_mbuf *pkt)
 	ether_addr_copy(&pkt_meta->nh_arp, &ether_hdr->d_addr);
 	ether_addr_copy(&local_ether_addr, &ether_hdr->s_addr);
 	ether_hdr->ether_type = rte_bswap16(ETHER_TYPE_IPv4);
-	pkt->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
+	pkt->l2_len = sizeof(struct ether_hdr);
 }
 
 static int
examples/ip_reassembly/main.c +4 -4
index 8184aad..b6b4f59 100644
@@ -412,8 +412,8 @@ reassemble(struct rte_mbuf *m, uint8_t portid, uint32_t queue,
 			dr = &qconf->death_row;
 
 			/* prepare mbuf: setup l2_len/l3_len. */
-			m->vlan_macip.f.l2_len = sizeof(*eth_hdr);
-			m->vlan_macip.f.l3_len = sizeof(*ip_hdr);
+			m->l2_len = sizeof(*eth_hdr);
+			m->l3_len = sizeof(*ip_hdr);
 
 			/* process this fragment. */
 			mo = rte_ipv4_frag_reassemble_packet(tbl, dr, m, tms, ip_hdr);
@@ -455,8 +455,8 @@ reassemble(struct rte_mbuf *m, uint8_t portid, uint32_t queue,
 			dr  = &qconf->death_row;
 
 			/* prepare mbuf: setup l2_len/l3_len. */
-			m->vlan_macip.f.l2_len = sizeof(*eth_hdr);
-			m->vlan_macip.f.l3_len = sizeof(*ip_hdr) + sizeof(*frag_hdr);
+			m->l2_len = sizeof(*eth_hdr);
+			m->l3_len = sizeof(*ip_hdr) + sizeof(*frag_hdr);
 
 			mo = rte_ipv6_frag_reassemble_packet(tbl, dr, m, tms, ip_hdr, frag_hdr);
 			if (mo == NULL)
examples/ipv4_multicast/main.c +3 -1
index 2232851..4233d33 100644
@@ -338,7 +338,9 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone)
 
 	/* copy metadata from source packet*/
 	hdr->port = pkt->port;
-	hdr->vlan_macip = pkt->vlan_macip;
+	hdr->vlan_tci = pkt->vlan_tci;
+	hdr->l2_len = pkt->l2_len;
+	hdr->l3_len = pkt->l3_len;
 	hdr->hash = pkt->hash;
 
 	hdr->ol_flags = pkt->ol_flags;
examples/vhost/main.c +3 -3
index 9320bd3..beadb5c 100644
@@ -2690,9 +2690,9 @@ virtio_tx_route_zcp(struct virtio_net *dev, struct rte_mbuf *m,
 		mbuf->buf_addr = m->buf_addr;
 	}
 	mbuf->ol_flags = PKT_TX_VLAN_PKT;
-	mbuf->vlan_macip.f.vlan_tci = vlan_tag;
-	mbuf->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
-	mbuf->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+	mbuf->vlan_tci = vlan_tag;
+	mbuf->l2_len = sizeof(struct ether_hdr);
+	mbuf->l3_len = sizeof(struct ipv4_hdr);
 	MBUF_HEADROOM_UINT32(mbuf) = (uint32_t)desc_idx;
 
 	tx_q->m_table[len] = mbuf;
lib/librte_ip_frag/ip_frag_common.h +1 -2
index 81ca23a..210f409 100644
@@ -173,8 +173,7 @@ ip_frag_chain(struct rte_mbuf *mn, struct rte_mbuf *mp)
 	struct rte_mbuf *ms;
 
 	/* adjust start of the last fragment data. */
-	rte_pktmbuf_adj(mp, (uint16_t)(mp->vlan_macip.f.l2_len +
-		mp->vlan_macip.f.l3_len));
+	rte_pktmbuf_adj(mp, (uint16_t)(mp->l2_len + mp->l3_len));
 
 	/* chain two fragments. */
 	ms = rte_pktmbuf_lastseg(mn);
lib/librte_ip_frag/rte_ipv4_fragmentation.c +1 -1
index 0b10310..6b9f07d 100644
@@ -198,7 +198,7 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,
 		    out_pkt->pkt_len - sizeof(struct ipv4_hdr));
 
 		out_pkt->ol_flags |= PKT_TX_IP_CKSUM;
-		out_pkt->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+		out_pkt->l3_len = sizeof(struct ipv4_hdr);
 
 		/* Write the fragment to the output list */
 		pkts_out[out_pkt_pos] = out_pkt;
lib/librte_ip_frag/rte_ipv4_reassembly.c +3 -3
index 06c37af..0b8ceeb 100644
@@ -87,10 +87,10 @@ ipv4_frag_reassemble(const struct ip_frag_pkt *fp)
 
 	/* update ipv4 header for the reassmebled packet */
 	ip_hdr = (struct ipv4_hdr*)(rte_pktmbuf_mtod(m, uint8_t *) +
-		m->vlan_macip.f.l2_len);
+		m->l2_len);
 
 	ip_hdr->total_length = rte_cpu_to_be_16((uint16_t)(fp->total_size +
-		m->vlan_macip.f.l3_len));
+		m->l3_len));
 	ip_hdr->fragment_offset = (uint16_t)(ip_hdr->fragment_offset &
 		rte_cpu_to_be_16(IPV4_HDR_DF_FLAG));
 	ip_hdr->hdr_checksum = 0;
@@ -137,7 +137,7 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
 
 	ip_ofs *= IPV4_HDR_OFFSET_UNITS;
 	ip_len = (uint16_t)(rte_be_to_cpu_16(ip_hdr->total_length) -
-		mb->vlan_macip.f.l3_len);
+		mb->l3_len);
 
 	IP_FRAG_LOG(DEBUG, "%s:%d:\n"
 		"mbuf: %p, tms: %" PRIu64
lib/librte_ip_frag/rte_ipv6_reassembly.c +2 -3
index dee3425..71cf721 100644
@@ -109,7 +109,7 @@ ipv6_frag_reassemble(const struct ip_frag_pkt *fp)
 
 	/* update ipv6 header for the reassembled datagram */
 	ip_hdr = (struct ipv6_hdr *) (rte_pktmbuf_mtod(m, uint8_t *) +
-								  m->vlan_macip.f.l2_len);
+								  m->l2_len);
 
 	ip_hdr->payload_len = rte_cpu_to_be_16(payload_len);
 
@@ -120,8 +120,7 @@ ipv6_frag_reassemble(const struct ip_frag_pkt *fp)
 	 * other headers, so we assume there are no other headers and thus update
 	 * the main IPv6 header instead.
 	 */
-	move_len = m->vlan_macip.f.l2_len + m->vlan_macip.f.l3_len -
-			sizeof(*frag_hdr);
+	move_len = m->l2_len + m->l3_len - sizeof(*frag_hdr);
 	frag_hdr = (struct ipv6_extension_fragment *) (ip_hdr + 1);
 	ip_hdr->proto = frag_hdr->next_header;
 
lib/librte_mbuf/rte_mbuf.h +9 -24
index 047a5a7..32e8474 100644
@@ -111,27 +111,6 @@ extern "C" {
  */
 #define PKT_TX_OFFLOAD_MASK (PKT_TX_VLAN_PKT | PKT_TX_IP_CKSUM | PKT_TX_L4_MASK)
 
-/** Offload features */
-union rte_vlan_macip {
-	uint32_t data;
-	struct {
-		uint16_t l3_len:9; /**< L3 (IP) Header Length. */
-		uint16_t l2_len:7; /**< L2 (MAC) Header Length. */
-		uint16_t vlan_tci;
-		/**< VLAN Tag Control Identifier (CPU order). */
-	} f;
-};
-
-/*
- * Compare mask for vlan_macip_len.data,
- * should be in sync with rte_vlan_macip.f layout.
- * */
-#define TX_VLAN_CMP_MASK        0xFFFF0000  /**< VLAN length - 16-bits. */
-#define TX_MAC_LEN_CMP_MASK     0x0000FE00  /**< MAC length - 7-bits. */
-#define TX_IP_LEN_CMP_MASK      0x000001FF  /**< IP  length - 9-bits. */
-/**< MAC+IP  length. */
-#define TX_MACIP_LEN_CMP_MASK   (TX_MAC_LEN_CMP_MASK | TX_IP_LEN_CMP_MASK)
-
 /**
  * The generic rte_mbuf, containing a packet mbuf.
  */
@@ -170,7 +149,9 @@ struct rte_mbuf {
 	uint32_t pkt_len;       /**< Total pkt len: sum of all segment data_len. */
 
 	/* offload features, valid for first segment only */
-	union rte_vlan_macip vlan_macip;
+	uint16_t l3_len:9;      /**< L3 (IP) Header Length. */
+	uint16_t l2_len:7;      /**< L2 (MAC) Header Length. */
+	uint16_t vlan_tci;      /**< VLAN Tag Control Identifier (CPU order). */
 	union {
 		uint32_t rss;       /**< RSS hash result if RSS enabled */
 		struct {
@@ -540,7 +521,9 @@ static inline void rte_pktmbuf_reset(struct rte_mbuf *m)
 
 	m->next = NULL;
 	m->pkt_len = 0;
-	m->vlan_macip.data = 0;
+	m->l2_len = 0;
+	m->l3_len = 0;
+	m->vlan_tci = 0;
 	m->nb_segs = 1;
 	m->port = 0xff;
 
@@ -607,7 +590,9 @@ static inline void rte_pktmbuf_attach(struct rte_mbuf *mi, struct rte_mbuf *md)
 	mi->data = md->data;
 	mi->data_len = md->data_len;
 	mi->port = md->port;
-	mi->vlan_macip = md->vlan_macip;
+	mi->vlan_tci = md->vlan_tci;
+	mi->l2_len = md->l2_len;
+	mi->l3_len = md->l3_len;
 	mi->hash = md->hash;
 
 	mi->next = NULL;
lib/librte_pmd_e1000/em_rxtx.c +31 -9
index 074c9b3..4f46bdf 100644
@@ -144,13 +144,34 @@ enum {
 	EM_CTX_NUM  = 1, /**< CTX NUM */
 };
 
+/** Offload features */
+union em_vlan_macip {
+	uint32_t data;
+	struct {
+		uint16_t l3_len:9; /**< L3 (IP) Header Length. */
+		uint16_t l2_len:7; /**< L2 (MAC) Header Length. */
+		uint16_t vlan_tci;
+		/**< VLAN Tag Control Identifier (CPU order). */
+	} f;
+};
+
+/*
+ * Compare mask for vlan_macip_len.data,
+ * should be in sync with em_vlan_macip.f layout.
+ * */
+#define TX_VLAN_CMP_MASK        0xFFFF0000  /**< VLAN length - 16-bits. */
+#define TX_MAC_LEN_CMP_MASK     0x0000FE00  /**< MAC length - 7-bits. */
+#define TX_IP_LEN_CMP_MASK      0x000001FF  /**< IP  length - 9-bits. */
+/**< MAC+IP  length. */
+#define TX_MACIP_LEN_CMP_MASK   (TX_MAC_LEN_CMP_MASK | TX_IP_LEN_CMP_MASK)
+
 /**
  * Structure to check if new context need be built
  */
 struct em_ctx_info {
 	uint16_t flags;               /**< ol_flags related to context build. */
 	uint32_t cmp_mask;            /**< compare mask */
-	union rte_vlan_macip hdrlen;  /**< L2 and L3 header lenghts */
+	union em_vlan_macip hdrlen;  /**< L2 and L3 header lenghts */
 };
 
 /**
@@ -219,7 +240,7 @@ static inline void
 em_set_xmit_ctx(struct em_tx_queue* txq,
 		volatile struct e1000_context_desc *ctx_txd,
 		uint16_t flags,
-		union rte_vlan_macip hdrlen)
+		union em_vlan_macip hdrlen)
 {
 	uint32_t cmp_mask, cmd_len;
 	uint16_t ipcse, l2len;
@@ -285,7 +306,7 @@ em_set_xmit_ctx(struct em_tx_queue* txq,
  */
 static inline uint32_t
 what_ctx_update(struct em_tx_queue *txq, uint16_t flags,
-		union rte_vlan_macip hdrlen)
+		union em_vlan_macip hdrlen)
 {
 	/* If match with the current context */
 	if (likely (txq->ctx_cache.flags == flags &&
@@ -391,7 +412,7 @@ eth_em_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	uint16_t tx_ol_req;
 	uint32_t ctx;
 	uint32_t new_ctx;
-	union rte_vlan_macip hdrlen;
+	union em_vlan_macip hdrlen;
 
 	txq = tx_queue;
 	sw_ring = txq->sw_ring;
@@ -421,7 +442,9 @@ eth_em_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		tx_ol_req = (uint16_t)(ol_flags & (PKT_TX_IP_CKSUM |
 							PKT_TX_L4_MASK));
 		if (tx_ol_req) {
-			hdrlen = tx_pkt->vlan_macip;
+			hdrlen.f.vlan_tci = tx_pkt->vlan_tci;
+			hdrlen.f.l2_len = tx_pkt->l2_len;
+			hdrlen.f.l3_len = tx_pkt->l3_len;
 			/* If new context to be built or reuse the exist ctx. */
 			ctx = what_ctx_update(txq, tx_ol_req, hdrlen);
 
@@ -516,8 +539,7 @@ eth_em_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		/* Set VLAN Tag offload fields. */
 		if (ol_flags & PKT_TX_VLAN_PKT) {
 			cmd_type_len |= E1000_TXD_CMD_VLE;
-			popts_spec = tx_pkt->vlan_macip.f.vlan_tci <<
-				E1000_TXD_VLAN_SHIFT;
+			popts_spec = tx_pkt->vlan_tci << E1000_TXD_VLAN_SHIFT;
 		}
 
 		if (tx_ol_req) {
@@ -784,7 +806,7 @@ eth_em_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 				rx_desc_error_to_pkt_flags(rxd.errors));
 
 		/* Only valid if PKT_RX_VLAN_PKT set in pkt_flags */
-		rxm->vlan_macip.f.vlan_tci = rte_le_to_cpu_16(rxd.special);
+		rxm->vlan_tci = rte_le_to_cpu_16(rxd.special);
 
 		/*
 		 * Store the mbuf address into the next entry of the array
@@ -1010,7 +1032,7 @@ eth_em_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 					rx_desc_error_to_pkt_flags(rxd.errors));
 
 		/* Only valid if PKT_RX_VLAN_PKT set in pkt_flags */
-		rxm->vlan_macip.f.vlan_tci = rte_le_to_cpu_16(rxd.special);
+		rxm->vlan_tci = rte_le_to_cpu_16(rxd.special);
 
 		/* Prefetch data of first segment, if configured to do so. */
 		rte_packet_prefetch(first_seg->data);
lib/librte_pmd_e1000/igb_rxtx.c +30 -9
index 8b33b6d..4e9f42e 100644
@@ -153,13 +153,34 @@ enum igb_advctx_num {
 	IGB_CTX_NUM  = 2, /**< CTX_NUM */
 };
 
+/** Offload features */
+union igb_vlan_macip {
+	uint32_t data;
+	struct {
+		uint16_t l3_len:9; /**< L3 (IP) Header Length. */
+		uint16_t l2_len:7; /**< L2 (MAC) Header Length. */
+		uint16_t vlan_tci;
+		/**< VLAN Tag Control Identifier (CPU order). */
+	} f;
+};
+
+/*
+ * Compare mask for vlan_macip_len.data,
+ * should be in sync with igb_vlan_macip.f layout.
+ * */
+#define TX_VLAN_CMP_MASK        0xFFFF0000  /**< VLAN length - 16-bits. */
+#define TX_MAC_LEN_CMP_MASK     0x0000FE00  /**< MAC length - 7-bits. */
+#define TX_IP_LEN_CMP_MASK      0x000001FF  /**< IP  length - 9-bits. */
+/**< MAC+IP  length. */
+#define TX_MACIP_LEN_CMP_MASK   (TX_MAC_LEN_CMP_MASK | TX_IP_LEN_CMP_MASK)
+
 /**
  * Strucutre to check if new context need be built
  */
 struct igb_advctx_info {
 	uint16_t flags;           /**< ol_flags related to context build. */
 	uint32_t cmp_mask;        /**< compare mask for vlan_macip_lens */
-	union rte_vlan_macip vlan_macip_lens; /**< vlan, mac & ip length. */
+	union igb_vlan_macip vlan_macip_lens; /**< vlan, mac & ip length. */
 };
 
 /**
@@ -342,6 +363,7 @@ eth_igb_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	volatile union e1000_adv_tx_desc *txd;
 	struct rte_mbuf     *tx_pkt;
 	struct rte_mbuf     *m_seg;
+	union igb_vlan_macip vlan_macip_lens;
 	uint64_t buf_dma_addr;
 	uint32_t olinfo_status;
 	uint32_t cmd_type_len;
@@ -355,7 +377,6 @@ eth_igb_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	uint16_t tx_ol_req;
 	uint32_t new_ctx = 0;
 	uint32_t ctx = 0;
-	uint32_t vlan_macip_lens;
 
 	txq = tx_queue;
 	sw_ring = txq->sw_ring;
@@ -380,13 +401,15 @@ eth_igb_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		tx_last = (uint16_t) (tx_id + tx_pkt->nb_segs - 1);
 
 		ol_flags = tx_pkt->ol_flags;
-		vlan_macip_lens = tx_pkt->vlan_macip.data;
+		vlan_macip_lens.f.vlan_tci = tx_pkt->vlan_tci;
+		vlan_macip_lens.f.l2_len = tx_pkt->l2_len;
+		vlan_macip_lens.f.l3_len = tx_pkt->l3_len;
 		tx_ol_req = (uint16_t)(ol_flags & PKT_TX_OFFLOAD_MASK);
 
 		/* If a Context Descriptor need be built . */
 		if (tx_ol_req) {
 			ctx = what_advctx_update(txq, tx_ol_req,
-				vlan_macip_lens);
+				vlan_macip_lens.data);
 			/* Only allocate context descriptor if required*/
 			new_ctx = (ctx == IGB_CTX_NUM);
 			ctx = txq->ctx_curr;
@@ -502,7 +525,7 @@ eth_igb_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 				}
 
 				igbe_set_xmit_ctx(txq, ctx_txd, tx_ol_req,
-				    vlan_macip_lens);
+				    vlan_macip_lens.data);
 
 				txe->last_id = tx_last;
 				tx_id = txe->next_id;
@@ -764,8 +787,7 @@ eth_igb_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		rxm->hash.rss = rxd.wb.lower.hi_dword.rss;
 		hlen_type_rss = rte_le_to_cpu_32(rxd.wb.lower.lo_dword.data);
 		/* Only valid if PKT_RX_VLAN_PKT set in pkt_flags */
-		rxm->vlan_macip.f.vlan_tci =
-			rte_le_to_cpu_16(rxd.wb.upper.vlan);
+		rxm->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan);
 
 		pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(hlen_type_rss);
 		pkt_flags = (uint16_t)(pkt_flags |
@@ -1001,8 +1023,7 @@ eth_igb_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		 * The vlan_tci field is only valid when PKT_RX_VLAN_PKT is
 		 * set in the pkt_flags field.
 		 */
-		first_seg->vlan_macip.f.vlan_tci =
-			rte_le_to_cpu_16(rxd.wb.upper.vlan);
+		first_seg->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan);
 		hlen_type_rss = rte_le_to_cpu_32(rxd.wb.lower.lo_dword.data);
 		pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(hlen_type_rss);
 		pkt_flags = (uint16_t)(pkt_flags |
lib/librte_pmd_i40e/i40e_rxtx.c +7 -7
index c481976..e41e8d0 100644
@@ -613,7 +613,7 @@ i40e_rx_scan_hw_ring(struct i40e_rx_queue *rxq)
 				I40E_RXD_QW1_LENGTH_PBUF_SHIFT) - rxq->crc_len;
 			mb->data_len = pkt_len;
 			mb->pkt_len = pkt_len;
-			mb->vlan_macip.f.vlan_tci = rx_status &
+			mb->vlan_tci = rx_status &
 				(1 << I40E_RX_DESC_STATUS_L2TAG1P_SHIFT) ?
 			rte_le_to_cpu_16(\
 				rxdp[j].wb.qword0.lo_dword.l2tag1) : 0;
@@ -850,7 +850,7 @@ i40e_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 		rxm->data_len = rx_packet_len;
 		rxm->port = rxq->port_id;
 
-		rxm->vlan_macip.f.vlan_tci = rx_status &
+		rxm->vlan_tci = rx_status &
 			(1 << I40E_RX_DESC_STATUS_L2TAG1P_SHIFT) ?
 			rte_le_to_cpu_16(rxd.wb.qword0.lo_dword.l2tag1) : 0;
 		pkt_flags = i40e_rxd_status_to_pkt_flags(qword1);
@@ -1003,7 +1003,7 @@ i40e_recv_scattered_pkts(void *rx_queue,
 		}
 
 		first_seg->port = rxq->port_id;
-		first_seg->vlan_macip.f.vlan_tci = (rx_status &
+		first_seg->vlan_tci = (rx_status &
 			(1 << I40E_RX_DESC_STATUS_L2TAG1P_SHIFT)) ?
 			rte_le_to_cpu_16(rxd.wb.qword0.lo_dword.l2tag1) : 0;
 		pkt_flags = i40e_rxd_status_to_pkt_flags(qword1);
@@ -1105,8 +1105,8 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		RTE_MBUF_PREFETCH_TO_FREE(txe->mbuf);
 
 		ol_flags = tx_pkt->ol_flags;
-		l2_len = tx_pkt->vlan_macip.f.l2_len;
-		l3_len = tx_pkt->vlan_macip.f.l3_len;
+		l2_len = tx_pkt->l2_len;
+		l3_len = tx_pkt->l3_len;
 
 		/* Calculate the number of context descriptors needed. */
 		nb_ctx = i40e_calc_context_desc(ol_flags);
@@ -1142,8 +1142,8 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
 		/* Descriptor based VLAN insertion */
 		if (ol_flags & PKT_TX_VLAN_PKT) {
-			tx_flags |= tx_pkt->vlan_macip.f.vlan_tci <<
-						I40E_TX_FLAG_L2TAG1_SHIFT;
+			tx_flags |= tx_pkt->vlan_tci <<
+					I40E_TX_FLAG_L2TAG1_SHIFT;
 			tx_flags |= I40E_TX_FLAG_INSERT_VLAN;
 			td_cmd |= I40E_TX_DESC_CMD_IL2TAG1;
 			td_tag = (tx_flags & I40E_TX_FLAG_L2TAG1_MASK) >>
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +9 -9
index eec1458..b897b1e 100644
@@ -540,6 +540,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	volatile union ixgbe_adv_tx_desc *txd;
 	struct rte_mbuf     *tx_pkt;
 	struct rte_mbuf     *m_seg;
+	union ixgbe_vlan_macip vlan_macip_lens;
 	uint64_t buf_dma_addr;
 	uint32_t olinfo_status;
 	uint32_t cmd_type_len;
@@ -551,7 +552,6 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	uint16_t nb_tx;
 	uint16_t nb_used;
 	uint16_t tx_ol_req;
-	uint32_t vlan_macip_lens;
 	uint32_t ctx = 0;
 	uint32_t new_ctx;
 
@@ -579,14 +579,16 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		 * are needed for offload functionality.
 		 */
 		ol_flags = tx_pkt->ol_flags;
-		vlan_macip_lens = tx_pkt->vlan_macip.data;
+		vlan_macip_lens.f.vlan_tci = tx_pkt->vlan_tci;
+		vlan_macip_lens.f.l2_len = tx_pkt->l2_len;
+		vlan_macip_lens.f.l3_len = tx_pkt->l3_len;
 
 		/* If hardware offload required */
 		tx_ol_req = (uint16_t)(ol_flags & PKT_TX_OFFLOAD_MASK);
 		if (tx_ol_req) {
 			/* If new context need be built or reuse the exist ctx. */
 			ctx = what_advctx_update(txq, tx_ol_req,
-				vlan_macip_lens);
+				vlan_macip_lens.data);
 			/* Only allocate context descriptor if required*/
 			new_ctx = (ctx == IXGBE_CTX_NUM);
 			ctx = txq->ctx_curr;
@@ -728,7 +730,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 				}
 
 				ixgbe_set_xmit_ctx(txq, ctx_txd, tx_ol_req,
-				    vlan_macip_lens);
+				    vlan_macip_lens.data);
 
 				txe->last_id = tx_last;
 				tx_id = txe->next_id;
@@ -939,7 +941,7 @@ ixgbe_rx_scan_hw_ring(struct igb_rx_queue *rxq)
 							rxq->crc_len);
 			mb->data_len = pkt_len;
 			mb->pkt_len = pkt_len;
-			mb->vlan_macip.f.vlan_tci = rxdp[j].wb.upper.vlan;
+			mb->vlan_tci = rxdp[j].wb.upper.vlan;
 			mb->hash.rss = rxdp[j].wb.lower.hi_dword.rss;
 
 			/* convert descriptor fields to rte mbuf flags */
@@ -1257,8 +1259,7 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 		hlen_type_rss = rte_le_to_cpu_32(rxd.wb.lower.lo_dword.data);
 		/* Only valid if PKT_RX_VLAN_PKT set in pkt_flags */
-		rxm->vlan_macip.f.vlan_tci =
-			rte_le_to_cpu_16(rxd.wb.upper.vlan);
+		rxm->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan);
 
 		pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(hlen_type_rss);
 		pkt_flags = (uint16_t)(pkt_flags |
@@ -1502,8 +1503,7 @@ ixgbe_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		 * The vlan_tci field is only valid when PKT_RX_VLAN_PKT is
 		 * set in the pkt_flags field.
 		 */
-		first_seg->vlan_macip.f.vlan_tci =
-				rte_le_to_cpu_16(rxd.wb.upper.vlan);
+		first_seg->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan);
 		hlen_type_rss = rte_le_to_cpu_32(rxd.wb.lower.lo_dword.data);
 		pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(hlen_type_rss);
 		pkt_flags = (uint16_t)(pkt_flags |
lib/librte_pmd_ixgbe/ixgbe_rxtx.h +22 -1
index 4c9cb74..2f1f40c 100644
@@ -153,6 +153,27 @@ enum ixgbe_advctx_num {
 	IXGBE_CTX_NUM  = 2, /**< CTX NUMBER  */
 };
 
+/** Offload features */
+union ixgbe_vlan_macip {
+	uint32_t data;
+	struct {
+		uint16_t l3_len:9; /**< L3 (IP) Header Length. */
+		uint16_t l2_len:7; /**< L2 (MAC) Header Length. */
+		uint16_t vlan_tci;
+		/**< VLAN Tag Control Identifier (CPU order). */
+	} f;
+};
+
+/*
+ * Compare mask for vlan_macip_len.data,
+ * should be in sync with ixgbe_vlan_macip.f layout.
+ * */
+#define TX_VLAN_CMP_MASK        0xFFFF0000  /**< VLAN length - 16-bits. */
+#define TX_MAC_LEN_CMP_MASK     0x0000FE00  /**< MAC length - 7-bits. */
+#define TX_IP_LEN_CMP_MASK      0x000001FF  /**< IP  length - 9-bits. */
+/**< MAC+IP  length. */
+#define TX_MACIP_LEN_CMP_MASK   (TX_MAC_LEN_CMP_MASK | TX_IP_LEN_CMP_MASK)
+
 /**
  * Structure to check if new context need be built
  */
@@ -160,7 +181,7 @@ enum ixgbe_advctx_num {
 struct ixgbe_advctx_info {
 	uint16_t flags;           /**< ol_flags for context build. */
 	uint32_t cmp_mask;        /**< compare mask for vlan_macip_lens */
-	union rte_vlan_macip vlan_macip_lens; /**< vlan, mac ip length. */
+	union ixgbe_vlan_macip vlan_macip_lens; /**< vlan, mac ip length. */
 };
 
 /**
lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c +3 -3
index 3536765..90325e1 100644
@@ -550,8 +550,8 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 					       rte_pktmbuf_mtod(rxm, void *));
 #endif
 				/* Copy vlan tag in packet buffer */
-				rxm->vlan_macip.f.vlan_tci =
-					rte_le_to_cpu_16((uint16_t)rcd->tci);
+				rxm->vlan_tci = rte_le_to_cpu_16(
+						(uint16_t)rcd->tci);
 
 			} else
 				rxm->ol_flags = 0;
@@ -563,7 +563,7 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 			rxm->pkt_len = (uint16_t)rcd->len;
 			rxm->data_len = (uint16_t)rcd->len;
 			rxm->port = rxq->port_id;
-			rxm->vlan_macip.f.vlan_tci = 0;
+			rxm->vlan_tci = 0;
 			rxm->data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
 
 			rx_pkts[nb_rx++] = rxm;
Signature · 1 line
1.9.3

A message that is not in the archive (sent off-list or not yet received): 1409240559-14447-7-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#38 lore raw

Re: [PATCH v2 6/6] mbuf: flatten struct vlan_macip into mbuf struct

Quoted 20 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Thursday, August 28, 2014 4:43 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH v2 6/6] mbuf: flatten struct vlan_macip into mbuf struct

The vlan_macip structure combined a vlan tag id with l2 and l3 headers lengths for tracking offloads. However, this structure was only used as a unit by the e1000 and ixgbe drivers, not generally.

This patch removes the structure from the mbuf header and places the fields into the mbuf structure directly at the required point, without any net effect on the structure layout. This allows us to treat the vlan tags and header length fields as separate for future mbuf changes. The drivers which were written to use the combined structure still do so, using a driver-local definition of it.

Quoted 4 lines

Changes in V2:
* None

After applying this patch, I see a performance degradation (around 5%) using testpmd with the default RX path, so this may require a v3 patch.

Thanks,
Pablo

A message that is not in the archive (sent off-list or not yet received): E115CCD9D858EF4F90C690B0DCB4D89722614382-kPTMFJFq+rEMvF1YICWikbfspsVTdybXVpNB7YpNyf8@public.gmane.org

#40 lore raw

Re: [PATCH v2 6/6] mbuf: flatten struct vlan_macip into mbuf struct

Quoted 30 lines

-----Original Message-----
From: De Lara Guarch, Pablo
Sent: Friday, September 05, 2014 5:21 PM
To: Richardson, Bruce; [email protected]
Subject: RE: [dpdk-dev] [PATCH v2 6/6] mbuf: flatten struct vlan_macip into mbuf struct

Quoted 21 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Thursday, August 28, 2014 4:43 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH v2 6/6] mbuf: flatten struct vlan_macip into mbuf struct

The vlan_macip structure combined a vlan tag id with l2 and l3 headers lengths for tracking offloads. However, this structure was only used as a unit by the e1000 and ixgbe drivers, not generally.

This patch removes the structure from the mbuf header and places the fields into the mbuf structure directly at the required point, without any net effect on the structure layout. This allows us to treat the vlan tags and header length fields as separate for future mbuf changes. The drivers which were written to use the combined structure still do so, using a driver-local definition of it.

Changes in V2:
* None

Quoted 7 lines
Quoted 1 line

After applying this patch, I see a performance degradation (around 5%) using testpmd with the default RX path, so this may require a v3 patch.

Thanks,
Pablo

Thanks for Pablo for flagging this. Since no fields are moved in the structure, merely flattened, I suspect any degradation must come from having the l2_len and l3_len bit fields split out. I'll do up a v3 with a union to allow them to be assigned simultaneously and see if it helps things. Fast-path is unaffected in my tests.

/Bruce

Acked-by
#41 lore raw

Re: [PATCH v2 6/6] mbuf: flatten struct vlan_macip into mbuf struct

In reply to a message not in the archive

Hi Bruce,

Just small typos below.

Quoted 35 lines · Bruce Richardson

The vlan_macip structure combined a vlan tag id with l2 and l3 headers lengths for tracking offloads. However, this structure was only used as a unit by the e1000 and ixgbe drivers, not generally.

This patch removes the structure from the mbuf header and places the fields into the mbuf structure directly at the required point, without any net effect on the structure layout. This allows us to treat the vlan tags and header length fields as separate for future mbuf changes. The drivers which were written to use the combined structure still do so, using a driver-local definition of it.

Changes in V2:
* None

[...]

lib/librte_pmd_e1000/em_rxtx.c +11 -0
index 074c9b3..4f46bdf 100644
@@ -144,13 +144,34 @@ enum {
 	EM_CTX_NUM  = 1, /**< CTX NUM */
 };
 
+/** Offload features */
+union em_vlan_macip {
+	uint32_t data;
+	struct {
+		uint16_t l3_len:9; /**< L3 (IP) Header Length. */
+		uint16_t l2_len:7; /**< L2 (MAC) Header Length. */
+		uint16_t vlan_tci;
+		/**< VLAN Tag Control Identifier (CPU order). */
+	} f;
+};
+

lib/librte_pmd_e1000/em_rxtx.c enum { · line 167

Quoted 10 lines
lib/librte_pmd_e1000/em_rxtx.c +10 -0
+/*
+ * Compare mask for vlan_macip_len.data,
+ * should be in sync with em_vlan_macip.f layout.
+ * */
+#define TX_VLAN_CMP_MASK        0xFFFF0000  /**< VLAN length - 16-bits. */
+#define TX_MAC_LEN_CMP_MASK     0x0000FE00  /**< MAC length - 7-bits. */
+#define TX_IP_LEN_CMP_MASK      0x000001FF  /**< IP  length - 9-bits. */
+/**< MAC+IP  length. */
+#define TX_MACIP_LEN_CMP_MASK   (TX_MAC_LEN_CMP_MASK | TX_IP_LEN_CMP_MASK)
+

I think the doxygen syntax "/**<" is only used for comments that are after the name. It was already like this before your patch (in rte_mbuf.h), but maybe it's a good occasion to fix this typo. There is the same in igb and ixgbe.

lib/librte_pmd_e1000/em_rxtx.c enum { · line 175

Quoted 9 lines
lib/librte_pmd_e1000/em_rxtx.c +1 -1
 /**
  * Structure to check if new context need be built
  */
 struct em_ctx_info {
 	uint16_t flags;               /**< ol_flags related to context build. */
 	uint32_t cmp_mask;            /**< compare mask */
-	union rte_vlan_macip hdrlen;  /**< L2 and L3 header lenghts */
+	union em_vlan_macip hdrlen;  /**< L2 and L3 header lenghts */
 };

The comment is not aligned with the others.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#43 lore raw

PATCH v3 6/6 mbuf: flatten struct vlan_macip into mbuf struct

The vlan_macip structure combined a vlan tag id with l2 and l3 headers lengths for tracking offloads. However, this structure was only used as a unit by the e1000 and ixgbe drivers, not generally.

This patch removes the structure from the mbuf header and places the fields into the mbuf structure directly at the required point, without any net effect on the structure layout. This allows us to treat the vlan tags and header length fields as separate for future mbuf changes. The drivers which were written to use the combined structure still do so, using a driver-local definition of it.

Changes in V2:
* None

Changes in V3:
* minor comment cleanup following review by Olivier
* reduce perf regression caused by splitting vlan_macip field. This is done by providing a single uint16_t value to allow writing/clearing the l2 and l3 lengths together. There is still a small perf hit to the slow path TX due to the reads from vlan_tci and l2/l3 lengths being separated. (<5% in my tests with testpmd with no extra params). Unfortunately, this cannot be eliminated, without restoring the vlan tags and l2/l3 lengths as a combined 32-bit field. This would prevent us from ever looking to move those fields about and is an artificial tie that applies only for performance in igb and ixgbe drivers. Therefore, this patch keeps the vlan_tci field separate from the lengths as the best solution going forward.

V2 Acked-by: Olivier Matz <[email protected]>

fixup cleanup

---
 app/test-pmd/csumonly.c                     |  4 +--
 app/test-pmd/flowgen.c                      | 14 ++++-----
 app/test-pmd/macfwd.c                       |  6 ++--
 app/test-pmd/macswap.c                      |  6 ++--
 app/test-pmd/rxonly.c                       |  3 +-
 app/test-pmd/testpmd.c                      |  3 +-
 app/test-pmd/txonly.c                       |  6 ++--
 app/test/packet_burst_generator.c           | 10 +++----
 examples/ip_fragmentation/main.c            |  2 +-
 examples/ip_pipeline/pipeline_rx.c          |  4 +--
 examples/ip_pipeline/pipeline_tx.c          |  2 +-
 examples/ip_reassembly/main.c               |  8 +++---
 examples/ipv4_multicast/main.c              |  3 +-
 examples/vhost/main.c                       |  6 ++--
 lib/librte_ip_frag/ip_frag_common.h         |  3 +-
 lib/librte_ip_frag/rte_ipv4_fragmentation.c |  2 +-
 lib/librte_ip_frag/rte_ipv4_reassembly.c    |  6 ++--
 lib/librte_ip_frag/rte_ipv6_reassembly.c    |  5 ++--
 lib/librte_mbuf/rte_mbuf.h                  | 36 ++++++++---------------
 lib/librte_pmd_e1000/em_rxtx.c              | 44 +++++++++++++++++++++--------
 lib/librte_pmd_e1000/igb_rxtx.c             | 37 ++++++++++++++++++------
 lib/librte_pmd_i40e/i40e_rxtx.c             | 14 ++++-----
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c           | 17 ++++++-----
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h           | 22 ++++++++++++++-
 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c       |  6 ++--
 25 files changed, 158 insertions(+), 111 deletions(-)
app/test-pmd/csumonly.c +2 -2
index 655b6d8..28b66f5 100644
@@ -432,8 +432,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 		}
 
 		/* Combine the packet header write. VLAN is not consider here */
-		mb->vlan_macip.f.l2_len = l2_len;
-		mb->vlan_macip.f.l3_len = l3_len;
+		mb->l2_len = l2_len;
+		mb->l3_len = l3_len;
 		mb->ol_flags = ol_flags;
 	}
 	nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx);
app/test-pmd/flowgen.c +7 -7
index 17dbf83..b091b6d 100644
@@ -205,13 +205,13 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
 		udp_hdr->dgram_len	= RTE_CPU_TO_BE_16(pkt_size -
 							   sizeof(*eth_hdr) -
 							   sizeof(*ip_hdr));
-		pkt->nb_segs			= 1;
-		pkt->pkt_len			= pkt_size;
-		pkt->ol_flags			= ol_flags;
-		pkt->vlan_macip.f.vlan_tci	= vlan_tci;
-		pkt->vlan_macip.f.l2_len	= sizeof(struct ether_hdr);
-		pkt->vlan_macip.f.l3_len	= sizeof(struct ipv4_hdr);
-		pkts_burst[nb_pkt]		= pkt;
+		pkt->nb_segs		= 1;
+		pkt->pkt_len		= pkt_size;
+		pkt->ol_flags		= ol_flags;
+		pkt->vlan_tci		= vlan_tci;
+		pkt->l2_len		= sizeof(struct ether_hdr);
+		pkt->l3_len		= sizeof(struct ipv4_hdr);
+		pkts_burst[nb_pkt]	= pkt;
 
 		next_flow = (next_flow + 1) % cfg_n_flows;
 	}
app/test-pmd/macfwd.c +3 -3
index 999c8e3..4b905cd 100644
@@ -116,9 +116,9 @@ pkt_burst_mac_forward(struct fwd_stream *fs)
 		ether_addr_copy(&ports[fs->tx_port].eth_addr,
 				&eth_hdr->s_addr);
 		mb->ol_flags = txp->tx_ol_flags;
-		mb->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
-		mb->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
-		mb->vlan_macip.f.vlan_tci = txp->tx_vlan_id;
+		mb->l2_len = sizeof(struct ether_hdr);
+		mb->l3_len = sizeof(struct ipv4_hdr);
+		mb->vlan_tci = txp->tx_vlan_id;
 	}
 	nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx);
 	fs->tx_packets += nb_tx;
app/test-pmd/macswap.c +3 -3
index 731f487..c5b3a0c 100644
@@ -118,9 +118,9 @@ pkt_burst_mac_swap(struct fwd_stream *fs)
 		ether_addr_copy(&addr, &eth_hdr->s_addr);
 
 		mb->ol_flags = txp->tx_ol_flags;
-		mb->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
-		mb->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
-		mb->vlan_macip.f.vlan_tci = txp->tx_vlan_id;
+		mb->l2_len = sizeof(struct ether_hdr);
+		mb->l3_len = sizeof(struct ipv4_hdr);
+		mb->vlan_tci = txp->tx_vlan_id;
 	}
 	nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx);
 	fs->tx_packets += nb_tx;
app/test-pmd/rxonly.c +1 -2
index c34a5e1..5bc74da 100644
@@ -165,8 +165,7 @@ pkt_burst_receive(struct fwd_stream *fs)
 			printf(" - FDIR hash=0x%x - FDIR id=0x%x ",
 			       mb->hash.fdir.hash, mb->hash.fdir.id);
 		if (ol_flags & PKT_RX_VLAN_PKT)
-			printf(" - VLAN tci=0x%x",
-				mb->vlan_macip.f.vlan_tci);
+			printf(" - VLAN tci=0x%x", mb->vlan_tci);
 		printf("\n");
 		if (ol_flags != 0) {
 			int rxf;
app/test-pmd/testpmd.c +2 -1
index d13a53a..b426dfc 100644
@@ -406,7 +406,8 @@ testpmd_mbuf_ctor(struct rte_mempool *mp,
 	mb->ol_flags     = 0;
 	mb->data         = (char *) mb->buf_addr + RTE_PKTMBUF_HEADROOM;
 	mb->nb_segs      = 1;
-	mb->vlan_macip.data = 0;
+	mb->l2_l3_len       = 0;
+	mb->vlan_tci     = 0;
 	mb->hash.rss     = 0;
 }
 
app/test-pmd/txonly.c +3 -3
index 1b2f661..8135264 100644
@@ -263,9 +263,9 @@ pkt_burst_transmit(struct fwd_stream *fs)
 		pkt->nb_segs = tx_pkt_nb_segs;
 		pkt->pkt_len = tx_pkt_length;
 		pkt->ol_flags = ol_flags;
-		pkt->vlan_macip.f.vlan_tci  = vlan_tci;
-		pkt->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
-		pkt->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+		pkt->vlan_tci  = vlan_tci;
+		pkt->l2_len = sizeof(struct ether_hdr);
+		pkt->l3_len = sizeof(struct ipv4_hdr);
 		pkts_burst[nb_pkt] = pkt;
 	}
 	nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_pkt);
app/test/packet_burst_generator.c +5 -5
index 8740348..db7f023 100644
@@ -260,19 +260,19 @@ nomore_mbuf:
 		 */
 		pkt->nb_segs = tx_pkt_nb_segs;
 		pkt->pkt_len = tx_pkt_length;
-		pkt->vlan_macip.f.l2_len = eth_hdr_size;
+		pkt->l2_len = eth_hdr_size;
 
 		if (ipv4) {
-			pkt->vlan_macip.f.vlan_tci  = ETHER_TYPE_IPv4;
-			pkt->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+			pkt->vlan_tci  = ETHER_TYPE_IPv4;
+			pkt->l3_len = sizeof(struct ipv4_hdr);
 
 			if (vlan_enabled)
 				pkt->ol_flags = PKT_RX_IPV4_HDR | PKT_RX_VLAN_PKT;
 			else
 				pkt->ol_flags = PKT_RX_IPV4_HDR;
 		} else {
-			pkt->vlan_macip.f.vlan_tci  = ETHER_TYPE_IPv6;
-			pkt->vlan_macip.f.l3_len = sizeof(struct ipv6_hdr);
+			pkt->vlan_tci  = ETHER_TYPE_IPv6;
+			pkt->l3_len = sizeof(struct ipv6_hdr);
 
 			if (vlan_enabled)
 				pkt->ol_flags = PKT_RX_IPV6_HDR | PKT_RX_VLAN_PKT;
examples/ip_fragmentation/main.c +1 -1
index ac8d4f7..6d309b5 100644
@@ -413,7 +413,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf,
 			rte_panic("No headroom in mbuf.\n");
 		}
 
-		m->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
+		m->l2_len = sizeof(struct ether_hdr);
 
 		/* 02:00:00:00:00:xx */
 		d_addr_bytes = &eth_hdr->d_addr.addr_bytes[0];
examples/ip_pipeline/pipeline_rx.c +2 -2
index 7a8309c..8f1f781 100644
@@ -255,8 +255,8 @@ app_pkt_metadata_fill(struct rte_mbuf *m)
 	/* Pop Ethernet header */
 	if (app.ether_hdr_pop_push) {
 		rte_pktmbuf_adj(m, (uint16_t)sizeof(struct ether_hdr));
-		m->vlan_macip.f.l2_len = 0;
-		m->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+		m->l2_len = 0;
+		m->l3_len = sizeof(struct ipv4_hdr);
 	}
 }
 
examples/ip_pipeline/pipeline_tx.c +1 -1
index b9491e3..64904b2 100644
@@ -66,7 +66,7 @@ app_pkt_metadata_flush(struct rte_mbuf *pkt)
 	ether_addr_copy(&pkt_meta->nh_arp, &ether_hdr->d_addr);
 	ether_addr_copy(&local_ether_addr, &ether_hdr->s_addr);
 	ether_hdr->ether_type = rte_bswap16(ETHER_TYPE_IPv4);
-	pkt->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
+	pkt->l2_len = sizeof(struct ether_hdr);
 }
 
 static int
examples/ip_reassembly/main.c +4 -4
index 8184aad..b6b4f59 100644
@@ -412,8 +412,8 @@ reassemble(struct rte_mbuf *m, uint8_t portid, uint32_t queue,
 			dr = &qconf->death_row;
 
 			/* prepare mbuf: setup l2_len/l3_len. */
-			m->vlan_macip.f.l2_len = sizeof(*eth_hdr);
-			m->vlan_macip.f.l3_len = sizeof(*ip_hdr);
+			m->l2_len = sizeof(*eth_hdr);
+			m->l3_len = sizeof(*ip_hdr);
 
 			/* process this fragment. */
 			mo = rte_ipv4_frag_reassemble_packet(tbl, dr, m, tms, ip_hdr);
@@ -455,8 +455,8 @@ reassemble(struct rte_mbuf *m, uint8_t portid, uint32_t queue,
 			dr  = &qconf->death_row;
 
 			/* prepare mbuf: setup l2_len/l3_len. */
-			m->vlan_macip.f.l2_len = sizeof(*eth_hdr);
-			m->vlan_macip.f.l3_len = sizeof(*ip_hdr) + sizeof(*frag_hdr);
+			m->l2_len = sizeof(*eth_hdr);
+			m->l3_len = sizeof(*ip_hdr) + sizeof(*frag_hdr);
 
 			mo = rte_ipv6_frag_reassemble_packet(tbl, dr, m, tms, ip_hdr, frag_hdr);
 			if (mo == NULL)
examples/ipv4_multicast/main.c +2 -1
index 2232851..35bd842 100644
@@ -338,7 +338,8 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone)
 
 	/* copy metadata from source packet*/
 	hdr->port = pkt->port;
-	hdr->vlan_macip = pkt->vlan_macip;
+	hdr->vlan_tci = pkt->vlan_tci;
+	hdr->l2_l3_len = pkt->l2_l3_len;
 	hdr->hash = pkt->hash;
 
 	hdr->ol_flags = pkt->ol_flags;
examples/vhost/main.c +3 -3
index f0f8cfa..4e1c103 100644
@@ -2690,9 +2690,9 @@ virtio_tx_route_zcp(struct virtio_net *dev, struct rte_mbuf *m,
 		mbuf->buf_addr = m->buf_addr;
 	}
 	mbuf->ol_flags = PKT_TX_VLAN_PKT;
-	mbuf->vlan_macip.f.vlan_tci = vlan_tag;
-	mbuf->vlan_macip.f.l2_len = sizeof(struct ether_hdr);
-	mbuf->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+	mbuf->vlan_tci = vlan_tag;
+	mbuf->l2_len = sizeof(struct ether_hdr);
+	mbuf->l3_len = sizeof(struct ipv4_hdr);
 	MBUF_HEADROOM_UINT32(mbuf) = (uint32_t)desc_idx;
 
 	tx_q->m_table[len] = mbuf;
lib/librte_ip_frag/ip_frag_common.h +1 -2
index 81ca23a..210f409 100644
@@ -173,8 +173,7 @@ ip_frag_chain(struct rte_mbuf *mn, struct rte_mbuf *mp)
 	struct rte_mbuf *ms;
 
 	/* adjust start of the last fragment data. */
-	rte_pktmbuf_adj(mp, (uint16_t)(mp->vlan_macip.f.l2_len +
-		mp->vlan_macip.f.l3_len));
+	rte_pktmbuf_adj(mp, (uint16_t)(mp->l2_len + mp->l3_len));
 
 	/* chain two fragments. */
 	ms = rte_pktmbuf_lastseg(mn);
lib/librte_ip_frag/rte_ipv4_fragmentation.c +1 -1
index 0b10310..6b9f07d 100644
@@ -198,7 +198,7 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,
 		    out_pkt->pkt_len - sizeof(struct ipv4_hdr));
 
 		out_pkt->ol_flags |= PKT_TX_IP_CKSUM;
-		out_pkt->vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+		out_pkt->l3_len = sizeof(struct ipv4_hdr);
 
 		/* Write the fragment to the output list */
 		pkts_out[out_pkt_pos] = out_pkt;
lib/librte_ip_frag/rte_ipv4_reassembly.c +3 -3
index 06c37af..0b8ceeb 100644
@@ -87,10 +87,10 @@ ipv4_frag_reassemble(const struct ip_frag_pkt *fp)
 
 	/* update ipv4 header for the reassmebled packet */
 	ip_hdr = (struct ipv4_hdr*)(rte_pktmbuf_mtod(m, uint8_t *) +
-		m->vlan_macip.f.l2_len);
+		m->l2_len);
 
 	ip_hdr->total_length = rte_cpu_to_be_16((uint16_t)(fp->total_size +
-		m->vlan_macip.f.l3_len));
+		m->l3_len));
 	ip_hdr->fragment_offset = (uint16_t)(ip_hdr->fragment_offset &
 		rte_cpu_to_be_16(IPV4_HDR_DF_FLAG));
 	ip_hdr->hdr_checksum = 0;
@@ -137,7 +137,7 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
 
 	ip_ofs *= IPV4_HDR_OFFSET_UNITS;
 	ip_len = (uint16_t)(rte_be_to_cpu_16(ip_hdr->total_length) -
-		mb->vlan_macip.f.l3_len);
+		mb->l3_len);
 
 	IP_FRAG_LOG(DEBUG, "%s:%d:\n"
 		"mbuf: %p, tms: %" PRIu64
lib/librte_ip_frag/rte_ipv6_reassembly.c +2 -3
index dee3425..71cf721 100644
@@ -109,7 +109,7 @@ ipv6_frag_reassemble(const struct ip_frag_pkt *fp)
 
 	/* update ipv6 header for the reassembled datagram */
 	ip_hdr = (struct ipv6_hdr *) (rte_pktmbuf_mtod(m, uint8_t *) +
-								  m->vlan_macip.f.l2_len);
+								  m->l2_len);
 
 	ip_hdr->payload_len = rte_cpu_to_be_16(payload_len);
 
@@ -120,8 +120,7 @@ ipv6_frag_reassemble(const struct ip_frag_pkt *fp)
 	 * other headers, so we assume there are no other headers and thus update
 	 * the main IPv6 header instead.
 	 */
-	move_len = m->vlan_macip.f.l2_len + m->vlan_macip.f.l3_len -
-			sizeof(*frag_hdr);
+	move_len = m->l2_len + m->l3_len - sizeof(*frag_hdr);
 	frag_hdr = (struct ipv6_extension_fragment *) (ip_hdr + 1);
 	ip_hdr->proto = frag_hdr->next_header;
 
lib/librte_mbuf/rte_mbuf.h +12 -24
index 047a5a7..a523d82 100644
@@ -111,27 +111,6 @@ extern "C" {
  */
 #define PKT_TX_OFFLOAD_MASK (PKT_TX_VLAN_PKT | PKT_TX_IP_CKSUM | PKT_TX_L4_MASK)
 
-/** Offload features */
-union rte_vlan_macip {
-	uint32_t data;
-	struct {
-		uint16_t l3_len:9; /**< L3 (IP) Header Length. */
-		uint16_t l2_len:7; /**< L2 (MAC) Header Length. */
-		uint16_t vlan_tci;
-		/**< VLAN Tag Control Identifier (CPU order). */
-	} f;
-};
-
-/*
- * Compare mask for vlan_macip_len.data,
- * should be in sync with rte_vlan_macip.f layout.
- * */
-#define TX_VLAN_CMP_MASK        0xFFFF0000  /**< VLAN length - 16-bits. */
-#define TX_MAC_LEN_CMP_MASK     0x0000FE00  /**< MAC length - 7-bits. */
-#define TX_IP_LEN_CMP_MASK      0x000001FF  /**< IP  length - 9-bits. */
-/**< MAC+IP  length. */
-#define TX_MACIP_LEN_CMP_MASK   (TX_MAC_LEN_CMP_MASK | TX_IP_LEN_CMP_MASK)
-
 /**
  * The generic rte_mbuf, containing a packet mbuf.
  */
@@ -170,7 +149,14 @@ struct rte_mbuf {
 	uint32_t pkt_len;       /**< Total pkt len: sum of all segment data_len. */
 
 	/* offload features, valid for first segment only */
-	union rte_vlan_macip vlan_macip;
+	union {
+		uint16_t l2_l3_len; /**< combined l2/l3 lengths as single var */
+		struct {
+			uint16_t l3_len:9;      /**< L3 (IP) Header Length. */
+			uint16_t l2_len:7;      /**< L2 (MAC) Header Length. */
+		};
+	};
+	uint16_t vlan_tci;      /**< VLAN Tag Control Identifier (CPU order). */
 	union {
 		uint32_t rss;       /**< RSS hash result if RSS enabled */
 		struct {
@@ -540,7 +526,8 @@ static inline void rte_pktmbuf_reset(struct rte_mbuf *m)
 
 	m->next = NULL;
 	m->pkt_len = 0;
-	m->vlan_macip.data = 0;
+	m->l2_l3_len = 0;
+	m->vlan_tci = 0;
 	m->nb_segs = 1;
 	m->port = 0xff;
 
@@ -607,7 +594,8 @@ static inline void rte_pktmbuf_attach(struct rte_mbuf *mi, struct rte_mbuf *md)
 	mi->data = md->data;
 	mi->data_len = md->data_len;
 	mi->port = md->port;
-	mi->vlan_macip = md->vlan_macip;
+	mi->vlan_tci = md->vlan_tci;
+	mi->l2_l3_len = md->l2_l3_len;
 	mi->hash = md->hash;
 
 	mi->next = NULL;
lib/librte_pmd_e1000/em_rxtx.c +33 -11

96 lines not on this page · raw message

lib/librte_pmd_e1000/igb_rxtx.c +28 -9
index 8b33b6d..d4a803e 100644
@@ -153,13 +153,33 @@ enum igb_advctx_num {
 	IGB_CTX_NUM  = 2, /**< CTX_NUM */
 };
 
+/** Offload features */
+union igb_vlan_macip {
+	uint32_t data;
+	struct {
+		uint16_t l2_l3_len; /**< 7bit L2 and 9b L3 lengths combined */
+		uint16_t vlan_tci;
+		/**< VLAN Tag Control Identifier (CPU order). */
+	} f;
+};
+
+/*
+ * Compare mask for vlan_macip_len.data,
+ * should be in sync with igb_vlan_macip.f layout.
+ * */
+#define TX_VLAN_CMP_MASK        0xFFFF0000  /**< VLAN length - 16-bits. */
+#define TX_MAC_LEN_CMP_MASK     0x0000FE00  /**< MAC length - 7-bits. */
+#define TX_IP_LEN_CMP_MASK      0x000001FF  /**< IP  length - 9-bits. */
+/** MAC+IP  length. */
+#define TX_MACIP_LEN_CMP_MASK   (TX_MAC_LEN_CMP_MASK | TX_IP_LEN_CMP_MASK)
+
 /**
  * Strucutre to check if new context need be built
  */
 struct igb_advctx_info {
 	uint16_t flags;           /**< ol_flags related to context build. */
 	uint32_t cmp_mask;        /**< compare mask for vlan_macip_lens */
-	union rte_vlan_macip vlan_macip_lens; /**< vlan, mac & ip length. */
+	union igb_vlan_macip vlan_macip_lens; /**< vlan, mac & ip length. */
 };
 
 /**
@@ -342,6 +362,7 @@ eth_igb_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	volatile union e1000_adv_tx_desc *txd;
 	struct rte_mbuf     *tx_pkt;
 	struct rte_mbuf     *m_seg;
+	union igb_vlan_macip vlan_macip_lens;
 	uint64_t buf_dma_addr;
 	uint32_t olinfo_status;
 	uint32_t cmd_type_len;
@@ -355,7 +376,6 @@ eth_igb_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	uint16_t tx_ol_req;
 	uint32_t new_ctx = 0;
 	uint32_t ctx = 0;
-	uint32_t vlan_macip_lens;
 
 	txq = tx_queue;
 	sw_ring = txq->sw_ring;
@@ -380,13 +400,14 @@ eth_igb_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		tx_last = (uint16_t) (tx_id + tx_pkt->nb_segs - 1);
 
 		ol_flags = tx_pkt->ol_flags;
-		vlan_macip_lens = tx_pkt->vlan_macip.data;
+		vlan_macip_lens.f.vlan_tci = tx_pkt->vlan_tci;
+		vlan_macip_lens.f.l2_l3_len = tx_pkt->l2_l3_len;
 		tx_ol_req = (uint16_t)(ol_flags & PKT_TX_OFFLOAD_MASK);
 
 		/* If a Context Descriptor need be built . */
 		if (tx_ol_req) {
 			ctx = what_advctx_update(txq, tx_ol_req,
-				vlan_macip_lens);
+				vlan_macip_lens.data);
 			/* Only allocate context descriptor if required*/
 			new_ctx = (ctx == IGB_CTX_NUM);
 			ctx = txq->ctx_curr;
@@ -502,7 +523,7 @@ eth_igb_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 				}
 
 				igbe_set_xmit_ctx(txq, ctx_txd, tx_ol_req,
-				    vlan_macip_lens);
+				    vlan_macip_lens.data);
 
 				txe->last_id = tx_last;
 				tx_id = txe->next_id;
@@ -764,8 +785,7 @@ eth_igb_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		rxm->hash.rss = rxd.wb.lower.hi_dword.rss;
 		hlen_type_rss = rte_le_to_cpu_32(rxd.wb.lower.lo_dword.data);
 		/* Only valid if PKT_RX_VLAN_PKT set in pkt_flags */
-		rxm->vlan_macip.f.vlan_tci =
-			rte_le_to_cpu_16(rxd.wb.upper.vlan);
+		rxm->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan);
 
 		pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(hlen_type_rss);
 		pkt_flags = (uint16_t)(pkt_flags |
@@ -1001,8 +1021,7 @@ eth_igb_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		 * The vlan_tci field is only valid when PKT_RX_VLAN_PKT is
 		 * set in the pkt_flags field.
 		 */
-		first_seg->vlan_macip.f.vlan_tci =
-			rte_le_to_cpu_16(rxd.wb.upper.vlan);
+		first_seg->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan);
 		hlen_type_rss = rte_le_to_cpu_32(rxd.wb.lower.lo_dword.data);
 		pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(hlen_type_rss);
 		pkt_flags = (uint16_t)(pkt_flags |
lib/librte_pmd_i40e/i40e_rxtx.c +7 -7
index c481976..e41e8d0 100644
@@ -613,7 +613,7 @@ i40e_rx_scan_hw_ring(struct i40e_rx_queue *rxq)
 				I40E_RXD_QW1_LENGTH_PBUF_SHIFT) - rxq->crc_len;
 			mb->data_len = pkt_len;
 			mb->pkt_len = pkt_len;
-			mb->vlan_macip.f.vlan_tci = rx_status &
+			mb->vlan_tci = rx_status &
 				(1 << I40E_RX_DESC_STATUS_L2TAG1P_SHIFT) ?
 			rte_le_to_cpu_16(\
 				rxdp[j].wb.qword0.lo_dword.l2tag1) : 0;
@@ -850,7 +850,7 @@ i40e_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 		rxm->data_len = rx_packet_len;
 		rxm->port = rxq->port_id;
 
-		rxm->vlan_macip.f.vlan_tci = rx_status &
+		rxm->vlan_tci = rx_status &
 			(1 << I40E_RX_DESC_STATUS_L2TAG1P_SHIFT) ?
 			rte_le_to_cpu_16(rxd.wb.qword0.lo_dword.l2tag1) : 0;
 		pkt_flags = i40e_rxd_status_to_pkt_flags(qword1);
@@ -1003,7 +1003,7 @@ i40e_recv_scattered_pkts(void *rx_queue,
 		}
 
 		first_seg->port = rxq->port_id;
-		first_seg->vlan_macip.f.vlan_tci = (rx_status &
+		first_seg->vlan_tci = (rx_status &
 			(1 << I40E_RX_DESC_STATUS_L2TAG1P_SHIFT)) ?
 			rte_le_to_cpu_16(rxd.wb.qword0.lo_dword.l2tag1) : 0;
 		pkt_flags = i40e_rxd_status_to_pkt_flags(qword1);
@@ -1105,8 +1105,8 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		RTE_MBUF_PREFETCH_TO_FREE(txe->mbuf);
 
 		ol_flags = tx_pkt->ol_flags;
-		l2_len = tx_pkt->vlan_macip.f.l2_len;
-		l3_len = tx_pkt->vlan_macip.f.l3_len;
+		l2_len = tx_pkt->l2_len;
+		l3_len = tx_pkt->l3_len;
 
 		/* Calculate the number of context descriptors needed. */
 		nb_ctx = i40e_calc_context_desc(ol_flags);
@@ -1142,8 +1142,8 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
 		/* Descriptor based VLAN insertion */
 		if (ol_flags & PKT_TX_VLAN_PKT) {
-			tx_flags |= tx_pkt->vlan_macip.f.vlan_tci <<
-						I40E_TX_FLAG_L2TAG1_SHIFT;
+			tx_flags |= tx_pkt->vlan_tci <<
+					I40E_TX_FLAG_L2TAG1_SHIFT;
 			tx_flags |= I40E_TX_FLAG_INSERT_VLAN;
 			td_cmd |= I40E_TX_DESC_CMD_IL2TAG1;
 			td_tag = (tx_flags & I40E_TX_FLAG_L2TAG1_MASK) >>
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +8 -9
index eec1458..575a014 100644
@@ -540,6 +540,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	volatile union ixgbe_adv_tx_desc *txd;
 	struct rte_mbuf     *tx_pkt;
 	struct rte_mbuf     *m_seg;
+	union ixgbe_vlan_macip vlan_macip_lens;
 	uint64_t buf_dma_addr;
 	uint32_t olinfo_status;
 	uint32_t cmd_type_len;
@@ -551,7 +552,6 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	uint16_t nb_tx;
 	uint16_t nb_used;
 	uint16_t tx_ol_req;
-	uint32_t vlan_macip_lens;
 	uint32_t ctx = 0;
 	uint32_t new_ctx;
 
@@ -579,14 +579,15 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		 * are needed for offload functionality.
 		 */
 		ol_flags = tx_pkt->ol_flags;
-		vlan_macip_lens = tx_pkt->vlan_macip.data;
+		vlan_macip_lens.f.vlan_tci = tx_pkt->vlan_tci;
+		vlan_macip_lens.f.l2_l3_len = tx_pkt->l2_l3_len;
 
 		/* If hardware offload required */
 		tx_ol_req = (uint16_t)(ol_flags & PKT_TX_OFFLOAD_MASK);
 		if (tx_ol_req) {
 			/* If new context need be built or reuse the exist ctx. */
 			ctx = what_advctx_update(txq, tx_ol_req,
-				vlan_macip_lens);
+				vlan_macip_lens.data);
 			/* Only allocate context descriptor if required*/
 			new_ctx = (ctx == IXGBE_CTX_NUM);
 			ctx = txq->ctx_curr;
@@ -728,7 +729,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 				}
 
 				ixgbe_set_xmit_ctx(txq, ctx_txd, tx_ol_req,
-				    vlan_macip_lens);
+				    vlan_macip_lens.data);
 
 				txe->last_id = tx_last;
 				tx_id = txe->next_id;
@@ -939,7 +940,7 @@ ixgbe_rx_scan_hw_ring(struct igb_rx_queue *rxq)
 							rxq->crc_len);
 			mb->data_len = pkt_len;
 			mb->pkt_len = pkt_len;
-			mb->vlan_macip.f.vlan_tci = rxdp[j].wb.upper.vlan;
+			mb->vlan_tci = rxdp[j].wb.upper.vlan;
 			mb->hash.rss = rxdp[j].wb.lower.hi_dword.rss;
 
 			/* convert descriptor fields to rte mbuf flags */
@@ -1257,8 +1258,7 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 		hlen_type_rss = rte_le_to_cpu_32(rxd.wb.lower.lo_dword.data);
 		/* Only valid if PKT_RX_VLAN_PKT set in pkt_flags */
-		rxm->vlan_macip.f.vlan_tci =
-			rte_le_to_cpu_16(rxd.wb.upper.vlan);
+		rxm->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan);
 
 		pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(hlen_type_rss);
 		pkt_flags = (uint16_t)(pkt_flags |
@@ -1502,8 +1502,7 @@ ixgbe_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		 * The vlan_tci field is only valid when PKT_RX_VLAN_PKT is
 		 * set in the pkt_flags field.
 		 */
-		first_seg->vlan_macip.f.vlan_tci =
-				rte_le_to_cpu_16(rxd.wb.upper.vlan);
+		first_seg->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan);
 		hlen_type_rss = rte_le_to_cpu_32(rxd.wb.lower.lo_dword.data);
 		pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(hlen_type_rss);
 		pkt_flags = (uint16_t)(pkt_flags |
lib/librte_pmd_ixgbe/ixgbe_rxtx.h +21 -1
index 4c9cb74..41042ac 100644
@@ -153,6 +153,26 @@ enum ixgbe_advctx_num {
 	IXGBE_CTX_NUM  = 2, /**< CTX NUMBER  */
 };
 
+/** Offload features */
+union ixgbe_vlan_macip {
+	uint32_t data;
+	struct {
+		uint16_t l2_l3_len; /**< combined 9-bit l3, 7-bit l2 lengths */
+		uint16_t vlan_tci;
+		/**< VLAN Tag Control Identifier (CPU order). */
+	} f;
+};
+
+/*
+ * Compare mask for vlan_macip_len.data,
+ * should be in sync with ixgbe_vlan_macip.f layout.
+ * */
+#define TX_VLAN_CMP_MASK        0xFFFF0000  /**< VLAN length - 16-bits. */
+#define TX_MAC_LEN_CMP_MASK     0x0000FE00  /**< MAC length - 7-bits. */
+#define TX_IP_LEN_CMP_MASK      0x000001FF  /**< IP  length - 9-bits. */
+/** MAC+IP  length. */
+#define TX_MACIP_LEN_CMP_MASK   (TX_MAC_LEN_CMP_MASK | TX_IP_LEN_CMP_MASK)
+
 /**
  * Structure to check if new context need be built
  */
@@ -160,7 +180,7 @@ enum ixgbe_advctx_num {
 struct ixgbe_advctx_info {
 	uint16_t flags;           /**< ol_flags for context build. */
 	uint32_t cmp_mask;        /**< compare mask for vlan_macip_lens */
-	union rte_vlan_macip vlan_macip_lens; /**< vlan, mac ip length. */
+	union ixgbe_vlan_macip vlan_macip_lens; /**< vlan, mac ip length. */
 };
 
 /**
lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c +3 -3
index 4afb116..e74b6fd 100644
@@ -551,8 +551,8 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 					       rte_pktmbuf_mtod(rxm, void *));
 #endif
 				/* Copy vlan tag in packet buffer */
-				rxm->vlan_macip.f.vlan_tci =
-					rte_le_to_cpu_16((uint16_t)rcd->tci);
+				rxm->vlan_tci = rte_le_to_cpu_16(
+						(uint16_t)rcd->tci);
 
 			} else
 				rxm->ol_flags = 0;
@@ -564,7 +564,7 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 			rxm->pkt_len = (uint16_t)rcd->len;
 			rxm->data_len = (uint16_t)rcd->len;
 			rxm->port = rxq->port_id;
-			rxm->vlan_macip.f.vlan_tci = 0;
+			rxm->vlan_tci = 0;
 			rxm->data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
 
 			rx_pkts[nb_rx++] = rxm;
Signature · 1 line
1.9.3

A message that is not in the archive (sent off-list or not yet received): 1410273656-4567-1-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#45 lore raw

Re: [PATCH v3 6/6] mbuf: flatten struct vlan_macip into mbuf struct

Quoted 37 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Tuesday, September 09, 2014 3:41 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH v3 6/6] mbuf: flatten struct vlan_macip into mbuf struct

The vlan_macip structure combined a vlan tag id with l2 and l3 headers lengths for tracking offloads. However, this structure was only used as a unit by the e1000 and ixgbe drivers, not generally.

This patch removes the structure from the mbuf header and places the fields into the mbuf structure directly at the required point, without any net effect on the structure layout. This allows us to treat the vlan tags and header length fields as separate for future mbuf changes. The drivers which were written to use the combined structure still do so, using a driver-local definition of it.

Changes in V2:
* None

Changes in V3:
* minor comment cleanup following review by Olivier
* reduce perf regression caused by splitting vlan_macip field. This is done by providing a single uint16_t value to allow writing/clearing the l2 and l3 lengths together. There is still a small perf hit to the slow path TX due to the reads from vlan_tci and l2/l3 lengths being separated. (<5% in my tests with testpmd with no extra params). Unfortunately, this cannot be eliminated, without restoring the vlan tags and l2/l3 lengths as a combined 32-bit field. This would prevent us from ever looking to move those fields about and is an artificial tie that applies only for performance in igb and ixgbe drivers. Therefore, this patch keeps the vlan_tci field separate from the lengths as the best solution going forward.

Quoted 2 lines

V2 Acked-by: Olivier Matz <[email protected]>

V3 Acked-by: Pablo de Lara <[email protected]>

#46 lore raw
In reply to a message not in the archive

Hi Bruce,

Quoted 5 lines · Bruce Richardson

This patch set does some initial pre-work to prepare the mbuf data structure (and ixgbe vector driver to a lesser extent) for more major changes which will follow on in a subsequent patch set. [See previous RFC patch set for more indications of the future coming changes].

Quoted 7 lines

The main changes here are the flattening out of the mbuf data structure, with much of it based off work by Olivier. The ctrlmbuf and pktmbuf structures are now gone, as is the vlan_macip structure. However, in this set, the concept of having a separate ctrl mbuf type is kept around. The plan is in a later set when we expand the flags field to 64-bits, we can use a single bit in the flags to indicate a control packet. For now, though, the ctrlmbuf functions and macros just are aliases for the pktmbuf equivalents as much as possible.

I'm wondering it "struct rte_kni_mbuf" should be updated accordingly each time "struct mbuf" is modified.

Regards,
Olivier

A message that is not in the archive (sent off-list or not yet received): [email protected]

#48 lore raw
Quoted 22 lines

-----Original Message-----
From: Olivier MATZ [mailto:[email protected]]
Sent: Monday, September 08, 2014 1:33 PM
To: Richardson, Bruce; [email protected]
Subject: Re: [dpdk-dev] [PATCH 0/6] Mbuf structure Rework, part 1

Hi Bruce,

Quoted 11 lines · Bruce Richardson

This patch set does some initial pre-work to prepare the mbuf data structure (and ixgbe vector driver to a lesser extent) for more major changes which will follow on in a subsequent patch set. [See previous RFC patch set for more indications of the future coming changes].

The main changes here are the flattening out of the mbuf data structure, with much of it based off work by Olivier. The ctrlmbuf and pktmbuf structures are now gone, as is the vlan_macip structure. However, in this set, the concept of having a separate ctrl mbuf type is kept around. The plan is in a later set when we expand the flags field to 64-bits, we can use a single bit in the flags to indicate a control packet. For now, though, the ctrlmbuf functions and

Quoted 8 lines

macros

Quoted 1 line

just are aliases for the pktmbuf equivalents as much as possible.

I'm wondering it "struct rte_kni_mbuf" should be updated accordingly each time "struct mbuf" is modified.

Regards,
Olivier

Yes, it should. There are no changes needed for the part 1 patch set (6 patches), as it does not change the actual field layout, it just flattens the C definitions. I've already started working on an update to the second patch set (13 patches) including kni changes as part of it.

/Bruce