minor fix to hw_cs inst
authorHanoh Haim <[email protected]>
Thu, 29 Sep 2016 13:47:41 +0000 (16:47 +0300)
committerHanoh Haim <[email protected]>
Thu, 29 Sep 2016 13:50:29 +0000 (16:50 +0300)
src/stateless/cp/trex_stream_vm.cpp
src/stateless/cp/trex_stream_vm.h

index a993575..96ba893 100644 (file)
@@ -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  "  ;
index c9f459d..f3c3501 100644 (file)
@@ -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));