summaryrefslogtreecommitdiffstats
path: root/src/stateless
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2016-12-11 19:06:13 +0200
committerYaroslav Brustinov <ybrustin@cisco.com>2016-12-19 11:23:46 +0200
commite4c8e44b0842093ce2a245e863a8db7f4c2ae9ff (patch)
treef1c92ff366088eb5250d56d22058cb6db7f41aeb /src/stateless
parent057a1ec1e70584f3598e9980bb44f70f73065bac (diff)
add min_ipg to push_pcaps
Change-Id: I353f8903c40963517fd2fed721cc0671d9f6dc4b Signed-off-by: Yaroslav Brustinov <ybrustin@cisco.com>
Diffstat (limited to 'src/stateless')
-rw-r--r--src/stateless/cp/trex_stateless_port.cpp2
-rw-r--r--src/stateless/cp/trex_stateless_port.h1
-rw-r--r--src/stateless/dp/trex_stateless_dp_core.cpp9
-rw-r--r--src/stateless/dp/trex_stateless_dp_core.h2
-rw-r--r--src/stateless/dp/trex_stream_node.h6
-rw-r--r--src/stateless/messaging/trex_stateless_messaging.cpp2
-rw-r--r--src/stateless/messaging/trex_stateless_messaging.h3
7 files changed, 21 insertions, 4 deletions
diff --git a/src/stateless/cp/trex_stateless_port.cpp b/src/stateless/cp/trex_stateless_port.cpp
index 3a4db196..97f60dd6 100644
--- a/src/stateless/cp/trex_stateless_port.cpp
+++ b/src/stateless/cp/trex_stateless_port.cpp
@@ -511,6 +511,7 @@ TrexStatelessPort::update_traffic(const TrexPortMultiplier &mul, bool force) {
void
TrexStatelessPort::push_remote(const std::string &pcap_filename,
double ipg_usec,
+ double min_ipg_sec,
double speedup,
uint32_t count,
double duration,
@@ -550,6 +551,7 @@ TrexStatelessPort::push_remote(const std::string &pcap_filename,
m_pending_async_stop_event,
pcap_filename,
ipg_usec,
+ min_ipg_sec,
speedup,
count,
duration,
diff --git a/src/stateless/cp/trex_stateless_port.h b/src/stateless/cp/trex_stateless_port.h
index 317f4f70..404e1355 100644
--- a/src/stateless/cp/trex_stateless_port.h
+++ b/src/stateless/cp/trex_stateless_port.h
@@ -221,6 +221,7 @@ public:
*/
void push_remote(const std::string &pcap_filename,
double ipg_usec,
+ double min_ipg_sec,
double speedup,
uint32_t count,
double duration,
diff --git a/src/stateless/dp/trex_stateless_dp_core.cpp b/src/stateless/dp/trex_stateless_dp_core.cpp
index 485e8533..6f9376c2 100644
--- a/src/stateless/dp/trex_stateless_dp_core.cpp
+++ b/src/stateless/dp/trex_stateless_dp_core.cpp
@@ -478,6 +478,7 @@ bool TrexStatelessDpPerPort::pause_traffic(uint8_t port_id){
bool TrexStatelessDpPerPort::push_pcap(uint8_t port_id,
const std::string &pcap_filename,
double ipg_usec,
+ double min_ipg_sec,
double speedup,
uint32_t count,
bool is_dual) {
@@ -508,6 +509,7 @@ bool TrexStatelessDpPerPort::push_pcap(uint8_t port_id,
slave_mac_addr,
pcap_filename,
ipg_usec,
+ min_ipg_sec,
speedup,
count,
is_dual);
@@ -1169,6 +1171,7 @@ TrexStatelessDpCore::push_pcap(uint8_t port_id,
int event_id,
const std::string &pcap_filename,
double ipg_usec,
+ double m_min_ipg_sec,
double speedup,
uint32_t count,
double duration,
@@ -1179,7 +1182,7 @@ TrexStatelessDpCore::push_pcap(uint8_t port_id,
lp_port->set_event_id(event_id);
/* delegate the command to the port */
- bool rc = lp_port->push_pcap(port_id, pcap_filename, ipg_usec, speedup, count, is_dual);
+ bool rc = lp_port->push_pcap(port_id, pcap_filename, ipg_usec, m_min_ipg_sec, speedup, count, is_dual);
if (!rc) {
/* report back that we stopped */
CNodeRing *ring = CMsgIns::Ins()->getCpDp()->getRingDpToCp(m_core->m_thread_id);
@@ -1263,6 +1266,7 @@ bool CGenNodePCAP::create(uint8_t port_id,
const uint8_t *slave_mac_addr,
const std::string &pcap_filename,
double ipg_usec,
+ double min_ipg_sec,
double speedup,
uint32_t count,
bool is_dual) {
@@ -1275,13 +1279,14 @@ bool CGenNodePCAP::create(uint8_t port_id,
m_count = count;
m_is_dual = is_dual;
m_dir = dir;
+ m_min_ipg_sec = min_ipg_sec;
/* mark this node as slow path */
set_slow_path(true);
if (ipg_usec != -1) {
/* fixed IPG */
- m_ipg_sec = usec_to_sec(ipg_usec / speedup);
+ m_ipg_sec = std::max(min_ipg_sec, usec_to_sec(ipg_usec / speedup));
m_speedup = 0;
} else {
/* packet IPG */
diff --git a/src/stateless/dp/trex_stateless_dp_core.h b/src/stateless/dp/trex_stateless_dp_core.h
index b386daf7..e880a6eb 100644
--- a/src/stateless/dp/trex_stateless_dp_core.h
+++ b/src/stateless/dp/trex_stateless_dp_core.h
@@ -74,6 +74,7 @@ public:
bool push_pcap(uint8_t port_id,
const std::string &pcap_filename,
double ipg_usec,
+ double min_ipg_sec,
double speedup,
uint32_t count,
bool is_dual);
@@ -183,6 +184,7 @@ public:
int event_id,
const std::string &pcap_filename,
double ipg_usec,
+ double min_ipg_sec,
double speedup,
uint32_t count,
double duration,
diff --git a/src/stateless/dp/trex_stream_node.h b/src/stateless/dp/trex_stream_node.h
index dda3113a..bc7be057 100644
--- a/src/stateless/dp/trex_stream_node.h
+++ b/src/stateless/dp/trex_stream_node.h
@@ -468,6 +468,7 @@ public:
const uint8_t *slave_mac_addr,
const std::string &pcap_filename,
double ipg_usec,
+ double min_ipg_sec,
double speedup,
uint32_t count,
bool is_dual);
@@ -536,7 +537,7 @@ public:
if (m_ipg_sec != -1) {
return m_ipg_sec;
} else {
- return ((m_raw_packet->get_time() - m_last_pkt_time) / m_speedup);
+ return (std::max(m_min_ipg_sec, (m_raw_packet->get_time() - m_last_pkt_time) / m_speedup));
}
}
@@ -632,6 +633,7 @@ private:
double m_last_pkt_time;
double m_speedup;
double m_ipg_sec;
+ double m_min_ipg_sec;
uint32_t m_count;
double m_next_time_offset; /* in sec */
@@ -644,7 +646,7 @@ private:
bool m_is_dual;
/* pad to match the size of CGenNode */
- uint8_t m_pad_end[19];
+ uint8_t m_pad_end[11];
} __rte_cache_aligned;
diff --git a/src/stateless/messaging/trex_stateless_messaging.cpp b/src/stateless/messaging/trex_stateless_messaging.cpp
index 2b8e93bb..aeb1e677 100644
--- a/src/stateless/messaging/trex_stateless_messaging.cpp
+++ b/src/stateless/messaging/trex_stateless_messaging.cpp
@@ -191,6 +191,7 @@ TrexStatelessDpPushPCAP::handle(TrexStatelessDpCore *dp_core) {
m_event_id,
m_pcap_filename,
m_ipg_usec,
+ m_min_ipg_sec,
m_speedup,
m_count,
m_duration,
@@ -204,6 +205,7 @@ TrexStatelessDpPushPCAP::clone() {
m_event_id,
m_pcap_filename,
m_ipg_usec,
+ m_min_ipg_sec,
m_speedup,
m_count,
m_duration,
diff --git a/src/stateless/messaging/trex_stateless_messaging.h b/src/stateless/messaging/trex_stateless_messaging.h
index dbdd9b56..72b92d11 100644
--- a/src/stateless/messaging/trex_stateless_messaging.h
+++ b/src/stateless/messaging/trex_stateless_messaging.h
@@ -313,6 +313,7 @@ public:
int event_id,
const std::string &pcap_filename,
double ipg_usec,
+ double min_ipg_sec,
double speedup,
uint32_t count,
double duration,
@@ -321,6 +322,7 @@ public:
m_port_id = port_id;
m_event_id = event_id;
m_ipg_usec = ipg_usec;
+ m_min_ipg_sec = min_ipg_sec;
m_speedup = speedup;
m_count = count;
m_duration = duration;
@@ -335,6 +337,7 @@ private:
std::string m_pcap_filename;
int m_event_id;
double m_ipg_usec;
+ double m_min_ipg_sec;
double m_speedup;
double m_duration;
uint32_t m_count;