diff options
author | Hanoh Haim <hhaim@cisco.com> | 2016-05-08 20:32:52 +0300 |
---|---|---|
committer | Hanoh Haim <hhaim@cisco.com> | 2016-05-08 20:32:52 +0300 |
commit | 8b4df27252f317b33e11a626997748971625a47c (patch) | |
tree | 9f46d76051e69cf20959199fca83126ef82944cf /src/bp_sim.cpp | |
parent | c2912dfc5ad81e2edcf77b7ee992f92216ed0bad (diff) |
add cache to CP
Diffstat (limited to 'src/bp_sim.cpp')
-rwxr-xr-x | src/bp_sim.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/bp_sim.cpp b/src/bp_sim.cpp index 9725084c..687f51fd 100755 --- a/src/bp_sim.cpp +++ b/src/bp_sim.cpp @@ -4840,20 +4840,26 @@ int CErfIFStl::send_node(CGenNode * _no_to_use){ pkt_dir_t dir=(pkt_dir_t)node_sl->get_mbuf_cache_dir(); - /* check that we have mbuf */ - rte_mbuf_t * m=node_sl->get_cache_mbuf(); - if (m) { - /* cache packet */ + rte_mbuf_t * m; + if ( likely(node_sl->is_cache_mbuf_array()) ) { + m=node_sl->cache_mbuf_array_get_cur(); fill_raw_packet(m,_no_to_use,dir); - /* can't free the m, it is cached*/ }else{ + m=node_sl->get_cache_mbuf(); + if (m) { + /* cache packet */ + fill_raw_packet(m,_no_to_use,dir); + /* can't free the m, it is cached*/ + }else{ - m=node_sl->alloc_node_with_vm(); - assert(m); - fill_raw_packet(m,_no_to_use,dir); - rte_pktmbuf_free(m); + m=node_sl->alloc_node_with_vm(); + assert(m); + fill_raw_packet(m,_no_to_use,dir); + rte_pktmbuf_free(m); + } } + /* check that we have mbuf */ int rc = write_pkt(m_raw); BP_ASSERT(rc == 0); |