diff options
author | imarom <imarom@cisco.com> | 2016-11-02 15:06:46 +0200 |
---|---|---|
committer | imarom <imarom@cisco.com> | 2016-11-02 15:08:35 +0200 |
commit | 0ed685e077e8533ffe6d96f5d1fefcdd42626763 (patch) | |
tree | 0458183b8fab84b8d4e9d136804d78699394b2c1 /src/stateless/rx/trex_stateless_rx_port_mngr.cpp | |
parent | 7eeb57c4656ee37d93f093d33d1921c8b9c3dc76 (diff) |
RX software features
Signed-off-by: imarom <imarom@cisco.com>
Diffstat (limited to 'src/stateless/rx/trex_stateless_rx_port_mngr.cpp')
-rw-r--r-- | src/stateless/rx/trex_stateless_rx_port_mngr.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/stateless/rx/trex_stateless_rx_port_mngr.cpp b/src/stateless/rx/trex_stateless_rx_port_mngr.cpp index fdf41471..5b10eebf 100644 --- a/src/stateless/rx/trex_stateless_rx_port_mngr.cpp +++ b/src/stateless/rx/trex_stateless_rx_port_mngr.cpp @@ -196,3 +196,53 @@ RXPacketRecorder::handle_pkt(const rte_mbuf_t *m) { stop(); } } + + +void RXPortManager::handle_pkt(const rte_mbuf_t *m) { + + /* handle features */ + + if (is_feature_set(LATENCY)) { + m_latency.handle_pkt(m); + } + + if (is_feature_set(RECORD)) { + m_recorder.handle_pkt(m); + } + + if (is_feature_set(QUEUE)) { + m_pkt_buffer->push(new RxPacket(m)); + } +} + + +int RXPortManager::process_all_pending_pkts(bool flush_rx) { + + rte_mbuf_t *rx_pkts[64]; + + /* try to read 64 packets clean up the queue */ + uint16_t cnt_p = m_io->rx_burst(rx_pkts, 64); + if (cnt_p == 0) { + return cnt_p; + } + + + m_cpu_dp_u->start_work1(); + + for (int j = 0; j < cnt_p; j++) { + rte_mbuf_t *m = rx_pkts[j]; + + if (!flush_rx) { + handle_pkt(m); + } + + rte_pktmbuf_free(m); + } + + /* commit only if there was work to do ! */ + m_cpu_dp_u->commit1(); + + + return cnt_p; +} + |