summaryrefslogtreecommitdiffstats
path: root/src/stateless/dp
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2015-11-01 10:20:16 +0200
committerimarom <imarom@cisco.com>2015-11-01 10:20:16 +0200
commita1971ec3a7f6cbe0aea1393a57aa17bf44deedac (patch)
tree41c0de4453d8f0cf0176834ca37f8757ecb90b47 /src/stateless/dp
parent9a820782c35c6de79d2e724a48087e8ee62fc72d (diff)
DP stop message now disables only port related nodes
and not all of them
Diffstat (limited to 'src/stateless/dp')
-rw-r--r--src/stateless/dp/trex_stateless_dp_core.cpp24
-rw-r--r--src/stateless/dp/trex_stateless_dp_core.h2
-rw-r--r--src/stateless/dp/trex_stream_node.h5
3 files changed, 22 insertions, 9 deletions
diff --git a/src/stateless/dp/trex_stateless_dp_core.cpp b/src/stateless/dp/trex_stateless_dp_core.cpp
index 9c10504e..fd54256d 100644
--- a/src/stateless/dp/trex_stateless_dp_core.cpp
+++ b/src/stateless/dp/trex_stateless_dp_core.cpp
@@ -89,13 +89,14 @@ TrexStatelessDpCore::add_cont_stream(double pps, const uint8_t *pkt, uint16_t pk
/* set the packet as a readonly */
node->set_cache_mbuf(m);
- m_state = TrexStatelessDpCore::STATE_TRANSMITTING;
-
/* keep track */
m_active_nodes.push_back(node);
/* schedule */
m_core->m_node_gen.add_node((CGenNode *)node);
+
+ m_state = TrexStatelessDpCore::STATE_TRANSMITTING;
+
}
void
@@ -106,16 +107,27 @@ TrexStatelessDpCore::start_traffic(TrexStreamsCompiledObj *obj) {
}
void
-TrexStatelessDpCore::stop_traffic() {
+TrexStatelessDpCore::stop_traffic(uint8_t port_id) {
/* we cannot remove nodes not from the top of the queue so
for every active node - make sure next time
the scheduler invokes it, it will be free */
for (auto node : m_active_nodes) {
- node->m_is_stream_active = 0;
+ if (node->m_port_id == port_id) {
+ node->m_is_stream_active = 0;
+ }
}
- m_active_nodes.clear();
- m_state = STATE_IDLE;
+ /* remove all the non active nodes */
+ auto pred = std::remove_if(m_active_nodes.begin(),
+ m_active_nodes.end(),
+ [](CGenNodeStateless *node) { return (!node->m_is_stream_active); });
+
+ m_active_nodes.erase(pred, m_active_nodes.end());
+
+ if (m_active_nodes.size() == 0) {
+ m_state = STATE_IDLE;
+ }
+
}
/**
diff --git a/src/stateless/dp/trex_stateless_dp_core.h b/src/stateless/dp/trex_stateless_dp_core.h
index fa3c5b22..b71431ad 100644
--- a/src/stateless/dp/trex_stateless_dp_core.h
+++ b/src/stateless/dp/trex_stateless_dp_core.h
@@ -64,7 +64,7 @@ public:
* stop all traffic for this core
*
*/
- void stop_traffic();
+ void stop_traffic(uint8_t port_id);
/**
* check for and handle messages from CP
diff --git a/src/stateless/dp/trex_stream_node.h b/src/stateless/dp/trex_stream_node.h
index 49481a5c..92b428ab 100644
--- a/src/stateless/dp/trex_stream_node.h
+++ b/src/stateless/dp/trex_stream_node.h
@@ -34,9 +34,10 @@ private:
double m_next_time_offset;
uint8_t m_is_stream_active;
+ uint8_t m_port_id;
/* pad to match the size of CGenNode */
- uint8_t m_pad_end[39];
+ uint8_t m_pad_end[87];
public:
@@ -97,7 +98,7 @@ public:
}
-} __rte_cache_aligned; ;
+} __rte_cache_aligned;
static_assert(sizeof(CGenNodeStateless) == sizeof(CGenNode), "sizeof(CGenNodeStateless) != sizeof(CGenNode)");