summaryrefslogtreecommitdiffstats
path: root/src/stateless/cp/trex_stream.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/stateless/cp/trex_stream.cpp')
-rw-r--r--src/stateless/cp/trex_stream.cpp32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/stateless/cp/trex_stream.cpp b/src/stateless/cp/trex_stream.cpp
index ef718529..72e72c7c 100644
--- a/src/stateless/cp/trex_stream.cpp
+++ b/src/stateless/cp/trex_stream.cpp
@@ -53,19 +53,30 @@ 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();
+void
+TrexStream::compile() {
+ /* in case there are no instructions - nothing to do */
+ if (m_vm.is_vm_empty()) {
+ m_has_vm = false;
+ return;
+ }
- /* 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;
+ m_has_vm = true;
- /* calculate the mbuf size that we should allocate */
- m_vm_prefix_size =calc_writable_mbuf_size(max_pkt_offset,pkt_size);
- }
+ m_vm.set_packet_size(m_pkt.len);
+
+ m_vm.compile();
+
+ 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);
}
@@ -222,3 +233,4 @@ int TrexStreamTable::size() {
return m_stream_table.size();
}
+