take care of extra Ethernet FCS bytes handed to software in e1000
authorIdo Barnea <[email protected]>
Thu, 1 Dec 2016 08:19:01 +0000 (10:19 +0200)
committerIdo Barnea <[email protected]>
Sun, 4 Dec 2016 09:24:28 +0000 (11:24 +0200)
Signed-off-by: Ido Barnea <[email protected]>
src/main_dpdk.cpp
src/stateless/rx/trex_stateless_rx_core.cpp
src/stateless/rx/trex_stateless_rx_core.h

index 095052e..add2e70 100644 (file)
@@ -168,6 +168,7 @@ public:
     virtual CFlowStatParser *get_flow_stat_parser();
     virtual int set_rcv_all(CPhyEthIF * _if, bool set_on)=0;
     virtual TRexPortAttr * create_port_attr(uint8_t port_id) = 0;
+    virtual uint8_t get_num_crc_fix_bytes() {return 0;}
 
     /* Does this NIC type support automatic packet dropping in case of a link down?
        in case it is supported the packets will be dropped, else there would be a back pressure to tx queues
@@ -277,6 +278,18 @@ public:
     virtual int set_rcv_all(CPhyEthIF * _if, bool set_on) {return 0;}
 };
 
+class CTRexExtendedDriverBaseE1000 : public CTRexExtendedDriverBase1GVm {
+    CTRexExtendedDriverBaseE1000() {
+        // E1000 driver is only relevant in VM in our case
+        CGlobalInfo::m_options.preview.set_vm_one_queue_enable(true);
+    }
+public:
+    static CTRexExtendedDriverBase * create() {
+        return ( new CTRexExtendedDriverBaseE1000() );
+    }
+    // e1000 driver handing us packets with ethernet CRC, so we need to chop them
+    virtual uint8_t get_num_crc_fix_bytes() {return 4;}
+};
 
 class CTRexExtendedDriverBase10G : public CTRexExtendedDriverBase {
 public:
@@ -573,7 +586,7 @@ private:
 
 
         /* virtual devices */
-        register_driver(std::string("rte_em_pmd"),CTRexExtendedDriverBase1GVm::create);
+        register_driver(std::string("rte_em_pmd"),CTRexExtendedDriverBaseE1000::create);
         register_driver(std::string("rte_vmxnet3_pmd"),CTRexExtendedDriverBase1GVm::create);
         register_driver(std::string("rte_virtio_pmd"),CTRexExtendedDriverBase1GVm::create);
 
@@ -3526,6 +3539,7 @@ void CGlobalTRex::rx_sl_configure(void) {
     int i;
 
     rx_sl_cfg.m_max_ports = m_max_ports;
+    rx_sl_cfg.m_num_crc_fix_bytes = get_ex_drv()->get_num_crc_fix_bytes();
 
     if ( get_vm_one_queue_enable() ) {
         /* vm mode, indirect queues  */
index 50dc04f..df5e8e8 100644 (file)
@@ -69,6 +69,7 @@ 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();
 
@@ -231,6 +232,8 @@ void CRxCoreStateless::capture_pkt(rte_mbuf_t *m) {
 
 }
 
+#if 0
+//??????? remove
 // In VM setup, handle packets coming as messages from DP cores.
 void CRxCoreStateless::handle_rx_queue_msgs(uint8_t thread_id, CNodeRing * r) {
     while ( true ) {
@@ -269,14 +272,11 @@ void CRxCoreStateless::handle_rx_queue_msgs(uint8_t thread_id, CNodeRing * r) {
 }
 
 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;
-
 }
 
 
index 52196e6..900abf2 100644 (file)
 
 class TrexStatelessCpToRxMsgBase;
 
+<<<<<<< HEAD
 /**
  * RFC 2544 implementation
  * 
  */
+=======
+class CCPortLatencyStl {
+ public:
+    void reset();
+
+ public:
+    rx_per_flow_t m_rx_pg_stat[MAX_FLOW_STATS];
+    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();
@@ -173,6 +206,8 @@ 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;