diff options
author | Hanoh Haim <hhaim@cisco.com> | 2016-09-29 16:47:41 +0300 |
---|---|---|
committer | Hanoh Haim <hhaim@cisco.com> | 2016-09-29 16:50:29 +0300 |
commit | 8a881fcefc44d705df417a9ee0c70284124981d1 (patch) | |
tree | aaac4da5072d4c9631d537752fde802b30705a73 /src/stateless | |
parent | 567fe4bc797c01e23e93c2d342fa5590d3f7b96e (diff) |
minor fix to hw_cs inst
Diffstat (limited to 'src/stateless')
-rw-r--r-- | src/stateless/cp/trex_stream_vm.cpp | 6 | ||||
-rw-r--r-- | src/stateless/cp/trex_stream_vm.h | 7 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/stateless/cp/trex_stream_vm.cpp b/src/stateless/cp/trex_stream_vm.cpp index a9935759..96ba8934 100644 --- a/src/stateless/cp/trex_stream_vm.cpp +++ b/src/stateless/cp/trex_stream_vm.cpp @@ -644,9 +644,9 @@ void StreamVm::build_program(){ err(ss.str()); } - if (lpFix->m_l3_len < 8 ) { + if (lpFix->m_l3_len < 20 ) { std::stringstream ss; - ss << "instruction id '" << ins_id << "' fix hw offset l3 " << lpFix->m_l3_len << " is lower than 8 "; + ss << "instruction id '" << ins_id << "' fix hw offset l3 " << lpFix->m_l3_len << " is lower than 20 "; err(ss.str()); } @@ -673,7 +673,7 @@ void StreamVm::build_program(){ } }else{ if (ipv4->getVersion() ==6) { - /* pass */ + packet_is_ipv4=false; }else{ std::stringstream ss; ss << "instruction id '" << ins_id << "' fix hw command should work on IPv4 or IPv6 " ; diff --git a/src/stateless/cp/trex_stream_vm.h b/src/stateless/cp/trex_stream_vm.h index c9f459d3..f3c35013 100644 --- a/src/stateless/cp/trex_stream_vm.h +++ b/src/stateless/cp/trex_stream_vm.h @@ -558,20 +558,21 @@ public: UDPHeader * udp; } u; - u.tcp = (TCPHeader*)(pkt_base+m_l3_len); + u.tcp = (TCPHeader*)(pkt_base+m_l2_len+m_l3_len); /* set the mbuf info */ m->l2_len = m_l2_len; m->l3_len = m_l3_len; m->ol_flags |= m_ol_flags; if (m_ol_flags & PKT_TX_IPV4 ){ /* splitting to 4 instructions didn't improve performance .. */ ipv4->ClearCheckSum(); - if (m_ol_flags & PKT_TX_TCP_CKSUM ){ + if ((m_ol_flags & PKT_TX_L4_MASK) == PKT_TX_TCP_CKSUM ){ u.tcp->setChecksumRaw(rte_ipv4_phdr_cksum((struct ipv4_hdr *)ipv4,m_ol_flags)); }else{ u.udp->setChecksumRaw(rte_ipv4_phdr_cksum((struct ipv4_hdr *)ipv4,m_ol_flags)); } + }else{ - if (m_ol_flags & PKT_TX_TCP_CKSUM ){ + if ((m_ol_flags & PKT_TX_L4_MASK) == PKT_TX_TCP_CKSUM ){ u.tcp->setChecksumRaw(rte_ipv6_phdr_cksum((struct ipv6_hdr *)ipv4,m_ol_flags)); }else{ u.udp->setChecksumRaw(rte_ipv6_phdr_cksum((struct ipv6_hdr *)ipv4,m_ol_flags)); |