summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2015-11-09 11:05:34 +0200
committerHanoh Haim <hhaim@cisco.com>2015-11-09 11:05:34 +0200
commitc6d2cb0554ebc39142fb433040a968714a7ec24f (patch)
tree3594c3e602069c08ed835a1cef0a5e5334fca96d /src
parentcb98f7938f3ea85c57de66c6f6919accdcc16fb4 (diff)
parent67bcc46be09049d2ca65c0af2aa6a2fe0821eb04 (diff)
Merge branch intg1
Diffstat (limited to 'src')
-rwxr-xr-xsrc/bp_gtest.cpp17
-rwxr-xr-xsrc/bp_sim.cpp151
-rwxr-xr-xsrc/bp_sim.h16
-rwxr-xr-xsrc/common/Network/Packet/IPHeader.cpp2
-rwxr-xr-xsrc/common/Network/Packet/TCPHeader.cpp2
-rwxr-xr-xsrc/common/c_common.h2
-rw-r--r--src/gtest/trex_stateless_gtest.cpp6
-rwxr-xr-xsrc/gtest/tuple_gen_test.cpp8
-rwxr-xr-xsrc/main.cpp23
-rwxr-xr-xsrc/main_dpdk.cpp114
-rwxr-xr-xsrc/nat_check.cpp4
-rwxr-xr-xsrc/platform_cfg.cpp6
-rw-r--r--src/rpc-server/commands/trex_rpc_cmd_stream.cpp8
-rwxr-xr-xsrc/rx_check.cpp24
-rwxr-xr-xsrc/rx_check_header.cpp10
-rw-r--r--src/stateless/cp/trex_stateless_port.cpp11
-rw-r--r--src/stateless/dp/trex_stateless_dp_core.cpp17
-rw-r--r--src/stateless/dp/trex_stateless_dp_core.h13
-rw-r--r--src/stub/trex_stateless_stub.cpp3
-rwxr-xr-xsrc/time_histogram.cpp6
-rwxr-xr-xsrc/tuple_gen.h3
-rwxr-xr-xsrc/utl_json.cpp4
-rwxr-xr-xsrc/utl_yaml.cpp2
23 files changed, 266 insertions, 186 deletions
diff --git a/src/bp_gtest.cpp b/src/bp_gtest.cpp
index e3145f2a..03ab74bd 100755
--- a/src/bp_gtest.cpp
+++ b/src/bp_gtest.cpp
@@ -66,7 +66,7 @@ int test_priorty_queue(void){
int i;
for (i=0; i<10; i++) {
node = new CGenNode();
- printf(" +%x \n",node);
+ printf(" +%p \n",node);
node->m_flow_id = 10-i;
node->m_pkt_info = (CFlowPktInfo *)(uintptr_t)i;
node->m_time = (double)i+0.1;
@@ -74,7 +74,7 @@ int test_priorty_queue(void){
}
while (!p_queue.empty()) {
node = p_queue.top();
- printf(" -->%x \n",node);
+ printf(" -->%p \n",node);
//node->Dump(stdout);
p_queue.pop();
//delete node;
@@ -159,7 +159,7 @@ public:
bool init(void){
- uint16 * ports;
+ uint16 * ports = NULL;
CTupleBase tuple;
CErfIF erf_vif;
@@ -663,6 +663,7 @@ TEST_F(basic, latency1) {
po->preview.setFileWrite(true);
uint8_t mac[]={0,0,0,1,0,0};
+ (void)mac;
CErfIF erf_vif;
erf_vif.set_review_mode(&CGlobalInfo::m_options.preview);
@@ -714,6 +715,7 @@ TEST_F(basic, latency2) {
uint8_t mac[]={0,0,0,1,0,0};
+ (void)mac;
mac[0]=0;
mac[1]=0;
@@ -728,14 +730,13 @@ TEST_F(basic, latency2) {
int i;
for (i=0; i<100; i++) {
- uint8_t *p;
rte_mbuf_t * m=l.generate_pkt(0);
- p=rte_pktmbuf_mtod(m, uint8_t*);
+ rte_pktmbuf_mtod(m, uint8_t*);
//utl_DumpBuffer(stdout,p,l.get_pkt_size(),0);
port0.update_packet(m);
- p=rte_pktmbuf_mtod(m, uint8_t*);
+ rte_pktmbuf_mtod(m, uint8_t*);
//utl_DumpBuffer(stdout,p,l.get_pkt_size(),0);
//printf("offset is : %d \n",l.get_payload_offset());
@@ -763,6 +764,7 @@ TEST_F(basic, latency3) {
uint8_t mac[]={0,0,0,1,0,0};
+ (void)mac;
mac[0]=0;
@@ -850,6 +852,7 @@ public:
TEST_F(basic, latency4) {
uint8_t mac[]={0,0,0,1,0,0};
+ (void)mac;
mac[0]=0;
mac[1]=0;
@@ -2125,7 +2128,7 @@ class CRxCheck1 : public CRxCheckCallbackBase {
public:
virtual void handle_packet(rte_mbuf_t * m){
- char *mp=rte_pktmbuf_mtod(m, char*);
+ rte_pktmbuf_mtod(m, char*);
CRx_check_header * rx_p;
rte_mbuf_t * m2 = m->next;
rx_p=(CRx_check_header *)rte_pktmbuf_mtod(m2, char*);
diff --git a/src/bp_sim.cpp b/src/bp_sim.cpp
index 842bc478..0c0cbb75 100755
--- a/src/bp_sim.cpp
+++ b/src/bp_sim.cpp
@@ -72,11 +72,11 @@ void CGlobalMemory::Dump(FILE *fd){
c_size=c_size*2;
}
- fprintf(fd," %-40s : %lu \n",names[i].c_str(),m_mbuf[i]);
+ fprintf(fd," %-40s : %lu \n",names[i].c_str(),(ulong)m_mbuf[i]);
}
c_total += (m_mbuf[MBUF_DP_FLOWS] * sizeof(CGenNode));
- fprintf(fd," %-40s : %lu \n","get_each_core_dp_flows",get_each_core_dp_flows());
+ fprintf(fd," %-40s : %lu \n","get_each_core_dp_flows",(ulong)get_each_core_dp_flows());
fprintf(fd," %-40s : %s \n","Total memory",double_to_human_str(c_total,"bytes",KBYE_1024).c_str() );
}
@@ -240,7 +240,7 @@ bool CPlatformSocketInfoConfig::init(){
}
if ( m_thread_phy_to_virtual[phy_thread] ){
- printf("ERROR physical thread %d defined twice %d \n",phy_thread);
+ printf("ERROR physical thread %d defined twice\n",phy_thread);
exit(1);
}
m_thread_phy_to_virtual[phy_thread]=virt_thread;
@@ -269,7 +269,7 @@ bool CPlatformSocketInfoConfig::init(){
void CPlatformSocketInfoConfig::dump(FILE *fd){
- fprintf(fd," core_mask %x \n",get_cores_mask());
+ fprintf(fd," core_mask %llx \n",(unsigned long long)get_cores_mask());
fprintf(fd," sockets :");
int i;
for (i=0; i<MAX_SOCKETS_SUPPORTED; i++) {
@@ -821,7 +821,6 @@ void CPacketIndication::UpdatePacketPadding(){
void CPacketIndication::RefreshPointers(){
char *pobase=getBasePtr();
- CPacketIndication * obj=this;
m_ether = (EthernetHeader *) (pobase + m_ether_offset);
l3.m_ipv4 = (IPHeader *) (pobase + m_ip_offset);
@@ -1672,7 +1671,6 @@ char * CFlowPktInfo::push_ipv4_option_offline(uint8_t bytes){
void CFlowPktInfo::mask_as_learn(){
- char *p;
CNatOption *lpNat;
if ( m_pkt_indication.is_ipv6() ){
lpNat=(CNatOption *)push_ipv6_option_offline(CNatOption::noOPTION_LEN);
@@ -2266,7 +2264,7 @@ void CCCapFileMemoryUsage::dump(FILE *fd){
int c_total=0;
for (i=0; i<CCCapFileMemoryUsage::MASK_SIZE; i++) {
- fprintf(fd," size_%-7d : %lu \n",c_size,m_buf[i]);
+ fprintf(fd," size_%-7d : %lu \n",c_size, (ulong)m_buf[i]);
c_total +=m_buf[i]*c_size;
c_size = c_size*2;
}
@@ -2441,7 +2439,6 @@ void operator >> (const YAML::Node& node, CFlowYamlInfo & fi) {
if ( node.FindValue("dyn_pyload") ){
- int i;
const YAML::Node& dyn_pyload = node["dyn_pyload"];
for(unsigned i=0;i<dyn_pyload.size();i++) {
CFlowYamlDpPkt fd;
@@ -2840,8 +2837,20 @@ void CFlowStats::DumpHeader(FILE *fd){
void CFlowStats::Dump(FILE *fd){
//"name","cps","f-pkts","f-bytes","Mb/sec","MB/sec","c-flows","PPS","total-Mbytes-duration","errors","flows"
fprintf(fd," %02d, %-40s ,%4.2f,%4.2f, %5.0f , %7.0f ,%7.2f ,%7.2f , %7.2f , %10.0f , %5.0f , %7.0f , %llu , %llu \n",
- m_id,m_name.c_str(),m_cps,get_normal_cps(),
- m_pkt,m_bytes,duration_sec,m_mb_sec,m_mB_sec,m_c_flows,m_pps,m_total_Mbytes,m_errors,m_flows);
+ m_id,
+ m_name.c_str(),
+ m_cps,
+ get_normal_cps(),
+ m_pkt,
+ m_bytes,
+ duration_sec,
+ m_mb_sec,
+ m_mB_sec,
+ m_c_flows,
+ m_pps,
+ m_total_Mbytes,
+ (unsigned long long)m_errors,
+ (unsigned long long)m_flows);
}
bool CFlowGeneratorRecPerThread::Create(CTupleGeneratorSmart * global_gen,
@@ -3046,21 +3055,20 @@ void CGenNode::DumpHeader(FILE *fd){
}
void CGenNode::Dump(FILE *fd){
- fprintf(fd,"%.6f,%llx,%p,%llu,%d,%d,%d,%d,%d,%d,%x,%x,%d\n",m_time,m_flow_id,m_pkt_info,
- m_pkt_info->m_pkt_indication.m_packet->pkt_cnt,
- m_pkt_info->m_pkt_indication.m_packet->pkt_len,
- m_pkt_info->m_pkt_indication.m_desc.getId(),
- (m_pkt_info->m_pkt_indication.m_desc.IsInitSide()?1:0),
- m_pkt_info->m_pkt_indication.m_desc.IsLastPkt(),
+ fprintf(fd,"%.6f,%llx,%p,%llu,%d,%d,%d,%d,%d,%d,%x,%x,%d\n",
+ m_time,
+ (unsigned long long)m_flow_id,
+ m_pkt_info,
+ (unsigned long long)m_pkt_info->m_pkt_indication.m_packet->pkt_cnt,
+ m_pkt_info->m_pkt_indication.m_packet->pkt_len,
+ m_pkt_info->m_pkt_indication.m_desc.getId(),
+ (m_pkt_info->m_pkt_indication.m_desc.IsInitSide()?1:0),
+ m_pkt_info->m_pkt_indication.m_desc.IsLastPkt(),
m_type,
m_thread_id,
m_src_ip,
m_dest_ip,
- m_src_port
-
-
-
- );
+ m_src_port);
}
@@ -3118,7 +3126,7 @@ int CNodeGenerator::close_file(CFlowGenListPerThread * thread){
int CNodeGenerator::update_stats(CGenNode * node){
if ( m_preview_mode.getVMode() >2 ){
- fprintf(stdout," %llu ,",m_cnt);
+ fprintf(stdout," %llu ,", (unsigned long long)m_cnt);
node->Dump(stdout);
m_cnt++;
}
@@ -3203,7 +3211,7 @@ bool CFlowGenListPerThread::Create(uint32_t thread_id,
assert(m_ring_to_rx);
/* create the info required for stateless DP core */
- m_stateless_dp_info = new TrexStatelessDpCore(thread_id, this);
+ m_stateless_dp_info.create(thread_id, this);
return (true);
}
@@ -3353,8 +3361,6 @@ void CFlowGenListPerThread::Delete(){
Clean();
m_cpu_cp_u.Delete();
- delete m_stateless_dp_info;
- m_stateless_dp_info = NULL;
}
@@ -3401,15 +3407,24 @@ int CNodeGenerator::flush_file(dsec_t max_time,
bool done=false;
thread->m_cpu_dp_u.start_work();
- while (!m_p_queue.empty()) {
+
+ /**
+ * if a positive value was given to max time
+ * schedule an exit node
+ */
+ if ( (max_time > 0) && (!always) ) {
+ CGenNode *exit_node = thread->create_node();
+
+ exit_node->m_type = CGenNode::EXIT_SCHED;
+ exit_node->m_time = max_time;
+ add_node(exit_node);
+ }
+
+ while (true) {
+
node = m_p_queue.top();
- n_time = node->m_time+ offset;
+ n_time = node->m_time + offset;
- if (( (n_time) > max_time ) &&
- (always==false) ) {
- /* nothing to do */
- break;
- }
events++;
/*#ifdef VALG
if (events > 1 ) {
@@ -3507,7 +3522,10 @@ int CNodeGenerator::flush_file(dsec_t max_time,
}
}else{
- handle_slow_messages(type,node,thread,always);
+ bool exit_sccheduler = handle_slow_messages(type,node,thread,always);
+ if (exit_sccheduler) {
+ break;
+ }
}
}
}
@@ -3523,10 +3541,14 @@ int CNodeGenerator::flush_file(dsec_t max_time,
return (0);
}
-void CNodeGenerator::handle_slow_messages(uint8_t type,
- CGenNode * node,
- CFlowGenListPerThread * thread,
- bool always){
+bool
+CNodeGenerator::handle_slow_messages(uint8_t type,
+ CGenNode * node,
+ CFlowGenListPerThread * thread,
+ bool always){
+
+ /* should we continue after */
+ bool exit_scheduler = false;
if (unlikely (type == CGenNode::FLOW_DEFER_PORT_RELEASE) ) {
m_p_queue.pop();
@@ -3547,7 +3569,7 @@ void CNodeGenerator::handle_slow_messages(uint8_t type,
m_p_queue.pop();
/* time out, need to free the flow and remove the association , we didn't get convertion yet*/
thread->terminate_nat_flows(node);
- return;
+ return (exit_scheduler);
}else{
flush_one_node_to_file(node);
@@ -3578,21 +3600,28 @@ void CNodeGenerator::handle_slow_messages(uint8_t type,
thread->check_msgs(); /* check messages */
m_v_if->flush_tx_queue(); /* flush pkt each timeout */
- if (always == false) {
+ /* on always (clean queue path) and queue empty - exit */
+ if ( always && (m_p_queue.empty()) ) {
+ thread->free_node(node);
+ exit_scheduler = true;
+ } else {
+ /* schedule for next maintenace */
node->m_time += SYNC_TIME_OUT;
m_p_queue.push(node);
- }else{
- thread->free_node(node);
}
- /* must be the last section of processing */
- } else if ( type == CGenNode::EXIT_SCHED ) {
- remove_all(thread);
+ } else if ( type == CGenNode::EXIT_SCHED ) {
+ m_p_queue.pop();
+ thread->free_node(node);
+ exit_scheduler = true;
+
} else {
printf(" ERROR type is not valid %d \n",type);
assert(0);
}
+
+ return exit_scheduler;
}
@@ -3831,7 +3860,7 @@ void CFlowGenListPerThread::handel_nat_msg(CGenNodeNatInfo * msg){
void CFlowGenListPerThread::check_msgs(void) {
/* inlined for performance */
- m_stateless_dp_info->periodic_check_for_cp_messages();
+ m_stateless_dp_info.periodic_check_for_cp_messages();
if ( likely ( m_ring_from_rx->isEmpty() ) ) {
return;
@@ -3908,7 +3937,7 @@ const uint8_t test_udp_pkt[]={
void CFlowGenListPerThread::start_stateless_daemon(){
m_cur_time_sec = 0;
- m_stateless_dp_info->start();
+ m_stateless_dp_info.start();
}
@@ -4502,9 +4531,12 @@ void CTupleTemplateGenerator::Generate(){
#endif
+static uint32_t get_rand_32(uint32_t MinimumRange,
+ uint32_t MaximumRange) __attribute__ ((unused));
+
+static uint32_t get_rand_32(uint32_t MinimumRange,
+ uint32_t MaximumRange) {
-static uint32_t get_rand_32(uint32_t MinimumRange ,
- uint32_t MaximumRange ){
enum {RANDS_NUM = 2 , RAND_MAX_BITS = 0xf , UNSIGNED_INT_BITS = 0x20 , TWO_BITS_MASK = 0x3};
const double TWO_POWER_32_BITS = 0x10000000 * (double)0x10;
@@ -4737,7 +4769,6 @@ void CCPortLatency::reset(){
static uint8_t nat_is_port_can_send(uint8_t port_id){
- uint8_t offset= ((port_id>>1)<<1);
uint8_t client_index = (port_id %2);
return (client_index ==0 ?1:0);
}
@@ -4859,7 +4890,7 @@ void CCPortLatency::dump_counters_json(std::string & json ){
}
void CCPortLatency::DumpCounters(FILE *fd){
- #define DP_A1(f) if (f) fprintf(fd," %-40s : %llu \n",#f,f)
+ #define DP_A1(f) if (f) fprintf(fd," %-40s : %llu \n",#f, (unsigned long long)f)
fprintf(fd," counter \n");
fprintf(fd," -----------\n");
@@ -4878,7 +4909,7 @@ void CCPortLatency::DumpCounters(FILE *fd){
fprintf(fd," -----------\n");
m_hist.Dump(fd);
- fprintf(fd," %-40s : %llu \n","jitter",get_jitter_usec());
+ fprintf(fd," %-40s : %lu \n","jitter", (ulong)get_jitter_usec());
}
bool CCPortLatency::dump_packet(rte_mbuf_t * m){
@@ -4902,6 +4933,9 @@ bool CCPortLatency::dump_packet(rte_mbuf_t * m){
if ( unlikely( CGlobalInfo::m_options.preview.get_vlan_mode_enable() ) ){
vlan_offset=4;
}
+
+ (void)vlan_offset;
+
// utl_DumpBuffer(stdout,p,pkt_size,0);
return (0);
@@ -4937,9 +4971,7 @@ bool CCPortLatency::check_packet(rte_mbuf_t * m,CRx_check_header * & rx_p){
uint16_t vlan_offset=parser.m_vlan_offset;
uint8_t *p=rte_pktmbuf_mtod(m, uint8_t*);
- rx_p=(CRx_check_header *)0;
- bool managed_by_ip_options=false;
- bool is_rx_check=true;
+ rx_p = (CRx_check_header *)0;
if ( !parser.IsLatencyPkt() ){
@@ -5056,7 +5088,7 @@ void CLatencyManager::Delete(){
static uint8_t swap_port(uint8_t port_id){
uint8_t offset= ((port_id>>1)<<1);
uint8_t client_index = (port_id %2);
- return (offset+client_index^1);
+ return (offset + (client_index ^ 1));
}
@@ -5179,8 +5211,6 @@ void CLatencyManager::run_rx_queue_msgs(uint8_t thread_id,
CGenNodeMsgBase * msg=(CGenNodeMsgBase *)node;
- CGenNodeLatencyPktInfo * msg1=(CGenNodeLatencyPktInfo *)msg;
-
uint8_t msg_type = msg->m_msg_type;
switch (msg_type ) {
case CGenNodeMsgBase::LATENCY_PKT:
@@ -5303,7 +5333,7 @@ void CLatencyManager::start(int iter){
}
if ( iter>0 ){
if ( ( cnt>iter) ){
- printf("stop due iter %d %d \n",iter);
+ printf("stop due iter %d\n",iter);
break;
}
}
@@ -5472,8 +5502,8 @@ void CLatencyManager::DumpRxCheckVerification(FILE *fd,
fprintf(fd," rx_checker is disabled \n");
return;
}
- fprintf(fd," rx_check Tx : %u \n",total_tx_rx_check);
- fprintf(fd," rx_check Rx : %u \n",m_rx_check_manager.getTotalRx() );
+ fprintf(fd," rx_check Tx : %llu \n", (unsigned long long)total_tx_rx_check);
+ fprintf(fd," rx_check Rx : %llu \n", (unsigned long long)m_rx_check_manager.getTotalRx() );
fprintf(fd," rx_check verification :" );
if (m_rx_check_manager.getTotalRx() == total_tx_rx_check) {
fprintf(fd," OK \n" );
@@ -6726,7 +6756,6 @@ bool CSimplePacketParser::Parse(){
EthernetHeader *m_ether = (EthernetHeader *)p;
IPHeader * ipv4=0;
IPv6Header * ipv6=0;
- uint16_t pkt_size=rte_pktmbuf_pkt_len(m);
m_vlan_offset=0;
m_option_offset=0;
diff --git a/src/bp_sim.h b/src/bp_sim.h
index 75958776..36595581 100755
--- a/src/bp_sim.h
+++ b/src/bp_sim.h
@@ -894,6 +894,8 @@ public:
/* number of main active sockets. socket #0 is always used */
virtual socket_id_t max_num_active_sockets()=0;
+ virtual ~CPlatformSocketInfoBase() {}
+
public:
/* which socket to allocate memory to each port */
virtual socket_id_t port_to_socket(port_id_t port)=0;
@@ -1337,8 +1339,8 @@ public:
-#define DP(f) if (f) printf(" %-40s: %llu \n",#f,f)
-#define DP_name(n,f) if (f) printf(" %-40s: %llu \n",n,f)
+#define DP(f) if (f) printf(" %-40s: %llu \n",#f,(unsigned long long)f)
+#define DP_name(n,f) if (f) printf(" %-40s: %llu \n",n,(unsigned long long)f)
#define DP_S(f,f_s) if (f) printf(" %-40s: %s \n",#f,f_s.c_str())
@@ -1901,9 +1903,10 @@ private:
return (m_v_if->send_node(node));
}
int update_stats(CGenNode * node);
- FORCE_NO_INLINE void handle_slow_messages(uint8_t type,
- CGenNode * node,
- CFlowGenListPerThread * thread,
+
+ FORCE_NO_INLINE bool handle_slow_messages(uint8_t type,
+ CGenNode * node,
+ CFlowGenListPerThread * thread,
bool always);
@@ -2379,6 +2382,7 @@ public:
return (uint32_t)((uintptr_t)( ((char *)l3.m_ipv4)-getBasePtr()) );
}else{
BP_ASSERT(0);
+ return (0);
}
}
@@ -3500,7 +3504,7 @@ private:
flow_id_node_t m_flow_id_to_node_lookup;
- TrexStatelessDpCore *m_stateless_dp_info;
+ TrexStatelessDpCore m_stateless_dp_info;
private:
uint8_t m_cacheline_pad[RTE_CACHE_LINE_SIZE][19]; // improve prefech
diff --git a/src/common/Network/Packet/IPHeader.cpp b/src/common/Network/Packet/IPHeader.cpp
index 3b90a1aa..c3363603 100755
--- a/src/common/Network/Packet/IPHeader.cpp
+++ b/src/common/Network/Packet/IPHeader.cpp
@@ -52,7 +52,7 @@ void IPHeader::dump(FILE *fd)
{
fprintf(fd, "\nIPHeader");
fprintf(fd, "\nSource 0x%.8lX, Destination 0x%.8lX, Protocol 0x%.1X",
- getSourceIp(), getDestIp(), getProtocol());
+ (ulong)getSourceIp(), (ulong)getDestIp(), (uint)getProtocol());
fprintf(fd, "\nTTL : %d, Id : 0x%.2X, Ver %d, Header Length %d, Total Length %d",
getTimeToLive(), getId(), getVersion(), getHeaderLength(), getTotalLength());
if(isFragmented())
diff --git a/src/common/Network/Packet/TCPHeader.cpp b/src/common/Network/Packet/TCPHeader.cpp
index bf28db2e..1826cef8 100755
--- a/src/common/Network/Packet/TCPHeader.cpp
+++ b/src/common/Network/Packet/TCPHeader.cpp
@@ -25,7 +25,7 @@ void TCPHeader::dump(FILE *fd)
fprintf(fd, "\nSourcePort 0x%.4X, DestPort 0x%.4X",
getSourcePort(), getDestPort());
fprintf(fd, "\nSeqNum 0x%.8lX, AckNum 0x%.8lX, Window %d",
- getSeqNumber(), getAckNumber(), getWindowSize());
+ (ulong)getSeqNumber(), (ulong)getAckNumber(), getWindowSize());
fprintf(fd, "\nHeader Length : %d, Checksum : 0x%.4X",
getHeaderLength(), getChecksum());
fprintf(fd, "\nFlags : SYN - %d, FIN - %d, ACK - %d, URG - %d, RST - %d, PSH - %d",
diff --git a/src/common/c_common.h b/src/common/c_common.h
index d8320aaa..3e43644f 100755
--- a/src/common/c_common.h
+++ b/src/common/c_common.h
@@ -46,7 +46,7 @@ typedef void* c_pvoid;
#ifdef _DEBUG
#define BP_ASSERT(a) assert(a)
#else
- #define BP_ASSERT(a)
+ #define BP_ASSERT(a) (void (a))
#endif
#endif
diff --git a/src/gtest/trex_stateless_gtest.cpp b/src/gtest/trex_stateless_gtest.cpp
index 0341516c..2bab4dff 100644
--- a/src/gtest/trex_stateless_gtest.cpp
+++ b/src/gtest/trex_stateless_gtest.cpp
@@ -82,7 +82,7 @@ private:
void CTRexDpStreamModeSingleBurst::dump(FILE *fd){
fprintf (fd," pps : %f \n",m_pps);
- fprintf (fd," total_packets : %llu \n",m_total_packets);
+ fprintf (fd," total_packets : %llu \n", (unsigned long long)m_total_packets);
}
@@ -130,9 +130,9 @@ private:
void CTRexDpStreamModeMultiBurst::dump(FILE *fd){
fprintf (fd," pps : %f \n",m_pps);
- fprintf (fd," total_packets : %llu \n",m_pkts_per_burst);
+ fprintf (fd," total_packets : %llu \n", (unsigned long long)m_pkts_per_burst);
fprintf (fd," ibg : %f \n",m_ibg);
- fprintf (fd," num_of_bursts : %llu \n",m_number_of_bursts);
+ fprintf (fd," num_of_bursts : %lu \n", (ulong)m_number_of_bursts);
}
diff --git a/src/gtest/tuple_gen_test.cpp b/src/gtest/tuple_gen_test.cpp
index 8a774e38..f3b9fa1e 100755
--- a/src/gtest/tuple_gen_test.cpp
+++ b/src/gtest/tuple_gen_test.cpp
@@ -161,7 +161,6 @@ TEST(tuple_gen,clientPoolL) {
0,0);
CTupleBase result;
uint32_t result_src;
- uint32_t result_dest;
uint16_t result_port;
for(int i=0;i<10;i++) {
@@ -186,7 +185,6 @@ TEST(tuple_gen,clientPool) {
0,0);
CTupleBase result;
uint32_t result_src;
- uint32_t result_dest;
uint16_t result_port;
for(int i=0;i<10;i++) {
@@ -436,7 +434,6 @@ TEST(tuple_gen,template1) {
template_1.GenerateTuple(result);
uint32_t result_src = result.getClient();
uint32_t result_dest = result.getServer();
- uint16_t result_port = result.getClientPort();
//printf(" %x %x %x \n",result_src,result_dest,result_port);
EXPECT_EQ(result_src, (uint32_t)(0x10000001+i));
EXPECT_EQ(result_dest, (uint32_t)(((0x12121212)) ));
@@ -489,9 +486,6 @@ TEST(tuple_gen,no_free) {
int i;
for (i=0; i<65557; i++) {
template_1.GenerateTuple(result);
- uint32_t result_src = result.getClient();
- uint32_t result_dest = result.getServer();
- uint16_t result_port = result.getClientPort();
}
// should have error
EXPECT_TRUE((gen.getErrorAllocationCounter()>0)?true:false);
@@ -514,8 +508,6 @@ TEST(tuple_gen,try_to_free) {
int i;
for (i=0; i<65557; i++) {
template_1.GenerateTuple(result);
- uint32_t result_src = result.getClient();
- uint32_t result_dest = result.getServer();
uint16_t result_port = result.getClientPort();
gen.FreePort(0,result.getClientId(),result_port);
}
diff --git a/src/main.cpp b/src/main.cpp
index bd64c5a4..df9d8b40 100755
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -214,11 +214,12 @@ void * thread_task(void *info){
char buf[100];
sprintf(buf,"my%d.erf",obj->thread_id);
- volatile int i;
lpt->start_generate_stateful(buf,*obj->preview_info);
lpt->m_node_gen.DumpHist(stdout);
printf("end thread %d \n",obj->thread_id);
}
+
+ return (NULL);
}
@@ -405,8 +406,6 @@ void update_tcp_seq_num(CCapFileFlowInfo * obj,
int i;
for (i=pkt_id+1; i<s; i++) {
- uint32_t seq;
- uint32_t ack;
pkt=obj->GetPacket(i);
tcp=pkt->m_pkt_indication.l4.m_tcp;
@@ -490,7 +489,7 @@ int manipolate_capfile() {
CCapFileFlowInfo flow_info;
flow_info.Create();
- int res=flow_info.load_cap_file("avl/delay_10_rtsp_0.pcap",0,0);
+ flow_info.load_cap_file("avl/delay_10_rtsp_0.pcap",0,0);
change_pkt_len(&flow_info,4-1 ,6);
change_pkt_len(&flow_info,5-1 ,6);
@@ -515,7 +514,7 @@ int manipolate_capfile_sip() {
CCapFileFlowInfo flow_info;
flow_info.Create();
- int res=flow_info.load_cap_file("avl/delay_10_sip_0.pcap",0,0);
+ flow_info.load_cap_file("avl/delay_10_sip_0.pcap",0,0);
change_pkt_len(&flow_info,1-1 ,6+6);
change_pkt_len(&flow_info,2-1 ,6+6);
@@ -532,8 +531,8 @@ int manipolate_capfile_sip1() {
CCapFileFlowInfo flow_info;
flow_info.Create();
- int res=flow_info.load_cap_file("avl/delay_sip_0.pcap",0,0);
- CFlowPktInfo * pkt=flow_info.GetPacket(1);
+ flow_info.load_cap_file("avl/delay_sip_0.pcap",0,0);
+ flow_info.GetPacket(1);
change_pkt_len(&flow_info,1-1 ,6+6+10);
@@ -569,7 +568,7 @@ public:
void CMergeCapFileRec::Dump(FILE *fd,int _id){
- double time;
+ double time = 0.0;
bool stop=GetCurPacket(time);
fprintf (fd," id:%2d stop : %d index:%4d %3.4f \n",_id,stop?1:0,m_index,time);
}
@@ -620,6 +619,8 @@ bool CMergeCapFileRec::Create(std::string cap_file,
m_limit_number_of_packets =0;
m_start_time = pkt->m_packet->get_time() ;
m_offset = offset;
+
+ return (true);
}
@@ -663,12 +664,12 @@ bool CMergeCapFile::run_merge(std::string to_cap_file){
int min_index=0;
double min_time;
- fprintf(stdout," --------------\n",cnt);
+ fprintf(stdout," --------------\n");
fprintf(stdout," pkt : %d \n",cnt);
for (i=0; i<MERGE_CAP_FILES; i++) {
m[i].Dump(stdout,i);
}
- fprintf(stdout," --------------\n",cnt);
+ fprintf(stdout," --------------\n");
bool valid = false;
for (i=0; i<MERGE_CAP_FILES; i++) {
@@ -702,6 +703,8 @@ bool CMergeCapFile::run_merge(std::string to_cap_file){
};
m_results.save_to_erf(to_cap_file,1);
+
+ return (true);
}
diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp
index 648c3b1a..c4ecb97d 100755
--- a/src/main_dpdk.cpp
+++ b/src/main_dpdk.cpp
@@ -688,12 +688,13 @@ static int parse_options(int argc, char *argv[], CParserOption* po, bool first_t
CSimpleOpt args(argc, argv, parser_options);
bool latency_was_set=false;
+ (void)latency_was_set;
+
int a=0;
int node_dump=0;
po->preview.setFileWrite(true);
po->preview.setRealTime(true);
- int res1;
uint32_t tmp_data;
po->m_run_mode = CParserOption::RUN_MODE_INVALID;
@@ -951,9 +952,9 @@ static int parse_options(int argc, char *argv[], CParserOption* po, bool first_t
int main_test(int argc , char * argv[]);
-static const char * default_argv[] = {"xx","-c", "0x7", "-n","2","-b","0000:0b:01.01"};
-static int argv_num = 7;
-
+//static const char * default_argv[] = {"xx","-c", "0x7", "-n","2","-b","0000:0b:01.01"};
+//static int argv_num = 7;
+
#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */
@@ -1137,8 +1138,8 @@ void CPhyEthIFStats::Clear(){
void CPhyEthIFStats::DumpAll(FILE *fd){
- #define DP_A4(f) printf(" %-40s : %llu \n",#f,f)
- #define DP_A(f) if (f) printf(" %-40s : %llu \n",#f,f)
+ #define DP_A4(f) printf(" %-40s : %llu \n",#f, (unsigned long long)f)
+ #define DP_A(f) if (f) printf(" %-40s : %llu \n",#f, (unsigned long long)f)
DP_A4(opackets);
DP_A4(obytes);
DP_A4(ipackets);
@@ -1613,10 +1614,6 @@ void CPhyEthIF::macaddr_get(struct ether_addr *mac_addr){
void CPhyEthIF::get_stats_1g(CPhyEthIFStats *stats){
- int i;
- uint64_t t=0;
-
-
stats->ipackets += pci_reg_read(E1000_GPRC) ;
stats->ibytes += (pci_reg_read(E1000_GORCL) );
@@ -1672,8 +1669,8 @@ void CPhyEthIF::get_stats(CPhyEthIFStats *stats){
void dump_hw_state(FILE *fd,struct ixgbe_hw_stats *hs ){
- #define DP_A1(f) if (hs->f) fprintf(fd," %-40s : %llu \n",#f,hs->f)
- #define DP_A2(f,m) for (i=0;i<m; i++) { if (hs->f[i]) fprintf(fd," %-40s[%d] : %llu \n",#f,i,hs->f[i]); }
+ #define DP_A1(f) if (hs->f) fprintf(fd," %-40s : %llu \n",#f, (unsigned long long)hs->f)
+ #define DP_A2(f,m) for (i=0;i<m; i++) { if (hs->f[i]) fprintf(fd," %-40s[%d] : %llu \n",#f,i, (unsigned long long)hs->f[i]); }
int i;
//for (i=0;i<8; i++) { if (hs->mpc[i]) fprintf(fd," %-40s[%d] : %llu \n","mpc",i,hs->mpc[i]); }
@@ -2100,6 +2097,8 @@ int CCoreEthIF::send_burst(CCorePerPort * lp_port,
rte_pktmbuf_free(m);
}
}
+
+ return (0);
}
@@ -2120,6 +2119,8 @@ int CCoreEthIF::send_pkt(CCorePerPort * lp_port,
len = 0;
}
lp_port->m_len = len;
+
+ return (0);
}
@@ -2549,7 +2550,7 @@ std::string CGlobalStats::get_field(std::string name,float &f){
std::string CGlobalStats::get_field(std::string name,uint64_t &f){
char buff[200];
- sprintf(buff,"\"%s\":%llu,",name.c_str(),f);
+ sprintf(buff,"\"%s\":%llu,",name.c_str(), (unsigned long long)f);
return (std::string(buff));
}
@@ -2561,7 +2562,7 @@ std::string CGlobalStats::get_field_port(int port,std::string name,float &f){
std::string CGlobalStats::get_field_port(int port,std::string name,uint64_t &f){
char buff[200];
- sprintf(buff,"\"%s-%d\":%llu,",name.c_str(),port,f);
+ sprintf(buff,"\"%s-%d\":%llu,",name.c_str(),port, (unsigned long long)f);
return (std::string(buff));
}
@@ -2634,7 +2635,7 @@ void CGlobalStats::DumpAllPorts(FILE *fd){
fprintf (fd," Platform_factor : %2.1f \n",m_platform_factor);
fprintf (fd," Total-Tx : %s ",double_to_human_str(m_tx_bps,"bps",KBYE_1000).c_str());
if ( CGlobalInfo::is_learn_mode() ) {
- fprintf (fd," Nat_time_out : %8llu \n",m_total_nat_time_out);
+ fprintf (fd," Nat_time_out : %8llu \n", (unsigned long long)m_total_nat_time_out);
}else{
fprintf (fd,"\n");
}
@@ -2642,49 +2643,52 @@ void CGlobalStats::DumpAllPorts(FILE *fd){
fprintf (fd," Total-Rx : %s ",double_to_human_str(m_rx_bps,"bps",KBYE_1000).c_str());
if ( CGlobalInfo::is_learn_mode() ) {
- fprintf (fd," Nat_no_fid : %8llu \n",m_total_nat_no_fid);
+ fprintf (fd," Nat_no_fid : %8llu \n", (unsigned long long)m_total_nat_no_fid);
}else{
fprintf (fd,"\n");
}
fprintf (fd," Total-PPS : %s ",double_to_human_str(m_tx_pps,"pps",KBYE_1000).c_str());
if ( CGlobalInfo::is_learn_mode() ) {
- fprintf (fd," Total_nat_active: %8llu \n",m_total_nat_active);
+ fprintf (fd," Total_nat_active: %8llu \n", (unsigned long long)m_total_nat_active);
}else{
fprintf (fd,"\n");
}
fprintf (fd," Total-CPS : %s ",double_to_human_str(m_tx_cps,"cps",KBYE_1000).c_str());
if ( CGlobalInfo::is_learn_mode() ) {
- fprintf (fd," Total_nat_open : %8llu \n",m_total_nat_open);
+ fprintf (fd," Total_nat_open : %8llu \n", (unsigned long long)m_total_nat_open);
}else{
fprintf (fd,"\n");
}
fprintf (fd,"\n");
fprintf (fd," Expected-PPS : %s ",double_to_human_str(m_tx_expected_pps,"pps",KBYE_1000).c_str());
if ( CGlobalInfo::is_learn_verify_mode() ) {
- fprintf (fd," Nat_learn_errors: %8llu \n",m_total_nat_learn_error);
+ fprintf (fd," Nat_learn_errors: %8llu \n", (unsigned long long)m_total_nat_learn_error);
}else{
fprintf (fd,"\n");
}
fprintf (fd," Expected-CPS : %s \n",double_to_human_str(m_tx_expected_cps,"cps",KBYE_1000).c_str());
fprintf (fd," Expected-BPS : %s \n",double_to_human_str(m_tx_expected_bps,"bps",KBYE_1000).c_str());
fprintf (fd,"\n");
- fprintf (fd," Active-flows : %8llu Clients : %8llu Socket-util : %3.4f %% \n",(uint64_t)m_active_flows,m_total_clients,m_socket_util);
+ fprintf (fd," Active-flows : %8llu Clients : %8llu Socket-util : %3.4f %% \n",
+ (unsigned long long)m_active_flows,
+ (unsigned long long)m_total_clients,
+ m_socket_util);
fprintf (fd," Open-flows : %8llu Servers : %8llu Socket : %8llu Socket/Clients : %.1f \n",
- (uint64_t)m_open_flows,
- m_total_servers,
- m_active_sockets,
+ (unsigned long long)m_open_flows,
+ (unsigned long long)m_total_servers,
+ (unsigned long long)m_active_sockets,
(float)m_active_sockets/(float)m_total_clients);
if (m_total_alloc_error) {
- fprintf (fd," Total_alloc_err : %llu \n",(uint64_t)m_total_alloc_error);
+ fprintf (fd," Total_alloc_err : %llu \n", (unsigned long long)m_total_alloc_error);
}
if ( m_total_queue_full ){
- fprintf (fd," Total_queue_full : %llu \n",(uint64_t)m_total_queue_full);
+ fprintf (fd," Total_queue_full : %llu \n", (unsigned long long)m_total_queue_full);
}
if (m_total_queue_drop) {
- fprintf (fd," Total_queue_drop : %llu \n",(uint64_t)m_total_queue_drop);
+ fprintf (fd," Total_queue_drop : %llu \n", (unsigned long long)m_total_queue_drop);
}
//m_template.Dump(fd);
@@ -2708,8 +2712,8 @@ void CGlobalStats::Dump(FILE *fd,DumpFormat mode){
CPerPortStats * lp=&m_port[i];
fprintf(fd,"port : %d \n",(int)i);
fprintf(fd,"------------\n");
- #define GS_DP_A4(f) fprintf(fd," %-40s : %llu \n",#f,lp->f)
- #define GS_DP_A(f) if (lp->f) fprintf(fd," %-40s : %llu \n",#f,lp->f)
+ #define GS_DP_A4(f) fprintf(fd," %-40s : %llu \n",#f, (unsigned long long)lp->f)
+ #define GS_DP_A(f) if (lp->f) fprintf(fd," %-40s : %llu \n",#f, (unsigned long long)lp->f)
GS_DP_A4(opackets);
GS_DP_A4(obytes);
GS_DP_A4(ipackets);
@@ -2998,13 +3002,13 @@ int CGlobalTRex::rcv_send_all(int queue_id){
int CGlobalTRex::test_send(){
int i;
- CPhyEthIF * lp=&m_ports[0];
-
//set_promisc_all(true);
//create_sctp_pkt();
create_udp_pkt();
CRx_check_header rx_check_header;
+ (void)rx_check_header;
+
rx_check_header.m_time_stamp=0x1234567;
rx_check_header.m_option_type=RX_CHECK_V4_OPT_TYPE;
rx_check_header.m_option_len=RX_CHECK_V4_OPT_LEN;
@@ -3078,7 +3082,7 @@ int CGlobalTRex::test_send(){
}*/
#endif
- fprintf(stdout," drop : %llu \n",m_test_drop);
+ fprintf(stdout," drop : %llu \n", (unsigned long long)m_test_drop);
return (0);
}
@@ -3209,6 +3213,8 @@ int CGlobalTRex::set_promisc_all(bool enable){
CPhyEthIF * _if=&m_ports[i];
_if->set_promiscuous(enable);
}
+
+ return (0);
}
@@ -3219,6 +3225,8 @@ int CGlobalTRex::reset_counters(){
CPhyEthIF * _if=&m_ports[i];
_if->stats_clear();
}
+
+ return (0);
}
@@ -3291,6 +3299,8 @@ int CGlobalTRex::ixgbe_configure_mg(void){
m_mg.Create(&mg_cfg);
m_mg.set_mask(CGlobalInfo::m_options.m_latency_mask);
+
+ return (0);
}
@@ -3413,7 +3423,6 @@ int CGlobalTRex::ixgbe_start(void){
*/
int port_offset=0;
- int queue_offset=0;
for (i=0; i<get_cores_tx(); i++) {
int j=(i+1);
int queue_id=((j-1)/get_base_num_cores() ); /* for the first min core queue 0 , then queue 1 etc */
@@ -3440,6 +3449,8 @@ int CGlobalTRex::ixgbe_start(void){
m_cores_vif[i+1]->DumpIfCfg(stdout);
}
fprintf(stdout," -------------------------------\n");
+
+ return (0);
}
@@ -3482,12 +3493,12 @@ bool CGlobalTRex::Create(){
assert( CMsgIns::Ins()->Create(get_cores_tx()) );
if ( sizeof(CGenNodeNatInfo) != sizeof(CGenNode) ) {
- printf("ERROR sizeof(CGenNodeNatInfo) %d != sizeof(CGenNode) %d must be the same size \n",sizeof(CGenNodeNatInfo),sizeof(CGenNode));
+ printf("ERROR sizeof(CGenNodeNatInfo) %lu != sizeof(CGenNode) %lu must be the same size \n",sizeof(CGenNodeNatInfo),sizeof(CGenNode));
assert(0);
}
if ( sizeof(CGenNodeLatencyPktInfo) != sizeof(CGenNode) ) {
- printf("ERROR sizeof(CGenNodeLatencyPktInfo) %d != sizeof(CGenNode) %d must be the same size \n",sizeof(CGenNodeLatencyPktInfo),sizeof(CGenNode));
+ printf("ERROR sizeof(CGenNodeLatencyPktInfo) %lu != sizeof(CGenNode) %lu must be the same size \n",sizeof(CGenNodeLatencyPktInfo),sizeof(CGenNode));
assert(0);
}
@@ -3515,9 +3526,6 @@ void CGlobalTRex::Delete(){
int CGlobalTRex::ixgbe_prob_init(void){
- uint8_t nb_ports;
-
-
m_max_ports = rte_eth_dev_count();
if (m_max_ports == 0)
rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
@@ -3696,17 +3704,17 @@ void CGlobalTRex::dump_post_test_stats(FILE *fd){
fprintf (fd," summary stats \n");
fprintf (fd," -------------- \n");
- fprintf (fd," Total-pkt-drop : %d pkts \n",(int64_t)(pkt_out-pkt_in));
- fprintf (fd," Total-tx-bytes : %llu bytes \n",pkt_out_bytes);
- fprintf (fd," Total-tx-sw-bytes : %llu bytes \n",sw_pkt_out_bytes);
- fprintf (fd," Total-rx-bytes : %llu byte \n",pkt_in_bytes);
+ fprintf (fd," Total-pkt-drop : %llu pkts \n",(unsigned long long)(pkt_out-pkt_in));
+ fprintf (fd," Total-tx-bytes : %llu bytes \n", (unsigned long long)pkt_out_bytes);
+ fprintf (fd," Total-tx-sw-bytes : %llu bytes \n", (unsigned long long)sw_pkt_out_bytes);
+ fprintf (fd," Total-rx-bytes : %llu byte \n", (unsigned long long)pkt_in_bytes);
fprintf (fd," \n");
- fprintf (fd," Total-tx-pkt : %llu pkts \n",pkt_out);
- fprintf (fd," Total-rx-pkt : %llu pkts \n",pkt_in);
- fprintf (fd," Total-sw-tx-pkt : %llu pkts \n",sw_pkt_out);
- fprintf (fd," Total-sw-err : %llu pkts \n",sw_pkt_out_err);
+ fprintf (fd," Total-tx-pkt : %llu pkts \n", (unsigned long long)pkt_out);
+ fprintf (fd," Total-rx-pkt : %llu pkts \n", (unsigned long long)pkt_in);
+ fprintf (fd," Total-sw-tx-pkt : %llu pkts \n", (unsigned long long)sw_pkt_out);
+ fprintf (fd," Total-sw-err : %llu pkts \n", (unsigned long long)sw_pkt_out_err);
if ( !CGlobalInfo::m_options.is_latency_disabled() ){
@@ -4183,6 +4191,7 @@ int CGlobalTRex::stop_master(){
dump_post_test_stats(stdout);
m_fl.Delete();
+ return (0);
}
bool CGlobalTRex::is_all_cores_finished(){
@@ -4216,6 +4225,8 @@ int CGlobalTRex::start_master_stateless(){
lpt->m_node_gen.m_socket_id =m_cores_vif[i+1]->get_socket_id();
}
m_fl_was_init=true;
+
+ return (0);
}
@@ -4274,6 +4285,7 @@ int CGlobalTRex::start_send_master(){
}
m_fl_was_init=true;
+ return (0);
}
@@ -4414,7 +4426,6 @@ int update_global_info_from_platform_file(){
int update_dpdk_args(void){
- uint32_t cores_number;
CPlatformSocketInfo * lpsock=&CGlobalInfo::m_socket;
CParserOption * lpop= &CGlobalInfo::m_options;
@@ -4431,7 +4442,7 @@ int update_dpdk_args(void){
}
- sprintf(global_cores_str,"0x%x",lpsock->get_cores_mask());
+ sprintf(global_cores_str,"0x%llx",(unsigned long long)lpsock->get_cores_mask());
/* set the DPDK options */
global_dpdk_args_num =7;
@@ -4482,6 +4493,7 @@ int update_dpdk_args(void){
printf(" %s \n",global_dpdk_args[i]);
}
}
+ return (0);
}
@@ -4765,14 +4777,13 @@ int CTRexExtendedDriverBase1G::configure_rx_filter_rules(CPhyEthIF * _if){
/* enable all rules */
_if->pci_reg_write(E1000_WUFC, (mask<<16) | (1<<14) );
+
+ return (0);
}
void CTRexExtendedDriverBase1G::get_extended_stats(CPhyEthIF * _if,CPhyEthIFStats *stats){
- int i;
- uint64_t t=0;
-
stats->ipackets += _if->pci_reg_read(E1000_GPRC) ;
stats->ibytes += (_if->pci_reg_read(E1000_GORCL) );
@@ -4902,6 +4913,7 @@ int CTRexExtendedDriverBase10G::configure_rx_filter_rules(CPhyEthIF * _if){
rte_exit(EXIT_FAILURE, " ERROR rte_eth_dev_fdir_add_perfect_filter : %d\n",res);
}
}
+ return (0);
}
int CTRexExtendedDriverBase10G::configure_drop_queue(CPhyEthIF * _if){
@@ -5024,6 +5036,8 @@ int CTRexExtendedDriverBase40G::configure_rx_filter_rules(CPhyEthIF * _if){
add_rules(_if,RTE_ETH_FLOW_TYPE_UDPV6,ttl);
add_rules(_if,RTE_ETH_FLOW_TYPE_TCPV6,ttl);
}
+
+ return (0);
}
diff --git a/src/nat_check.cpp b/src/nat_check.cpp
index 676c1292..170d2de6 100755
--- a/src/nat_check.cpp
+++ b/src/nat_check.cpp
@@ -171,8 +171,8 @@ void CNatRxManager::handle_packet_ipv4(CNatOption * option,
}
-#define MYDP(f) if (f) fprintf(fd," %-40s: %llu \n",#f,f)
-#define MYDP_A(f) fprintf(fd," %-40s: %llu \n",#f,f)
+#define MYDP(f) if (f) fprintf(fd," %-40s: %llu \n",#f,(unsigned long long)f)
+#define MYDP_A(f) fprintf(fd," %-40s: %llu \n",#f, (unsigned long long)f)
diff --git a/src/platform_cfg.cpp b/src/platform_cfg.cpp
index 92ffefbd..df04cd89 100755
--- a/src/platform_cfg.cpp
+++ b/src/platform_cfg.cpp
@@ -127,7 +127,7 @@ void CPlatformMemoryYamlInfo::Dump(FILE *fd){
int i=0;
for (i=0; i<MBUF_SIZE; i++) {
- fprintf(fd," %-40s : %lu \n",names[i].c_str(),m_mbuf[i]);
+ fprintf(fd," %-40s : %lu \n",names[i].c_str(), (ulong)m_mbuf[i]);
}
}
@@ -379,7 +379,7 @@ void CPlatformYamlInfo::Dump(FILE *fd){
}else{
fprintf(fd," port limit : not configured \n");
}
- fprintf(fd," port_bandwidth_gb : %lu \n",m_port_bandwidth_gb);
+ fprintf(fd," port_bandwidth_gb : %lu \n", (ulong)m_port_bandwidth_gb);
if ( m_if_mask_exist && m_if_mask.size() ) {
fprintf(fd," if_mask : ");
@@ -387,7 +387,7 @@ void CPlatformYamlInfo::Dump(FILE *fd){
for (i=0; i<(int)m_if_mask.size(); i++) {
fprintf(fd," %s,",m_if_mask[i].c_str());
}
- fprintf(fd,"\n",m_if_mask[i].c_str());
+ fprintf(fd,"\n");
}else{
fprintf(fd," if_mask : None \n");
diff --git a/src/rpc-server/commands/trex_rpc_cmd_stream.cpp b/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
index d7138f7b..4fa0956d 100644
--- a/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
+++ b/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
@@ -127,7 +127,7 @@ TrexRpcCmdAddStream::_run(const Json::Value &params, Json::Value &result) {
TrexStream *
TrexRpcCmdAddStream::allocate_new_stream(const Json::Value &section, uint8_t port_id, uint32_t stream_id, Json::Value &result) {
- TrexStream *stream;
+ TrexStream *stream = NULL;
const Json::Value &mode = parse_object(section, "mode", result);
std::string type = parse_string(mode, "type", result);
@@ -200,9 +200,9 @@ TrexRpcCmdAddStream::parse_vm_instr_flow_var(const Json::Value &inst, TrexStream
std::string min_value_str = parse_string(inst, "min_value", result);
std::string max_value_str = parse_string(inst, "max_value", result);
- uint64_t init_value;
- uint64_t min_value;
- uint64_t max_value;
+ uint64_t init_value = 0;
+ uint64_t min_value = 0;
+ uint64_t max_value = 0;
try {
init_value = str2num(init_value_str);
diff --git a/src/rx_check.cpp b/src/rx_check.cpp
index 3a67ca23..59b42e1a 100755
--- a/src/rx_check.cpp
+++ b/src/rx_check.cpp
@@ -45,8 +45,8 @@ void CRxCheckFlowTableStats::Clear(){
}
-#define MYDP(f) if (f) fprintf(fd," %-40s: %llu \n",#f,f)
-#define MYDP_A(f) fprintf(fd," %-40s: %llu \n",#f,f)
+#define MYDP(f) if (f) fprintf(fd," %-40s: %llu \n",#f,(unsigned long long)f)
+#define MYDP_A(f) fprintf(fd," %-40s: %llu \n",#f,(unsigned long long)f)
#define MYDP_J(f) json+=add_json(#f,f);
#define MYDP_J_LAST(f) json+=add_json(#f,f,true);
@@ -146,7 +146,7 @@ void CRxCheckFlowTableMap::dump_all(FILE *fd){
rx_check_flow_map_iter_t it;
for (it= m_map.begin(); it != m_map.end(); ++it) {
CRxCheckFlow *lp = it->second;
- printf ("flow_id: %d \n",lp->m_flow_id);
+ printf ("flow_id: %llu \n",(unsigned long long)lp->m_flow_id);
}
}
@@ -208,7 +208,7 @@ std::string CPerTxthreadTemplateInfo::dump_as_json(std::string name){
int i;
for (i=0;i<MAX_TEMPLATES_STATS;i++){
char buff[200];
- sprintf(buff,"%llu",m_template_info[i]);
+ sprintf(buff,"%llu", (unsigned long long)m_template_info[i]);
json+=std::string(buff);
if ( i < MAX_TEMPLATES_STATS-1) {
json+=std::string(",");
@@ -231,7 +231,7 @@ void CPerTxthreadTemplateInfo::Dump(FILE *fd){
int i;
for (i=0; i<MAX_TEMPLATES_STATS; i++) {
if (m_template_info[i]) {
- fprintf (fd," template id: %llu %llu \n",i,m_template_info[i]);
+ fprintf (fd," template id: %d %llu \n",i, (unsigned long long)m_template_info[i]);
}
}
}
@@ -484,7 +484,7 @@ void RxCheckManager::DumpTemplate(FILE *fd,bool verbose){
if (cnt==0){
fprintf(fd,"\n");
}
- fprintf(fd,"[id:%2d val:%8d,rx:%8d], ",i,lp->get_error_counter(),lp->get_rx_counter());
+ fprintf(fd,"[id:%2d val:%8llu,rx:%8llu], ",i, (unsigned long long)lp->get_error_counter(), (unsigned long long)lp->get_rx_counter());
cnt++;
if (cnt>5) {
cnt=0;
@@ -500,7 +500,11 @@ void RxCheckManager::DumpTemplateFull(FILE *fd){
int i;
for (i=0; i<MAX_TEMPLATES_STATS;i++ ) {
CPerTemplateInfo * lp=get_template(i);
- fprintf(fd," template_id_%2d , errors:%8d, jitter: %lu rx : %lu \n",i,lp->get_error_counter(),lp->get_jitter_usec(),lp->get_rx_counter() );
+ fprintf(fd," template_id_%2d , errors:%8llu, jitter: %llu rx : %llu \n",
+ i,
+ (unsigned long long)lp->get_error_counter(),
+ (unsigned long long)lp->get_jitter_usec(),
+ (unsigned long long)lp->get_rx_counter() );
}
}
@@ -514,7 +518,11 @@ void RxCheckManager::DumpShort(FILE *fd){
DumpTemplate(fd,false);
fprintf(fd,"\n");
fprintf(fd,"---\n");
- fprintf(fd," active flows: %8d, fif: %8d, drop: %8d, errors: %8d \n",m_stats.m_active,m_stats.m_fif,m_stats.m_err_drop,m_stats.get_total_err());
+ fprintf(fd," active flows: %8llu, fif: %8llu, drop: %8llu, errors: %8llu \n",
+ (unsigned long long)m_stats.m_active,
+ (unsigned long long)m_stats.m_fif,
+ (unsigned long long)m_stats.m_err_drop,
+ (unsigned long long)m_stats.get_total_err());
fprintf(fd,"------------------------------------------------------------------------------------------------------------\n");
}
diff --git a/src/rx_check_header.cpp b/src/rx_check_header.cpp
index 8ee580db..5934ee15 100755
--- a/src/rx_check_header.cpp
+++ b/src/rx_check_header.cpp
@@ -42,11 +42,11 @@ void CRx_check_header::dump(FILE *fd){
void CNatOption::dump(FILE *fd){
- fprintf(fd," op : %lx \n",get_option_type());
- fprintf(fd," ol : %lx \n",get_option_len());
- fprintf(fd," thread_id : %lx \n",get_thread_id());
- fprintf(fd," magic : %lx \n",get_magic());
- fprintf(fd," fid : %lx \n",get_fid());
+ fprintf(fd," op : %x \n",get_option_type());
+ fprintf(fd," ol : %x \n",get_option_len());
+ fprintf(fd," thread_id : %x \n",get_thread_id());
+ fprintf(fd," magic : %x \n",get_magic());
+ fprintf(fd," fid : %x \n",get_fid());
utl_DumpBuffer(stdout,(void *)&u.m_data[0],8,0);
}
diff --git a/src/stateless/cp/trex_stateless_port.cpp b/src/stateless/cp/trex_stateless_port.cpp
index 3a8d2c14..cb6fcc0e 100644
--- a/src/stateless/cp/trex_stateless_port.cpp
+++ b/src/stateless/cp/trex_stateless_port.cpp
@@ -27,9 +27,16 @@ limitations under the License.
#include <string>
#ifndef TREX_RPC_MOCK_SERVER
+
// DPDK c++ issue
-#define UINT8_MAX 255
-#define UINT16_MAX 0xFFFF
+#ifndef UINT8_MAX
+ #define UINT8_MAX 255
+#endif
+
+#ifndef UINT16_MAX
+ #define UINT16_MAX 0xFFFF
+#endif
+
// DPDK c++ issue
#endif
diff --git a/src/stateless/dp/trex_stateless_dp_core.cpp b/src/stateless/dp/trex_stateless_dp_core.cpp
index 5f4e553a..b2bd0152 100644
--- a/src/stateless/dp/trex_stateless_dp_core.cpp
+++ b/src/stateless/dp/trex_stateless_dp_core.cpp
@@ -30,7 +30,9 @@ usec_to_sec(double usec) {
return (usec / (1000 * 1000));
}
-TrexStatelessDpCore::TrexStatelessDpCore(uint8_t thread_id, CFlowGenListPerThread *core) {
+
+void
+TrexStatelessDpCore::create(uint8_t thread_id, CFlowGenListPerThread *core) {
m_thread_id = thread_id;
m_core = core;
@@ -73,7 +75,8 @@ TrexStatelessDpCore::start_scheduler() {
m_core->m_node_gen.add_node(node_sync);
double old_offset = 0.0;
- m_core->m_node_gen.flush_file(100000000, 0.0, false, m_core, old_offset);
+ m_core->m_node_gen.flush_file(-1, 0.0, false, m_core, old_offset);
+ m_core->m_node_gen.close_file(m_core);
}
void
@@ -176,14 +179,14 @@ TrexStatelessDpCore::stop_traffic(uint8_t port_id) {
m_state = STATE_IDLE;
/* stop the scheduler */
- CGenNode *node = m_core->create_node() ;
+ CGenNode *node = m_core->create_node() ;
- node->m_type = CGenNode::EXIT_SCHED;
+ node->m_type = CGenNode::EXIT_SCHED;
- /* make sure it will be scheduled after the current node */
- node->m_time = m_core->m_node_gen.m_p_queue.top()->m_time;
+ /* make sure it will be scheduled after the current node */
+ node->m_time = m_core->m_cur_time_sec + 0.0001;
- m_core->m_node_gen.add_node(node);
+ m_core->m_node_gen.add_node(node);
}
}
diff --git a/src/stateless/dp/trex_stateless_dp_core.h b/src/stateless/dp/trex_stateless_dp_core.h
index f3b5ff62..f4dbad08 100644
--- a/src/stateless/dp/trex_stateless_dp_core.h
+++ b/src/stateless/dp/trex_stateless_dp_core.h
@@ -42,7 +42,18 @@ public:
STATE_TRANSMITTING
};
- TrexStatelessDpCore(uint8_t thread_id, CFlowGenListPerThread *core);
+ TrexStatelessDpCore() {
+ m_thread_id = 0;
+ m_core = NULL;
+ }
+
+ /**
+ * "static constructor"
+ *
+ * @param thread_id
+ * @param core
+ */
+ void create(uint8_t thread_id, CFlowGenListPerThread *core);
/**
* launch the stateless DP core code
diff --git a/src/stub/trex_stateless_stub.cpp b/src/stub/trex_stateless_stub.cpp
index de56e57a..199356d8 100644
--- a/src/stub/trex_stateless_stub.cpp
+++ b/src/stub/trex_stateless_stub.cpp
@@ -4,7 +4,8 @@
class CFlowGenListPerThread;
class TrexStatelessCpToDpMsgBase;
-TrexStatelessDpCore::TrexStatelessDpCore(unsigned char, CFlowGenListPerThread*) {
+void
+TrexStatelessDpCore::create(unsigned char, CFlowGenListPerThread*) {
m_thread_id = 0;
m_core = NULL;
diff --git a/src/time_histogram.cpp b/src/time_histogram.cpp
index f1b47e59..96796bfc 100755
--- a/src/time_histogram.cpp
+++ b/src/time_histogram.cpp
@@ -182,10 +182,10 @@ void CTimeHistogram::DumpWinMax(FILE *fd){
}
void CTimeHistogram::Dump(FILE *fd){
- fprintf (fd," min_delta : %lu usec \n",get_usec(m_min_delta));
+ fprintf (fd," min_delta : %lu usec \n", (ulong)get_usec(m_min_delta));
fprintf (fd," cnt : %lu \n",m_cnt);
fprintf (fd," high_cnt : %lu \n",m_high_cnt);
- fprintf (fd," max_d_time : %lu usec\n",get_usec(m_max_dt));
+ fprintf (fd," max_d_time : %lu usec\n", (ulong)get_usec(m_max_dt));
//fprintf (fd," average : %.0f usec\n", get_total_average());
fprintf (fd," sliding_average : %.0f usec\n", get_average_latency());
fprintf (fd," precent : %.1f %%\n",(100.0*(double)m_high_cnt/(double)m_cnt));
@@ -198,7 +198,7 @@ void CTimeHistogram::Dump(FILE *fd){
for (j=0; j<HISTOGRAM_SIZE_LOG; j++) {
for (i=0; i<HISTOGRAM_SIZE; i++) {
if (m_hcnt[j][i] >0 ) {
- fprintf (fd," h[%lu] : %lu \n",(base*(i+1)),m_hcnt[j][i]);
+ fprintf (fd," h[%u] : %llu \n",(base*(i+1)),(unsigned long long)m_hcnt[j][i]);
}
}
base=base*10;
diff --git a/src/tuple_gen.h b/src/tuple_gen.h
index 29adbd69..d34e27bc 100755
--- a/src/tuple_gen.h
+++ b/src/tuple_gen.h
@@ -553,6 +553,9 @@ public:
class CServerPoolBase {
public:
+
+ virtual ~CServerPoolBase() {}
+
virtual void GenerateTuple(CTupleBase& tuple) = 0;
virtual uint16_t GenerateOnePort(uint32_t idx) = 0;
virtual void Delete() = 0;
diff --git a/src/utl_json.cpp b/src/utl_json.cpp
index 990346f5..fb55be0a 100755
--- a/src/utl_json.cpp
+++ b/src/utl_json.cpp
@@ -25,7 +25,7 @@ limitations under the License.
std::string add_json(std::string name, uint32_t counter,bool last){
char buff[200];
- sprintf(buff,"\"%s\":%lu",name.c_str(),counter);
+ sprintf(buff,"\"%s\":%lu",name.c_str(), (ulong)counter);
std::string s= std::string(buff);
if (!last) {
s+=",";
@@ -35,7 +35,7 @@ std::string add_json(std::string name, uint32_t counter,bool last){
std::string add_json(std::string name, uint64_t counter,bool last){
char buff[200];
- sprintf(buff,"\"%s\":%llu",name.c_str(),counter);
+ sprintf(buff,"\"%s\":%llu",name.c_str(), (unsigned long long)counter);
std::string s= std::string(buff);
if (!last) {
s+=",";
diff --git a/src/utl_yaml.cpp b/src/utl_yaml.cpp
index 5f3ca735..828817e4 100755
--- a/src/utl_yaml.cpp
+++ b/src/utl_yaml.cpp
@@ -104,6 +104,8 @@ bool utl_yaml_read_uint16(const YAML::Node& node,
val = (uint16_t)val_tmp;
res=true;
}
+
+ return (res);
}
bool utl_yaml_read_bool(const YAML::Node& node,