Fixes for v2.21 --software mode issues
authorIdo Barnea <[email protected]>
Thu, 16 Mar 2017 14:35:42 +0000 (16:35 +0200)
committerIdo Barnea <[email protected]>
Thu, 16 Mar 2017 14:38:28 +0000 (16:38 +0200)
Signed-off-by: Ido Barnea <[email protected]>
src/bp_sim.h
src/main_dpdk.cpp
src/platform_cfg.cpp
src/pre_test.cpp
src/stateless/rx/trex_stateless_rx_core.cpp

index d8f620e..fd4e662 100755 (executable)
@@ -1388,7 +1388,7 @@ static inline bool get_is_rx_filter_enable(){
     uint32_t latency_rate=CGlobalInfo::m_options.m_latency_rate;
     return ( ( get_is_rx_check_mode() || CGlobalInfo::is_learn_mode() || latency_rate != 0
                || get_is_stateless()) &&  ((CGlobalInfo::get_queues_mode() != CGlobalInfo::Q_MODE_RSS)
-                                           || (CGlobalInfo::get_queues_mode() != CGlobalInfo::Q_MODE_ONE_QUEUE))
+                                           && (CGlobalInfo::get_queues_mode() != CGlobalInfo::Q_MODE_ONE_QUEUE))
              ?true:false );
 }
 static inline uint16_t get_rx_check_hops() {
index ecd1ca9..3e149ee 100644 (file)
@@ -185,9 +185,16 @@ public:
     virtual int set_rcv_all(CPhyEthIF * _if, bool set_on)=0;
     virtual TRexPortAttr * create_port_attr(uint8_t port_id) = 0;
 
+    virtual rte_mempool_t * get_rx_mem_pool(int socket_id) {
+        return CGlobalInfo::m_mem_pool[socket_id].m_mbuf_pool_9k;
+    }
     virtual void get_dpdk_drv_params(CTrexDpdkParams &p) {
         p.rx_data_q_num = 1;
-        p.rx_drop_q_num = 1;
+        if (CGlobalInfo::get_queues_mode() == CGlobalInfo::Q_MODE_ONE_QUEUE) {
+            p.rx_drop_q_num = 0;
+        } else {
+            p.rx_drop_q_num = 1;
+        }
         p.rx_desc_num_data_q = RX_DESC_NUM_DATA_Q;
         p.rx_desc_num_drop_q = RX_DESC_NUM_DROP_Q;
         p.tx_desc_num = TX_DESC_NUM;
@@ -256,7 +263,10 @@ public:
         p.rx_desc_num_drop_q = RX_DESC_NUM_DROP_Q;
         p.tx_desc_num = TX_DESC_NUM;
     }
-
+    virtual rte_mempool_t * get_rx_mem_pool(int socket_id) {
+        // In VMs there is usually less memory available
+        return CGlobalInfo::m_mem_pool[socket_id].m_mbuf_pool_2048;
+    }
     virtual void update_configuration(port_cfg_t * cfg);
     virtual int configure_rx_filter_rules(CPhyEthIF * _if);
     virtual int stop_queue(CPhyEthIF * _if, uint16_t q_num);
@@ -867,7 +877,7 @@ static int usage(){
     printf(" -s                         : Single core. Run only one data path core. For debug \n");
     printf(" --send-debug-pkt <proto>   : Do not run traffic generator. Just send debug packet and dump receive queues \n");
     printf("    Supported protocols are 1 for icmp, 2 for UDP, 3 for TCP, 4 for ARP, 5 for 9K UDP \n");
-    printf(" --software                 : Do not configure any hardare rules. In this mode we used 1 core, and one RX queue and one TX queue per port\n");
+    printf(" --software                 : Do not configure any hardware rules. In this mode we use 1 core, and one RX queue and one TX queue per port\n");
     printf(" -v <verbosity level>       : The higher the value, print more debug information \n");
     printf(" --vlan                     : Relevant only for stateless mode with Intel 82599 10G NIC \n");
     printf("                              When configuring flow stat and latency per stream rules, assume all streams uses VLAN \n");
@@ -5114,7 +5124,7 @@ void CPhyEthIF::conf_queues() {
             // Only 1 rx queue, so use it for everything
             g_trex.m_rx_core_tx_q_id = 0;
             rx_queue_setup(0, dpdk_p.rx_desc_num_data_q, socket_id, &g_trex.m_port_cfg.m_rx_conf,
-                           CGlobalInfo::m_mem_pool[socket_id].m_mbuf_pool_2048);
+                           get_ex_drv()->get_rx_mem_pool(socket_id));
             set_rx_queue(0);
         } else {
             // no drop q. Many rcv queues. RSS mode.
index 92b4e7e..8a2a948 100755 (executable)
@@ -257,6 +257,8 @@ void operator >> (const YAML::Node& node, CMacYamlInfo & mac_info) {
     }
     if (! utl_yaml_read_uint16(node, "vlan", mac_info.m_vlan)) {
         mac_info.m_vlan = 0;
+    } else {
+        mac_info.m_vlan &= 0x0fff; // we only care about the vlan ID
     }
 }
 
index a72b7e8..9316d37 100644 (file)
@@ -211,6 +211,9 @@ void CPretestOnePortInfo::send_arp_req_all() {
         if (verbose >= 3) {
             fprintf(stdout, "TX ARP request on port %d - " , m_port_id);
             (*it)->dump(stdout, "");
+            if (verbose >= 7) {
+                utl_DumpBuffer(stdout, p, rte_pktmbuf_pkt_len(m[0]), 0);
+            }
         }
 
         num_sent = rte_eth_tx_burst(m_port_id, 0, m, 1);
@@ -387,7 +390,7 @@ bool CPretest::is_arp(const uint8_t *p, uint16_t pkt_size, ArpHdr *&arp, uint16_
         if (m_ether->getVlanProtocol() != EthernetHeader::Protocol::ARP) {
             return false;
         } else {
-            vlan_tag = m_ether->getVlanTag();
+            vlan_tag = m_ether->getVlanTag() & 0xfff;
             arp = (ArpHdr *)(p + 18);
         }
     }
@@ -428,6 +431,8 @@ int CPretest::handle_rx(int port_id, int queue_id) {
                                 , ip_to_str(ntohl(arp->m_arp_sip)).c_str()
                                 , ip_to_str(ntohl(arp->m_arp_tip)).c_str()
                                 , vlan_tag);
+                        if (verbose >= 7)
+                            utl_DumpBuffer(stdout, p, rte_pktmbuf_pkt_len(m), 0);
                     }
                     // is this request for our IP?
                     COneIPv4Info *src_addr;
index 016b719..30458b3 100644 (file)
@@ -175,7 +175,7 @@ void CRxCoreStateless::hot_state_loop() {
  * 
  */
 void CRxCoreStateless::cold_state_loop() {
-    const uint32_t COLD_LIMIT_ITER = 1000;
+    const uint32_t COLD_LIMIT_ITER = 10000000;
     const uint32_t COLD_SLEEP_MS  = 10;
 
     int counter = 0;