Extend the mbuf structure
cover Extend the mbuf structure
This patch set expands and enhances the mbuf data structure. This set includes patches previously submitted by Olivier to rework the mbuf, but takes the rework further than proposed there.
NOTE: This is still a work in progress! Feedback at this stage is still welcome though.
Outline of changes are:
* adds a second cache line to the structure
* moves some fields to that cache line to make space
* eliminates the control mbuf structure again to save space
* compresses the data pointer down to an offset to save space
* adds in new fields for:
- packet type
- sequence number
- inner_l3, l4 lengths
- max segment size
- user data pointer
- second vlan tag
* the flags field is expanded out to 64-bit, giving 48 new flags. The hash field is now called filters and is also expanded.
* some other structures are flattened out or otherwise reworked, e.g. vlan_macip field is gone.
* the field order has changed as fields are ordered more by function where they are used, e.g. rearm vs RX vs TX.
Following this patch set, the mbuf is larger, but still has free space in it for future expansion. The first cache line has 8 bytes free, and the second has 32 bytes free.
Current status: This patch set compiles on 64-bit gcc and clang, and handles throughput traffic using testpmd, in the fast path, and the full-features path cases, including handling jumbo frames. No performance regressions are seen in either of those cases, however further testing is needed, and is ongoing. Also, 32-bit support is not yet done.
Bruce Richardson (10):
mbuf: rename in_port to just port
mbuf: reorder fields by time-of-use
ixgbe: rework vector pmd following mbuf changes
mbuf: split mbuf across two cache lines. Fix performance regression due to moved pool ptr
mbuf: set next pointer to NULL on mbuf free.
ixgbe: make mbuf_initializer queue variable global
ixgbe: Make vector stores unaligned
mbuf: cleanup + added in additional mbuf fields.
ixgbe: Allow vector RX of scattered packets
Olivier Matz (4):
mbuf: rename RTE_MBUF_SCATTER_GATHER into RTE_MBUF_REFCNT
mbuf: remove rte_ctrlmbuf
mbuf: remove the rte_pktmbuf structure
mbuf: replace data pointer by an offset
app/test-pmd/cmdline.c | 2 - app/test-pmd/csumonly.c | 6 +- app/test-pmd/flowgen.c | 18 +- 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 | 11 +- app/test-pmd/testpmd.h | 2 +- app/test-pmd/txonly.c | 45 +-- app/test/commands.c | 2 - app/test/packet_burst_generator.c | 47 +-- app/test/test_distributor.c | 18 +- app/test/test_distributor_perf.c | 4 +- app/test/test_mbuf.c | 102 +---- app/test/test_sched.c | 4 +- app/test/test_table_acl.c | 7 +- app/test/test_table_pipeline.c | 10 +- config/common_bsdapp | 2 +- config/common_linuxapp | 2 +- doc/doxy-api.conf | 2 +- examples/dpdk_qat/crypto.c | 22 +- examples/dpdk_qat/main.c | 2 +- examples/exception_path/main.c | 11 +- examples/ip_pipeline/main.c | 2 +- examples/ip_reassembly/main.c | 8 +- examples/ipv4_multicast/Makefile | 4 +- examples/ipv4_multicast/main.c | 16 +- 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 | 79 ++-- 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 | 91 ++--- lib/librte_mbuf/rte_mbuf.h | 424 ++++++++------------- lib/librte_pmd_bond/rte_eth_bond_pmd.c | 4 +- lib/librte_pmd_e1000/e1000_ethdev.h | 21 + lib/librte_pmd_e1000/em_rxtx.c | 73 ++-- lib/librte_pmd_e1000/igb_rxtx.c | 83 ++-- lib/librte_pmd_i40e/i40e_rxtx.c | 109 +++--- lib/librte_pmd_ixgbe/ixgbe_ethdev.h | 21 + lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 151 ++++---- lib/librte_pmd_ixgbe/ixgbe_rxtx.h | 25 +- lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 395 ++++++++++--------- lib/librte_pmd_pcap/rte_eth_pcap.c | 14 +- lib/librte_pmd_virtio/virtio_rxtx.c | 22 +- lib/librte_pmd_virtio/virtqueue.h | 3 +- lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c | 29 +- lib/librte_pmd_xenvirt/rte_eth_xenvirt.c | 14 +- lib/librte_pmd_xenvirt/virtqueue.h | 4 +- lib/librte_sched/rte_sched.c | 14 +- lib/librte_sched/rte_sched.h | 21 +- 64 files changed, 1021 insertions(+), 1116 deletions(-)
Signature · 1 line
1.9.3
A message that is not in the archive (sent off-list or not yet received): 1407789890-17355-1-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
RFC PATCH 1/14 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.
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/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 ++-- 10 files changed, 38 insertions(+), 35 deletions(-)
app/test/test_mbuf.c +8 -8
@@ -82,7 +82,7 @@static struct rte_mempool *pktmbuf_pool =NULL ;static struct rte_mempool *ctrlmbuf_pool =NULL ; -#if definedRTE_MBUF_SCATTER_GATHER && definedRTE_MBUF_REFCNT_ATOMIC +#if definedRTE_MBUF_REFCNT && definedRTE_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 definedRTE_MBUF_SCATTER_GATHER && definedRTE_MBUF_REFCNT_ATOMIC +#if definedRTE_MBUF_REFCNT && definedRTE_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 definedRTE_MBUF_SCATTER_GATHER && definedRTE_MBUF_REFCNT_ATOMIC +#if definedRTE_MBUF_REFCNT && definedRTE_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
@@ -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
@@ -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
@@ -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/ip_pipeline/main.c +1 -1
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -404,7 +404,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 ];
@@ -427,7 +427,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 )
Signature · 1 line
1.9.3
A message that is not in the archive (sent off-list or not yet received): 1407789890-17355-2-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Stephen Hemminger
Acked-byRe: [RFC PATCH 01/14] mbuf: rename RTE_MBUF_SCATTER_GATHER into RTE_MBUF_REFCNT
Quoted 7 lines · On Mon, 11 Aug 2014 21:44:37 +0100 Bruce Richardson…
From: Olivier Matz <[email protected]>
It seems that
RTE_MBUF_SCATTER_GATHERis not the proper name for the feature it provides. "Scatter gather" means that data is stored using several buffers.RTE_MBUF_REFCNTseems to be a better name for that feature as it provides a reference counter for mbufs.
Quoted 5 lines
The macro
RTE_MBUF_SCATTER_GATHERis poisoned to ensure this modification is seen by drivers or applications using it.Signed-off-by Olivier Matz <[email protected]>Signed-off-by Bruce Richardson <[email protected]>
A message that is not in the archive (sent off-list or not yet received): 20140811144521.21058e5b-a7a0dvSY7KrRI77zikRAJc56i+j3xesD0e7PPNI6Mm0@public.gmane.org
Re: [RFC PATCH 01/14] mbuf: rename RTE_MBUF_SCATTER_GATHER into RTE_MBUF_REFCNT
Hi Bruce,
Quoted 10 lines · Stephen Hemminger
Quoted 7 lines · On Mon, 11 Aug 2014 21:44:37 +0100 Bruce Richardson…
From: Olivier Matz <[email protected]>
It seems that
RTE_MBUF_SCATTER_GATHERis not the proper name for the feature it provides. "Scatter gather" means that data is stored using several buffers.RTE_MBUF_REFCNTseems to be a better name for that feature as it provides a reference counter for mbufs.
Quoted 5 lines
Quoted 5 lines
The macro
RTE_MBUF_SCATTER_GATHERis poisoned to ensure this modification is seen by drivers or applications using it.Signed-off-by Olivier Matz <[email protected]>Signed-off-by Bruce Richardson <[email protected]>
After applying this first patch, I still get references to "scatter gather":
$ git grep RTE_MBUF_SCATTER_GATHER examples/Makefile:DIRS-$(CONFIG_RTE_MBUF_SCATTER_GATHER) += ip_fragmentation examples/Makefile:DIRS-$(CONFIG_RTE_MBUF_SCATTER_GATHER) += ipv4_multicast examples/ip_fragmentation/Makefile:ifneq ($(CONFIG_RTE_MBUF_SCATTER_GATHER),y) examples/ip_fragmentation/Makefile:$(error This application requires RTE_MBUF_SCATTER_GATHER to be enabled) examples/ip_pipeline/Makefile:ifeq ($(CONFIG_RTE_MBUF_SCATTER_GATHER),y) lib/librte_mbuf/rte_mbuf.h:#pragma GCC poison RTE_MBUF_SCATTER_GATHER lib/librte_port/Makefile:ifeq ($(CONFIG_RTE_MBUF_SCATTER_GATHER),y) lib/librte_port/Makefile:ifeq ($(CONFIG_RTE_MBUF_SCATTER_GATHER),y)
Olivier
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [RFC PATCH 01/14] mbuf: rename RTE_MBUF_SCATTER_GATHER into RTE_MBUF_REFCNT
Ok, thanks, I'll see about fixing those.
I see a number of comments about the format and structure of the patch set itself. I'll take those all on board, but I'll admit that I didn't rework the patchset much before submitting it as an RFC. I'm leaving that until I've finished on this and ready to start submitting non-RFC patchset for merge. Right now my primary concern is whether the reworked struct rte_mbuf has everything we need, and whether there are any performance regressions we need to fix due to the second cache line.
Regards,
/Bruce
Quoted 46 lines
-----Original Message-----
From: Olivier MATZ [mailto:[email protected]]
Sent: Tuesday, August 12, 2014 1:00 AM
To: Richardson, Bruce
Cc: Stephen Hemminger; [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 01/14] mbuf: renameRTE_MBUF_SCATTER_GATHERintoRTE_MBUF_REFCNTHi Bruce,
Quoted 10 lines · Stephen Hemminger
Quoted 7 lines · On Mon, 11 Aug 2014 21:44:37 +0100 Bruce Richardson…
From: Olivier Matz <[email protected]>
It seems that
RTE_MBUF_SCATTER_GATHERis not the proper name for the feature it provides. "Scatter gather" means that data is stored using several buffers.RTE_MBUF_REFCNTseems to be a better name for that feature as it provides a reference counter for mbufs.Quoted 5 lines
Quoted 5 lines
The macro
RTE_MBUF_SCATTER_GATHERis poisoned to ensure this modification is seen by drivers or applications using it.Signed-off-by Olivier Matz <[email protected]>Signed-off-by Bruce Richardson <[email protected]>After applying this first patch, I still get references to "scatter gather":
$ git grep RTE_MBUF_SCATTER_GATHER examples/Makefile:DIRS-$(CONFIG_RTE_MBUF_SCATTER_GATHER) += ip_fragmentation examples/Makefile:DIRS-$(CONFIG_RTE_MBUF_SCATTER_GATHER) += ipv4_multicast examples/ip_fragmentation/Makefile:ifneq ($(CONFIG_RTE_MBUF_SCATTER_GATHER),y) examples/ip_fragmentation/Makefile:$(error This application requires RTE_MBUF_SCATTER_GATHER to be enabled) examples/ip_pipeline/Makefile:ifeq ($(CONFIG_RTE_MBUF_SCATTER_GATHER),y) lib/librte_mbuf/rte_mbuf.h:#pragma GCC poison RTE_MBUF_SCATTER_GATHER lib/librte_port/Makefile:ifeq ($(CONFIG_RTE_MBUF_SCATTER_GATHER),y) lib/librte_port/Makefile:ifeq ($(CONFIG_RTE_MBUF_SCATTER_GATHER),y)Olivier
RFC PATCH 2/14 mbuf: remove rte_ctrlmbuf
In reply to a message not in the archiveFrom: 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.
Conflicts:
lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
--- 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/ipv4_multicast/main.c | 2 +- lib/librte_mbuf/rte_mbuf.c | 65 +++--------- lib/librte_mbuf/rte_mbuf.h | 175 ++++++------------------------- 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_ixgbe/ixgbe_rxtx_vec.c | 32 +++--- 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 +- 17 files changed, 71 insertions(+), 301 deletions(-)
app/test-pmd/cmdline.c +0 -1
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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/ipv4_multicast/main.c +1 -1
@@ -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 +12 -53
110 lines not on this page · raw message
lib/librte_mbuf/rte_mbuf.h +31 -144
340 lines not on this page · raw message
lib/librte_pmd_e1000/em_rxtx.c +1 -1
@@ -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
@@ -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
@@ -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
@@ -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_ixgbe/ixgbe_rxtx_vec.c +15 -17
@@ -47,24 +47,22 @@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 , + .pkt = { + .data_len =0 , + .pkt_len =0 , + + .vlan_macip = { + .data =0 , + }, + .hash = { + .rss =0 , }, + + .nb_segs =1 , + .in_port =0 , + + .next =NULL , + .data =NULL , }, };
lib/librte_pmd_virtio/virtio_rxtx.c +1 -1
@@ -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
@@ -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
@@ -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): 1407789890-17355-3-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Re: [RFC PATCH 02/14] mbuf: remove rte_ctrlmbuf
Hi Bruce,
Quoted 12 lines · Bruce Richardson
From: Olivier Matz <[email protected]>
The initial role of
rte_ctrlmbufis 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 therte_mbufstructure
- having some dead code rte_mbuf.[ch]This patch removes this feature. Thanks to it, it is now possible to simplify the
rte_mbufstructure by merging therte_pktmbufstructure in it. This is done in next commit.
Quoted 6 lines
Signed-off-by Olivier Matz <[email protected]>Conflicts:
lib/librte_pmd_vmxnet3/vmxnet3_rxtx.cSigned-off-by Bruce Richardson <[email protected]>
Same here, "git grep ctrlmbuf" finds results in examples/ip_pipeline/cmdline.c and examples/ip_pipeline/init.c
You can also see it by doing
"make examples T=x86_64-native-linuxapp-gcc" from dpdk root.
lib/librte_mbuf/rte_mbuf.h struct rte_mbuf { · line 185
Quoted 7 lines
lib/librte_mbuf/rte_mbuf.h +1
-2@@ -204,14 +182,10 @@ struct rte_mbuf {#else uint16_t refcnt_reserved;/**< Do not use this field */ #endif -uint8_t type;/**< Type of mbuf. */ -uint8_t reserved;/**< Unused field. Required for padding. */ +uint16_t reserved;/**< Unused field. Required for padding. */
This line breaks the alignment of comments (this typo was already present in my initial patch). By the way, there was also a patch called "mbuf: cosmetic changes in rte_mbuf structure" to restore the comments alignment for all the fields of the structure. Maybe it should be integrated in your series.
Regards,
Olivier
RFC PATCH 3/14 mbuf: remove the rte_pktmbuf structure
In reply to a message not in the archiveFrom: 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
Conflicts:
lib/librte_pmd_virtio/virtio_rxtx.c
lib/librte_pmd_virtio/virtqueue.h
lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
--- 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_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 | 140 ++++++++++----------- 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 | 46 ++++--- 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_sched/rte_sched.c | 14 +-- lib/librte_sched/rte_sched.h | 10 +- 57 files changed, 565 insertions(+), 571 deletions(-)
app/test-pmd/cmdline.c +0 -1
@@ -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
@@ -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
@@ -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, ð_hdr->d_addr);ether_addr_copy (&cfg_ether_src, ð_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
@@ -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=" , ð_h->s_addr);ether_addr_dump (" dst=" , ð_h->d_addr); }
app/test-pmd/ieee1588fwd.c +3 -3
@@ -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
@@ -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], ð_hdr->d_addr); ether_addr_copy(&ports[fs->tx_port].eth_addr,
app/test-pmd/macfwd.c +4 -4
@@ -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], ð_hdr->d_addr);ether_addr_copy (&ports[fs->tx_port].eth_addr, ð_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
@@ -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 (ð_hdr->d_addr, &addr);
@@ -118,9 +118,9 @@ pkt_burst_mac_swap(struct fwd_stream *fs)ether_addr_copy (&addr, ð_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
@@ -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=" , ð_hdr->s_addr);print_ether_addr (" - dst=" , ð_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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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_reassembly/main.c +4 -4
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -104,12 +104,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 */
@@ -140,10 +140,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 )
@@ -162,22 +162,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 +69 -71
275 lines not on this page · raw message
lib/librte_pmd_bond/rte_eth_bond_pmd.c +2 -2
@@ -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
@@ -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 +22 -24
85 lines not on this page · raw message
lib/librte_pmd_pcap/rte_eth_pcap.c +7 -7
@@ -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[i] = 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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_sched/rte_sched.c +7 -7
@@ -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
@@ -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, uint3static 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): 1407789890-17355-4-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Re: [RFC PATCH 03/14] mbuf: remove the rte_pktmbuf structure
Hi Bruce,
Quoted 14 lines · Bruce Richardson
From: Olivier Matz <[email protected]>
The
rte_pktmbufstructure was initially included in therte_mbufstructure. This was needed when there was 2 types of mbuf (ctrl and packet). As the control mbuf has been removed, we can merge therte_pktmbufinto therte_mbufstructure.Advantages of doing this:
- the access to mbuf fields is easier (ex:m->datainstead ofm->pkt.data)
- make the structure more consistent: for instance, there was no reason to have theol_flagsfield inrte_mbuf
- it will allow a deeper reorganization of therte_mbufstructure in the next commits, allowing to gain several bytes in it
Quoted 8 lines
Signed-off-by Olivier Matz <[email protected]>Conflicts:
lib/librte_pmd_virtio/virtio_rxtx.c
lib/librte_pmd_virtio/virtqueue.h
lib/librte_pmd_vmxnet3/vmxnet3_rxtx.cSigned-off-by Bruce Richardson <[email protected]>
Some files are missing. We can find some with: git grep "pkt\." in app/test/packet_burst_generator.c examples/ip_fragmentation/main.c examples/ip_pipeline/pipeline_rx.c examples/ip_pipeline/pipeline_tx.c lib/librte_port/rte_port_frag.c
I'm not sure it gives all remaining occurences. The best way to find them is probably to check the compilation of examples for all targets.
Olivier
RFC PATCH 4/14 mbuf: replace data pointer by an offset
In reply to a message not in the archiveFrom: Olivier Matz <[email protected]>
Original patch:
The mbuf structure already contains a pointer to the beginning of the buffer (m->buf_addr). It is not needed to use 8 bytes again to store another pointer to the beginning of the data.
Using a 16 bits unsigned integer is enough as we know that a mbuf is never longer than 64KB. We gain 6 bytes in the structure thanks to this modification.
This version:
* Updated original patch to apply to latest on mainline.
* Disabled vector PMD in config as it relies heavily on the mbuf layout
--- app/test-pmd/csumonly.c | 2 +- app/test-pmd/flowgen.c | 2 +- app/test-pmd/icmpecho.c | 2 +- app/test-pmd/macfwd-retry.c | 2 +- app/test-pmd/macfwd.c | 2 +- app/test-pmd/macswap.c | 2 +- app/test-pmd/rxonly.c | 2 +- app/test-pmd/testpmd.c | 2 +- app/test-pmd/txonly.c | 7 +++-- app/test/packet_burst_generator.c | 7 +++-- app/test/test_mbuf.c | 6 ++-- app/test/test_table_acl.c | 7 +++-- app/test/test_table_pipeline.c | 8 ++---- config/common_linuxapp | 2 +- examples/exception_path/main.c | 3 +- examples/vhost/main.c | 39 ++++++++++++++----------- examples/vhost_xen/main.c | 2 +- lib/librte_ip_frag/rte_ipv4_fragmentation.c | 6 ++-- lib/librte_ip_frag/rte_ipv6_fragmentation.c | 6 ++-- lib/librte_mbuf/rte_mbuf.c | 6 ++-- lib/librte_mbuf/rte_mbuf.h | 44 +++++++++++++---------------- lib/librte_pmd_bond/rte_eth_bond_pmd.c | 4 +-- lib/librte_pmd_e1000/em_rxtx.c | 12 ++++---- lib/librte_pmd_e1000/igb_rxtx.c | 13 ++++----- lib/librte_pmd_i40e/i40e_rxtx.c | 17 ++++++----- lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 13 +++++---- lib/librte_pmd_ixgbe/ixgbe_rxtx.h | 3 +- lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 1 - lib/librte_pmd_virtio/virtio_rxtx.c | 4 +-- lib/librte_pmd_virtio/virtqueue.h | 3 +- lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c | 5 ++-- 31 files changed, 115 insertions(+), 119 deletions(-)
app/test-pmd/csumonly.c +1 -1
@@ -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->data; + eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *); eth_type =rte_be_to_cpu_16 (eth_hdr->ether_type);if (eth_type ==ETHER_TYPE_VLAN ) {/* Only allow single VLAN label here */
app/test-pmd/flowgen.c +1 -1
@@ -175,7 +175,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) pkt->next =NULL ;/* Initialize Ethernet header. */ - eth_hdr = (struct ether_hdr *)pkt->data; + eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *);ether_addr_copy (&cfg_ether_dst, ð_hdr->d_addr);ether_addr_copy (&cfg_ether_src, ð_hdr->s_addr); eth_hdr->ether_type =rte_cpu_to_be_16 (ETHER_TYPE_IPv4);
app/test-pmd/icmpecho.c +1 -1
@@ -330,7 +330,7 @@ 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->data; + eth_h = rte_pktmbuf_mtod(pkt, struct ether_hdr *); eth_type =RTE_BE_TO_CPU_16 (eth_h->ether_type); l2_len =sizeof (struct ether_hdr );if (verbose_level >0 ) {
app/test-pmd/macfwd-retry.c +1 -1
@@ -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->data; + eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *);ether_addr_copy (&peer_eth_addrs[fs->peer_addr], ð_hdr->d_addr); ether_addr_copy(&ports[fs->tx_port].eth_addr,
app/test-pmd/macfwd.c +1 -1
@@ -110,7 +110,7 @@ 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->data; + eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *);ether_addr_copy (&peer_eth_addrs[fs->peer_addr], ð_hdr->d_addr); ether_addr_copy(&ports[fs->tx_port].eth_addr,
app/test-pmd/macswap.c +1 -1
@@ -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->data; + eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *);/* Swap dest and src mac addresses. */ ether_addr_copy (ð_hdr->d_addr, &addr);
app/test-pmd/rxonly.c +1 -1
@@ -149,7 +149,7 @@ pkt_burst_receive(struct fwd_stream *fs)rte_pktmbuf_free (mb);continue ; } - eth_hdr = (struct ether_hdr *) mb->data; + eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *); eth_type =RTE_BE_TO_CPU_16 (eth_hdr->ether_type); ol_flags = mb->ol_flags;print_ether_addr (" src=" , ð_hdr->s_addr);
app/test-pmd/testpmd.c +1 -1
@@ -404,7 +404,7 @@ 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->data = (char *) mb->buf_addr +RTE_PKTMBUF_HEADROOM ; + mb->data_off =RTE_PKTMBUF_HEADROOM ; mb->nb_segs =1 ; mb->vlan_macip.data =0 ; mb->hash.rss =0 ;
app/test-pmd/txonly.c +4 -3
@@ -111,13 +111,13 @@ copy_buf_to_pkt_segs(void* buf, unsigned len, struct rte_mbuf *pkt, seg = seg->next; } copy_len = seg->data_len - offset; - seg_buf = ((char *) seg->data + offset); + seg_buf = (rte_pktmbuf_mtod(seg, char *) + offset);while (len > copy_len) {rte_memcpy (seg_buf, buf, (size_t ) copy_len); len -= copy_len; buf = ((char *) buf + copy_len); seg = seg->next; - seg_buf = seg->data; + seg_buf = rte_pktmbuf_mtod(seg, char *); }rte_memcpy (seg_buf, buf, (size_t ) len); }
@@ -126,7 +126,8 @@ static inline void copy_buf_to_pkt(void* buf, unsigned len, struct rte_mbuf *pkt, unsigned offset) {if (offset + len <= pkt->data_len) { -rte_memcpy (((char *) pkt->data + offset), buf, (size_t ) len); + rte_memcpy((rte_pktmbuf_mtod(pkt, char *) + offset), + buf, (size_t ) len);return ; }copy_buf_to_pkt_segs (buf, len, pkt, offset);
app/test/packet_burst_generator.c +4 -3
@@ -59,13 +59,13 @@ copy_buf_to_pkt_segs(void *buf, unsigned len, struct rte_mbuf *pkt, seg = seg->next; } copy_len = seg->data_len - offset; - seg_buf = ((char *) seg->data + offset); + seg_buf = rte_pktmbuf_mtod(seg, char *) + offset;while (len > copy_len) {rte_memcpy (seg_buf, buf, (size_t ) copy_len); len -= copy_len; buf = ((char *) buf + copy_len); seg = seg->next; - seg_buf = seg->data; + seg_buf = rte_pktmbuf_mtod(seg, void *); }rte_memcpy (seg_buf, buf, (size_t ) len); }
@@ -74,7 +74,8 @@ static inline void copy_buf_to_pkt(void *buf, unsigned len, struct rte_mbuf *pkt, unsigned offset) {if (offset + len <= pkt->data_len) { -rte_memcpy (((char *) pkt->data + offset), buf, (size_t ) len); + rte_memcpy(rte_pktmbuf_mtod(pkt, char *) + offset, + buf, (size_t) len);return ; }copy_buf_to_pkt_segs (buf, len, pkt, offset);
app/test/test_mbuf.c +3 -3
@@ -432,7 +432,7 @@ test_pktmbuf_pool_ptr(void)printf ("rte_pktmbuf_alloc() failed (%u)\n" , i); ret =-1 ; } - m[i]->data =RTE_PTR_ADD (m[i]->data,64 ); + m[i]->data_off +=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]->data !=RTE_PTR_ADD (m[i]->buf_addr,RTE_PKTMBUF_HEADROOM )) { -printf ("data pointer not set properly\n" ); +if (m[i]->data_off !=RTE_PKTMBUF_HEADROOM ) { +printf ("invalid data_off\n" ); ret =-1 ; } }
app/test/test_table_acl.c +4 -3
@@ -515,7 +515,7 @@ test_pipeline_single_filter(int expected_count)struct rte_mbuf *mbuf; mbuf =rte_pktmbuf_alloc (pool); -memset (mbuf->data,0x00 , + memset(rte_pktmbuf_mtod(mbuf, char *), 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->data, &five_tuple, + memcpy(rte_pktmbuf_mtod(mbuf, char *), &five_tuple, sizeof(struct ipv4_5tuple));RTE_LOG (INFO ,PIPELINE ,"%s: Enqueue onto ring %d\n" , __func__, i);
@@ -551,7 +551,8 @@ 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->data,64 ); +rte_hexdump (stdout,"mbuf" , + rte_pktmbuf_mtod(mbuf, char *), 64);rte_pktmbuf_free (mbuf); } tx_count += ret;
app/test/test_table_pipeline.c +2 -6
@@ -45,11 +45,6 @@#include "test_table.h" #include "test_table_pipeline.h" -#define RTE_CBUF_UINT8_PTR (cbuf, offset) \ - (&cbuf->data[offset]) -#define RTE_CBUF_UINT32_PTR (cbuf, offset) \ - (&cbuf->data32[offset/sizeof(uint32_t)]) -#if 0 static rte_pipeline_port_out_action_handler port_action_0x00
@@ -504,7 +499,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->data, +rte_hexdump (stdout,"Object:" , + rte_pktmbuf_mtod(mbuf, char *), mbuf->data_len);rte_pktmbuf_free (mbuf); }
config/common_linuxapp +1 -1
@@ -191,7 +191,7 @@ CONFIG_RTE_LIBRTE_IXGBE_DEBUG_DRIVER=n CONFIG_RTE_LIBRTE_IXGBE_PF_DISABLE_STRIP_CRC=n CONFIG_RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC=y CONFIG_RTE_LIBRTE_IXGBE_ALLOW_UNSUPPORTED_SFP=n -CONFIG_RTE_IXGBE_INC_VECTOR=y +CONFIG_RTE_IXGBE_INC_VECTOR=n CONFIG_RTE_IXGBE_RX_OLFLAGS_ENABLE=y #
examples/exception_path/main.c +2 -1
@@ -302,7 +302,8 @@ main_loop(__attribute__((unused)) void *arg)if (m ==NULL )continue ; - ret =read (tap_fd, m->data,MAX_PACKET_SZ ); + ret = read(tap_fd, rte_pktmbuf_mtod(m, void *), +MAX_PACKET_SZ ); lcore_stats[lcore_id].rx++;if (unlikely (ret <0 )) { FATAL_ERROR("Reading from %s interface failed",
examples/vhost/main.c +22 -17
@@ -1027,7 +1027,9 @@ 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->data,rte_pktmbuf_data_len (buff)); +rte_memcpy ((void *)(uintptr_t )buff_addr, + rte_pktmbuf_mtod(buff, const void *), +rte_pktmbuf_data_len (buff)); res_cur_idx++; packet_success++;
@@ -1089,7 +1091,7 @@ link_vmdq(struct virtio_net *dev, struct rte_mbuf *m)int i, ret;/* Learn MAC address of guest device from packet */ - pkt_hdr = (struct ether_hdr *)m->data; + pkt_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); dev_ll = ll_root_used;
@@ -1176,7 +1178,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->data; + pkt_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);/*get the used devices list*/ dev_ll = ll_root_used;
@@ -1235,7 +1237,7 @@ virtio_tx_route(struct virtio_net* dev, struct rte_mbuf *m, struct rte_mempool *unsigned len, ret, offset =0 ;const uint16_t lcore_id =rte_lcore_id ();struct virtio_net_data_ll *dev_ll = ll_root_used; -struct ether_hdr *pkt_hdr = (struct ether_hdr *)m->data; + struct ether_hdr *pkt_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);/*check if destination is local VM*/ if ((vm2vm_mode ==VM2VM_SOFTWARE ) && (virtio_tx_local (dev, m) ==0 ))
@@ -1292,18 +1294,21 @@ virtio_tx_route(struct virtio_net* dev, struct rte_mbuf *m, struct rte_mempool * mbuf->pkt_len = mbuf->data_len;/* Copy ethernet header to mbuf. */ -rte_memcpy ((void *)mbuf->data, (const void *)m->data,ETH_HLEN ); + rte_memcpy(rte_pktmbuf_mtod(mbuf, void *), +rte_pktmbuf_mtod (m ,const void *), + ETH_HLEN);/* Setup vlan header. Bytes need to be re-ordered for network with htons()*/ - vlan_hdr = (struct vlan_ethhdr *) mbuf->data; + vlan_hdr = rte_pktmbuf_mtod(mbuf, struct vlan_ethhdr *); 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->data +VLAN_ETH_HLEN ), - (const void *) ((uint8_t *)m->data +ETH_HLEN ), (m->data_len -ETH_HLEN )); + rte_memcpy((void *)(rte_pktmbuf_mtod(mbuf, uint8_t *) + VLAN_ETH_HLEN), + (const void *)(rte_pktmbuf_mtod(m, uint8_t *) + ETH_HLEN), + (m->data_len -ETH_HLEN )); tx_q->m_table[len] = mbuf; len++;if (enable_stats) {
@@ -1394,7 +1399,7 @@ virtio_dev_tx(struct virtio_net* dev, struct rte_mempool *mbuf_pool)/* Setup dummy mbuf. This is copied to a real mbuf if transmitted out the physical port. */ m.data_len = desc->len; - m.data = (void *)(uintptr_t )buff_addr; + m.data_off =0 ;PRINT_PACKET (dev, (uintptr_t )buff_addr, desc->len,0 );
@@ -1713,7 +1718,7 @@ attach_rxmbuf_zcp(struct virtio_net *dev) } mbuf->buf_addr = (void *)(uintptr_t )(buff_addr -RTE_PKTMBUF_HEADROOM ); - mbuf->data = (void *)(uintptr_t )(buff_addr); + mbuf->data_off =RTE_PKTMBUF_HEADROOM ; mbuf->buf_physaddr = phys_addr -RTE_PKTMBUF_HEADROOM ; mbuf->data_len = desc->len;MBUF_HEADROOM_UINT32 (mbuf) = (uint32_t )desc_idx;
@@ -1750,7 +1755,7 @@ static inline void pktmbuf_detach_zcp(struct rte_mbuf *m) buf_ofs = (RTE_PKTMBUF_HEADROOM <= m->buf_len) ?RTE_PKTMBUF_HEADROOM : m->buf_len; - m->data = (char *) m->buf_addr + buf_ofs; + m->data_off = buf_ofs; m->data_len =0 ; }
@@ -1984,7 +1989,7 @@ virtio_tx_route_zcp(struct virtio_net *dev, struct rte_mbuf *m,unsigned len, ret, offset =0 ;struct vpool *vpool;struct virtio_net_data_ll *dev_ll = ll_root_used; -struct ether_hdr *pkt_hdr = (struct ether_hdr *)m->data; + struct ether_hdr *pkt_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);uint16_t vlan_tag = (uint16_t )vlan_tags[(uint16_t )dev->device_fh];/*Add packet to the port tx queue*/
@@ -2061,11 +2066,11 @@ virtio_tx_route_zcp(struct virtio_net *dev, struct rte_mbuf *m, mbuf->pkt_len = mbuf->data_len;if (unlikely (need_copy)) {/* Copy the packet contents to the mbuf. */ -rte_memcpy ((void *)((uint8_t *)mbuf->data), - (const void *) ((uint8_t *)m->data), + rte_memcpy(rte_pktmbuf_mtod(mbuf, void *), +rte_pktmbuf_mtod (m ,void *), m->data_len); }else { - mbuf->data = m->data; + mbuf->data_off = m->data_off; mbuf->buf_physaddr = m->buf_physaddr; mbuf->buf_addr = m->buf_addr; }
@@ -2199,8 +2204,8 @@ virtio_dev_tx_zcp(struct virtio_net *dev) m.data_len = desc->len; m.nb_segs =1 ; m.next =NULL ; - m.data = (void *)(uintptr_t )buff_addr; - m.buf_addr = m.data; + m.data_off =0 ; + m.buf_addr = (void *)(uintptr_t )buff_addr; m.buf_physaddr = phys_addr;/*
examples/vhost_xen/main.c +1 -1
@@ -981,7 +981,7 @@ virtio_dev_tx(struct virtio_net* dev, struct rte_mempool *mbuf_pool)/* Setup dummy mbuf. This is copied to a real mbuf if transmitted out the physical port. */ m.data_len = desc->len; - m.data = (void *)(uintptr_t )buff_addr; + m.data_off =0 ; m.nb_segs =1 ;virtio_tx_route (dev, &m, mbuf_pool,0 );
lib/librte_ip_frag/rte_ipv4_fragmentation.c +3 -3
@@ -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->data; + in_hdr = rte_pktmbuf_mtod(pkt_in, struct ipv4_hdr *); flag_offset =rte_cpu_to_be_16 (in_hdr->fragment_offset);/* If Don't Fragment flag is set */
@@ -165,7 +165,7 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,if (len > (in_seg->data_len - in_seg_data_pos)) { len = in_seg->data_len - in_seg_data_pos; } - out_seg->data = (char *) in_seg->data + (uint16_t )in_seg_data_pos; + out_seg->data_off = in_seg->data_off + in_seg_data_pos; out_seg->data_len = (uint16_t )len; out_pkt->pkt_len = (uint16_t )(len + out_pkt->pkt_len);
@@ -188,7 +188,7 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,/* Build the IP header */ - out_hdr = (struct ipv4_hdr *) out_pkt->data; + out_hdr = rte_pktmbuf_mtod(out_pkt, struct ipv4_hdr *); __fill_ipv4hdr_frag(out_hdr, in_hdr, (uint16_t)out_pkt->pkt_len,
lib/librte_ip_frag/rte_ipv6_fragmentation.c +3 -3
@@ -125,7 +125,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, (uint16_t)(pkt_in->pkt_len - sizeof (struct ipv6_hdr)))) return (-EINVAL); - in_hdr = (struct ipv6_hdr *) pkt_in->data; + in_hdr = rte_pktmbuf_mtod(pkt_in, struct ipv6_hdr *); in_seg = pkt_in; in_seg_data_pos =sizeof (struct ipv6_hdr );
@@ -171,7 +171,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in,if (len > (in_seg->data_len - in_seg_data_pos)) { len = in_seg->data_len - in_seg_data_pos; } - out_seg->data = (char *) in_seg->data + (uint16_t ) in_seg_data_pos; + out_seg->data_off = in_seg->data_off + in_seg_data_pos; out_seg->data_len = (uint16_t )len; out_pkt->pkt_len = (uint16_t )(len + out_pkt->pkt_len);
@@ -196,7 +196,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in,/* Build the IP header */ - out_hdr = (struct ipv6_hdr *) out_pkt->data; + out_hdr = rte_pktmbuf_mtod(out_pkt, struct ipv6_hdr *); __fill_ipv6hdr_frag(out_hdr, in_hdr, (uint16_t) out_pkt->pkt_len - sizeof(struct ipv6_hdr),
lib/librte_mbuf/rte_mbuf.c +3 -3
@@ -104,7 +104,7 @@ rte_pktmbuf_init(struct rte_mempool *mp, m->buf_len = (uint16_t )buf_len;/* keep some headroom between start of buffer and data */ - m->data = (char *) m->buf_addr +RTE_MIN (RTE_PKTMBUF_HEADROOM , m->buf_len); + m->data_off =RTE_MIN (RTE_PKTMBUF_HEADROOM , (uint16_t )m->buf_len);/* init some constant fields */ m->pool = mp;
@@ -170,12 +170,12 @@ rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m, unsigned dump_len)__rte_mbuf_sanity_check (m,0 );fprintf (f," segment at 0x%p, data=0x%p, data_len=%u\n" , - m, m->data, (unsigned )m->data_len); + m, rte_pktmbuf_mtod(m, void *), (unsigned)m->data_len); len = dump_len;if (len > m->data_len) len = m->data_len;if (len !=0 ) -rte_hexdump (f,NULL , m->data, len); + rte_hexdump(f, NULL, rte_pktmbuf_mtod(m, void *), len); dump_len -= len; m = m->next; nb_segs --;
lib/librte_mbuf/rte_mbuf.h +20 -24
132 lines not on this page · raw message
lib/librte_pmd_bond/rte_eth_bond_pmd.c +2 -2
@@ -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->data; + eth_hdr = rte_pktmbuf_mtod(buf, struct ether_hdr *); hash =ether_hash (eth_hdr); hash ^= hash >>8 ;return hash % slave_count;case BALANCE_XMIT_POLICY_LAYER23 : - eth_hdr = (struct ether_hdr *)buf->data; + eth_hdr = rte_pktmbuf_mtod(buf, struct ether_hdr *);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 +6 -6
@@ -90,8 +90,7 @@ rte_rxmbuf_alloc(struct rte_mempool *mp) }#define RTE_MBUF_DATA_DMA_ADDR (mb) \ - (uint64_t) ((mb)->buf_physaddr + \ - (uint64_t) ((char *)((mb)->data) - (char *)(mb)->buf_addr)) + (uint64_t) ((mb)->buf_physaddr + (mb)->data_off)#define RTE_MBUF_DATA_DMA_ADDR_DEFAULT (mb) \ (uint64_t) ((mb)->buf_physaddr + RTE_PKTMBUF_HEADROOM)
@@ -771,8 +770,8 @@ eth_em_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,*/ pkt_len = (uint16_t ) (rte_le_to_cpu_16 (rxd.length) - rxq->crc_len); - rxm->data = (char *) rxm->buf_addr +RTE_PKTMBUF_HEADROOM ; -rte_packet_prefetch (rxm->data); + rxm->data_off =RTE_PKTMBUF_HEADROOM ; +rte_packet_prefetch ((char *)rxm->buf_addr + rxm->data_off); rxm->nb_segs =1 ; rxm->next =NULL ; rxm->pkt_len = pkt_len;
@@ -941,7 +940,7 @@ eth_em_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,*/ data_len =rte_le_to_cpu_16 (rxd.length); rxm->data_len = data_len; - rxm->data = (char *) rxm->buf_addr +RTE_PKTMBUF_HEADROOM ; + rxm->data_off =RTE_PKTMBUF_HEADROOM ;/* * If this is the first buffer of the received packet,
@@ -1013,7 +1012,8 @@ eth_em_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, rxm->vlan_macip.f.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); +rte_packet_prefetch ((char *)first_seg->buf_addr + + first_seg->data_off);/* * Store the mbuf address into the next entry of the array
lib/librte_pmd_e1000/igb_rxtx.c +6 -7
@@ -95,9 +95,7 @@ rte_rxmbuf_alloc(struct rte_mempool *mp) }#define RTE_MBUF_DATA_DMA_ADDR (mb) \ - (uint64_t) ((mb)->buf_physaddr + \ - (uint64_t) ((char *)((mb)->data) - \ - (char *)(mb)->buf_addr)) + (uint64_t) ((mb)->buf_physaddr + (mb)->data_off)#define RTE_MBUF_DATA_DMA_ADDR_DEFAULT (mb) \ (uint64_t) ((mb)->buf_physaddr + RTE_PKTMBUF_HEADROOM)
@@ -753,8 +751,8 @@ eth_igb_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,*/ pkt_len = (uint16_t ) (rte_le_to_cpu_16 (rxd.wb.upper.length) - rxq->crc_len); - rxm->data = (char *) rxm->buf_addr +RTE_PKTMBUF_HEADROOM ; -rte_packet_prefetch (rxm->data); + rxm->data_off =RTE_PKTMBUF_HEADROOM ; +rte_packet_prefetch ((char *)rxm->buf_addr + rxm->data_off); rxm->nb_segs =1 ; rxm->next =NULL ; rxm->pkt_len = pkt_len;
@@ -930,7 +928,7 @@ eth_igb_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,*/ data_len =rte_le_to_cpu_16 (rxd.wb.upper.length); rxm->data_len = data_len; - rxm->data = (char *) rxm->buf_addr +RTE_PKTMBUF_HEADROOM ; + rxm->data_off =RTE_PKTMBUF_HEADROOM ;/* * If this is the first buffer of the received packet,
@@ -1012,7 +1010,8 @@ eth_igb_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, first_seg->ol_flags = pkt_flags;/* Prefetch data of first segment, if configured to do so. */ -rte_packet_prefetch (first_seg->data); +rte_packet_prefetch ((char *)first_seg->buf_addr + + first_seg->data_off);/* * Store the mbuf address into the next entry of the array
lib/librte_pmd_i40e/i40e_rxtx.c +8 -9
@@ -78,9 +78,7 @@ (uint64_t) ((mb)->buf_physaddr + RTE_PKTMBUF_HEADROOM)#define RTE_MBUF_DATA_DMA_ADDR (mb) \ - ((uint64_t)((mb)->buf_physaddr + \ - (uint64_t)((char *)((mb)->data) - \ - (char *)(mb)->buf_addr))) + ((uint64_t)((mb)->buf_physaddr + (mb)->data_off))static const struct rte_memzone * i40e_ring_dma_zone_reserve(struct rte_eth_dev *dev,
@@ -688,7 +686,7 @@ i40e_rx_alloc_bufs(struct i40e_rx_queue *rxq) mb = rxep[i].mbuf;rte_mbuf_refcnt_set (mb,1 ); mb->next =NULL ; - mb->data = (char *)mb->buf_addr +RTE_PKTMBUF_HEADROOM ; + mb->data_off =RTE_PKTMBUF_HEADROOM ; mb->nb_segs =1 ; mb->in_port = rxq->port_id; dma_addr = rte_cpu_to_le_64(\
@@ -845,8 +843,8 @@ i40e_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) rx_packet_len = ((qword1 &I40E_RXD_QW1_LENGTH_PBUF_MASK ) >>I40E_RXD_QW1_LENGTH_PBUF_SHIFT ) - rxq->crc_len; - rxm->data = (char *)rxm->buf_addr +RTE_PKTMBUF_HEADROOM ; -rte_prefetch0 (rxm->data); + rxm->data_off =RTE_PKTMBUF_HEADROOM ; +rte_prefetch0 (RTE_PTR_ADD (rxm->buf_addr,RTE_PKTMBUF_HEADROOM )); rxm->nb_segs =1 ; rxm->next =NULL ; rxm->pkt_len = rx_packet_len;
@@ -949,7 +947,7 @@ i40e_recv_scattered_pkts(void *rx_queue, rx_packet_len = (qword1 &I40E_RXD_QW1_LENGTH_PBUF_MASK ) >>I40E_RXD_QW1_LENGTH_PBUF_SHIFT ; rxm->data_len = rx_packet_len; - rxm->data = (char *)rxm->buf_addr +RTE_PKTMBUF_HEADROOM ; + rxm->data_off =RTE_PKTMBUF_HEADROOM ;/** * If this is the first buffer of the received packet, set the
@@ -1018,7 +1016,8 @@ i40e_recv_scattered_pkts(void *rx_queue,rte_le_to_cpu_32 (rxd.wb.qword0.hi_dword.rss);/* Prefetch data of first segment, if configured to do so. */ -rte_prefetch0 (first_seg->data); +rte_prefetch0 (RTE_PTR_ADD (first_seg->buf_addr, + first_seg->data_off)); rx_pkts[nb_rx++] = first_seg; first_seg =NULL ; }
@@ -2020,7 +2019,7 @@ i40e_alloc_rx_queue_mbufs(struct i40e_rx_queue *rxq)rte_mbuf_refcnt_set (mbuf,1 ); mbuf->next =NULL ; - mbuf->data = (char *)mbuf->buf_addr +RTE_PKTMBUF_HEADROOM ; + mbuf->data_off =RTE_PKTMBUF_HEADROOM ; mbuf->nb_segs =1 ; mbuf->in_port = rxq->port_id;
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +7 -6
@@ -996,7 +996,7 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq) mb = rxep[i].mbuf;rte_mbuf_refcnt_set (mb,1 ); mb->next =NULL ; - mb->data = (char *)mb->buf_addr +RTE_PKTMBUF_HEADROOM ; + mb->data_off =RTE_PKTMBUF_HEADROOM ; mb->nb_segs =1 ; mb->in_port = rxq->port_id;
@@ -1247,8 +1247,8 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,*/ pkt_len = (uint16_t ) (rte_le_to_cpu_16 (rxd.wb.upper.length) - rxq->crc_len); - rxm->data = (char *) rxm->buf_addr +RTE_PKTMBUF_HEADROOM ; -rte_packet_prefetch (rxm->data); + rxm->data_off =RTE_PKTMBUF_HEADROOM ; +rte_packet_prefetch ((char *)rxm->buf_addr + rxm->data_off); rxm->nb_segs =1 ; rxm->next =NULL ; rxm->pkt_len = pkt_len;
@@ -1431,7 +1431,7 @@ ixgbe_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,*/ data_len =rte_le_to_cpu_16 (rxd.wb.upper.length); rxm->data_len = data_len; - rxm->data = (char *) rxm->buf_addr +RTE_PKTMBUF_HEADROOM ; + rxm->data_off =RTE_PKTMBUF_HEADROOM ;/* * If this is the first buffer of the received packet,
@@ -1523,7 +1523,8 @@ ixgbe_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, }/* Prefetch data of first segment, if configured to do so. */ -rte_packet_prefetch (first_seg->data); +rte_packet_prefetch ((char *)first_seg->buf_addr + + first_seg->data_off);/* * Store the mbuf address into the next entry of the array
@@ -3213,7 +3214,7 @@ ixgbe_alloc_rx_queue_mbufs(struct igb_rx_queue *rxq)rte_mbuf_refcnt_set (mbuf,1 ); mbuf->next =NULL ; - mbuf->data = (char *)mbuf->buf_addr +RTE_PKTMBUF_HEADROOM ; + mbuf->data_off =RTE_PKTMBUF_HEADROOM ; mbuf->nb_segs =1 ; mbuf->in_port = rxq->port_id;
lib/librte_pmd_ixgbe/ixgbe_rxtx.h +1 -2
@@ -47,8 +47,7 @@#endif #define RTE_MBUF_DATA_DMA_ADDR (mb) \ - (uint64_t) ((mb)->buf_physaddr + (uint64_t)((char *)((mb)->data) - \ - (char *)(mb)->buf_addr)) + (uint64_t) ((mb)->buf_physaddr + (mb)->data_off)#define RTE_MBUF_DATA_DMA_ADDR_DEFAULT (mb) \ (uint64_t) ((mb)->buf_physaddr + RTE_PKTMBUF_HEADROOM)
lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c +0 -1
@@ -61,7 +61,6 @@ static struct rte_mbuf mb_def = { .in_port = 0, .next = NULL, - .data = NULL, }; static inline void
lib/librte_pmd_virtio/virtio_rxtx.c +2 -2
@@ -118,7 +118,7 @@ virtqueue_dequeue_burst_rx(struct virtqueue *vq, struct rte_mbuf **rx_pkts, }rte_prefetch0 (cookie); -rte_packet_prefetch (cookie->data); +rte_packet_prefetch (rte_pktmbuf_mtod(cookie ,void *)); rx_pkts[i] = cookie; vq->vq_used_cons_idx++;vq_ring_free_chain (vq, desc_idx);
@@ -470,7 +470,7 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) } rxm->in_port = rxvq->port_id; - rxm->data = (char *)rxm->buf_addr +RTE_PKTMBUF_HEADROOM ; + rxm->data_off =RTE_PKTMBUF_HEADROOM ; rxm->nb_segs =1 ; rxm->next =NULL ; rxm->pkt_len = (uint32_t)(len[i]
lib/librte_pmd_virtio/virtqueue.h +1 -2
@@ -59,8 +59,7 @@#define VIRTQUEUE_MAX_NAME_SZ 32#define RTE_MBUF_DATA_DMA_ADDR (mb) \ - (uint64_t) ((mb)->buf_physaddr + (uint64_t)((char *)((mb)->data) - \ - (char *)(mb)->buf_addr)) + (uint64_t) ((mb)->buf_physaddr + (mb)->data_off)#define VTNET_SQ_RQ_QUEUE_IDX 0#define VTNET_SQ_TQ_QUEUE_IDX 1
lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c +2 -3
@@ -79,8 +79,7 @@#define RTE_MBUF_DATA_DMA_ADDR (mb) \ - (uint64_t) ((mb)->buf_physaddr + (uint64_t)((char *)((mb)->data) - \ - (char *)(mb)->buf_addr)) + (uint64_t) ((mb)->buf_physaddr + (mb)->data_off)#define RTE_MBUF_DATA_DMA_ADDR_DEFAULT (mb) \ (uint64_t) ((mb)->buf_physaddr + RTE_PKTMBUF_HEADROOM)
@@ -564,7 +563,7 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) 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 ; + rxm->data_off =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): 1407789890-17355-5-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Re: [RFC PATCH 04/14] mbuf: replace data pointer by an offset
Hi Bruce,
Quoted 11 lines · Bruce Richardson
From: Olivier Matz <[email protected]>
Original patch:
The mbuf structure already contains a pointer to the beginning of the buffer (m->buf_addr). It is not needed to use 8 bytes again to store another pointer to the beginning of the data.Using a 16 bits unsigned integer is enough as we know that a mbuf is never longer than 64KB. We gain 6 bytes in the structure thanks to this modification.
Quoted 7 lines
Signed-off-by Olivier Matz <[email protected]>This version:
* Updated original patch to apply to latest on mainline.
* Disabled vector PMD in config as it relies heavily on the mbuf layoutSigned-off-by Bruce Richardson <[email protected]>
Remaining references shown by:
git grep "\(pkt->data[^_]\)\|\(mb->data[^_]\)\|\(m->data[^_]\)\|\(mbuf->data[^_]\)"
In:app/test-pmd/ieee1588fwd.cexamples/vhost_xen/main.clib/librte_pmd_ixgbe/ixgbe_rxtx_vec.clib/librte_pmd_pcap/rte_eth_pcap.clib/librte_pmd_xenvirt/rte_eth_xenvirt.c
Quoted 24 lines
lib/librte_mbuf/rte_mbuf.h +7
-4@@ -140,6 +140,13 @@ 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. */ + +/* valid for any segment */ +struct rte_mbuf *next;/**< Next segment of scattered packet. */ +uint16_t data_off; +uint16_t data_len;/**< Amount of data in segment buffer. */ +uint32_t pkt_len;/**< Total pkt len: sum of all segments. */ +#ifdef RTE_MBUF_REFCNT /** * 16-bit Reference counter. @@ -156,18 +163,12 @@ struct rte_mbuf {#else uint16_t refcnt_reserved;/**< Do not use this field */ #endif -uint16_t reserved;/**< Unused field. Required for padding. */ -uint16_t ol_flags;/**< Offload features. */ - -/* valid for any segment */
lib/librte_mbuf/rte_mbuf.h struct rte_mbuf { · line 171
Quoted 10 lines
lib/librte_mbuf/rte_mbuf.h +2
-4-struct rte_mbuf *next;/**< Next segment of scattered packet. */ -void * data;/**< Start address of data in segment buffer. */ -uint16_t data_len;/**< Amount of data in segment buffer. */ /* these fields are valid for first segment only */ uint8_t nb_segs;/**< Number of segments. */ uint8_t in_port;/**< Input port. */ -uint32_t pkt_len;/**< Total pkt len: sum of all segment data_len. */ +uint16_t ol_flags;/**< Offload features. */ +uint16_t reserved;/**< Unused field. Required for padding. */
I think we should try to keep comments aligned if possible.
lib/librte_mbuf/rte_mbuf.h struct rte_mbuf { · line 191
Quoted 11 lines
lib/librte_mbuf/rte_mbuf.h +1
-1/* offload features, valid for first segment only */ union rte_vlan_macip vlan_macip;@@ -185,7 +186,7 @@ struct rte_mbuf {uint16_t metadata16[0 ];uint32_t metadata32[0 ];uint64_t metadata64[0 ]; - }; + } __rte_cache_aligned; } __rte_cache_aligned;
In my initial patch, there was a "reserved2" field at the end of the rte_mbuf structure to keep its size to 64 bytes. This is not really required because of the __rte_cache_aligned, but I wonder if it's a problem to have metadata not starting on a cache line. There can be some conflicts if some part of the code use *(uint32 *)(m + 1) and other part of code m->metadata32[0].
By the way (that's completely off-topic), but I don't really see why having this metadata at the end of mbuf structure is useful.
lib/librte_mbuf/rte_mbuf.h ixgbe_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, · line 1528
Quoted 8 lines
lib/librte_mbuf/rte_mbuf.h +2
-1@@ -1523,7 +1523,8 @@ ixgbe_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, }/* Prefetch data of first segment, if configured to do so. */ -rte_packet_prefetch (first_seg->data); +rte_packet_prefetch ((char *)first_seg->buf_addr + + first_seg->data_off);
It seems there is a trailing whitespace here after the "+" (seen by "git am").
Regards,
Olivier
RFC PATCH 5/14 mbuf: rename in_port to just port
In reply to a message not in the archiveIn 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -109,7 +109,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 */
@@ -163,7 +163,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
@@ -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. */ uint16_t ol_flags;/**< Offload features. */ uint16_t reserved;/**< Unused field. Required for padding. */
@@ -473,7 +473,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 ; m->data_off = (RTE_PKTMBUF_HEADROOM <= m->buf_len) ?
@@ -536,7 +536,7 @@ static inline void rte_pktmbuf_attach(struct rte_mbuf *mi, struct rte_mbuf *md) mi->next = md->next; mi->data_off = md->data_off; 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
@@ -776,7 +776,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 |
@@ -1002,7 +1002,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
@@ -757,7 +757,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);
@@ -992,7 +992,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
@@ -688,7 +688,7 @@ i40e_rx_alloc_bufs(struct i40e_rx_queue *rxq) mb->next =NULL ; mb->data_off =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;
@@ -849,7 +849,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) ?
@@ -1003,7 +1003,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 ;
@@ -2021,7 +2021,7 @@ i40e_alloc_rx_queue_mbufs(struct i40e_rx_queue *rxq) mbuf->next =NULL ; mbuf->data_off =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
@@ -998,7 +998,7 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq) mb->next =NULL ; mb->data_off =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
@@ -3216,7 +3216,7 @@ ixgbe_alloc_rx_queue_mbufs(struct igb_rx_queue *rxq) mbuf->next =NULL ; mbuf->data_off =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
@@ -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_off =RTE_PKTMBUF_HEADROOM ; rxm->nb_segs =1 ; rxm->next =NULL ;
lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c +2 -2
@@ -556,12 +556,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_off =RTE_PKTMBUF_HEADROOM ;
lib/librte_pmd_xenvirt/rte_eth_xenvirt.c +1 -1
@@ -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): 1407789890-17355-6-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Olivier MATZ
Acked-byRe: [RFC PATCH 05/14] mbuf: rename in_port to just port
Quoted 5 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.Signed-off-by Bruce Richardson <[email protected]>
RFC PATCH 6/14 mbuf: reorder fields by time-of-use
In reply to a message not in the archive* Reorder the fields in the mbuf so that we have fields that are used together side-by-side in the structure. This means that we have a contiguous block of 8-bytes in the mbuf which are used to reset an mbuf of descriptor rearm.
* Where needed add in a dummy fields to overwrite values 8 or 16 bytes at a time, when doing RX or RX descriptor rearm. This avoids compiler warnings when using uint64_t values to overwrite a set of smaller values.
* At the end, place fields that are only used for TX or for the slower RX path, and mark them as down to be moved to a second cache line.
--- lib/librte_mbuf/rte_mbuf.c | 2 +- lib/librte_mbuf/rte_mbuf.h | 37 +++++++++++++++++++++---------------- 2 files changed, 22 insertions(+), 17 deletions(-)
lib/librte_mbuf/rte_mbuf.c +1 -1
@@ -161,7 +161,7 @@ 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, " +fprintf (f," pkt_len=%" PRIu32", ol_flags=%" PRIx64", nb_segs=%u, " "in_port=%u\n" , m->pkt_len, m->ol_flags, (unsigned )m->nb_segs, (unsigned )m->port); nb_segs = m->nb_segs;
lib/librte_mbuf/rte_mbuf.h +21 -16
@@ -132,22 +132,20 @@ union rte_vlan_macip {/**< 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. */ struct rte_mbuf { -struct rte_mempool *pool;/**< Pool from which mbuf was allocated. */ 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. */ -/* valid for any segment */ -struct rte_mbuf *next;/**< Next segment of scattered packet. */ +/* next 8 bytes are initialised on RX descriptor rearm */ +uint64_t rearm_data[0 ];/**< dummy element so we can get uin64_t ptrs +* to this part of the mbuf without alias error +*/ +uint16_t buf_len;/**< Length of segment buffer. */ uint16_t data_off; -uint16_t data_len;/**< Amount of data in segment buffer. */ -uint32_t pkt_len;/**< Total pkt len: sum of all segments. */ - -#ifdef RTE_MBUF_REFCNT /** * 16-bit Reference counter. * It should only be accessed using the following functions:
@@ -157,20 +155,23 @@ struct rte_mbuf {* config option. */ union { +#ifdef RTE_MBUF_REFCNT rte_atomic16_t refcnt_atomic;/**< Atomically accessed refcnt */ uint16_t refcnt;/**< Non-atomically accessed refcnt */ - }; -#else -uint16_t refcnt_reserved;/**< Do not use this field */ #endif - -/* these fields are valid for first segment only */ +uint16_t refcnt_reserved;/**< Do not use this field */ + };uint8_t nb_segs;/**< Number of segments. */ uint8_t port;/**< Input port. */ -uint16_t ol_flags;/**< Offload features. */ -uint16_t reserved;/**< Unused field. Required for padding. */ -/* offload features, valid for first segment only */ +/* remaining bytes are set on RX when pulling packet from descriptor */ +uint64_t ol_flags;/**< Offload features. */ + +__m128i rx_descriptor_fields1[0 ];/**< dummy field used as marker for +* writes in a vector driver */ +uint16_t packet_type;/**< Type of packet, e.g. protocols used */ +uint16_t data_len;/**< Amount of data in segment buffer. */ +uint32_t pkt_len;/**< Total pkt len: sum of all segments. */ union rte_vlan_macip vlan_macip;union {uint32_t rss;/**< RSS hash result if RSS enabled */
@@ -181,6 +182,10 @@ struct rte_mbuf {uint32_t sched;/**< Hierarchical scheduler */ } hash;/**< hash information */ +/* second cache line, fields only used in slow path or on TX */ +struct rte_mempool *pool;/**< Pool from which mbuf was allocated. */ +struct rte_mbuf *next;/**< Next segment of scattered packet. */ +union {uint8_t metadata[0 ];uint16_t metadata16[0 ];
Signature · 1 line
1.9.3
A message that is not in the archive (sent off-list or not yet received): 1407789890-17355-7-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Re: [RFC PATCH 06/14] mbuf: reorder fields by time-of-use
Hi Bruce,
Quoted 22 lines · Bruce Richardson
* Reorder the fields in the mbuf so that we have fields that are used together side-by-side in the structure. This means that we have a contiguous block of 8-bytes in the mbuf which are used to reset an mbuf of descriptor rearm.
* Where needed add in a dummy fields to overwrite values 8 or 16 bytes at a time, when doing RX or RX descriptor rearm. This avoids compiler warnings when usinguint64_tvalues to overwrite a set of smaller values.
* At the end, place fields that are only used for TX or for the slower RX path, and mark them as down to be moved to a second cache line.Signed-off-by Bruce Richardson <[email protected]>--- lib/librte_mbuf/rte_mbuf.c | 2 +- lib/librte_mbuf/rte_mbuf.h | 37 +++++++++++++++++++++---------------- 2 files changed, 22 insertions(+), 17 deletions(-)lib/librte_mbuf/rte_mbuf.c +0
-0
lib/librte_mbuf/rte_mbuf.c rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m, unsigned dump_len) · line 167
Quoted 8 lines
lib/librte_mbuf/rte_mbuf.c +1
-1@@ -161,7 +161,7 @@ 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, " +fprintf (f," pkt_len=%" PRIu32", ol_flags=%" PRIx64", nb_segs=%u, " "in_port=%u\n" , m->pkt_len, m->ol_flags, (unsigned )m->nb_segs, (unsigned )m->port); nb_segs = m->nb_segs;
I think this should not go in this patch. Another one "change ol_flags to 64 bits" would be nice.
lib/librte_mbuf/rte_mbuf.h union rte_vlan_macip { · line 136
Quoted 10 lines
lib/librte_mbuf/rte_mbuf.h +1
-0@@ -132,22 +132,20 @@ union rte_vlan_macip {/**< MAC+IP length. */ #define TX_MACIP_LEN_CMP_MASK (TX_MAC_LEN_CMP_MASK | TX_IP_LEN_CMP_MASK) +/**
Garbage here.
Quoted 8 lines
lib/librte_mbuf/rte_mbuf.h +0
-2* The generic rte_mbuf, containing a packet mbuf. */ struct rte_mbuf { -struct rte_mempool *pool;/**< Pool from which mbuf was allocated. */ 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. */
lib/librte_mbuf/rte_mbuf.h union rte_vlan_macip { · line 148
Quoted 10 lines
lib/librte_mbuf/rte_mbuf.h +5
-4-/* valid for any segment */ -struct rte_mbuf *next;/**< Next segment of scattered packet. */ +/* next 8 bytes are initialised on RX descriptor rearm */ +uint64_t rearm_data[0 ];/**< dummy element so we can get uin64_t ptrs +* to this part of the mbuf without alias error +*/ +uint16_t buf_len;/**< Length of segment buffer. */ uint16_t data_off; -uint16_t data_len;/**< Amount of data in segment buffer. */ -uint32_t pkt_len;/**< Total pkt len: sum of all segments. */
What do you think about using an union instead? I'm not sure it's clearer, but in case of:
union {
uint64_t u64;
struct {
uint16_t buf_len;
uint16_t data_off;
...
};
};Quoted 10 lines
lib/librte_mbuf/rte_mbuf.h +1
-2- -#ifdef RTE_MBUF_REFCNT /** * 16-bit Reference counter. * It should only be accessed using the following functions: @@ -157,20 +155,23 @@ struct rte_mbuf {* config option. */ union { +#ifdef RTE_MBUF_REFCNT
lib/librte_mbuf/rte_mbuf.h struct rte_mbuf { · line 163
Quoted 10 lines
lib/librte_mbuf/rte_mbuf.h +2
-5rte_atomic16_t refcnt_atomic;/**< Atomically accessed refcnt */ uint16_t refcnt;/**< Non-atomically accessed refcnt */ - }; -#else -uint16_t refcnt_reserved;/**< Do not use this field */ #endif - -/* these fields are valid for first segment only */ +uint16_t refcnt_reserved;/**< Do not use this field */ + };
I think this should go in another cosmetic patch.
lib/librte_mbuf/rte_mbuf.h struct rte_mbuf { · line 168
Quoted 8 lines
lib/librte_mbuf/rte_mbuf.h +2
-3uint8_t nb_segs;/**< Number of segments. */ uint8_t port;/**< Input port. */ -uint16_t ol_flags;/**< Offload features. */ -uint16_t reserved;/**< Unused field. Required for padding. */ -/* offload features, valid for first segment only */ +/* remaining bytes are set on RX when pulling packet from descriptor */ +uint64_t ol_flags;/**< Offload features. */
Should be moved to "change ol_flags to 64 bits".
lib/librte_mbuf/rte_mbuf.h struct rte_mbuf { · line 171
Quoted 3 lines
lib/librte_mbuf/rte_mbuf.h +3
-0+ +__m128i rx_descriptor_fields1[0 ];/**< dummy field used as marker for +* writes in a vector driver */
Is it a good idea to have a specific type in the generic mbuf structure? Moreover it seems that later in your patch series it's replaced by something else.
Also, the 2nd line of comment mixes tabs and spaces.
lib/librte_mbuf/rte_mbuf.h struct rte_mbuf { · line 187
Quoted 4 lines
lib/librte_mbuf/rte_mbuf.h +3
-0+/* second cache line, fields only used in slow path or on TX */ +struct rte_mempool *pool;/**< Pool from which mbuf was allocated. */ +struct rte_mbuf *next;/**< Next segment of scattered packet. */
The comment is wrong, this is not a new cache line (introduced later).
Regards,
Olivier
RFC PATCH 7/14 ixgbe: rework vector pmd following mbuf changes
In reply to a message not in the archiveThe vector PMD expects fields to be in a specific order so that it can do vector operations on multiple fields at a time. Following mbuf rework, adjust driver to take account of the new layout and re-enable it in the config.
--- config/common_linuxapp | 2 +- lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 2 +- lib/librte_pmd_ixgbe/ixgbe_rxtx.h | 2 +- lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 150 ++++++++++++---------------------- 4 files changed, 55 insertions(+), 101 deletions(-)
config/common_linuxapp +1 -1
@@ -191,7 +191,7 @@ CONFIG_RTE_LIBRTE_IXGBE_DEBUG_DRIVER=n CONFIG_RTE_LIBRTE_IXGBE_PF_DISABLE_STRIP_CRC=n CONFIG_RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC=y CONFIG_RTE_LIBRTE_IXGBE_ALLOW_UNSUPPORTED_SFP=n -CONFIG_RTE_IXGBE_INC_VECTOR=n +CONFIG_RTE_IXGBE_INC_VECTOR=y CONFIG_RTE_IXGBE_RX_OLFLAGS_ENABLE=y #
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +1 -1
@@ -1523,7 +1523,7 @@ ixgbe_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, }/* Prefetch data of first segment, if configured to do so. */ -rte_packet_prefetch ((char *)first_seg->buf_addr + +rte_packet_prefetch ((char *)first_seg->buf_addr + first_seg->data_off);/*
lib/librte_pmd_ixgbe/ixgbe_rxtx.h +1 -1
@@ -126,7 +126,7 @@ struct igb_rx_queue {#ifdef RTE_IXGBE_INC_VECTOR uint16_t rxrearm_nb;/**< the idx we start the re-arming from */ uint16_t rxrearm_start;/**< number of remaining to be re-armed */ -__m128i misc_info;/**< cache XMM combine port_id/crc/nb_segs */ +uint64_t mbuf_initializer;/**< value to init mbufs */ #endif uint16_t rx_free_thresh;/**< max free RX desc to hold. */ uint16_t queue_id;/**< RX queue index. */
lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c +52 -98
258 lines not on this page · raw message
Signature · 1 line
1.9.3
RFC PATCH 8/14 mbuf: split mbuf across two cache lines.
In reply to a message not in the archiveThis change splits the mbuf in two to move the pool and next pointers to the second cache line. This frees up 16 bytes in first cache line.
--- app/test/test_mbuf.c | 2 +- lib/librte_mbuf/rte_mbuf.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-)
app/test/test_mbuf.c +1 -1
@@ -782,7 +782,7 @@ test_failing_mbuf_sanity_check(void)int test_mbuf (void ) { -RTE_BUILD_BUG_ON (sizeof (struct rte_mbuf ) !=64 ); +RTE_BUILD_BUG_ON (sizeof (struct rte_mbuf ) !=CACHE_LINE_SIZE *2 );/* create pktmbuf pool if it does not exist */ if (pktmbuf_pool ==NULL ) {
lib/librte_mbuf/rte_mbuf.h +5 -0
@@ -137,6 +137,9 @@ union rte_vlan_macip {* The generic rte_mbuf, containing a packet mbuf. */ struct rte_mbuf { +/** dummy field marking start of first cache line */ +void *cache_line0[0 ]; +void *buf_addr;/**< Virtual address of segment buffer. */ phys_addr_t buf_physaddr;/**< Physical address of segment buffer. */
@@ -183,6 +186,8 @@ struct rte_mbuf { } hash;/**< hash information */ /* second cache line, fields only used in slow path or on TX */ +/** dummy field marking start of second cache line */ + void *cache_line1[0] __rte_cache_aligned;struct rte_mempool *pool;/**< Pool from which mbuf was allocated. */ struct rte_mbuf *next;/**< Next segment of scattered packet. */
Signature · 1 line
1.9.3
RFC PATCH 9/14 Fix performance regression due to moved pool ptr
In reply to a message not in the archiveAdjust the fast-path code to fix the regression caused by the pool pointer moving to the second cache line. This change adjusts the prefetching and also the way in which the mbufs are freed back to the mempool.
--- lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 23 +++++---- lib/librte_pmd_ixgbe/ixgbe_rxtx.h | 12 ----- lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 93 ++++++++++++++--------------------- 3 files changed, 47 insertions(+), 81 deletions(-)
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +11 -12
@@ -142,10 +142,6 @@ ixgbe_tx_free_bufs(struct igb_tx_queue *txq)*/ txep = &(txq->sw_ring[txq->tx_next_dd - (txq->tx_rs_thresh -1 )]); -/* prefetch the mbufs that are about to be freed */ -for (i =0 ; i < txq->tx_rs_thresh; ++i) -rte_prefetch0 ((txep + i)->mbuf); -/* free buffers one at a time */ if ((txq->txq_flags & (uint32_t )ETH_TXQ_FLAGS_NOREFCOUNT ) !=0 ) {for (i =0 ; i < txq->tx_rs_thresh; ++i, ++txep) {
@@ -186,6 +182,7 @@ tx4(volatile union ixgbe_adv_tx_desc *txdp, struct rte_mbuf **pkts) ((uint32_t )DCMD_DTYP_FLAGS | pkt_len); txdp->read.olinfo_status = (pkt_len <<IXGBE_ADVTXD_PAYLEN_SHIFT ); +rte_prefetch0 (&(*pkts)->pool); } }
@@ -205,6 +202,7 @@ tx1(volatile union ixgbe_adv_tx_desc *txdp, struct rte_mbuf **pkts) ((uint32_t )DCMD_DTYP_FLAGS | pkt_len); txdp->read.olinfo_status = (pkt_len <<IXGBE_ADVTXD_PAYLEN_SHIFT ); +rte_prefetch0 (&(*pkts)->pool); }/*
@@ -252,14 +250,6 @@ tx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,volatile union ixgbe_adv_tx_desc *tx_r = txq->tx_ring;uint16_t n =0 ; -/* -* Begin scanning the H/W ring for done descriptors when the -* number of available descriptors drops below tx_free_thresh. For -* each done descriptor, free the associated buffer. -*/ -if (txq->nb_tx_free < txq->tx_free_thresh) -ixgbe_tx_free_bufs (txq); -/* Only use descriptors that are available */ nb_pkts = (uint16_t )RTE_MIN (txq->nb_tx_free, nb_pkts);if (unlikely (nb_pkts ==0 ))
@@ -323,6 +313,15 @@ tx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,if (txq->tx_tail >= txq->nb_tx_desc) txq->tx_tail =0 ; +/* +* Begin scanning the H/W ring for done descriptors when the +* number of available descriptors drops below tx_free_thresh. For +* each done descriptor, free the associated buffer. +*/ +if (txq->nb_tx_free < txq->tx_free_thresh) +ixgbe_tx_free_bufs (txq); + +/* update tail pointer */ rte_wmb ();IXGBE_PCI_REG_WRITE (txq->tdt_reg_addr, txq->tx_tail);
lib/librte_pmd_ixgbe/ixgbe_rxtx.h +0 -12
@@ -96,14 +96,6 @@ struct igb_tx_entry_v { };/** -* continuous entry sequence, gather by the same mempool -*/ -struct igb_tx_entry_seq { -const struct rte_mempool * pool; -uint32_t same_pool; -}; - -/** * Structure associated with each RX queue. */ struct igb_rx_queue {
@@ -170,10 +162,6 @@ struct igb_tx_queue {volatile union ixgbe_adv_tx_desc *tx_ring;uint64_t tx_ring_phys_addr;/**< TX ring DMA address. */ struct igb_tx_entry *sw_ring;/**< virtual address of SW ring. */ -#ifdef RTE_IXGBE_INC_VECTOR -/** continuous tx entry sequence within the same mempool */ -struct igb_tx_entry_seq *sw_ring_seq; -#endif volatile uint32_t *tdt_reg_addr;/**< Address of TDT register. */ uint16_t nb_tx_desc;/**< number of TX descriptors. */ uint16_t tx_tail;/**< current value of TDT reg. */
lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c +36 -57
190 lines not on this page · raw message
Signature · 1 line
1.9.3
A message that is not in the archive (sent off-list or not yet received): 1407789890-17355-10-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Re: [RFC PATCH 09/14] Fix performance regression due to moved pool ptr
Hi Bruce,
Quoted 6 lines · Bruce Richardson
Adjust the fast-path code to fix the regression caused by the pool pointer moving to the second cache line. This change adjusts the prefetching and also the way in which the mbufs are freed back to the mempool.
Signed-off-by Bruce Richardson <[email protected]>
Just one comment here (maybe this code should be reviewed by someone knowing the ixgbe driver better than me):
Quoted 21 lines
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +2
-8@@ -252,14 +250,6 @@ tx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,volatile union ixgbe_adv_tx_desc *tx_r = txq->tx_ring;uint16_t n =0 ; -/* -* Begin scanning the H/W ring for done descriptors when the -* number of available descriptors drops below tx_free_thresh. For -* each done descriptor, free the associated buffer. -*/ -if (txq->nb_tx_free < txq->tx_free_thresh) -ixgbe_tx_free_bufs (txq); -/* Only use descriptors that are available */ nb_pkts = (uint16_t )RTE_MIN (txq->nb_tx_free, nb_pkts);if (unlikely (nb_pkts ==0 ))@@ -323,6 +313,15 @@ tx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,if (txq->tx_tail >= txq->nb_tx_desc) txq->tx_tail =0 ; +/* +* Begin scanning the H/W ring for done descriptors when the
lib/librte_pmd_ixgbe/ixgbe_rxtx.c tx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, · line 327
Quoted 10 lines
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +7
-0+* number of available descriptors drops below tx_free_thresh. For +* each done descriptor, free the associated buffer. +*/ +if (txq->nb_tx_free < txq->tx_free_thresh) +ixgbe_tx_free_bufs (txq); + +/* update tail pointer */ rte_wmb ();IXGBE_PCI_REG_WRITE (txq->tdt_reg_addr, txq->tx_tail);
It looks like these 2 hunks are reverted in next commit. I'm not sure this is what you expected.
RFC PATCH 10/14 mbuf: set next pointer to NULL on mbuf free.
In reply to a message not in the archivePreviously we set the next pointer to NULL on allocation, we now set it to NULL on free, as the next pointer is on a second cache line.
--- lib/librte_mbuf/rte_mbuf.h | 4 +++- lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 18 +++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-)
lib/librte_mbuf/rte_mbuf.h +3 -1
@@ -629,8 +629,10 @@ __rte_pktmbuf_prefree_seg(struct rte_mbuf *m)static inline void __attribute__((always_inline))rte_pktmbuf_free_seg (struct rte_mbuf *m) { -if (likely (NULL != (m =__rte_pktmbuf_prefree_seg (m)))) +if (likely (NULL != (m =__rte_pktmbuf_prefree_seg (m)))) { + m->next =NULL ;__rte_mbuf_raw_free (m); + } }/**
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +9 -9
@@ -145,6 +145,7 @@ ixgbe_tx_free_bufs(struct igb_tx_queue *txq)/* free buffers one at a time */ if ((txq->txq_flags & (uint32_t )ETH_TXQ_FLAGS_NOREFCOUNT ) !=0 ) {for (i =0 ; i < txq->tx_rs_thresh; ++i, ++txep) { + txep->mbuf->next =NULL ;rte_mempool_put (txep->mbuf->pool, txep->mbuf); txep->mbuf =NULL ; }
@@ -250,6 +251,14 @@ tx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,volatile union ixgbe_adv_tx_desc *tx_r = txq->tx_ring;uint16_t n =0 ; +/* +* Begin scanning the H/W ring for done descriptors when the +* number of available descriptors drops below tx_free_thresh. For +* each done descriptor, free the associated buffer. +*/ +if (txq->nb_tx_free < txq->tx_free_thresh) +ixgbe_tx_free_bufs (txq); +/* Only use descriptors that are available */ nb_pkts = (uint16_t )RTE_MIN (txq->nb_tx_free, nb_pkts);if (unlikely (nb_pkts ==0 ))
@@ -313,15 +322,6 @@ tx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,if (txq->tx_tail >= txq->nb_tx_desc) txq->tx_tail =0 ; -/* -* Begin scanning the H/W ring for done descriptors when the -* number of available descriptors drops below tx_free_thresh. For -* each done descriptor, free the associated buffer. -*/ -if (txq->nb_tx_free < txq->tx_free_thresh) -ixgbe_tx_free_bufs (txq); - -/* update tail pointer */ rte_wmb ();IXGBE_PCI_REG_WRITE (txq->tdt_reg_addr, txq->tx_tail);
Signature · 1 line
1.9.3
RFC PATCH 11/14 ixgbe: make mbuf_initializer queue variable global
In reply to a message not in the archiveOn descriptor rearm, the mbuf_initializer variable can be used to do a single-shot write to an mbuf to initialize all variables that can be set. This is currently used only by vector PMD function, but now allow it to be generally used by other RX code paths.
--- lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 25 +++++++++++++++++++++++-- lib/librte_pmd_ixgbe/ixgbe_rxtx.h | 9 ++++++--- lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 25 +------------------------ 3 files changed, 30 insertions(+), 29 deletions(-)
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +23 -2
@@ -90,6 +90,27 @@ ETH_RSS_IPV6_UDP | \ ETH_RSS_IPV6_UDP_EX) +int +ixgbe_set_mbuf_initializer (struct igb_rx_queue *rxq) +{ +static struct rte_mbuf mb_def = { + .buf_len =0 , + .data_len =0 , + + .data_off =RTE_PKTMBUF_HEADROOM , +#ifdef RTE_MBUF_REFCNT + .refcnt =1 , +#endif + .nb_segs =1 , + .port =0 + }; + + mb_def.buf_len = rxq->mb_pool->elt_size -sizeof (struct rte_mbuf ); + mb_def.port = rxq->port_id; + rxq->mbuf_initializer = *((uint64_t *)&mb_def.rearm_data); +return 0 ; +} +static inline struct rte_mbuf *rte_rxmbuf_alloc (struct rte_mempool *mp) {
@@ -1878,7 +1899,7 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,PMD_INIT_LOG (INFO ,"Using simple tx code path\n" );#ifdef RTE_IXGBE_INC_VECTOR if (txq->tx_rs_thresh <=RTE_IXGBE_TX_MAX_FREE_BUF_SZ && -ixgbe_txq_vec_setup (txq, socket_id) ==0 ) { +ixgbe_txq_vec_setup (txq) ==0 ) {PMD_INIT_LOG (INFO ,"Vector tx enabled.\n" ); dev->tx_pkt_burst = ixgbe_xmit_pkts_vec; }
@@ -2169,7 +2190,6 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,if (!ixgbe_rx_vec_condition_check (dev)) {PMD_INIT_LOG (INFO ,"Vector rx enabled, please make " "sure RX burst size no less than 32.\n" ); -ixgbe_rxq_vec_setup (rxq, socket_id); dev->rx_pkt_burst = ixgbe_recv_pkts_vec; }#endif
@@ -2183,6 +2203,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev, } dev->data->rx_queues[queue_idx] = rxq; +ixgbe_set_mbuf_initializer (rxq);ixgbe_reset_rx_queue (rxq);return 0 ;
lib/librte_pmd_ixgbe/ixgbe_rxtx.h +6 -3
@@ -107,6 +107,7 @@ struct igb_rx_queue {struct igb_rx_entry *sw_ring;/**< address of RX software ring. */ struct rte_mbuf *pkt_first_seg;/**< First segment of current packet. */ struct rte_mbuf *pkt_last_seg;/**< Last segment of current packet. */ +uint64_t mbuf_initializer;/**< value to init mbufs */ uint16_t nb_rx_desc;/**< number of RX descriptors. */ uint16_t rx_tail;/**< current value of RDT register. */ uint16_t nb_rx_hold;/**< number of held free RX desc. */
@@ -118,7 +119,6 @@ struct igb_rx_queue {#ifdef RTE_IXGBE_INC_VECTOR uint16_t rxrearm_nb;/**< the idx we start the re-arming from */ uint16_t rxrearm_start;/**< number of remaining to be re-armed */ -uint64_t mbuf_initializer;/**< value to init mbufs */ #endif uint16_t rx_free_thresh;/**< max free RX desc to hold. */ uint16_t queue_id;/**< RX queue index. */
@@ -226,9 +226,12 @@ struct ixgbe_txq_ops {#ifdef RTE_IXGBE_INC_VECTOR uint16_t ixgbe_recv_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts);uint16_t ixgbe_xmit_pkts_vec (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); -int ixgbe_txq_vec_setup (struct igb_tx_queue *txq,unsigned int socket_id); -int ixgbe_rxq_vec_setup (struct igb_rx_queue *rxq,unsigned int socket_id); +int ixgbe_txq_vec_setup (struct igb_tx_queue *txq);int ixgbe_rx_vec_condition_check (struct rte_eth_dev *dev);#endif +int +ixgbe_set_mbuf_initializer (struct igb_rx_queue *rxq); + +#endif
lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c +1 -24
@@ -45,28 +45,6 @@#endif -int -ixgbe_rxq_vec_setup (struct igb_rx_queue *rxq, - __rte_unused unsigned int socket_id) -{ -static struct rte_mbuf mb_def = { - .buf_len =0 , - .data_len =0 , - - .data_off =RTE_PKTMBUF_HEADROOM , -#ifdef RTE_MBUF_REFCNT - .refcnt =1 , -#endif - .nb_segs =1 , - .port =0 - }; - - mb_def.buf_len = rxq->mb_pool->elt_size -sizeof (struct rte_mbuf ); - mb_def.port = rxq->port_id; - rxq->mbuf_initializer = *((uint64_t *)&mb_def.rearm_data); -return 0 ; -} -static inline void ixgbe_rxq_rearm (struct igb_rx_queue *rxq) {
@@ -586,8 +564,7 @@ static struct ixgbe_txq_ops vec_txq_ops = { .reset = ixgbe_reset_tx_queue, }; -int ixgbe_txq_vec_setup (struct igb_tx_queue *txq, - unsigned int socket_id __rte_unused) +int ixgbe_txq_vec_setup (struct igb_tx_queue *txq) {if (txq->sw_ring ==NULL )return -1 ;
Signature · 1 line
1.9.3
A message that is not in the archive (sent off-list or not yet received): 1407789890-17355-12-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Re: [RFC PATCH 11/14] ixgbe: make mbuf_initializer queue variable global
Quoted 11 lines · On Mon, 11 Aug 2014 21:44:47 +0100 Bruce Richardson…
On descriptor rearm, the
mbuf_initializervariable can be used to do a single-shot write to an mbuf to initialize all variables that can be set. This is currently used only by vector PMD function, but now allow it to be generally used by other RX code paths.Signed-off-by Bruce Richardson <[email protected]>--- lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 25 +++++++++++++++++++++++-- lib/librte_pmd_ixgbe/ixgbe_rxtx.h | 9 ++++++--- lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 25 +------------------------ 3 files changed, 30 insertions(+), 29 deletions(-)
These patches from 11-14 are really a follow on thread to the original changes. The sequence could be shorter so that reviewers digest 1-10 first.
A message that is not in the archive (sent off-list or not yet received): 20140811144737.3ef08d36-a7a0dvSY7KrRI77zikRAJc56i+j3xesD0e7PPNI6Mm0@public.gmane.org
Re: [RFC PATCH 11/14] ixgbe: make mbuf_initializer queue variable global
Quoted 25 lines
-----Original Message-----
From: Stephen Hemminger [mailto:[email protected]]
Sent: Monday, August 11, 2014 2:48 PM
To: Richardson, Bruce
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 11/14] ixgbe: makembuf_initializerqueue variable globalQuoted 11 lines · On Mon, 11 Aug 2014 21:44:47 +0100 Bruce Richardson…
On descriptor rearm, the
mbuf_initializervariable can be used to do a single-shot write to an mbuf to initialize all variables that can be set. This is currently used only by vector PMD function, but now allow it to be generally used by other RX code paths.Signed-off-by Bruce Richardson <[email protected]>--- lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 25 +++++++++++++++++++++++-- lib/librte_pmd_ixgbe/ixgbe_rxtx.h | 9 ++++++--- lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 25 +------------------------ 3 files changed, 30 insertions(+), 29 deletions(-)
Quoted 2 lines
These patches from 11-14 are really a follow on thread to the original changes. The sequence could be shorter so that reviewers digest 1-10 first.
Ok. The whole patch sequence needs to be cleaned up a lot before it's ready to go into the code, so I'll try and keep that in mind when doing the cleanup.
RFC PATCH 12/14 ixgbe: Make vector stores unaligned
In reply to a message not in the archiveWhen writing to the mbuf array for receiving packets, do not assume 16-byte alignment by using aligned stores. If the pointers are only 8-byte aligned, the program will crash due to incorrect alignment. Changing "store" to "storeu" fixes this.
--- lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c +2 -2
@@ -246,7 +246,7 @@ ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, descs[3 ] =_mm_loadu_si128 ((__m128i *)(rxdp +3 ));/* B.2 copy 2 mbuf point into rx_pkts */ -_mm_store_si128 ((__m128i *)&rx_pkts[pos], mbp1); +_mm_storeu_si128 ((__m128i *)&rx_pkts[pos], mbp1);/* B.1 load 1 mbuf point */ mbp2 =_mm_loadu_si128 ((__m128i *)&sw_ring[pos+2 ]);
@@ -257,7 +257,7 @@ ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, descs[0 ] =_mm_loadu_si128 ((__m128i *)(rxdp));/* B.2 copy 2 mbuf point into rx_pkts */ -_mm_store_si128 ((__m128i *)&rx_pkts[pos+2 ], mbp2); +_mm_storeu_si128 ((__m128i *)&rx_pkts[pos+2 ], mbp2);/* avoid compiler reorder optimization */ rte_compiler_barrier ();
Signature · 1 line
1.9.3
RFC PATCH 13/14 mbuf: cleanup + added in additional mbuf fields.
In reply to a message not in the archiveCleanups:
* use typedefs for markers within mbuf struct
* split up vlan_macip field as the l2/l3 lengths are for TX so go on the second cache line.
* created a tx_ol field in second cache line for data used for tx offloads
* rename the hash field to the filter field as it contains more than just a hash value.
Added in the extra mbuf fields needed:
* fdir flex bytes for i40e driver, i.e. extra 32-bits for filters
* field to be used for a sequence number, extra 32-bit field
* field for a second vlan tag, extra 16-bits, using space freed by moving out the l2 l3 lengths.
* userdata field for general application use.
* added inner_l3 and l4 length fields to allow tunneling.
--- app/test-pmd/csumonly.c | 4 +- app/test-pmd/flowgen.c | 6 +- app/test-pmd/macfwd.c | 6 +- app/test-pmd/macswap.c | 6 +- app/test-pmd/rxonly.c | 7 +-- app/test-pmd/testpmd.c | 5 +- app/test-pmd/txonly.c | 6 +- app/test/packet_burst_generator.c | 10 ++-- app/test/test_distributor.c | 18 +++--- app/test/test_distributor_perf.c | 4 +- lib/librte_distributor/rte_distributor.c | 2 +- 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 | 88 ++++++++++++++++------------- lib/librte_pmd_e1000/e1000_ethdev.h | 21 +++++++ lib/librte_pmd_e1000/em_rxtx.c | 13 +++-- lib/librte_pmd_e1000/igb_rxtx.c | 20 +++---- lib/librte_pmd_i40e/i40e_rxtx.c | 22 ++++---- lib/librte_pmd_ixgbe/ixgbe_ethdev.h | 21 +++++++ lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 28 ++++----- lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 8 +-- lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c | 4 +- lib/librte_sched/rte_sched.h | 19 ++++--- 25 files changed, 198 insertions(+), 136 deletions(-)
app/test-pmd/csumonly.c +2 -2
@@ -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->tx_ol.l2_len = l2_len; + mb->tx_ol.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 +3 -3
@@ -208,9 +208,9 @@ pkt_burst_flow_gen(struct fwd_stream *fs) 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 ); + pkt->vlan_tci0 = vlan_tci; + pkt->tx_ol.l2_len =sizeof (struct ether_hdr ); + pkt->tx_ol.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
@@ -116,9 +116,9 @@ pkt_burst_mac_forward(struct fwd_stream *fs)ether_addr_copy (&ports[fs->tx_port].eth_addr, ð_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->tx_ol.l2_len =sizeof (struct ether_hdr ); + mb->tx_ol.l3_len =sizeof (struct ipv4_hdr ); + mb->vlan_tci0 = 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
@@ -118,9 +118,9 @@ pkt_burst_mac_swap(struct fwd_stream *fs)ether_addr_copy (&addr, ð_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->tx_ol.l2_len =sizeof (struct ether_hdr ); + mb->tx_ol.l3_len =sizeof (struct ipv4_hdr ); + mb->vlan_tci0 = 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 +3 -4
@@ -158,15 +158,14 @@ pkt_burst_receive(struct fwd_stream *fs) eth_type, (unsigned ) mb->pkt_len, (int)mb->nb_segs);if (ol_flags &PKT_RX_RSS_HASH ) { -printf (" - RSS hash=0x%x" , (unsigned ) mb->hash.rss); +printf (" - RSS hash=0x%x" , (unsigned ) mb->filters.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->hash.fdir.hash, mb->hash.fdir.id); + mb->filters.fdir.hash, mb->filters.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_tci0);printf ("\n" );if (ol_flags !=0 ) {int rxf;
app/test-pmd/testpmd.c +3 -2
@@ -406,8 +406,9 @@ testpmd_mbuf_ctor(struct rte_mempool *mp, mb->ol_flags =0 ; mb->data_off =RTE_PKTMBUF_HEADROOM ; mb->nb_segs =1 ; - mb->vlan_macip.data =0 ; - mb->hash.rss =0 ; + mb->vlan_tci0 =0 ; + mb->tx_ol.u64 =0 ; + mb->filters.rss =0 ; } static void
app/test-pmd/txonly.c +3 -3
@@ -264,9 +264,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_tci0 = vlan_tci; + pkt->tx_ol.l2_len =sizeof (struct ether_hdr ); + pkt->tx_ol.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
@@ -261,19 +261,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->tx_ol.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_tci0 = ETHER_TYPE_IPv4; + pkt->tx_ol.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_tci0 = ETHER_TYPE_IPv6; + pkt->tx_ol.l3_len =sizeof (struct ipv6_hdr );if (vlan_enabled) pkt->ol_flags =PKT_RX_IPV6_HDR |PKT_RX_VLAN_PKT ;
app/test/test_distributor.c +9 -9
@@ -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]->hash.rss =0 ; + bufs[i]->filters.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]->hash.rss = (i &1 ) <<8 ; + bufs[i]->filters.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]->hash.rss = i; + bufs[i]->filters.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]->hash.rss = i <<2 ; + many_bufs[i]->filters.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]->hash.rss = (i+j) <<1 ; + bufs[j]->filters.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]->hash.rss =0 ; + bufs[i]->filters.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]->hash.rss =0 ; + bufs[i]->filters.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]->hash.rss =0 ; + bufs[i]->filters.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]->hash.rss = i <<1 ; + bufs[i]->filters.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
@@ -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]->hash.rss = i; + bufs[i]->filters.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]->hash.rss = i <<1 ; + bufs[i]->filters.rss = i <<1 ;rte_distributor_process (d, bufs, num_workers);rte_mempool_put_bulk (p, (void *)bufs, num_workers);
lib/librte_distributor/rte_distributor.c +1 -1
@@ -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->hash.rss |1 ); + new_tag = (next_mb->filters.rss |1 );uint32_t match =0 ;unsigned i;
lib/librte_ip_frag/ip_frag_common.h +1 -2
@@ -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->tx_ol.l2_len + mp->tx_ol.l3_len));/* chain two fragments. */ ms =rte_pktmbuf_lastseg (mn);
lib/librte_ip_frag/rte_ipv4_fragmentation.c +1 -1
@@ -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->tx_ol.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
@@ -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->tx_ol.l2_len); ip_hdr->total_length =rte_cpu_to_be_16 ((uint16_t )(fp->total_size + - m->vlan_macip.f.l3_len)); + m->tx_ol.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->tx_ol.l3_len);IP_FRAG_LOG (DEBUG ,"%s:%d:\n" "mbuf: %p, tms: %" PRIu64
lib/librte_ip_frag/rte_ipv6_reassembly.c +2 -3
@@ -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->tx_ol.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->tx_ol.l2_len + m->tx_ol.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 +50 -38
164 lines not on this page · raw message
lib/librte_pmd_e1000/e1000_ethdev.h +21 -0
@@ -116,6 +116,27 @@ struct e1000_vfta {uint32_t vfta[IGB_VFTA_SIZE ]; }; +/** Offload features for context descriptors - previously in mbuf */ +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) +/* * VF data which used by PF host only */
lib/librte_pmd_e1000/em_rxtx.c +8 -5
@@ -420,7 +420,11 @@ 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 = (union rte_vlan_macip ){ .f = { + .l3_len = tx_pkt->tx_ol.l3_len, + .l2_len = tx_pkt->tx_ol.l2_len, + .vlan_tci = tx_pkt->vlan_tci0, + } };/* If new context to be built or reuse the exist ctx. */ ctx =what_ctx_update (txq, tx_ol_req, hdrlen);
@@ -515,8 +519,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_tci0 <<E1000_TXD_VLAN_SHIFT ; }if (tx_ol_req) {
@@ -783,7 +786,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_tci0 =rte_le_to_cpu_16 (rxd.special);/* * Store the mbuf address into the next entry of the array
@@ -1009,7 +1012,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_tci0 =rte_le_to_cpu_16 (rxd.special);/* Prefetch data of first segment, if configured to do so. */ rte_packet_prefetch((char *)first_seg->buf_addr +
lib/librte_pmd_e1000/igb_rxtx.c +10 -10
@@ -353,7 +353,7 @@ 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; +union rte_vlan_macip vlan_macip_lens; txq = tx_queue; sw_ring = txq->sw_ring;
@@ -378,13 +378,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_tci0; + vlan_macip_lens.f.l3_len = tx_pkt->tx_ol.l3_len; + vlan_macip_lens.f.l2_len = tx_pkt->tx_ol.l2_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;
@@ -500,7 +502,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;
@@ -759,11 +761,10 @@ eth_igb_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, rxm->data_len = pkt_len; rxm->port = rxq->port_id; - rxm->hash.rss = rxd.wb.lower.hi_dword.rss; + rxm->filters.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_tci0 =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 |
@@ -993,14 +994,13 @@ eth_igb_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,* - error flags. */ first_seg->port = rxq->port_id; - first_seg->hash.rss = rxd.wb.lower.hi_dword.rss; + first_seg->filters.rss = rxd.wb.lower.hi_dword.rss;/* * 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_tci0 =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 +11 -11
@@ -614,16 +614,16 @@ 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_tci0 = rx_status & (1 <<I40E_RX_DESC_STATUS_L2TAG1P_SHIFT ) ? -rte_le_to_cpu_16 (\ - rxdp[j].wb.qword0.lo_dword.l2tag1) :0 ; +rte_le_to_cpu_16 (\ + rxdp[j].wb.qword0.lo_dword.l2tag1) :0 ; pkt_flags =i40e_rxd_status_to_pkt_flags (qword1); pkt_flags |=i40e_rxd_error_to_pkt_flags (qword1); pkt_flags |=i40e_rxd_ptype_to_pkt_flags (qword1); mb->ol_flags = pkt_flags;if (pkt_flags &PKT_RX_RSS_HASH ) - mb->hash.rss =rte_le_to_cpu_32 (\ + mb->filters.rss =rte_le_to_cpu_32 (\ rxdp->wb.qword0.hi_dword.rss); }
@@ -851,7 +851,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_tci0 = 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);
@@ -859,7 +859,7 @@ i40e_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) pkt_flags |=i40e_rxd_ptype_to_pkt_flags (qword1); rxm->ol_flags = pkt_flags;if (pkt_flags &PKT_RX_RSS_HASH ) - rxm->hash.rss = + rxm->filters.rss =rte_le_to_cpu_32 (rxd.wb.qword0.hi_dword.rss); rx_pkts[nb_rx++] = rxm;
@@ -1004,7 +1004,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_tci0 = (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);
@@ -1012,7 +1012,7 @@ i40e_recv_scattered_pkts(void *rx_queue, pkt_flags |=i40e_rxd_ptype_to_pkt_flags (qword1); first_seg->ol_flags = pkt_flags;if (pkt_flags &PKT_RX_RSS_HASH ) - rxm->hash.rss = + rxm->filters.rss =rte_le_to_cpu_32 (rxd.wb.qword0.hi_dword.rss);/* Prefetch data of first segment, if configured to do so. */
@@ -1107,8 +1107,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->tx_ol.l2_len; + l3_len = tx_pkt->tx_ol.l3_len;/* Calculate the number of context descriptors needed. */ nb_ctx =i40e_calc_context_desc (ol_flags);
@@ -1144,7 +1144,7 @@ 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 << + tx_flags |= tx_pkt->vlan_tci0 <<I40E_TX_FLAG_L2TAG1_SHIFT ; tx_flags |=I40E_TX_FLAG_INSERT_VLAN ; td_cmd |=I40E_TX_DESC_CMD_IL2TAG1 ;
lib/librte_pmd_ixgbe/ixgbe_ethdev.h +21 -0
@@ -98,6 +98,27 @@#define IXGBE_5TUPLE_MAX_PRI 7#define IXGBE_5TUPLE_MIN_PRI 1 +/** Offload features for context descriptors - previously in mbuf */ +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) +/* * Information about the fdir mode. */
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +15 -13
@@ -599,7 +599,11 @@ 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 = (union rte_vlan_macip ){ .f = { + .l3_len = tx_pkt->tx_ol.l3_len, + .l2_len = tx_pkt->tx_ol.l2_len, + .vlan_tci = tx_pkt->vlan_tci0, + } }.data;/* If hardware offload required */ tx_ol_req = (uint16_t )(ol_flags &PKT_TX_OFFLOAD_MASK );
@@ -959,8 +963,8 @@ 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->hash.rss = rxdp[j].wb.lower.hi_dword.rss; + mb->vlan_tci0 = rxdp[j].wb.upper.vlan; + mb->filters.rss = rxdp[j].wb.lower.hi_dword.rss;/* convert descriptor fields to rte mbuf flags */ mb->ol_flags = rx_desc_hlen_type_rss_to_pkt_flags(
@@ -1277,8 +1281,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_tci0 =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 |
@@ -1288,12 +1291,12 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, rxm->ol_flags = pkt_flags;if (likely (pkt_flags &PKT_RX_RSS_HASH )) - rxm->hash.rss = rxd.wb.lower.hi_dword.rss; + rxm->filters.rss = rxd.wb.lower.hi_dword.rss;else if (pkt_flags &PKT_RX_FDIR ) { - rxm->hash.fdir.hash = + rxm->filters.fdir.hash = (uint16_t )((rxd.wb.lower.hi_dword.csum_ip.csum) &IXGBE_ATR_HASH_MASK ); - rxm->hash.fdir.id = rxd.wb.lower.hi_dword.csum_ip.ip_id; + rxm->filters.fdir.id = rxd.wb.lower.hi_dword.csum_ip.ip_id; }/* * Store the mbuf address into the next entry of the array
@@ -1522,8 +1525,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_tci0 =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 |
@@ -1533,12 +1535,12 @@ ixgbe_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, first_seg->ol_flags = pkt_flags;if (likely (pkt_flags &PKT_RX_RSS_HASH )) - first_seg->hash.rss = rxd.wb.lower.hi_dword.rss; + first_seg->filters.rss = rxd.wb.lower.hi_dword.rss;else if (pkt_flags &PKT_RX_FDIR ) { - first_seg->hash.fdir.hash = + first_seg->filters.fdir.hash = (uint16_t )((rxd.wb.lower.hi_dword.csum_ip.csum) &IXGBE_ATR_HASH_MASK ); - first_seg->hash.fdir.id = + first_seg->filters.fdir.id = rxd.wb.lower.hi_dword.csum_ip.ip_id; }
lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c +4 -4
@@ -287,9 +287,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 (rx_pkts[pos+3 ]->rx_descriptor_fields1, +_mm_storeu_si128 ((void *)&rx_pkts[pos+3 ]->rx_descriptor_fields1, pkt_mb4); -_mm_storeu_si128 (rx_pkts[pos+2 ]->rx_descriptor_fields1, +_mm_storeu_si128 ((void *)&rx_pkts[pos+2 ]->rx_descriptor_fields1, pkt_mb3);/* D.2 pkt 1,2 set in_port/nb_seg and remove crc */
@@ -301,9 +301,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 (rx_pkts[pos+1 ]->rx_descriptor_fields1, +_mm_storeu_si128 ((void *)&rx_pkts[pos+1 ]->rx_descriptor_fields1, pkt_mb2); -_mm_storeu_si128 (rx_pkts[pos]->rx_descriptor_fields1, +_mm_storeu_si128 ((void *)&rx_pkts[pos]->rx_descriptor_fields1, pkt_mb1);/* C.4 calc avaialbe number of desc */
lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c +2 -2
@@ -549,7 +549,7 @@ 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 = + rxm->vlan_tci0 =rte_le_to_cpu_16 ((uint16_t )rcd->tci); }else
@@ -562,7 +562,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_tci0 =0 ; rxm->data_off =RTE_PKTMBUF_HEADROOM ; rx_pkts[nb_rx++] = rxm;
lib/librte_sched/rte_sched.h +12 -7
@@ -195,10 +195,12 @@ struct rte_sched_port_params {#endif }; -/** Path through the scheduler hierarchy used by the scheduler enqueue operation to -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.*/ +/** +* Path through the scheduler hierarchy used by the scheduler enqueue operation +* to identify the destination queue for the current packet. Stored in the field +* filters.sched of struct rte_mbuf of each packet, typically written by the +* classification stage and read by scheduler enqueue. +*/ struct rte_sched_port_hierarchy {uint32_t queue:2 ;/**< Queue ID (0 .. 3) */ uint32_t traffic_class:2 ;/**< Traffic class ID (0 .. 3)*/
@@ -352,7 +354,8 @@ 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->hash.sched; + struct rte_sched_port_hierarchy *sched = + (struct rte_sched_port_hierarchy *) &pkt->filters.sched; sched->color = (uint32_t ) color; sched->subport = subport;
@@ -381,7 +384,8 @@ 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->hash.sched; +struct rte_sched_port_hierarchy *sched = + (struct rte_sched_port_hierarchy *) &pkt->filters.sched; *subport = sched->subport; *pipe = sched->pipe;
@@ -392,7 +396,8 @@ rte_sched_port_pkt_read_tree_path(struct rte_mbuf *pkt, uint32_t *subport, uint3static 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->hash.sched; +struct rte_sched_port_hierarchy *sched = + (struct rte_sched_port_hierarchy *) &pkt->filters.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): 1407789890-17355-14-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Re: [RFC PATCH 13/14] mbuf: cleanup + added in additional mbuf fields.
Hi Bruce,
Quoted 17 lines · Bruce Richardson
Cleanups:
* use typedefs for markers within mbuf struct
* split upvlan_macipfield as the l2/l3 lengths are for TX so go on the second cache line.
* created atx_olfield in second cache line for data used for tx offloads
* rename the hash field to the filter field as it contains more than just a hash value.Added in the extra mbuf fields needed:
* fdir flex bytes for i40e driver, i.e. extra 32-bits for filters
* field to be used for a sequence number, extra 32-bit field
* field for a second vlan tag, extra 16-bits, using space freed by moving out the l2 l3 lengths.
* userdata field for general application use.
* addedinner_l3and l4 length fields to allow tunneling.
Quoted 1 line
Signed-off-by Bruce Richardson <[email protected]>
I think it would be clearer if splitted in several patches. First 2 patches for:
- rename hash in filter
- rename vlan_macip in rte_tx_offloads (and change to 64 bits ?)
By the way, the modification of ol_flags in 64 bits probably requires more modifications in driver and testpmd. See me initial patch "mbuf: change ol_flags to 32 bits".
Why not directly adding the MARKER typedef in previous patches? Also, I'm wondering if the markers really need to by typed. An empty struct would do the job, just requiring the users to cast it into the proper type.
About sequence, double vlan id, userdata: they are not used now. I think we should add them one by one in separate patches, with code really that really requires the added field to be present. By the way, there is already a way to reserve a zone in mbuf for the application at mbuf pool creation. What is the purpose of the userdata field?
About fdir_i40e field, I'm not sure that we should have driver-specific info in the generic mbuf structure. In addition, the application would need to know which hash type is present in the mbuf.
Each time we add a new field in the mbuf, I think we should ask ourselves how the application will use it, especially if the application manages several kind of ports (virtual and physical for instance), which may not support all features. For instance, who will fill the "sequence" field ? Is it the driver? If it's application-specific
Regards,
Olivier
RFC PATCH 14/14 ixgbe: Allow vector RX of scattered packets
In reply to a message not in the archiveProvide a wrapper routine to enable receive of scattered packets with a vector driver.
--- lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 8 +- lib/librte_pmd_ixgbe/ixgbe_rxtx.h | 1 + lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 164 ++++++++++++++++++++++++++++++++-- 3 files changed, 160 insertions(+), 13 deletions(-)
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +4 -4
@@ -3504,12 +3504,12 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)if ((dev->data->dev_conf.rxmode.max_rx_pkt_len +2 *IXGBE_VLAN_TAG_SIZE ) > buf_size){ dev->data->scattered_rx =1 ; - dev->rx_pkt_burst = ixgbe_recv_scattered_pkts; + dev->rx_pkt_burst = ixgbe_recv_scattered_pkts_vec; } }if (dev->data->dev_conf.rxmode.enable_scatter) { - dev->rx_pkt_burst = ixgbe_recv_scattered_pkts; + dev->rx_pkt_burst = ixgbe_recv_scattered_pkts_vec; dev->data->scattered_rx =1 ; }
@@ -3997,12 +3997,12 @@ ixgbevf_dev_rx_init(struct rte_eth_dev *dev)if ((dev->data->dev_conf.rxmode.max_rx_pkt_len +2 *IXGBE_VLAN_TAG_SIZE ) > buf_size) { dev->data->scattered_rx =1 ; - dev->rx_pkt_burst = ixgbe_recv_scattered_pkts; + dev->rx_pkt_burst = ixgbe_recv_scattered_pkts_vec; } }if (dev->data->dev_conf.rxmode.enable_scatter) { - dev->rx_pkt_burst = ixgbe_recv_scattered_pkts; + dev->rx_pkt_burst = ixgbe_recv_scattered_pkts_vec; dev->data->scattered_rx =1 ; }
lib/librte_pmd_ixgbe/ixgbe_rxtx.h +1 -0
@@ -225,6 +225,7 @@ struct ixgbe_txq_ops {#ifdef RTE_IXGBE_INC_VECTOR uint16_t ixgbe_recv_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); +uint16_t ixgbe_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts);uint16_t ixgbe_xmit_pkts_vec (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts);int ixgbe_txq_vec_setup (struct igb_tx_queue *txq);int ixgbe_rx_vec_condition_check (struct rte_eth_dev *dev);
lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c +155 -9
220 lines not on this page · raw message
Signature · 1 line
1.9.3
Hi Bruce,
Quoted 4 lines · Bruce Richardson
This patch set expands and enhances the mbuf data structure. This set includes patches previously submitted by Olivier to rework the mbuf, but takes the rework further than proposed there.
NOTE: This is still a work in progress! Feedback at this stage is still welcome though.
From the original series, I think the following ones could be added in a second patchset, do you agree?
dpdk igb/ixgbe: fix IP checksum calculation dpdk mbuf: add functions to get the name of an ol_flag dpdk testpmd: modify source address to validate checksum dpdk mbuf: generic support of TCP segmentation offload dpdk ixgbe: support TCP segmentation offload virtio-net-pmd pmd: adapt to new rte_mbuf structure vmxnet3-usermap pmd: remove support of old dpdk versions vmxnet3-usermap pmd: adapt to new rte_mbuf structure memnic pmd: adapt to new rte_mbuf structure
Regards,
Olivier
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Olivier,
Sorry for the delayed reply. I haven't looked at those patches in detail yet, but from the description I imagine that those patch sets could then be put in following the mbuf rework that I'm looking at.
/Bruce
Quoted 32 lines
-----Original Message-----
From: Olivier MATZ [mailto:[email protected]]
Sent: Tuesday, August 12, 2014 3:44 PM
To: Richardson, Bruce; [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 00/14] Extend the mbuf structureHi Bruce,
Quoted 1 line · Bruce Richardson
This patch set expands and enhances the mbuf data structure. This set includes
patches previously
Quoted 1 line
submitted by Olivier to rework the mbuf, but takes the rework further than
proposed there.
Quoted 2 lines
NOTE: This is still a work in progress! Feedback at this stage is still welcome
though.
From the original series, I think the following ones could be
added in a second patchset, do you agree?dpdk igb/ixgbe: fix IP checksum calculation dpdk mbuf: add functions to get the name of an ol_flag dpdk testpmd: modify source address to validate checksum dpdk mbuf: generic support of TCP segmentation offload dpdk ixgbe: support TCP segmentation offload virtio-net-pmd pmd: adapt to new rte_mbuf structure vmxnet3-usermap pmd: remove support of old dpdk versions vmxnet3-usermap pmd: adapt to new rte_mbuf structure memnic pmd: adapt to new rte_mbuf structureRegards,
Olivier
Cao, Min
Tested-byThis patch modifies the mbuf data struct, function and performace tests can work OK with it. It is ready to be integrated to dpdk.org.
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Tuesday, August 12, 2014 4:45 AM
To: [email protected]
Subject: [dpdk-dev] [RFC PATCH 00/14] Extend the mbuf structure
This patch set expands and enhances the mbuf data structure. This set includes patches previously submitted by Olivier to rework the mbuf, but takes the rework further than proposed there.
NOTE: This is still a work in progress! Feedback at this stage is still welcome though.
Outline of changes are:
* adds a second cache line to the structure
* moves some fields to that cache line to make space
* eliminates the control mbuf structure again to save space
* compresses the data pointer down to an offset to save space
* adds in new fields for:
- packet type
- sequence number
- inner_l3, l4 lengths
- max segment size
- user data pointer
- second vlan tag
* the flags field is expanded out to 64-bit, giving 48 new flags. The hash field is now called filters and is also expanded.
* some other structures are flattened out or otherwise reworked, e.g. vlan_macip field is gone.
* the field order has changed as fields are ordered more by function where they are used, e.g. rearm vs RX vs TX.
Following this patch set, the mbuf is larger, but still has free space in it for future expansion. The first cache line has 8 bytes free, and the second has 32 bytes free.
Current status: This patch set compiles on 64-bit gcc and clang, and handles throughput traffic using testpmd, in the fast path, and the full-features path cases, including handling jumbo frames. No performance regressions are seen in either of those cases, however further testing is needed, and is ongoing. Also, 32-bit support is not yet done.
Bruce Richardson (10):
mbuf: rename in_port to just port
mbuf: reorder fields by time-of-use
ixgbe: rework vector pmd following mbuf changes
mbuf: split mbuf across two cache lines. Fix performance regression due to moved pool ptr
mbuf: set next pointer to NULL on mbuf free.
ixgbe: make mbuf_initializer queue variable global
ixgbe: Make vector stores unaligned
mbuf: cleanup + added in additional mbuf fields.
ixgbe: Allow vector RX of scattered packets
Olivier Matz (4):
mbuf: rename RTE_MBUF_SCATTER_GATHER into RTE_MBUF_REFCNT
mbuf: remove rte_ctrlmbuf
mbuf: remove the rte_pktmbuf structure
mbuf: replace data pointer by an offset
app/test-pmd/cmdline.c | 2 - app/test-pmd/csumonly.c | 6 +- app/test-pmd/flowgen.c | 18 +- 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 | 11 +- app/test-pmd/testpmd.h | 2 +- app/test-pmd/txonly.c | 45 +-- app/test/commands.c | 2 - app/test/packet_burst_generator.c | 47 +-- app/test/test_distributor.c | 18 +- app/test/test_distributor_perf.c | 4 +- app/test/test_mbuf.c | 102 +---- app/test/test_sched.c | 4 +- app/test/test_table_acl.c | 7 +- app/test/test_table_pipeline.c | 10 +- config/common_bsdapp | 2 +- config/common_linuxapp | 2 +- doc/doxy-api.conf | 2 +- examples/dpdk_qat/crypto.c | 22 +- examples/dpdk_qat/main.c | 2 +- examples/exception_path/main.c | 11 +- examples/ip_pipeline/main.c | 2 +- examples/ip_reassembly/main.c | 8 +- examples/ipv4_multicast/Makefile | 4 +- examples/ipv4_multicast/main.c | 16 +- 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 | 79 ++-- 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 | 91 ++--- lib/librte_mbuf/rte_mbuf.h | 424 ++++++++------------- lib/librte_pmd_bond/rte_eth_bond_pmd.c | 4 +- lib/librte_pmd_e1000/e1000_ethdev.h | 21 + lib/librte_pmd_e1000/em_rxtx.c | 73 ++-- lib/librte_pmd_e1000/igb_rxtx.c | 83 ++-- lib/librte_pmd_i40e/i40e_rxtx.c | 109 +++--- lib/librte_pmd_ixgbe/ixgbe_ethdev.h | 21 + lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 151 ++++---- lib/librte_pmd_ixgbe/ixgbe_rxtx.h | 25 +- lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 395 ++++++++++--------- lib/librte_pmd_pcap/rte_eth_pcap.c | 14 +- lib/librte_pmd_virtio/virtio_rxtx.c | 22 +- lib/librte_pmd_virtio/virtqueue.h | 3 +- lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c | 29 +- lib/librte_pmd_xenvirt/rte_eth_xenvirt.c | 14 +- lib/librte_pmd_xenvirt/virtqueue.h | 4 +- lib/librte_sched/rte_sched.c | 14 +- lib/librte_sched/rte_sched.h | 21 +- 64 files changed, 1021 insertions(+), 1116 deletions(-)
Signature · 1 line
1.9.3
A message that is not in the archive (sent off-list or not yet received): B6059B2012717B4390714544B1F509E110D591C2-0J0gbvR4kTggGBtAFL8yw7fspsVTdybXVpNB7YpNyf8@public.gmane.org
Quoted 11 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Cao, Min
Sent: Wednesday, August 20, 2014 8:08 AM
To: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 00/14] Extend the mbuf structureTested-by Cao Min <[email protected]>This patch modifies the mbuf data struct, function and performace tests can work OK with it.
It is ready to be integrated to dpdk.org.
Well, it's getting there. I need to rework and clean up the patches somewhat, taking account of the feedback received. 32-bit support also needs to be looked at more, too. However, I hope shortly to have non-RFC (i.e. v1 of N :-) ) versions of these patches ready to submit.
/Bruce