Fix debug packet test to work with mlnx and vic cards
authorIdo Barnea <[email protected]>
Sun, 4 Dec 2016 16:28:32 +0000 (18:28 +0200)
committerIdo Barnea <[email protected]>
Sun, 4 Dec 2016 16:28:48 +0000 (18:28 +0200)
Signed-off-by: Ido Barnea <[email protected]>
src/debug.cpp
src/pkt_gen.cpp
src/pkt_gen.h

index d0b7cf1..e272424 100644 (file)
@@ -142,7 +142,7 @@ rte_mbuf_t *CTrexDebug::create_test_pkt(int ip_ver, uint16_t l4_proto, uint8_t t
 
     pkt = CTestPktGen::create_test_pkt(l3_type, l4_proto, ttl, ip_id, flags, 1000, pkt_size);
 
-    /* DEBUG print the packet 
+    /* DEBUG print the packet
     utl_k12_pkt_format(stdout,pkt,  pkt_size) ;
     */
 
@@ -370,6 +370,7 @@ int CTrexDebug::verify_hw_rules(bool recv_all) {
             case STL:
                 if ( CGlobalInfo::m_options.is_stateless() ) {
                     exp_q = MAIN_DPDK_RX_Q;
+                    pkt_flags |= DPF_TOS_1;
                 } else {
                     exp_q = MAIN_DPDK_DATA_Q;
                 }
@@ -379,6 +380,7 @@ int CTrexDebug::verify_hw_rules(bool recv_all) {
                     exp_q = MAIN_DPDK_DATA_Q;
                 } else {
                     exp_q = MAIN_DPDK_RX_Q;
+                    pkt_flags |= DPF_TOS_1;
                 }
                 break;
             default:
index 45e3a29..656b1b0 100644 (file)
@@ -222,7 +222,7 @@ char *CTestPktGen::create_test_pkt(uint16_t l3_type, uint16_t l4_proto, uint8_t
     switch(l3_type) {
     case EthernetHeader::Protocol::IP:
         ip->setTimeToLive(ttl);
-        if (ttl==TTL_RESERVE_DUPLICATE || ttl==(TTL_RESERVE_DUPLICATE-1)) {
+        if (flags & DPF_TOS_1) {
             ip->setTOS(TOS_TTL_RESERVE_DUPLICATE);
         }else{
             ip->setTOS(0x2);
@@ -232,11 +232,11 @@ char *CTestPktGen::create_test_pkt(uint16_t l3_type, uint16_t l4_proto, uint8_t
         break;
     case EthernetHeader::Protocol::IPv6:
         ipv6->setHopLimit(ttl);
-        if (ttl==TTL_RESERVE_DUPLICATE || ttl==(TTL_RESERVE_DUPLICATE-1)) {
+        if (flags & DPF_TOS_1) {
             ipv6->setTrafficClass(TOS_TTL_RESERVE_DUPLICATE);
         }else{
             ipv6->setTrafficClass(0x2);
-        } 
+        }
 
         break;
     }
index 309e02b..8dcba62 100644 (file)
@@ -37,7 +37,8 @@ enum {
 enum {
     DPF_VLAN = 0x1,
     DPF_QINQ = 0X2,
-    DPF_RXCHECK = 0x4
+    DPF_RXCHECK = 0x4,
+    DPF_TOS_1 = 0x8,
 };
 
 class CTestPktGen {