summaryrefslogtreecommitdiffstats
path: root/src/stateless/rx
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-10-31 11:58:27 +0200
committerimarom <imarom@cisco.com>2016-11-02 15:08:35 +0200
commit0337db2b07c2c054ee5c5ea49cab6cfce5d5a897 (patch)
treeea29f13937170a989697356ed9f777dc4db4670f /src/stateless/rx
parent02ab06b1cf8886be0a6fde5360497b4fa968d3a3 (diff)
draft: RX software feature
Signed-off-by: imarom <imarom@cisco.com>
Diffstat (limited to 'src/stateless/rx')
-rw-r--r--src/stateless/rx/trex_stateless_rx_core.cpp15
-rw-r--r--src/stateless/rx/trex_stateless_rx_core.h16
2 files changed, 30 insertions, 1 deletions
diff --git a/src/stateless/rx/trex_stateless_rx_core.cpp b/src/stateless/rx/trex_stateless_rx_core.cpp
index d162c5b3..e8d5857e 100644
--- a/src/stateless/rx/trex_stateless_rx_core.cpp
+++ b/src/stateless/rx/trex_stateless_rx_core.cpp
@@ -26,6 +26,8 @@
#include "pal/linux/sanb_atomic.h"
#include "trex_stateless_messaging.h"
#include "trex_stateless_rx_core.h"
+#include "trex_stateless.h"
+
void CRFC2544Info::create() {
m_latency.Create();
@@ -128,6 +130,7 @@ bool CRxCoreStateless::periodic_check_for_cp_messages() {
}
+
void CRxCoreStateless::idle_state_loop() {
const int SHORT_DELAY_MS = 2;
const int LONG_DELAY_MS = 50;
@@ -371,6 +374,7 @@ void CRxCoreStateless::flush_rx() {
}// all ports
}
+
int CRxCoreStateless::try_rx() {
rte_mbuf_t * rx_pkts[64];
int i, total_pkts = 0;
@@ -385,7 +389,8 @@ int CRxCoreStateless::try_rx() {
int j;
for (j = 0; j < cnt_p; j++) {
m = rx_pkts[j];
- handle_rx_pkt(lp, m);
+ //handle_rx_pkt(lp, m);
+ m_rx_port_mngr[i].handle_pkt(m);
rte_pktmbuf_free(m);
}
/* commit only if there was work to do ! */
@@ -472,3 +477,11 @@ void CRxCoreStateless::update_cpu_util(){
double CRxCoreStateless::get_cpu_util() {
return m_cpu_cp_u.GetVal();
}
+
+
+void
+CRxCoreStateless::set_rx_filter_mode(uint8_t port_id, rx_filter_mode_e filter_mode) {
+ const TrexPlatformApi *api = get_stateless_obj()->get_platform_api();
+ api->set_rx_filter_mode(port_id, filter_mode);
+}
+
diff --git a/src/stateless/rx/trex_stateless_rx_core.h b/src/stateless/rx/trex_stateless_rx_core.h
index 3f9fb6cc..294c7527 100644
--- a/src/stateless/rx/trex_stateless_rx_core.h
+++ b/src/stateless/rx/trex_stateless_rx_core.h
@@ -25,6 +25,7 @@
#include "os_time.h"
#include "pal/linux/sanb_atomic.h"
#include "utl_cpuu.h"
+#include "trex_stateless_rx_port_mngr.h"
class TrexStatelessCpToRxMsgBase;
@@ -140,6 +141,18 @@ class CRxCoreStateless {
double get_cpu_util();
void update_cpu_util();
+ RxPacketBuffer *get_rx_sw_pkt_buffer(uint8_t port_id) {
+ return m_rx_port_mngr[port_id].get_pkt_buffer();
+ }
+
+ /**
+ * sets the port filter mode
+ *
+ * @author imarom (10/31/2016)
+ *
+ * @param filter_mode
+ */
+ void set_rx_filter_mode(uint8_t port_id, rx_filter_mode_e filter_mode);
private:
void handle_cp_msg(TrexStatelessCpToRxMsgBase *msg);
@@ -147,6 +160,7 @@ class CRxCoreStateless {
void tickle();
void idle_state_loop();
void handle_rx_pkt(CLatencyManagerPerPortStl * lp, rte_mbuf_t * m);
+ void handle_rx_pkt_2(int port_id, rte_mbuf_t *m);
void capture_pkt(rte_mbuf_t *m);
void handle_rx_queue_msgs(uint8_t thread_id, CNodeRing * r);
void flush_rx();
@@ -171,5 +185,7 @@ class CRxCoreStateless {
volatile bool m_ack_start_work_msg __rte_cache_aligned;
CRxCoreErrCntrs m_err_cntrs;
CRFC2544Info m_rfc2544[MAX_FLOW_STATS_PAYLOAD];
+
+ RXPortManager m_rx_port_mngr[TREX_MAX_PORTS];
};
#endif