summaryrefslogtreecommitdiffstats
path: root/src/flow_stat.cpp
diff options
context:
space:
mode:
authorIdo Barnea <ibarnea@cisco.com>2016-09-08 12:04:59 +0300
committerIdo Barnea <ibarnea@cisco.com>2016-09-13 11:54:20 +0300
commit58f1ee52761a489322036f111793ddd8e85e197a (patch)
tree0381145a5b44e685c94a9723f6d75e3cfe924004 /src/flow_stat.cpp
parent34a6b9050f9179e8000e54b0b3c07f054322c5a2 (diff)
APIs and functions in preparation for receive all mode. XL710/i350 mode toggling work.
Diffstat (limited to 'src/flow_stat.cpp')
-rw-r--r--src/flow_stat.cpp37
1 files changed, 35 insertions, 2 deletions
diff --git a/src/flow_stat.cpp b/src/flow_stat.cpp
index 58ff65a4..84be590f 100644
--- a/src/flow_stat.cpp
+++ b/src/flow_stat.cpp
@@ -583,6 +583,11 @@ int CFlowStatRuleMgr::add_stream_internal(TrexStream * stream, bool do_action) {
switch(rule_type) {
case TrexPlatformApi::IF_STAT_IPV4_ID:
uint16_t l3_proto;
+
+ if (m_mode == FLOW_STAT_MODE_PASS_ALL) {
+ throw TrexFStatEx("Can not add flow stat stream in 'receive all' mode", TrexException::T_FLOW_STAT_BAD_RULE_TYPE_FOR_MODE);
+ }
+
if (m_parser->get_l3_proto(l3_proto) < 0) {
throw TrexFStatEx("Failed determining l3 proto for packet", TrexException::T_FLOW_STAT_FAILED_FIND_L3);
}
@@ -594,8 +599,8 @@ int CFlowStatRuleMgr::add_stream_internal(TrexStream * stream, bool do_action) {
// throws exception if there is error
if (do_action) {
- uint8_t ipv6_next_h = l4_proto; //??? just for now
- m_user_id_map.add_stream(stream->m_rx_check.m_pg_id, l3_proto, l4_proto, ipv6_next_h);
+ // passing 0 in ipv6_next_h. This is not used currently in stateless.
+ m_user_id_map.add_stream(stream->m_rx_check.m_pg_id, l3_proto, l4_proto, 0);
}
break;
case TrexPlatformApi::IF_STAT_PAYLOAD:
@@ -930,6 +935,34 @@ int CFlowStatRuleMgr::get_active_pgids(flow_stat_active_t &result) {
return 0;
}
+int CFlowStatRuleMgr::set_mode(enum flow_stat_mode_e mode) {
+ if ( ! m_user_id_map.is_empty() )
+ return -1;
+
+ if (! m_api ) {
+ create();
+ }
+
+ switch (mode) {
+ case FLOW_STAT_MODE_PASS_ALL:
+ delete m_parser;
+ m_parser = new CPassAllParser;
+ break;
+ case FLOW_STAT_MODE_NORMAL:
+ delete m_parser;
+ m_parser = m_api->get_flow_stat_parser();
+ assert(m_parser);
+ break;
+ default:
+ return -1;
+
+ }
+
+ m_mode = mode;
+
+ return 0;
+}
+
extern bool rx_should_stop;
void CFlowStatRuleMgr::send_start_stop_msg_to_rx(bool is_start) {
TrexStatelessCpToRxMsgBase *msg;