summaryrefslogtreecommitdiffstats
path: root/src/bp_sim.h
diff options
context:
space:
mode:
authorIdo Barnea <ibarnea@cisco.com>2016-11-16 11:03:51 +0200
committerIdo Barnea <ibarnea@cisco.com>2016-11-16 11:03:51 +0200
commit122f336ffde6d3fc74acc6861322328d778d3232 (patch)
tree2fa5d0889c66608296a1b0431f2289584b77c977 /src/bp_sim.h
parent52b8755b842c4adbb8bf923798cc1fc4fd498ae4 (diff)
Fix trex-267 - allocation of ARP packets from wrong memory socket
Signed-off-by: Ido Barnea <ibarnea@cisco.com>
Diffstat (limited to 'src/bp_sim.h')
-rwxr-xr-xsrc/bp_sim.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/bp_sim.h b/src/bp_sim.h
index c292103b..0cf77437 100755
--- a/src/bp_sim.h
+++ b/src/bp_sim.h
@@ -1205,12 +1205,13 @@ public:
/* for simulation */
static void free_pools();
-
static inline rte_mbuf_t * pktmbuf_alloc_small(socket_id_t socket){
return ( m_mem_pool[socket].pktmbuf_alloc_small() );
}
-
+ static inline rte_mbuf_t * pktmbuf_alloc_small_by_port(uint8_t port_id) {
+ return ( m_mem_pool[m_socket.port_to_socket(port_id)].pktmbuf_alloc_small() );
+ }
/**
* try to allocate small buffers too
@@ -1228,6 +1229,13 @@ public:
return (m_mem_pool[socket].pktmbuf_alloc(size));
}
+ static inline rte_mbuf_t * pktmbuf_alloc_by_port(uint8_t port_id, uint16_t size){
+ socket_id_t socket = m_socket.port_to_socket(port_id);
+ if (size<FIRST_PKT_SIZE) {
+ return ( pktmbuf_alloc_small(socket));
+ }
+ return (m_mem_pool[socket].pktmbuf_alloc(size));
+ }
static inline bool is_learn_verify_mode(){
return ( (m_options.m_learn_mode != CParserOption::LEARN_MODE_DISABLED) && m_options.preview.get_learn_and_verify_mode_enable());