bug found by valgrind
authorimarom <[email protected]>
Thu, 1 Dec 2016 13:24:58 +0000 (15:24 +0200)
committerimarom <[email protected]>
Thu, 1 Dec 2016 13:30:29 +0000 (15:30 +0200)
also an issue with 40G deleting no exisiting rules with recv_all

Signed-off-by: imarom <[email protected]>
scripts/t-rex-64-valgrind
src/flow_stat.cpp
src/main_dpdk.cpp
src/rpc-server/commands/trex_rpc_cmd_general.cpp

index a770895..5ac2bec 100755 (executable)
@@ -31,6 +31,7 @@ export LD_LIBRARY_PATH=$PWD:$PWD/dumy_libs
 fi
             
 export VALGRIND_LIB=/auto/proj-pcube-b/apps/PL-b/tools/valgrind-dpdk/lib/valgrind
+export VALGRIND_BIN="/auto/proj-pcube-b/apps/PL-b/tools/valgrind-dpdk/bin/valgrind --leak-check=full"
 
 if [ -t 0 ] && [ -t 1 ]; then
     export is_tty=true
@@ -41,17 +42,18 @@ fi
 
 # if we have a new core run optimized trex 
 if  grep -q avx /proc/cpuinfo ; then
-    /auto/proj-pcube-b/apps/PL-b/tools/valgrind-dpdk/bin/valgrind ./_t-rex-64 $INPUT_ARGS
+    $VALGRIND_BIN ./_t-rex-64 $INPUT_ARGS
     RESULT=$?
     if [ $RESULT -eq 132 ]; then
         echo " WARNING this program is optimized for the new Intel processors.  "
         echo " try the ./t-rex-64-o application that should work for any Intel processor but might be slower. "
         echo " try to run t-rex-64-o .. "
-        /auto/proj-pcube-b/apps/PL-b/tools/valgrind-dpdk/bin/valgrind ./_t-rex-64-o $INPUT_ARGS
+
+        $VALGRIND_BIN ./_t-rex-64 $INPUT_ARGS
         RESULT=$?
     fi
 else
-        /auto/proj-pcube-b/apps/PL-b/tools/valgrind-dpdk/bin/valgrind ./_t-rex-64-o $INPUT_ARGS
+        $VALGRIND_BIN ./_t-rex-64 $INPUT_ARGS
         RESULT=$?
 fi
 
index ba125df..e1e2f01 100644 (file)
@@ -804,7 +804,6 @@ int CFlowStatRuleMgr::start_stream(TrexStream * stream) {
     if (m_num_started_streams == 0) {
         
         send_start_stop_msg_to_rx(true); // First transmitting stream. Rx core should start reading packets;
-        assert(m_rx_core->is_working());
         
         //also good time to zero global counters
         memset(m_rx_cant_count_err, 0, sizeof(m_rx_cant_count_err));
@@ -981,7 +980,10 @@ void CFlowStatRuleMgr::send_start_stop_msg_to_rx(bool is_start) {
         m_ring_to_rx->Enqueue((CGenNode *)msg);
         
         /* hold until message was ack'ed - otherwise we might lose packets */
-        reply.wait_for_reply();
+        if (m_rx_core) {
+            reply.wait_for_reply();
+            assert(m_rx_core->is_working());
+        }
         
     } else {
         msg = new TrexStatelessRxDisableLatency();
index c02d676..2fa5af8 100644 (file)
@@ -132,7 +132,7 @@ static char global_master_id_str[10];
 
 class CTRexExtendedDriverBase {
 public:
-
+    
     /* by default NIC driver adds CRC */
     virtual bool has_crc_added() {
         return true;
@@ -7341,6 +7341,10 @@ TRexPortAttr *TrexDpdkPlatformApi::getPortAttrObj(uint8_t port_id) const {
 
 int DpdkTRexPortAttr::set_rx_filter_mode(rx_filter_mode_e rx_filter_mode) {
 
+    if (rx_filter_mode == m_rx_filter_mode) {
+        return (0);
+    }
+    
     CPhyEthIF *_if = &g_trex.m_ports[m_port_id];
     bool recv_all = (rx_filter_mode == RX_FILTER_MODE_ALL);
     int rc = CTRexExtendedDriverDb::Ins()->get_drv()->set_rcv_all(_if, recv_all);
index 107b7b4..3d541fe 100644 (file)
@@ -820,6 +820,8 @@ TrexRpcCmdGetRxQueuePkts::_run(const Json::Value &params, Json::Value &result) {
         const RXPacketBuffer *pkt_buffer = port->get_rx_queue_pkts();
         if (pkt_buffer) {
             result["result"]["pkts"] = pkt_buffer->to_json();
+            delete pkt_buffer;
+            
         } else {
             result["result"]["pkts"] = Json::arrayValue;
         }