Merge stateless rx core changes with Itay's changes
authorIdo Barnea <[email protected]>
Thu, 1 Dec 2016 15:52:44 +0000 (17:52 +0200)
committerIdo Barnea <[email protected]>
Sun, 4 Dec 2016 09:24:28 +0000 (11:24 +0200)
Signed-off-by: Ido Barnea <[email protected]>
src/flow_stat.cpp
src/stateless/rx/trex_stateless_rx_core.cpp
src/stateless/rx/trex_stateless_rx_core.h
src/stateless/rx/trex_stateless_rx_defs.h
src/stateless/rx/trex_stateless_rx_port_mngr.cpp
src/stateless/rx/trex_stateless_rx_port_mngr.h

index e1e2f01..92cbca6 100644 (file)
@@ -461,6 +461,7 @@ CFlowStatRuleMgr::CFlowStatRuleMgr() {
     memset(m_rx_cant_count_err, 0, sizeof(m_rx_cant_count_err));
     memset(m_tx_cant_count_err, 0, sizeof(m_tx_cant_count_err));
     m_num_ports = 0; // need to call create to init
+    m_mode = FLOW_STAT_MODE_NORMAL;
 }
 
 CFlowStatRuleMgr::~CFlowStatRuleMgr() {
index d6dcd3f..f2061bf 100644 (file)
@@ -69,7 +69,6 @@ void CRFC2544Info::export_data(rfc2544_info_t_ &obj) {
 void CRxCoreStateless::create(const CRxSlCfg &cfg) {
     m_capture = false;
     m_max_ports = cfg.m_max_ports;
-    m_num_crc_fix_bytes = cfg.m_num_crc_fix_bytes;
 
     CMessagingManager * cp_rx = CMsgIns::Ins()->getCpRx();
 
@@ -88,7 +87,8 @@ void CRxCoreStateless::create(const CRxSlCfg &cfg) {
         m_rx_port_mngr[i].create(cfg.m_ports[i],
                                  m_rfc2544,
                                  &m_err_cntrs,
-                                 &m_cpu_dp_u);
+                                 &m_cpu_dp_u,
+                                 cfg.m_num_crc_fix_bytes);
     }
 }
 
@@ -232,6 +232,17 @@ void CRxCoreStateless::capture_pkt(rte_mbuf_t *m) {
 
 }
 
+int CRxCoreStateless::process_all_pending_pkts(bool flush_rx) {
+
+    int total_pkts = 0;
+    for (int i = 0; i < m_max_ports; i++) {
+        total_pkts += m_rx_port_mngr[i].process_all_pending_pkts(flush_rx);
+    }
+
+    return total_pkts;
+
+}
+
 void CRxCoreStateless::reset_rx_stats(uint8_t port_id) {
     m_rx_port_mngr[port_id].clear_stats();
 }
index 900abf2..cd16bb8 100644 (file)
 
 class TrexStatelessCpToRxMsgBase;
 
-<<<<<<< HEAD
-/**
- * RFC 2544 implementation
- * 
- */
-=======
 class CCPortLatencyStl {
  public:
     void reset();
@@ -44,28 +38,6 @@ class CCPortLatencyStl {
     rx_per_flow_t m_rx_pg_stat_payload[MAX_FLOW_STATS_PAYLOAD];
 };
 
-class CLatencyManagerPerPortStl {
-public:
-     CCPortLatencyStl     m_port;
-     CPortLatencyHWBase * m_io;
-};
-
-class CRxSlCfg {
- public:
-    CRxSlCfg (){
-        m_max_ports = 0;
-        m_cps = 0.0;
-        m_num_crc_fix_bytes = 0;
-    }
-
- public:
-    uint32_t             m_max_ports;
-    double               m_cps;
-    CPortLatencyHWBase * m_ports[TREX_MAX_PORTS];
-    uint8_t              m_num_crc_fix_bytes;
-};
-
->>>>>>> f4198c7... take care of extra Ethernet FCS bytes handed to software in e1000
 class CRFC2544Info {
  public:
     void create();
@@ -206,8 +178,6 @@ class CRxCoreStateless {
  private:
     TrexMonitor      m_monitor;
     uint32_t         m_max_ports;
-    // compensate for the fact that hardware send us packets without Ethernet CRC, and we report with it
-    uint8_t m_num_crc_fix_bytes;
     bool             m_capture;
     state_e          m_state;
     CNodeRing       *m_ring_from_cp;
index 3e5d2c3..aefcc13 100644 (file)
@@ -27,6 +27,7 @@
 
 class CPortLatencyHWBase;
 
+
 /**
  * general SL cfg
  * 
@@ -36,12 +37,14 @@ class CRxSlCfg {
     CRxSlCfg (){
         m_max_ports = 0;
         m_cps = 0.0;
+        m_num_crc_fix_bytes = 0;
     }
 
  public:
     uint32_t             m_max_ports;
     double               m_cps;
     CPortLatencyHWBase * m_ports[TREX_MAX_PORTS];
+    uint8_t              m_num_crc_fix_bytes;
 };
 
 /**
index bd8650a..afc6827 100644 (file)
@@ -416,9 +416,11 @@ void
 RXPortManager::create(CPortLatencyHWBase *io,
                       CRFC2544Info *rfc2544,
                       CRxCoreErrCntrs *err_cntrs,
-                      CCpuUtlDp *cpu_util) {
+                      CCpuUtlDp *cpu_util,
+                      uint8_t crc_bytes_num) {
     m_io = io;
     m_cpu_dp_u = cpu_util;
+    m_num_crc_fix_bytes = crc_bytes_num;
     
     /* init features */
     m_latency.create(rfc2544, err_cntrs);
@@ -459,6 +461,11 @@ int RXPortManager::process_all_pending_pkts(bool flush_rx) {
         rte_mbuf_t *m = rx_pkts[j];
 
         if (!flush_rx) {
+            // patch relevant only for e1000 driver
+            if (m_num_crc_fix_bytes) {
+                rte_pktmbuf_trim(m, m_num_crc_fix_bytes);
+            }
+
             handle_pkt(m);
         }
 
index 6af90f8..c049cb5 100644 (file)
@@ -276,7 +276,8 @@ public:
     void create(CPortLatencyHWBase *io,
                 CRFC2544Info *rfc2544,
                 CRxCoreErrCntrs *err_cntrs,
-                CCpuUtlDp *cpu_util);
+                CCpuUtlDp *cpu_util,
+                uint8_t crc_bytes_num);
 
     void clear_stats() {
         m_latency.reset_stats();
@@ -402,7 +403,8 @@ private:
     RXLatency                    m_latency;
     RXPacketRecorder             m_recorder;
     RXQueue                      m_queue;
-    
+    // compensate for the fact that hardware send us packets without Ethernet CRC, and we report with it
+    uint8_t m_num_crc_fix_bytes;
     
     CCpuUtlDp                   *m_cpu_dp_u;
     CPortLatencyHWBase          *m_io;