diff options
author | Hanoh Haim <hhaim@cisco.com> | 2016-02-23 16:13:46 +0200 |
---|---|---|
committer | Hanoh Haim <hhaim@cisco.com> | 2016-02-23 16:13:46 +0200 |
commit | 5a951d9435dd13b8c785969f1fd85b1c19743ab0 (patch) | |
tree | 92a91af52ddf392643922f9842c4d9cbf20a9a4f /src/stateless | |
parent | 36cc1ecef32dcee3640e6ddf96422c07d89777b3 (diff) |
add to mask instruction add_value field
Diffstat (limited to 'src/stateless')
-rw-r--r-- | src/stateless/cp/trex_stream_vm.cpp | 5 | ||||
-rw-r--r-- | src/stateless/cp/trex_stream_vm.h | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/stateless/cp/trex_stream_vm.cpp b/src/stateless/cp/trex_stream_vm.cpp index b0cadfb6..d8395ba4 100644 --- a/src/stateless/cp/trex_stream_vm.cpp +++ b/src/stateless/cp/trex_stream_vm.cpp @@ -84,7 +84,7 @@ void StreamVmInstructionFlowMan::sanity_check(uint32_t ins_id,StreamVm *lp){ void StreamVmInstructionWriteMaskToPkt::Dump(FILE *fd){ - fprintf(fd," flow_var:%s, offset:%lu, cast_size:%lu, mask:0x%lx, shift:%ld, is_big:%lu \n",m_flow_var_name.c_str(),(ulong)m_pkt_offset,(ulong)m_pkt_cast_size,(ulong)m_mask,(long)m_shift,(ulong)(m_is_big_endian?1:0)); + fprintf(fd," flow_var:%s, offset:%lu, cast_size:%lu, mask:0x%lx, shift:%ld, add:%ld, is_big:%lu \n",m_flow_var_name.c_str(),(ulong)m_pkt_offset,(ulong)m_pkt_cast_size,(ulong)m_mask,(long)m_shift,(long)m_add_value,(ulong)(m_is_big_endian?1:0)); } @@ -735,6 +735,7 @@ void StreamVm::build_program(){ pmask.m_flags = flags; pmask.m_var_offset = flow_offset; pmask.m_shift = lpPkt->m_shift; + pmask.m_add_value = lpPkt->m_add_value; pmask.m_pkt_cast_size = cast_size; pmask.m_flowv_cast_size = op_size; pmask.m_pkt_offset = lpPkt->m_pkt_offset; @@ -1343,6 +1344,8 @@ void StreamDPOpPktWrMask::wr(uint8_t * flow_var_base, assert(0); } + val+=m_add_value; + /* shift the flow var val */ if (m_shift>0) { val=val<<m_shift; diff --git a/src/stateless/cp/trex_stream_vm.h b/src/stateless/cp/trex_stream_vm.h index 0bd00711..f5d58edd 100644 --- a/src/stateless/cp/trex_stream_vm.h +++ b/src/stateless/cp/trex_stream_vm.h @@ -444,6 +444,7 @@ struct StreamDPOpPktWrMask { uint8_t m_flowv_cast_size; /* 1,2,4 */ uint16_t m_pkt_offset; uint32_t m_mask; + int32_t m_add_value; bool is_big(){ return ( (m_flags &StreamDPOpPktWrMask::MASK_PKT_WR_IS_BIG) == StreamDPOpPktWrMask::MASK_PKT_WR_IS_BIG ?true:false); } @@ -1037,12 +1038,14 @@ public: uint8_t pkt_cast_size, /* valid 1,2,4 */ uint32_t mask, int shift, /* positive is shift left, negetive shift right */ + int32_t add_value = 0, bool is_big_endian = true) : m_flow_var_name(flow_var_name), m_pkt_offset(pkt_offset), m_pkt_cast_size(pkt_cast_size), m_mask(mask), m_shift(shift), + m_add_value(add_value), m_is_big_endian(is_big_endian) {} virtual instruction_type_t get_instruction_type() const { @@ -1057,6 +1060,7 @@ public: m_pkt_cast_size, m_mask, m_shift, + m_add_value, m_is_big_endian); } @@ -1070,7 +1074,8 @@ public: uint8_t m_pkt_cast_size; /* valid 1,2,4 */ uint32_t m_mask; - int m_shift; + int m_shift; + int m_add_value; bool m_is_big_endian; }; |