diff options
Diffstat (limited to 'src/pal')
-rw-r--r-- | src/pal/common/common_mbuf.cpp | 46 | ||||
-rw-r--r-- | src/pal/common/common_mbuf.h | 88 | ||||
-rwxr-xr-x | src/pal/linux/mbuf.cpp | 85 | ||||
-rwxr-xr-x | src/pal/linux/mbuf.h | 65 | ||||
-rw-r--r-- | src/pal/linux_dpdk/dpdk0716/rte_config.h | 357 | ||||
-rwxr-xr-x | src/pal/linux_dpdk/mbuf.cpp | 4 | ||||
-rwxr-xr-x | src/pal/linux_dpdk/mbuf.h | 57 |
7 files changed, 537 insertions, 165 deletions
diff --git a/src/pal/common/common_mbuf.cpp b/src/pal/common/common_mbuf.cpp new file mode 100644 index 00000000..eba29418 --- /dev/null +++ b/src/pal/common/common_mbuf.cpp @@ -0,0 +1,46 @@ +/* +Copyright (c) 2016-2016 Cisco Systems, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +#include <stdio.h> +#include <mbuf.h> +#include "common_mbuf.h" + +/* Dump structure of mbuf chain, without the data */ +void +utl_rte_pktmbuf_dump(const struct rte_mbuf *m) { + while (m) { + printf("(%d %d %d)", m->pkt_len, m->data_len, +#ifdef TREX_SIM + (int)m->refcnt_reserved); +#else + (int)m->refcnt_atomic.cnt); +#endif + if (RTE_MBUF_INDIRECT(m)) { +#ifdef TREX_SIM + struct rte_mbuf *md = RTE_MBUF_FROM_BADDR(m->buf_addr); +#else + struct rte_mbuf *md = rte_mbuf_from_indirect((struct rte_mbuf *)m); +#endif + printf("(direct %d %d %d)", md->pkt_len, md->data_len, +#ifdef TREX_SIM + (int)md->refcnt_reserved); +#else + (int)md->refcnt_atomic.cnt); +#endif + } + m = m->next; + } + printf("\n"); +} diff --git a/src/pal/common/common_mbuf.h b/src/pal/common/common_mbuf.h new file mode 100644 index 00000000..c52842bd --- /dev/null +++ b/src/pal/common/common_mbuf.h @@ -0,0 +1,88 @@ +#ifndef COMMON_MBUF_H +#define COMMON_MBUF_H + +/* +Copyright (c) 2016-2016 Cisco Systems, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +static inline rte_mbuf_t * utl_rte_pktmbuf_add_after2(rte_mbuf_t *m1,rte_mbuf_t *m2){ + utl_rte_pktmbuf_check(m1); + utl_rte_pktmbuf_check(m2); + + m1->next=m2; + m1->pkt_len += m2->data_len; + m1->nb_segs = m2->nb_segs + 1; + return (m1); +} + +static inline rte_mbuf_t * utl_rte_pktmbuf_add_after(rte_mbuf_t *m1,rte_mbuf_t *m2){ + + utl_rte_pktmbuf_check(m1); + utl_rte_pktmbuf_check(m2); + + rte_mbuf_refcnt_update(m2,1); + m1->next=m2; + m1->pkt_len += m2->data_len; + m1->nb_segs = m2->nb_segs + 1; + return (m1); +} + + +static inline void utl_rte_pktmbuf_add_last(rte_mbuf_t *m,rte_mbuf_t *m_last){ + + //there could be 2 cases supported + //1. one mbuf + //2. two mbug where last is indirect + + if ( m->next == NULL ) { + utl_rte_pktmbuf_add_after2(m,m_last); + }else{ + m->next->next=m_last; + m->pkt_len += m_last->data_len; + m->nb_segs = 3; + } +} + +// Create following m_buf structure: +// base -> indirect -> last +// Read only is the direct of indirect. +static inline rte_mbuf_t * utl_rte_pktmbuf_chain_with_indirect (rte_mbuf_t *base, rte_mbuf_t *indirect + , rte_mbuf_t *read_only, rte_mbuf_t *last) { + rte_pktmbuf_attach(indirect, read_only); + base->next = indirect; + indirect->next = last; + rte_pktmbuf_refcnt_update(read_only, -1); + base->nb_segs = 3; + indirect->nb_segs = 2; + last->nb_segs = 1; + return base; +} + +rte_mempool_t * utl_rte_mempool_create(const char *name, + unsigned n, + unsigned elt_size, + unsigned cache_size, + uint32_t _id , + int socket_id + ); + +rte_mempool_t * utl_rte_mempool_create_non_pkt(const char *name, + unsigned n, + unsigned elt_size, + unsigned cache_size, + uint32_t _id , + int socket_id); + +#endif diff --git a/src/pal/linux/mbuf.cpp b/src/pal/linux/mbuf.cpp index 846c776c..9f568e80 100755 --- a/src/pal/linux/mbuf.cpp +++ b/src/pal/linux/mbuf.cpp @@ -27,31 +27,12 @@ limitations under the License. #include "mbuf.h" #include <stdio.h> -#include <assert.h> #include <stdlib.h> #include <ctype.h> #include "sanb_atomic.h" - -#define RTE_MBUF_TO_BADDR(mb) (((struct rte_mbuf *)(mb)) + 1) -#define RTE_MBUF_FROM_BADDR(ba) (((struct rte_mbuf *)(ba)) - 1) - - void rte_pktmbuf_detach(struct rte_mbuf *m); - - -void utl_rte_check(rte_mempool_t * mp){ - assert(mp->magic == MAGIC0); - assert(mp->magic2 == MAGIC2); -} - -void utl_rte_pktmbuf_check(struct rte_mbuf *m){ - utl_rte_check(m->pool); - assert(m->magic == MAGIC0); - assert(m->magic2== MAGIC2); -} - rte_mempool_t * utl_rte_mempool_create_non_pkt(const char *name, unsigned n, unsigned elt_size, @@ -95,8 +76,9 @@ void utl_rte_mempool_delete(rte_mempool_t * & pool){ uint16_t rte_mbuf_refcnt_update(rte_mbuf_t *m, int16_t value) { utl_rte_pktmbuf_check(m); - uint32_t a=sanb_atomic_add_return_32_old(&m->refcnt_reserved, value); - return (a); + m->refcnt_reserved = (uint16_t)(m->refcnt_reserved + value); + assert(m->refcnt_reserved >= 0); + return m->refcnt_reserved; } @@ -109,7 +91,7 @@ void rte_pktmbuf_reset(struct rte_mbuf *m) m->pkt_len = 0; m->nb_segs = 1; m->in_port = 0xff; - m->refcnt_reserved=1; + m->ol_flags = 0; #if RTE_PKTMBUF_HEADROOM > 0 m->data_off = (RTE_PKTMBUF_HEADROOM <= m->buf_len) ? @@ -136,7 +118,7 @@ rte_mbuf_t *rte_pktmbuf_alloc(rte_mempool_t *mp){ m->magic = MAGIC0; m->magic2 = MAGIC2; m->pool = mp; - m->refcnt_reserved =0; + m->refcnt_reserved = 1; m->buf_len = buf_len; m->buf_addr =(char *)((char *)m+sizeof(rte_mbuf_t)+RTE_PKTMBUF_HEADROOM) ; @@ -146,28 +128,26 @@ rte_mbuf_t *rte_pktmbuf_alloc(rte_mempool_t *mp){ return (m); } - -void rte_pktmbuf_free_seg(rte_mbuf_t *m){ +void rte_pktmbuf_free_seg(rte_mbuf_t *m) { utl_rte_pktmbuf_check(m); - uint32_t old=sanb_atomic_dec2zero32(&m->refcnt_reserved); - if (old == 1) { - struct rte_mbuf *md = RTE_MBUF_FROM_BADDR(m->buf_addr); - if ( md != m ) { + if (rte_mbuf_refcnt_update(m, -1) == 0) { + /* if this is an indirect mbuf, then + * - detach mbuf + * - free attached mbuf segment + */ + + if (RTE_MBUF_INDIRECT(m)) { + struct rte_mbuf *md = RTE_MBUF_FROM_BADDR(m->buf_addr); rte_pktmbuf_detach(m); - if (rte_mbuf_refcnt_update(md, -1) == 0) { + if (rte_mbuf_refcnt_update(md, -1) == 0) free(md); - } - } - free(m); } } - - void rte_pktmbuf_free(rte_mbuf_t *m){ rte_mbuf_t *m_next; @@ -331,19 +311,6 @@ rte_pktmbuf_dump(const struct rte_mbuf *m, unsigned dump_len) } } - -rte_mbuf_t * utl_rte_pktmbuf_add_after2(rte_mbuf_t *m1,rte_mbuf_t *m2){ - utl_rte_pktmbuf_check(m1); - utl_rte_pktmbuf_check(m2); - - m1->next=m2; - m1->pkt_len += m2->data_len; - m1->nb_segs = m2->nb_segs + 1; - return (m1); -} - - - void rte_pktmbuf_attach(struct rte_mbuf *mi, struct rte_mbuf *md) { @@ -355,6 +322,7 @@ void rte_pktmbuf_attach(struct rte_mbuf *mi, struct rte_mbuf *md) mi->next = NULL; mi->data_len = md->data_len; mi->pkt_len = mi->data_len; + mi->ol_flags = mi->ol_flags | IND_ATTACHED_MBUF; mi->nb_segs = 1; } @@ -376,33 +344,14 @@ void rte_pktmbuf_detach(struct rte_mbuf *m) m->data_len = 0; + m->ol_flags = 0; } - - - - -rte_mbuf_t * utl_rte_pktmbuf_add_after(rte_mbuf_t *m1,rte_mbuf_t *m2){ - - utl_rte_pktmbuf_check(m1); - utl_rte_pktmbuf_check(m2); - - rte_mbuf_refcnt_update(m2,1); - m1->next=m2; - m1->pkt_len += m2->data_len; - m1->nb_segs = m2->nb_segs + 1; - return (m1); -} - - uint64_t rte_rand(void){ return ( rand() ); } - - - #ifdef ONLY_A_TEST diff --git a/src/pal/linux/mbuf.h b/src/pal/linux/mbuf.h index 174c757d..e7819148 100755 --- a/src/pal/linux/mbuf.h +++ b/src/pal/linux/mbuf.h @@ -24,10 +24,19 @@ limitations under the License. #include <stdint.h> #include <string.h> +#include <assert.h> + +typedef struct rte_mbuf rte_mbuf_t; #define MAGIC0 0xAABBCCDD #define MAGIC2 0x11223344 +#define IND_ATTACHED_MBUF (1ULL << 62) /**< Indirect attached mbuf */ +#define RTE_MBUF_INDIRECT(mb) ((mb)->ol_flags & IND_ATTACHED_MBUF) +#define RTE_MBUF_TO_BADDR(mb) (((struct rte_mbuf *)(mb)) + 1) +#define RTE_MBUF_FROM_BADDR(ba) (((struct rte_mbuf *)(ba)) - 1) + + struct rte_mempool { uint32_t magic; uint32_t elt_size; @@ -36,9 +45,6 @@ struct rte_mempool { int size; }; - - - struct rte_mbuf { uint32_t magic; struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */ @@ -55,33 +61,16 @@ struct rte_mbuf { uint32_t pkt_len; /**< Total pkt len: sum of all segment data_len. */ uint32_t magic2; - uint32_t refcnt_reserved; /**< Do not use this field */ + uint16_t refcnt_reserved; + uint64_t ol_flags; /**< Offload features. */ } ; - -typedef struct rte_mbuf rte_mbuf_t; - typedef struct rte_mempool rte_mempool_t; #define RTE_PKTMBUF_HEADROOM 0 void utl_rte_mempool_delete(rte_mempool_t * &pool); -rte_mempool_t * utl_rte_mempool_create(const char *name, - unsigned n, - unsigned elt_size, - unsigned cache_size, - uint32_t _id , - int socket_id - ); - -rte_mempool_t * utl_rte_mempool_create_non_pkt(const char *name, - unsigned n, - unsigned elt_size, - unsigned cache_size, - uint32_t _id , - int socket_id); - inline unsigned rte_mempool_count(rte_mempool_t *mp){ return (10); } @@ -107,9 +96,6 @@ void rte_pktmbuf_free_seg(rte_mbuf_t *m); uint16_t rte_mbuf_refcnt_update(rte_mbuf_t *m, int16_t value); -rte_mbuf_t * utl_rte_pktmbuf_add_after(rte_mbuf_t *m1,rte_mbuf_t *m2); -rte_mbuf_t * utl_rte_pktmbuf_add_after2(rte_mbuf_t *m1,rte_mbuf_t *m2); - void rte_pktmbuf_dump(const struct rte_mbuf *m, unsigned dump_len); @@ -166,22 +152,6 @@ rte_lcore_to_socket_id(unsigned lcore_id){ uint64_t rte_rand(void); - -static inline void utl_rte_pktmbuf_add_last(rte_mbuf_t *m,rte_mbuf_t *m_last){ - - //there could be 2 cases supported - //1. one mbuf - //2. two mbug where last is indirect - - if ( m->next == NULL ) { - utl_rte_pktmbuf_add_after2(m,m_last); - }else{ - m->next->next=m_last; - m->pkt_len += m_last->data_len; - m->nb_segs = 3; - } -} - static inline void rte_pktmbuf_refcnt_update(struct rte_mbuf *m, int16_t v) { do { @@ -189,8 +159,16 @@ static inline void rte_pktmbuf_refcnt_update(struct rte_mbuf *m, int16_t v) } while ((m = m->next) != NULL); } +static inline void utl_rte_check(rte_mempool_t * mp){ + assert(mp->magic == MAGIC0); + assert(mp->magic2 == MAGIC2); +} - +static inline void utl_rte_pktmbuf_check(struct rte_mbuf *m){ + utl_rte_check(m->pool); + assert(m->magic == MAGIC0); + assert(m->magic2== MAGIC2); +} #define __rte_cache_aligned @@ -199,4 +177,7 @@ static inline void rte_pktmbuf_refcnt_update(struct rte_mbuf *m, int16_t v) #define RTE_CACHE_LINE_SIZE 64 #define SOCKET_ID_ANY 0 +// has to be after the definition of rte_mbuf and other utility functions +#include "common_mbuf.h" + #endif diff --git a/src/pal/linux_dpdk/dpdk0716/rte_config.h b/src/pal/linux_dpdk/dpdk0716/rte_config.h new file mode 100644 index 00000000..a4c86fe6 --- /dev/null +++ b/src/pal/linux_dpdk/dpdk0716/rte_config.h @@ -0,0 +1,357 @@ +#ifndef __RTE_CONFIG_H +#define __RTE_CONFIG_H +#undef RTE_FORCE_INTRINSICS +#undef RTE_ARCH_STRICT_ALIGN +#undef RTE_BUILD_SHARED_LIB +#undef RTE_NEXT_ABI +#define RTE_NEXT_ABI 1 +#undef RTE_CACHE_LINE_SIZE +#define RTE_CACHE_LINE_SIZE 64 +#undef RTE_LIBRTE_EAL +#define RTE_LIBRTE_EAL 1 +#undef RTE_MAX_LCORE +#define RTE_MAX_LCORE 128 +#undef RTE_MAX_NUMA_NODES +#define RTE_MAX_NUMA_NODES 8 +#undef RTE_MAX_MEMSEG +#define RTE_MAX_MEMSEG 256 +#undef RTE_MAX_MEMZONE +#define RTE_MAX_MEMZONE 2560 +#undef RTE_MAX_TAILQ +#define RTE_MAX_TAILQ 32 +#undef RTE_LOG_LEVEL +#define RTE_LOG_LEVEL RTE_LOG_INFO +#undef RTE_LOG_HISTORY +#define RTE_LOG_HISTORY 256 +#undef RTE_LIBEAL_USE_HPET +#undef RTE_EAL_ALLOW_INV_SOCKET_ID +#undef RTE_EAL_ALWAYS_PANIC_ON_ERROR +#undef RTE_MALLOC_DEBUG +#undef RTE_EAL_PMD_PATH +#define RTE_EAL_PMD_PATH "" +#undef RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT +#define RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT 1 +#undef RTE_LIBRTE_KVARGS +#define RTE_LIBRTE_KVARGS 1 +#undef RTE_LIBRTE_ETHER +#define RTE_LIBRTE_ETHER 1 +#undef RTE_LIBRTE_ETHDEV_DEBUG +#undef RTE_MAX_ETHPORTS +#define RTE_MAX_ETHPORTS 32 +#undef RTE_MAX_QUEUES_PER_PORT +#define RTE_MAX_QUEUES_PER_PORT 1024 +#undef RTE_LIBRTE_IEEE1588 +#undef RTE_ETHDEV_QUEUE_STAT_CNTRS +#define RTE_ETHDEV_QUEUE_STAT_CNTRS 16 +#undef RTE_ETHDEV_RXTX_CALLBACKS +// TREX_PATCH RTE_ETHDEV_RXTX_CALLBACKS used to be 1 +#undef RTE_NIC_BYPASS +#undef RTE_LIBRTE_ENA_PMD +#define RTE_LIBRTE_ENA_PMD 1 +#undef RTE_LIBRTE_ENA_DEBUG_RX +#undef RTE_LIBRTE_ENA_DEBUG_TX +#undef RTE_LIBRTE_ENA_DEBUG_TX_FREE +#undef RTE_LIBRTE_ENA_DEBUG_DRIVER +#undef RTE_LIBRTE_ENA_COM_DEBUG +#undef RTE_LIBRTE_EM_PMD +#define RTE_LIBRTE_EM_PMD 1 +#undef RTE_LIBRTE_IGB_PMD +#define RTE_LIBRTE_IGB_PMD 1 +#undef RTE_LIBRTE_E1000_DEBUG_INIT +#undef RTE_LIBRTE_E1000_DEBUG_RX +#undef RTE_LIBRTE_E1000_DEBUG_TX +#undef RTE_LIBRTE_E1000_DEBUG_TX_FREE +#undef RTE_LIBRTE_E1000_DEBUG_DRIVER +#undef RTE_LIBRTE_E1000_PF_DISABLE_STRIP_CRC +#undef RTE_LIBRTE_IXGBE_PMD +#define RTE_LIBRTE_IXGBE_PMD 1 +#undef RTE_LIBRTE_IXGBE_DEBUG_INIT +#undef RTE_LIBRTE_IXGBE_DEBUG_RX +#undef RTE_LIBRTE_IXGBE_DEBUG_TX +#undef RTE_LIBRTE_IXGBE_DEBUG_TX_FREE +#undef RTE_LIBRTE_IXGBE_DEBUG_DRIVER +#undef RTE_LIBRTE_IXGBE_PF_DISABLE_STRIP_CRC +#undef RTE_IXGBE_INC_VECTOR +#define RTE_IXGBE_INC_VECTOR 1 +#undef RTE_IXGBE_RX_OLFLAGS_ENABLE +#define RTE_IXGBE_RX_OLFLAGS_ENABLE 1 +#undef RTE_LIBRTE_I40E_PMD +#define RTE_LIBRTE_I40E_PMD 1 +#undef RTE_LIBRTE_I40E_DEBUG_INIT +#undef RTE_LIBRTE_I40E_DEBUG_RX +#undef RTE_LIBRTE_I40E_DEBUG_TX +#undef RTE_LIBRTE_I40E_DEBUG_TX_FREE +#undef RTE_LIBRTE_I40E_DEBUG_DRIVER +#undef RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC +#define RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC 1 +#undef RTE_LIBRTE_I40E_INC_VECTOR +#undef RTE_LIBRTE_I40E_RX_OLFLAGS_ENABLE +#define RTE_LIBRTE_I40E_RX_OLFLAGS_ENABLE 1 +#undef RTE_LIBRTE_I40E_16BYTE_RX_DESC +#undef RTE_LIBRTE_I40E_QUEUE_NUM_PER_PF +#define RTE_LIBRTE_I40E_QUEUE_NUM_PER_PF 64 +#undef RTE_LIBRTE_I40E_QUEUE_NUM_PER_VF +#define RTE_LIBRTE_I40E_QUEUE_NUM_PER_VF 4 +#undef RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM +#define RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM 4 +#undef RTE_LIBRTE_I40E_ITR_INTERVAL +#define RTE_LIBRTE_I40E_ITR_INTERVAL -1 +#undef RTE_LIBRTE_FM10K_PMD +#define RTE_LIBRTE_FM10K_PMD 1 +#undef RTE_LIBRTE_FM10K_DEBUG_INIT +#undef RTE_LIBRTE_FM10K_DEBUG_RX +#undef RTE_LIBRTE_FM10K_DEBUG_TX +#undef RTE_LIBRTE_FM10K_DEBUG_TX_FREE +#undef RTE_LIBRTE_FM10K_DEBUG_DRIVER +#undef RTE_LIBRTE_FM10K_RX_OLFLAGS_ENABLE +#define RTE_LIBRTE_FM10K_RX_OLFLAGS_ENABLE 1 +#undef RTE_LIBRTE_FM10K_INC_VECTOR +#define RTE_LIBRTE_FM10K_INC_VECTOR 1 +#undef RTE_LIBRTE_MLX4_PMD +#undef RTE_LIBRTE_MLX4_DEBUG +#undef RTE_LIBRTE_MLX4_SGE_WR_N +#define RTE_LIBRTE_MLX4_SGE_WR_N 4 +#undef RTE_LIBRTE_MLX4_MAX_INLINE +#define RTE_LIBRTE_MLX4_MAX_INLINE 0 +#undef RTE_LIBRTE_MLX4_TX_MP_CACHE +#define RTE_LIBRTE_MLX4_TX_MP_CACHE 8 +#undef RTE_LIBRTE_MLX4_SOFT_COUNTERS +#define RTE_LIBRTE_MLX4_SOFT_COUNTERS 1 +#undef RTE_LIBRTE_MLX5_PMD +#undef RTE_LIBRTE_MLX5_DEBUG +#undef RTE_LIBRTE_MLX5_TX_MP_CACHE +#define RTE_LIBRTE_MLX5_TX_MP_CACHE 8 +#undef RTE_LIBRTE_BNX2X_PMD +#undef RTE_LIBRTE_BNX2X_DEBUG +#undef RTE_LIBRTE_BNX2X_DEBUG_INIT +#undef RTE_LIBRTE_BNX2X_DEBUG_RX +#undef RTE_LIBRTE_BNX2X_DEBUG_TX +#undef RTE_LIBRTE_BNX2X_MF_SUPPORT +#undef RTE_LIBRTE_BNX2X_DEBUG_PERIODIC +#undef RTE_LIBRTE_CXGBE_PMD +#define RTE_LIBRTE_CXGBE_PMD 1 +#undef RTE_LIBRTE_CXGBE_DEBUG +#undef RTE_LIBRTE_CXGBE_DEBUG_REG +#undef RTE_LIBRTE_CXGBE_DEBUG_MBOX +#undef RTE_LIBRTE_CXGBE_DEBUG_TX +#undef RTE_LIBRTE_CXGBE_DEBUG_RX +#undef RTE_LIBRTE_ENIC_PMD +#define RTE_LIBRTE_ENIC_PMD 1 +#undef RTE_LIBRTE_ENIC_DEBUG +#undef RTE_LIBRTE_NFP_PMD +#undef RTE_LIBRTE_NFP_DEBUG +#undef RTE_LIBRTE_BNXT_PMD +#define RTE_LIBRTE_BNXT_PMD 1 +#undef RTE_LIBRTE_PMD_SZEDATA2 +#undef RTE_LIBRTE_PMD_SZEDATA2_AS +#define RTE_LIBRTE_PMD_SZEDATA2_AS 0 +#undef RTE_LIBRTE_THUNDERX_NICVF_PMD +#undef RTE_LIBRTE_THUNDERX_NICVF_DEBUG_INIT +#undef RTE_LIBRTE_THUNDERX_NICVF_DEBUG_RX +#undef RTE_LIBRTE_THUNDERX_NICVF_DEBUG_TX +#undef RTE_LIBRTE_THUNDERX_NICVF_DEBUG_DRIVER +#undef RTE_LIBRTE_THUNDERX_NICVF_DEBUG_MBOX +#undef RTE_LIBRTE_VIRTIO_PMD +#define RTE_LIBRTE_VIRTIO_PMD 1 +#undef RTE_LIBRTE_VIRTIO_DEBUG_INIT +#undef RTE_LIBRTE_VIRTIO_DEBUG_RX +#undef RTE_LIBRTE_VIRTIO_DEBUG_TX +#undef RTE_LIBRTE_VIRTIO_DEBUG_DRIVER +#undef RTE_LIBRTE_VIRTIO_DEBUG_DUMP +#undef RTE_LIBRTE_VMXNET3_PMD +#define RTE_LIBRTE_VMXNET3_PMD 1 +#undef RTE_LIBRTE_VMXNET3_DEBUG_INIT +#undef RTE_LIBRTE_VMXNET3_DEBUG_RX +#undef RTE_LIBRTE_VMXNET3_DEBUG_TX +#undef RTE_LIBRTE_VMXNET3_DEBUG_TX_FREE +#undef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER +#undef RTE_LIBRTE_PMD_RING +#define RTE_LIBRTE_PMD_RING 1 +#undef RTE_PMD_RING_MAX_RX_RINGS +#define RTE_PMD_RING_MAX_RX_RINGS 16 +#undef RTE_PMD_RING_MAX_TX_RINGS +#define RTE_PMD_RING_MAX_TX_RINGS 16 +#undef RTE_LIBRTE_PMD_PCAP +#define RTE_LIBRTE_PMD_PCAP 1 +#undef RTE_LIBRTE_PMD_BOND +#define RTE_LIBRTE_PMD_BOND 1 +#undef RTE_LIBRTE_BOND_DEBUG_ALB +#undef RTE_LIBRTE_BOND_DEBUG_ALB_L1 +#undef RTE_LIBRTE_QEDE_PMD +#undef RTE_LIBRTE_QEDE_DEBUG_INIT +#undef RTE_LIBRTE_QEDE_DEBUG_INFO +#undef RTE_LIBRTE_QEDE_DEBUG_DRIVER +#undef RTE_LIBRTE_QEDE_DEBUG_TX +#undef RTE_LIBRTE_QEDE_DEBUG_RX +#undef RTE_LIBRTE_QEDE_FW +#define RTE_LIBRTE_QEDE_FW "" +#undef RTE_LIBRTE_PMD_XENVIRT +#undef RTE_LIBRTE_PMD_NULL +#define RTE_LIBRTE_PMD_NULL 1 +#undef RTE_PMD_PACKET_PREFETCH +#define RTE_PMD_PACKET_PREFETCH 1 +#undef RTE_LIBRTE_CRYPTODEV +#define RTE_LIBRTE_CRYPTODEV 1 +#undef RTE_LIBRTE_CRYPTODEV_DEBUG +#undef RTE_CRYPTO_MAX_DEVS +#define RTE_CRYPTO_MAX_DEVS 64 +#undef RTE_CRYPTODEV_NAME_LEN +#define RTE_CRYPTODEV_NAME_LEN 64 +#undef RTE_LIBRTE_PMD_QAT +#undef RTE_LIBRTE_PMD_QAT_DEBUG_INIT +#undef RTE_LIBRTE_PMD_QAT_DEBUG_TX +#undef RTE_LIBRTE_PMD_QAT_DEBUG_RX +#undef RTE_LIBRTE_PMD_QAT_DEBUG_DRIVER +#undef RTE_QAT_PMD_MAX_NB_SESSIONS +#define RTE_QAT_PMD_MAX_NB_SESSIONS 2048 +#undef RTE_LIBRTE_PMD_AESNI_MB +#undef RTE_LIBRTE_PMD_AESNI_MB_DEBUG +#undef RTE_LIBRTE_PMD_AESNI_GCM +#undef RTE_LIBRTE_PMD_AESNI_GCM_DEBUG +#undef RTE_LIBRTE_PMD_SNOW3G +#undef RTE_LIBRTE_PMD_SNOW3G_DEBUG +#undef RTE_LIBRTE_PMD_KASUMI +#undef RTE_LIBRTE_PMD_KASUMI_DEBUG +#undef RTE_LIBRTE_PMD_NULL_CRYPTO +#define RTE_LIBRTE_PMD_NULL_CRYPTO 1 +#undef RTE_LIBRTE_RING +#define RTE_LIBRTE_RING 1 +#undef RTE_LIBRTE_RING_DEBUG +#undef RTE_RING_SPLIT_PROD_CONS +#undef RTE_RING_PAUSE_REP_COUNT +#define RTE_RING_PAUSE_REP_COUNT 0 +#undef RTE_LIBRTE_MEMPOOL +#define RTE_LIBRTE_MEMPOOL 1 +#undef RTE_MEMPOOL_CACHE_MAX_SIZE +#define RTE_MEMPOOL_CACHE_MAX_SIZE 512 +#undef RTE_LIBRTE_MEMPOOL_DEBUG +#undef RTE_LIBRTE_MBUF +#define RTE_LIBRTE_MBUF 1 +#undef RTE_LIBRTE_MBUF_DEBUG +#undef RTE_MBUF_DEFAULT_MEMPOOL_OPS +#define RTE_MBUF_DEFAULT_MEMPOOL_OPS "ring_mp_mc" +#undef RTE_MBUF_REFCNT_ATOMIC +#define RTE_MBUF_REFCNT_ATOMIC 1 +#undef RTE_PKTMBUF_HEADROOM +// TREX_PATCH: DPDK original value is 128 here. This creates big overhead of memory. +// We would like to put 0, but it cuases compilation issues with virtio driver. +// 16 caused big performance degradation because of alignment issues. So 64 is the winner. +#define RTE_PKTMBUF_HEADROOM 64 + +#undef RTE_LIBRTE_TIMER +#define RTE_LIBRTE_TIMER 1 +#undef RTE_LIBRTE_TIMER_DEBUG +#undef RTE_LIBRTE_CFGFILE +#define RTE_LIBRTE_CFGFILE 1 +#undef RTE_LIBRTE_CMDLINE +#define RTE_LIBRTE_CMDLINE 1 +#undef RTE_LIBRTE_CMDLINE_DEBUG +#undef RTE_LIBRTE_HASH +#define RTE_LIBRTE_HASH 1 +#undef RTE_LIBRTE_HASH_DEBUG +#undef RTE_LIBRTE_JOBSTATS +#define RTE_LIBRTE_JOBSTATS 1 +#undef RTE_LIBRTE_LPM +#define RTE_LIBRTE_LPM 1 +#undef RTE_LIBRTE_LPM_DEBUG +#undef RTE_LIBRTE_ACL +#define RTE_LIBRTE_ACL 1 +#undef RTE_LIBRTE_ACL_DEBUG +#undef RTE_LIBRTE_POWER_DEBUG +#undef RTE_MAX_LCORE_FREQS +#define RTE_MAX_LCORE_FREQS 64 +#undef RTE_LIBRTE_NET +#define RTE_LIBRTE_NET 1 +#undef RTE_LIBRTE_IP_FRAG +#define RTE_LIBRTE_IP_FRAG 1 +#undef RTE_LIBRTE_IP_FRAG_DEBUG +#undef RTE_LIBRTE_IP_FRAG_MAX_FRAG +#define RTE_LIBRTE_IP_FRAG_MAX_FRAG 4 +#undef RTE_LIBRTE_IP_FRAG_TBL_STAT +#undef RTE_LIBRTE_METER +#define RTE_LIBRTE_METER 1 +#undef RTE_LIBRTE_SCHED +#define RTE_LIBRTE_SCHED 1 +#undef RTE_SCHED_DEBUG +#undef RTE_SCHED_RED +#undef RTE_SCHED_COLLECT_STATS +#undef RTE_SCHED_SUBPORT_TC_OV +#undef RTE_SCHED_PORT_N_GRINDERS +#define RTE_SCHED_PORT_N_GRINDERS 8 +#undef RTE_SCHED_VECTOR +#undef RTE_LIBRTE_DISTRIBUTOR +#define RTE_LIBRTE_DISTRIBUTOR 1 +#undef RTE_LIBRTE_REORDER +#define RTE_LIBRTE_REORDER 1 +#undef RTE_LIBRTE_PORT +#define RTE_LIBRTE_PORT 1 +#undef RTE_PORT_STATS_COLLECT +#undef RTE_PORT_PCAP +#undef RTE_LIBRTE_TABLE +#define RTE_LIBRTE_TABLE 1 +#undef RTE_TABLE_STATS_COLLECT +#undef RTE_LIBRTE_PIPELINE +#define RTE_LIBRTE_PIPELINE 1 +#undef RTE_PIPELINE_STATS_COLLECT +#undef RTE_KNI_PREEMPT_DEFAULT +#define RTE_KNI_PREEMPT_DEFAULT 1 +#undef RTE_KNI_KO_DEBUG +#undef RTE_KNI_VHOST +#undef RTE_KNI_VHOST_MAX_CACHE_SIZE +#define RTE_KNI_VHOST_MAX_CACHE_SIZE 1024 +#undef RTE_KNI_VHOST_VNET_HDR_EN +#undef RTE_KNI_VHOST_DEBUG_RX +#undef RTE_KNI_VHOST_DEBUG_TX +#undef RTE_LIBRTE_PDUMP +#define RTE_LIBRTE_PDUMP 1 +#undef RTE_LIBRTE_VHOST_USER +#define RTE_LIBRTE_VHOST_USER 1 +#undef RTE_LIBRTE_VHOST_NUMA +#undef RTE_LIBRTE_VHOST_DEBUG +#undef RTE_LIBRTE_XEN_DOM0 +#undef RTE_INSECURE_FUNCTION_WARNING +#undef RTE_APP_TEST +#define RTE_APP_TEST 1 +#undef RTE_APP_TEST_RESOURCE_TAR +#undef RTE_TEST_PMD +#define RTE_TEST_PMD 1 +#undef RTE_TEST_PMD_RECORD_CORE_CYCLES +#undef RTE_TEST_PMD_RECORD_BURST_STATS +#undef RTE_EXEC_ENV +#define RTE_EXEC_ENV "linuxapp" +#undef RTE_EXEC_ENV_LINUXAPP +#define RTE_EXEC_ENV_LINUXAPP 1 +#undef RTE_EAL_IGB_UIO +#define RTE_EAL_IGB_UIO 1 +#undef RTE_EAL_VFIO +#define RTE_EAL_VFIO 1 +#undef RTE_KNI_KMOD +#define RTE_KNI_KMOD 1 +#undef RTE_LIBRTE_KNI +#define RTE_LIBRTE_KNI 1 +#undef RTE_LIBRTE_VHOST +#define RTE_LIBRTE_VHOST 1 +#undef RTE_LIBRTE_PMD_VHOST +#define RTE_LIBRTE_PMD_VHOST 1 +#undef RTE_LIBRTE_PMD_AF_PACKET +#define RTE_LIBRTE_PMD_AF_PACKET 1 +#undef RTE_LIBRTE_POWER +#define RTE_LIBRTE_POWER 1 +#undef RTE_VIRTIO_USER +#define RTE_VIRTIO_USER 1 +#undef RTE_MACHINE +#define RTE_MACHINE "native" +#undef RTE_ARCH +#define RTE_ARCH "x86_64" +#undef RTE_ARCH_X86_64 +#define RTE_ARCH_X86_64 1 +#undef RTE_ARCH_X86 +#define RTE_ARCH_X86 1 +#undef RTE_ARCH_64 +#define RTE_ARCH_64 1 +#undef RTE_TOOLCHAIN +#define RTE_TOOLCHAIN "gcc" +#undef RTE_TOOLCHAIN_GCC +#define RTE_TOOLCHAIN_GCC 1 +#endif /* __RTE_CONFIG_H */ + diff --git a/src/pal/linux_dpdk/mbuf.cpp b/src/pal/linux_dpdk/mbuf.cpp index dd78617f..2a405ab1 100755 --- a/src/pal/linux_dpdk/mbuf.cpp +++ b/src/pal/linux_dpdk/mbuf.cpp @@ -6,7 +6,7 @@ */ /* -Copyright (c) 2015-2015 Cisco Systems, Inc. +Copyright (c) 2015-2016 Cisco Systems, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ rte_mempool_t * utl_rte_mempool_create(const char *name, unsigned elt_size, unsigned cache_size, uint32_t _id, - uint32_t socket_id ){ + int socket_id ){ char buffer[100]; sprintf(buffer,"%s-%d",name,socket_id); diff --git a/src/pal/linux_dpdk/mbuf.h b/src/pal/linux_dpdk/mbuf.h index 339c0909..0d9ca8be 100755 --- a/src/pal/linux_dpdk/mbuf.h +++ b/src/pal/linux_dpdk/mbuf.h @@ -6,7 +6,7 @@ */ /* -Copyright (c) 2015-2015 Cisco Systems, Inc. +Copyright (c) 2015-2016 Cisco Systems, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -27,61 +27,12 @@ limitations under the License. #include <rte_random.h> typedef struct rte_mbuf rte_mbuf_t; - +inline void utl_rte_pktmbuf_check(struct rte_mbuf *m) {} typedef struct rte_mempool rte_mempool_t; -inline void utl_rte_mempool_delete(rte_mempool_t * & pool){ -} - - -rte_mempool_t * utl_rte_mempool_create(const char *name, - unsigned n, - unsigned elt_size, - unsigned cache_size, - uint32_t _id, - uint32_t socket_id ); +#include "common_mbuf.h" -rte_mempool_t * utl_rte_mempool_create_non_pkt(const char *name, - unsigned n, - unsigned elt_size, - unsigned cache_size, - uint32_t _id , - int socket_id); - - -static inline rte_mbuf_t * utl_rte_pktmbuf_add_after(rte_mbuf_t *m1,rte_mbuf_t *m2){ - - rte_mbuf_refcnt_update(m2,1); - m1->next=m2; - - m1->pkt_len += m2->data_len; - m1->nb_segs = m2->nb_segs + 1; - return (m1); -} - -static inline rte_mbuf_t * utl_rte_pktmbuf_add_after2(rte_mbuf_t *m1,rte_mbuf_t *m2){ - - m1->next=m2; - m1->pkt_len += m2->data_len; - m1->nb_segs = m2->nb_segs + 1; - return (m1); -} - -static inline void utl_rte_pktmbuf_add_last(rte_mbuf_t *m,rte_mbuf_t *m_last){ - - //there could be 2 cases supported - //1. one mbuf - //2. two mbug where last is indirect - - if ( m->next == NULL ) { - utl_rte_pktmbuf_add_after2(m,m_last); - }else{ - m->next->next=m_last; - m->pkt_len += m_last->data_len; - m->nb_segs = 3; - } +inline void utl_rte_mempool_delete(rte_mempool_t * & pool){ } - - #endif |