summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gtest/trex_stateless_gtest.cpp22
-rw-r--r--src/stateless/cp/trex_stream_vm.cpp29
2 files changed, 50 insertions, 1 deletions
diff --git a/src/gtest/trex_stateless_gtest.cpp b/src/gtest/trex_stateless_gtest.cpp
index 10bd0aac..7954e8e6 100644
--- a/src/gtest/trex_stateless_gtest.cpp
+++ b/src/gtest/trex_stateless_gtest.cpp
@@ -188,6 +188,28 @@ TEST_F(basic_vm, vm_rand_limit0) {
vm.Dump(stdout);
}
+TEST_F(basic_vm, vm_rand_limit1) {
+
+ StreamVm vm;
+
+ vm.add_instruction( new StreamVmInstructionFlowRandLimit( "var1",1,100,0x1234) );
+ vm.add_instruction( new StreamVmInstructionWriteToPkt( "var1",26, 0,true)
+ );
+ vm.add_instruction( new StreamVmInstructionFixChecksumIpv4(14) );
+
+ vm.compile(128);
+
+
+ uint32_t program_size=vm.get_dp_instruction_buffer()->get_program_size();
+
+ printf (" program size : %lu \n",(ulong)program_size);
+
+
+ vm.Dump(stdout);
+
+}
+
+
/* start/stop/stop back to back */
diff --git a/src/stateless/cp/trex_stream_vm.cpp b/src/stateless/cp/trex_stream_vm.cpp
index 1f3f8ab4..0f1ea682 100644
--- a/src/stateless/cp/trex_stream_vm.cpp
+++ b/src/stateless/cp/trex_stream_vm.cpp
@@ -1306,7 +1306,10 @@ void StreamDPVmInstructions::Dump(FILE *fd){
StreamDPOpClientsUnLimit *lp_client_unlimited;
StreamDPOpPktSizeChange *lp_pkt_size_change;
-
+ StreamDPOpFlowRandLimit8 * lpv_rl8;
+ StreamDPOpFlowRandLimit16 * lpv_rl16;
+ StreamDPOpFlowRandLimit32 * lpv_rl32;
+ StreamDPOpFlowRandLimit64 * lpv_rl64;
while ( p < p_end) {
uint8_t op_code=*p;
@@ -1471,6 +1474,30 @@ void StreamDPVmInstructions::Dump(FILE *fd){
p+=sizeof(StreamDPOpPktWrMask);
break;
+ case ditRAND_LIMIT8 :
+ lpv_rl8 =(StreamDPOpFlowRandLimit8 *)p;
+ lpv_rl8->dump(fd,"RAND_LIMIT8");
+ p+=sizeof(StreamDPOpFlowRandLimit8);
+ break;
+
+ case ditRAND_LIMIT16 :
+ lpv_rl16 =(StreamDPOpFlowRandLimit16 *)p;
+ lpv_rl16->dump(fd,"RAND_LIMIT16");
+ p+=sizeof(StreamDPOpFlowRandLimit16);
+ break;
+
+ case ditRAND_LIMIT32 :
+ lpv_rl32 =(StreamDPOpFlowRandLimit32 *)p;
+ lpv_rl32->dump(fd,"RAND_LIMIT32");
+ p+=sizeof(StreamDPOpFlowRandLimit32);
+ break;
+
+ case ditRAND_LIMIT64 :
+ lpv_rl64 =(StreamDPOpFlowRandLimit64 *)p;
+ lpv_rl64->dump(fd,"RAND_LIMIT64");
+ p+=sizeof(StreamDPOpFlowRandLimit64);
+ break;
+
default:
assert(0);
}