summaryrefslogtreecommitdiffstats
path: root/src/stateless/cp/trex_stream.cpp
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2015-12-15 14:45:55 +0200
committerHanoh Haim <hhaim@cisco.com>2015-12-15 14:45:55 +0200
commite7ffce7b0317f9861264b17d003b22915177de33 (patch)
treeccf0b538a8bfbabb476f4f6e9b02139eb17dc11b /src/stateless/cp/trex_stream.cpp
parente263b80e39391a7552d9b9f56940e4fe4a9c3fbc (diff)
first test works
Diffstat (limited to 'src/stateless/cp/trex_stream.cpp')
-rw-r--r--src/stateless/cp/trex_stream.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/stateless/cp/trex_stream.cpp b/src/stateless/cp/trex_stream.cpp
index 8ea0c011..ef718529 100644
--- a/src/stateless/cp/trex_stream.cpp
+++ b/src/stateless/cp/trex_stream.cpp
@@ -53,6 +53,22 @@ std::string TrexStream::get_stream_type_str(stream_type_t stream_type){
}
+void TrexStream::post_vm_compile(){
+ /* if VM is enabled */
+ if (is_vm()) {
+ m_vm_dp = m_vm.cloneAsVmDp();
+
+
+ /* calc m_vm_prefix_size which is the size of the writable packet */
+ uint16_t max_pkt_offset = m_vm_dp->get_max_packet_update_offset();
+ uint16_t pkt_size = m_pkt.len;
+
+ /* calculate the mbuf size that we should allocate */
+ m_vm_prefix_size =calc_writable_mbuf_size(max_pkt_offset,pkt_size);
+ }
+}
+
+
void TrexStream::Dump(FILE *fd){
fprintf(fd,"\n");
@@ -113,12 +129,17 @@ TrexStream::TrexStream(uint8_t type,
m_burst_total_pkts=0;
m_num_bursts=1;
m_ibg_usec=0.0;
+ m_vm_dp = NULL;
}
TrexStream::~TrexStream() {
if (m_pkt.binary) {
delete [] m_pkt.binary;
}
+ if ( m_vm_dp ){
+ delete m_vm_dp;
+ m_vm_dp=NULL;
+ }
}
void