summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2015-10-25 20:26:25 +0200
committerHanoh Haim <hhaim@cisco.com>2015-10-25 20:26:25 +0200
commit44d266232d124bb277f6dec965a04dd93e47fb55 (patch)
treebd449bfe89762c5f700dbc6268c0e931fa92d446 /src
parent29550cab54a8d49647f0f2c34b04cc2fc97daaea (diff)
add stateless io object
Diffstat (limited to 'src')
-rwxr-xr-xsrc/bp_sim.h2
-rwxr-xr-xsrc/main_dpdk.cpp87
2 files changed, 36 insertions, 53 deletions
diff --git a/src/bp_sim.h b/src/bp_sim.h
index 0b1f91ae..328b6ba1 100755
--- a/src/bp_sim.h
+++ b/src/bp_sim.h
@@ -1652,6 +1652,8 @@ public:
} __rte_cache_aligned ;
+
+
/* run time verification of objects size and offsets
need to clean this up and derive this objects from base object but require too much refactoring right now
hhaim
diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp
index fd2d01c3..6f031ae1 100755
--- a/src/main_dpdk.cpp
+++ b/src/main_dpdk.cpp
@@ -1897,8 +1897,16 @@ private:
uint16_t m_mbuf_cache;
CCorePerPort m_ports[CS_NUM]; /* each core has 2 tx queues 1. client side and server side */
CNodeRing * m_ring_to_rx;
+
+} __rte_cache_aligned; ;
+
+class CCoreEthIFStateless : public CCoreEthIF {
+public:
+ virtual int send_node(CGenNode * node);
};
+
+
bool CCoreEthIF::Create(uint8_t core_id,
uint16_t tx_client_queue_id,
CPhyEthIF * tx_client_port,
@@ -2154,6 +2162,16 @@ void CCoreEthIF::update_mac_addr(CGenNode * node,uint8_t *p){
}
+
+int CCoreEthIFStateless::send_node(CGenNode * node){
+ /*CGenNode * node*/
+ /* fill the info needed by stateless */
+ printf(" send node stateless \n");
+
+ return (0);
+};
+
+
int CCoreEthIF::send_node(CGenNode * node){
if ( unlikely( node->get_cache_mbuf() !=NULL ) ) {
@@ -2816,7 +2834,6 @@ public:
- int test_send1();
int rcv_send(int port,int queue_id);
int rcv_send_all(int queue_id);
@@ -2882,7 +2899,9 @@ public:
CPhyEthIF m_ports[BP_MAX_PORTS];
- CCoreEthIF m_cores_vif[BP_MAX_CORES]; /* counted from 1 , 2,3 core zero is reserve*/
+ CCoreEthIF m_cores_vif_sf[BP_MAX_CORES]; /* counted from 1 , 2,3 core zero is reserve - stateful */
+ CCoreEthIFStateless m_cores_vif_sl[BP_MAX_CORES]; /* counted from 1 , 2,3 core zero is reserve - stateless*/
+ CCoreEthIF * m_cores_vif[BP_MAX_CORES];
CParserOption m_po ;
@@ -2909,49 +2928,6 @@ private:
-int CGlobalTRex::test_send1(){
-
- CParserOption po ;
- CFlowGenList fl;
-
- po.cfg_file = "cap2/dns.yaml";
- //po.cfg_file = "cap2/sfr3.yaml";
- //po.cfg_file = "cap2/sfr4.yaml";
- //po.cfg_file = "cap2/sfr.yaml";
-
- po.preview.setVMode(3);
- po.preview.setFileWrite(true);
-
- fl.Create();
-
- fl.load_from_yaml(po.cfg_file,1);
- //fl.DumpPktSize();
-
- fl.generate_p_thread_info(1);
- CFlowGenListPerThread * lpt;
-
- int i;
- for (i=0; i<1; i++) {
- lpt = fl.m_threads_info[i];
- //CNullIF * erf_vif = new CNullIF();
- CVirtualIF * erf_vif = &m_cores_vif[0];
- lpt->set_vif(erf_vif);
- lpt->start_generate_stateful("hey",po.preview);
- lpt->m_node_gen.DumpHist(stdout);
- lpt->DumpStats(stdout);
- }
-
- m_cores_vif[0].flush_tx_queue();
- delay(1000);
- //fprintf(stdout," drop : %llu \n",m_test_drop);
-
- m_cores_vif[0].DumpCoreStats(stdout);
- m_cores_vif[0].DumpIfStats(stdout);
-
- fl.Delete();
-}
-
-
int CGlobalTRex::rcv_send(int port,int queue_id){
CPhyEthIF * lp=&m_ports[port];
@@ -3404,7 +3380,12 @@ int CGlobalTRex::ixgbe_start(void){
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 */
- m_cores_vif[j].Create(j,
+ if ( get_is_stateless() ){
+ m_cores_vif[j]=&m_cores_vif_sl[j];
+ }else{
+ m_cores_vif[j]=&m_cores_vif_sf[j];
+ }
+ m_cores_vif[j]->Create(j,
queue_id,
&m_ports[port_offset], /* 0,2*/
queue_id,
@@ -3419,7 +3400,7 @@ int CGlobalTRex::ixgbe_start(void){
fprintf(stdout," -------------------------------\n");
CCoreEthIF::DumpIfCfgHeader(stdout);
for (i=0; i<get_cores_tx(); i++) {
- m_cores_vif[i+1].DumpIfCfg(stdout);
+ m_cores_vif[i+1]->DumpIfCfg(stdout);
}
fprintf(stdout," -------------------------------\n");
}
@@ -3641,7 +3622,7 @@ void CGlobalTRex::dump_post_test_stats(FILE *fd){
int i;
for (i=0; i<get_cores_tx(); i++) {
- CCoreEthIF * erf_vif = &m_cores_vif[i+1];
+ CCoreEthIF * erf_vif = m_cores_vif[i+1];
CVirtualIFPerSideStats stats;
erf_vif->GetCoreCounters(&stats);
sw_pkt_out += stats.m_tx_pkt;
@@ -4102,7 +4083,7 @@ int CGlobalTRex::stop_master(){
int i;
for (i=0; i<get_cores_tx(); i++) {
lpt = m_fl.m_threads_info[i];
- CCoreEthIF * erf_vif = &m_cores_vif[i+1];
+ CCoreEthIF * erf_vif = m_cores_vif[i+1];
erf_vif->DumpCoreStats(stdout);
erf_vif->DumpIfStats(stdout);
@@ -4161,9 +4142,9 @@ int CGlobalTRex::start_master_stateless(){
for (i=0; i<get_cores_tx(); i++) {
lpt = m_fl.m_threads_info[i];
- CVirtualIF * erf_vif = &m_cores_vif[i+1];
+ CVirtualIF * erf_vif = m_cores_vif[i+1];
lpt->set_vif(erf_vif);
- lpt->m_node_gen.m_socket_id =m_cores_vif[i+1].get_socket_id();
+ lpt->m_node_gen.m_socket_id =m_cores_vif[i+1]->get_socket_id();
}
m_fl_was_init=true;
}
@@ -4216,10 +4197,10 @@ int CGlobalTRex::start_send_master(){
for (i=0; i<get_cores_tx(); i++) {
lpt = m_fl.m_threads_info[i];
//CNullIF * erf_vif = new CNullIF();
- CVirtualIF * erf_vif = &m_cores_vif[i+1];
+ CVirtualIF * erf_vif = m_cores_vif[i+1];
lpt->set_vif(erf_vif);
/* socket id */
- lpt->m_node_gen.m_socket_id =m_cores_vif[i+1].get_socket_id();
+ lpt->m_node_gen.m_socket_id =m_cores_vif[i+1]->get_socket_id();
}
m_fl_was_init=true;