mlx5 add TOS marker for mlx5 type of driver
authorHanoh Haim <[email protected]>
Thu, 10 Nov 2016 20:17:45 +0000 (22:17 +0200)
committerHanoh Haim <[email protected]>
Fri, 11 Nov 2016 10:22:51 +0000 (12:22 +0200)
Signed-off-by: Hanoh Haim <[email protected]>
15 files changed:
scripts/exp/dns_ipv6_rxcheck-ex.erf
scripts/exp/dns_ipv6_rxcheck.erf
scripts/exp/dns_rxcheck-ex.erf
scripts/exp/dns_rxcheck.erf
scripts/exp/ipv6-0-ex.erf
scripts/exp/ipv6-0.erf
scripts/exp/ipv6_vlan-0-ex.erf
scripts/exp/ipv6_vlan-0.erf
scripts/exp/rtsp_short1_ipv6_rxcheck-ex.erf
scripts/exp/rtsp_short1_ipv6_rxcheck.erf
scripts/exp/rtsp_short1_rxcheck-ex.erf
scripts/exp/rtsp_short1_rxcheck.erf
src/bp_sim.cpp
src/bp_sim.h
src/rx_check.cpp

index ebf9519..3984c0e 100755 (executable)
Binary files a/scripts/exp/dns_ipv6_rxcheck-ex.erf and b/scripts/exp/dns_ipv6_rxcheck-ex.erf differ
index ebf9519..3984c0e 100644 (file)
Binary files a/scripts/exp/dns_ipv6_rxcheck.erf and b/scripts/exp/dns_ipv6_rxcheck.erf differ
index 21a610a..a6135f3 100755 (executable)
Binary files a/scripts/exp/dns_rxcheck-ex.erf and b/scripts/exp/dns_rxcheck-ex.erf differ
index 21a610a..a6135f3 100644 (file)
Binary files a/scripts/exp/dns_rxcheck.erf and b/scripts/exp/dns_rxcheck.erf differ
index 21e0eab..1e10285 100755 (executable)
Binary files a/scripts/exp/ipv6-0-ex.erf and b/scripts/exp/ipv6-0-ex.erf differ
index 21e0eab..1e10285 100644 (file)
Binary files a/scripts/exp/ipv6-0.erf and b/scripts/exp/ipv6-0.erf differ
index b97d760..f7c8283 100755 (executable)
Binary files a/scripts/exp/ipv6_vlan-0-ex.erf and b/scripts/exp/ipv6_vlan-0-ex.erf differ
index b97d760..f7c8283 100644 (file)
Binary files a/scripts/exp/ipv6_vlan-0.erf and b/scripts/exp/ipv6_vlan-0.erf differ
index 06ac648..a35e9f4 100755 (executable)
Binary files a/scripts/exp/rtsp_short1_ipv6_rxcheck-ex.erf and b/scripts/exp/rtsp_short1_ipv6_rxcheck-ex.erf differ
index 06ac648..a35e9f4 100644 (file)
Binary files a/scripts/exp/rtsp_short1_ipv6_rxcheck.erf and b/scripts/exp/rtsp_short1_ipv6_rxcheck.erf differ
index cd120df..cfc3726 100755 (executable)
Binary files a/scripts/exp/rtsp_short1_rxcheck-ex.erf and b/scripts/exp/rtsp_short1_rxcheck-ex.erf differ
index cd120df..cfc3726 100644 (file)
Binary files a/scripts/exp/rtsp_short1_rxcheck.erf and b/scripts/exp/rtsp_short1_rxcheck.erf differ
index 3373c36..9056041 100755 (executable)
@@ -1675,7 +1675,8 @@ void CFlowPktInfo::do_generate_new_mbuf_rxcheck(rte_mbuf_t * m,
         IPv6Header * ipv6=(IPv6Header *)(mp1 + 14);
         uint8_t save_header= ipv6->getNextHdr();
         ipv6->setNextHdr(RX_CHECK_V6_OPT_TYPE);
-        ipv6->setHopLimit(TTL_RESERVE_DUPLICATE);
+         ipv6->setHopLimit(TTL_RESERVE_DUPLICATE);
+        ipv6->setTrafficClass(ipv6->getTrafficClass()|TOS_TTL_RESERVE_DUPLICATE);
         ipv6->setPayloadLen( ipv6->getPayloadLen() +
                                   sizeof(CRx_check_header));
         rxhdr->m_option_type = save_header;
@@ -1685,6 +1686,8 @@ void CFlowPktInfo::do_generate_new_mbuf_rxcheck(rte_mbuf_t * m,
         ipv4->setHeaderLength(current_opt_len+opt_len);
         ipv4->setTotalLength(ipv4->getTotalLength()+opt_len);
         ipv4->setTimeToLive(TTL_RESERVE_DUPLICATE);
+        ipv4->setTOS(ipv4->getTOS()|TOS_TTL_RESERVE_DUPLICATE);
+
         rxhdr->m_option_type = RX_CHECK_V4_OPT_TYPE;
         rxhdr->m_option_len = RX_CHECK_V4_OPT_LEN;
     }
@@ -2155,6 +2158,7 @@ void CCapFileFlowInfo::update_info(){
             lp = GetPacket(1);
             assert(lp);
             lp->m_pkt_indication.setTTL(TTL_RESERVE_DUPLICATE);
+            lp->m_pkt_indication.setTOSReserve();
         }
     }
 
@@ -2241,6 +2245,9 @@ enum CCapFileFlowInfo::load_cap_file_err CCapFileFlowInfo::load_cap_file(std::st
                         pkt_indication.setTTL(TTL_RESERVE_DUPLICATE-4);
                 }
 
+                pkt_indication.clearTOSReserve();
+
+
                 // Validation for first packet in flow
                 if (is_fif) {
                     lpflow->flow_id = m_total_flows;
index e3dab2a..c292103 100755 (executable)
@@ -2688,6 +2688,26 @@ public:
             return (0);
         }
     }
+
+
+    void  setTOSReserve(){
+        BP_ASSERT(l3.m_ipv4);
+        if (is_ipv6()) {
+            l3.m_ipv6->setTrafficClass(l3.m_ipv6->getTrafficClass() | TOS_TTL_RESERVE_DUPLICATE );
+        }else{
+            l3.m_ipv4->setTOS(l3.m_ipv4->getTOS()| TOS_TTL_RESERVE_DUPLICATE );
+        }
+    }
+
+    void  clearTOSReserve(){
+        BP_ASSERT(l3.m_ipv4);
+        if (is_ipv6()) {
+            l3.m_ipv6->setTrafficClass(l3.m_ipv6->getTrafficClass()& (~TOS_TTL_RESERVE_DUPLICATE) );
+        }else{
+            l3.m_ipv4->setTOS(l3.m_ipv4->getTOS() & (~TOS_TTL_RESERVE_DUPLICATE) );
+        }
+    }
+
     uint8_t getTTL(){
         BP_ASSERT(l3.m_ipv4);
         if (is_ipv6()) {
@@ -3060,7 +3080,7 @@ inline void CFlowPktInfo::update_pkt_info(char *p,
                 printf(" %.3f : DP :  learn packet !\n",now_sec());
 #endif
                 ipv4->setTimeToLive(TTL_RESERVE_DUPLICATE);
-                ipv4->setTOS(0x3);
+                ipv4->setTOS(ipv4->getTOS()|TOS_TTL_RESERVE_DUPLICATE); 
 
 
                 /* first ipv4 option add the info in case of learn packet, usualy only the first packet */
index bfaa4dd..d7eeced 100755 (executable)
@@ -255,7 +255,9 @@ bool RxCheckManager::Create(){
 
 
 void RxCheckManager::handle_packet(CRx_check_header * rxh){
-    //rxh->dump(stdout);
+  //    m_stats.Dump(stdout);
+  //rxh->dump(stdout);
+
     m_stats.m_total_rx++;
     if ( rxh->m_magic != RX_CHECK_MAGIC ){
         m_stats.m_err_no_magic++;