summaryrefslogtreecommitdiffstats
path: root/src/rpc-server/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/rpc-server/commands')
-rw-r--r--src/rpc-server/commands/trex_rpc_cmd_stream.cpp15
-rw-r--r--src/rpc-server/commands/trex_rpc_cmds.h2
2 files changed, 16 insertions, 1 deletions
diff --git a/src/rpc-server/commands/trex_rpc_cmd_stream.cpp b/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
index f0eadef6..9bb2d552 100644
--- a/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
+++ b/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
@@ -212,6 +212,15 @@ TrexRpcCmdAddStream::parse_rate(const Json::Value &rate, std::unique_ptr<TrexStr
}
void
+TrexRpcCmdAddStream::parse_vm_instr_checksum_hw(const Json::Value &inst, std::unique_ptr<TrexStream> &stream, Json::Value &result) {
+ uint16_t l2_len = parse_uint16(inst, "l2_len", result);
+ uint16_t l3_len = parse_uint16(inst, "l3_len", result);
+ uint16_t l4_type = parse_uint16(inst, "l4_type", result);
+
+ stream->m_vm.add_instruction(new StreamVmInstructionFixHwChecksum(l2_len,l3_len,l4_type));
+}
+
+void
TrexRpcCmdAddStream::parse_vm_instr_checksum(const Json::Value &inst, std::unique_ptr<TrexStream> &stream, Json::Value &result) {
uint16_t pkt_offset = parse_uint16(inst, "pkt_offset", result);
@@ -462,13 +471,17 @@ TrexRpcCmdAddStream::parse_vm(const Json::Value &vm, std::unique_ptr<TrexStream>
for (int i = 0; i < instructions.size(); i++) {
const Json::Value & inst = parse_object(instructions, i, result);
- auto vm_types = {"fix_checksum_ipv4", "flow_var", "write_flow_var","tuple_flow_var","trim_pkt_size","write_mask_flow_var","flow_var_rand_limit"};
+ auto vm_types = {"fix_checksum_hw", "fix_checksum_ipv4", "flow_var", "write_flow_var","tuple_flow_var","trim_pkt_size","write_mask_flow_var","flow_var_rand_limit"};
std::string vm_type = parse_choice(inst, "type", vm_types, result);
// checksum instruction
if (vm_type == "fix_checksum_ipv4") {
parse_vm_instr_checksum(inst, stream, result);
+ } else if (vm_type == "fix_checksum_hw") {
+
+ parse_vm_instr_checksum_hw(inst, stream, result);
+
} else if (vm_type == "flow_var") {
parse_vm_instr_flow_var(inst, stream, result);
diff --git a/src/rpc-server/commands/trex_rpc_cmds.h b/src/rpc-server/commands/trex_rpc_cmds.h
index 506bd2c9..a68796ae 100644
--- a/src/rpc-server/commands/trex_rpc_cmds.h
+++ b/src/rpc-server/commands/trex_rpc_cmds.h
@@ -104,6 +104,8 @@ std::unique_ptr<TrexStream> allocate_new_stream(const Json::Value &section, uint
void validate_stream(const std::unique_ptr<TrexStream> &stream, Json::Value &result);
void parse_vm(const Json::Value &vm, std::unique_ptr<TrexStream> &stream, Json::Value &result);
void parse_vm_instr_checksum(const Json::Value &inst, std::unique_ptr<TrexStream> &stream, Json::Value &result);
+void parse_vm_instr_checksum_hw(const Json::Value &inst, std::unique_ptr<TrexStream> &stream, Json::Value &result);
+
void parse_vm_instr_flow_var(const Json::Value &inst, std::unique_ptr<TrexStream> &stream, Json::Value &result);
void parse_vm_instr_flow_var_rand_limit(const Json::Value &inst, std::unique_ptr<TrexStream> &stream, Json::Value &result);
void check_min_max(uint8_t flow_var_size, uint64_t init_value,uint64_t step,uint64_t min_value,uint64_t max_value,Json::Value &result);