diff options
author | Hanoh Haim <hhaim@cisco.com> | 2015-11-30 14:31:39 +0200 |
---|---|---|
committer | Hanoh Haim <hhaim@cisco.com> | 2015-11-30 14:31:39 +0200 |
commit | 2e51cea370c6c401453d77b23f552811a669d86a (patch) | |
tree | ac5b02efa7a18f255f63fca007b35036fa8a56bc /src/stateless/dp/trex_stream_node.h | |
parent | 7f07d43ec534562ea274839c8996c9e79e747801 (diff) |
vm mode works - first test
Diffstat (limited to 'src/stateless/dp/trex_stream_node.h')
-rw-r--r-- | src/stateless/dp/trex_stream_node.h | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/src/stateless/dp/trex_stream_node.h b/src/stateless/dp/trex_stream_node.h index 111af845..1ae8cbbc 100644 --- a/src/stateless/dp/trex_stream_node.h +++ b/src/stateless/dp/trex_stream_node.h @@ -54,6 +54,16 @@ struct CGenNodeStateless : public CGenNodeBase { friend class TrexStatelessDpCore; public: + + /* flags MASKS*/ + enum { + SL_NODE_FLAGS_DIR =1, //USED by master + SL_NODE_FLAGS_MBUF_CACHE =2, //USED by master + + SL_NODE_CONST_MBUF =4 + + }; + enum { ss_FREE_RESUSE =1, /* should be free by scheduler */ ss_INACTIVE =2, /* will be active by other stream or stopped */ @@ -86,8 +96,10 @@ private: TrexStream * m_ref_stream_info; /* the stream info */ CGenNodeStateless * m_next_stream; + uint8_t * m_original_packet_data_prefix; /* pointer to the original first pointer 64/128/512 */ + /* pad to match the size of CGenNode */ - uint8_t m_pad_end[56]; + uint8_t m_pad_end[48]; @@ -256,13 +268,51 @@ public: } inline rte_mbuf_t * get_cache_mbuf(){ - if ( m_flags &NODE_FLAGS_MBUF_CACHE ) { + if ( m_flags & NODE_FLAGS_MBUF_CACHE ) { + return ((rte_mbuf_t *)m_cache_mbuf); + }else{ + return ((rte_mbuf_t *)0); + } + } + + inline void set_const_mbuf(rte_mbuf_t * m){ + m_cache_mbuf=(void *)m; + m_flags |= SL_NODE_CONST_MBUF; + } + + inline rte_mbuf_t * get_const_mbuf(){ + if ( m_flags &SL_NODE_CONST_MBUF ) { return ((rte_mbuf_t *)m_cache_mbuf); }else{ return ((rte_mbuf_t *)0); } } + /* prefix header exits only in non cache mode size is 64/128/512 other are not possible right now */ + inline void alloc_prefix_header(uint8_t size){ + set_prefix_header_size(size); + m_original_packet_data_prefix = (uint8_t *)malloc(size); + assert(m_original_packet_data_prefix); + } + + inline void free_prefix_header(){ + if (m_original_packet_data_prefix) { + free(m_original_packet_data_prefix); + } + } + + /* prefix headr could be 64/128/512 */ + inline void set_prefix_header_size(uint16_t size){ + m_src_port=size; + } + + inline uint16_t prefix_header_size(){ + return (m_src_port); + } + + + rte_mbuf_t * alloc_node_with_vm(); + void free_stl_node(); public: |