diff options
author | Ido Barnea <ibarnea@cisco.com> | 2016-09-08 13:22:36 +0300 |
---|---|---|
committer | Ido Barnea <ibarnea@cisco.com> | 2016-09-08 13:22:36 +0300 |
commit | 2261b2337b055e516c0ecf331c49eee8a002b5f0 (patch) | |
tree | f517bba6120024677278f6975e32a60117e385c2 /src | |
parent | e93473c41701ab308b105f2c9f2cbd0886cfeeaf (diff) |
Fix issue of reading RX queue from DP core even when we are not in VM mode
Diffstat (limited to 'src')
-rwxr-xr-x | src/bp_sim.h | 85 | ||||
-rw-r--r-- | src/main_dpdk.cpp | 43 | ||||
-rw-r--r-- | src/stateless/dp/trex_stateless_dp_core.cpp | 2 |
3 files changed, 33 insertions, 97 deletions
diff --git a/src/bp_sim.h b/src/bp_sim.h index b1033496..2790aa95 100755 --- a/src/bp_sim.h +++ b/src/bp_sim.h @@ -345,93 +345,38 @@ void CVirtualIFPerSideStats::Dump(FILE *fd){ m_template.Dump(fd); } - - - - - class CVirtualIF { public: - - - CVirtualIF (){ - m_preview_mode =NULL; + CVirtualIF () { + m_preview_mode = NULL; } - - virtual ~CVirtualIF(){ - } -public: - + virtual ~CVirtualIF() {} virtual int open_file(std::string file_name)=0; - virtual int close_file(void)=0; - - - /** - * send one packet - * - * @param node - * - * @return - */ - virtual int send_node(CGenNode * node) =0; - - - /** - * send one packet to a specific dir. flush all packets - * - * @param dir - * @param m - */ - virtual void send_one_pkt(pkt_dir_t dir, rte_mbuf_t *m){ - } - - - /** - * flush all pending packets into the stream - * - * @return - */ + /* send one packet */ + virtual int send_node(CGenNode * node)=0; + /* send one packet to a specific dir. flush all packets */ + virtual void send_one_pkt(pkt_dir_t dir, rte_mbuf_t *m) {} + /* flush all pending packets into the stream */ virtual int flush_tx_queue(void)=0; - // read all packets from rx_queue on dp core - virtual void flush_dp_rx_queue(void) {}; - // read all packets from rx queue - virtual void flush_rx_queue(void) {}; - - /** - * update the source and destination mac-addr of a given mbuf by global database - * - * @param dir - * @param m - * - * @return - */ - virtual int update_mac_addr_from_global_cfg(pkt_dir_t dir, uint8_t * p)=0; - - /** - * translate a port_id to the correct dir on the core - * - */ + virtual void handle_rx_queue(void) {}; + /* update the source and destination mac-addr of a given mbuf by global database */ + virtual int update_mac_addr_from_global_cfg(pkt_dir_t dir, uint8_t * p)=0; + /* translate port_id to the correct dir on the core */ virtual pkt_dir_t port_id_to_dir(uint8_t port_id) { return (CS_INVALID); } - -public: - - - void set_review_mode(CPreviewMode * preview_mode){ - m_preview_mode =preview_mode; + void set_review_mode(CPreviewMode *preview_mode) { + m_preview_mode = preview_mode; } -protected : +protected: CPreviewMode * m_preview_mode; public: CVirtualIFPerSideStats m_stats[CS_NUM]; }; - - /* global info */ #define CONST_NB_MBUF 16380 diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp index 4b5cedbc..1e31f3df 100644 --- a/src/main_dpdk.cpp +++ b/src/main_dpdk.cpp @@ -1233,10 +1233,6 @@ void CPhyEthIFStats::Dump(FILE *fd){ DP_A(rx_nombuf); } -// only on VM we have rx queues on DP cores -void CPhyEthIF::flush_dp_rx_queue(void) { -} - // Clear the RX queue of an interface, dropping all packets void CPhyEthIF::flush_rx_queue(void){ @@ -1761,11 +1757,9 @@ public: , CCorePerPort * lp_port , CVirtualIFPerSideStats * lp_stats, bool is_const); virtual int send_node(CGenNode * node); - virtual void send_one_pkt(pkt_dir_t dir, rte_mbuf_t *m); - - virtual void flush_dp_rx_queue(void); + virtual void send_one_pkt(pkt_dir_t dir, rte_mbuf_t *m); virtual int flush_tx_queue(void); - __attribute__ ((noinline)) void flush_rx_queue(); + __attribute__ ((noinline)) void handle_rx_queue(); __attribute__ ((noinline)) void handle_slowpath_features(CGenNode *node, rte_mbuf_t *m, uint8_t *p, pkt_dir_t dir); void apply_client_cfg(const ClientCfg *cfg, rte_mbuf_t *m, pkt_dir_t dir, uint8_t *p); @@ -1841,16 +1835,15 @@ bool CCoreEthIF::Create(uint8_t core_id, return (true); } -// On VM, we get the packets in dp core, so just call general flush_rx_queue -void CCoreEthIF::flush_dp_rx_queue(void) { - flush_rx_queue(); -} - // This function is only relevant if we are in VM. In this case, we only have one rx queue. Can't have -// rules to drop queue 0, and pass queue 1 to RX core, like in other cases. +// rules to drop queue 0 packets, and pass queue 1 packets to RX core, like in other cases. // We receive all packets in the same core that transmitted, and handle them to RX core. -void CCoreEthIF::flush_rx_queue(void){ - pkt_dir_t dir ; +void CCoreEthIF::handle_rx_queue(void) { + if ( likely( ! get_vm_one_queue_enable() ) ) { + return; + } + + pkt_dir_t dir; bool is_rx = get_is_rx_thread_enabled(); for (dir=CLIENT_SIDE; dir<CS_NUM; dir++) { CCorePerPort * lp_port=&m_ports[dir]; @@ -1884,21 +1877,19 @@ void CCoreEthIF::flush_rx_queue(void){ int CCoreEthIF::flush_tx_queue(void){ /* flush both sides */ - pkt_dir_t dir ; - for (dir=CLIENT_SIDE; dir<CS_NUM; dir++) { - CCorePerPort * lp_port=&m_ports[dir]; - CVirtualIFPerSideStats * lp_stats= &m_stats[dir]; + pkt_dir_t dir; + for (dir = CLIENT_SIDE; dir < CS_NUM; dir++) { + CCorePerPort * lp_port = &m_ports[dir]; + CVirtualIFPerSideStats * lp_stats = &m_stats[dir]; if ( likely(lp_port->m_len > 0) ) { - send_burst(lp_port,lp_port->m_len,lp_stats); + send_burst(lp_port, lp_port->m_len, lp_stats); lp_port->m_len = 0; } } - if ( unlikely( get_vm_one_queue_enable() ) ){ - /* try drain the rx packets */ - flush_rx_queue(); - } - return (0); + handle_rx_queue(); + + return 0; } void CCoreEthIF::GetCoreCounters(CVirtualIFPerSideStats *stats){ diff --git a/src/stateless/dp/trex_stateless_dp_core.cpp b/src/stateless/dp/trex_stateless_dp_core.cpp index e5679590..53e9bbf4 100644 --- a/src/stateless/dp/trex_stateless_dp_core.cpp +++ b/src/stateless/dp/trex_stateless_dp_core.cpp @@ -672,7 +672,7 @@ TrexStatelessDpCore::idle_state_loop() { while (m_state == STATE_IDLE) { m_core->tickle(); - m_core->m_node_gen.m_v_if->flush_dp_rx_queue(); + m_core->m_node_gen.m_v_if->handle_rx_queue(); bool had_msg = periodic_check_for_cp_messages(); if (had_msg) { counter = 0; |