summaryrefslogtreecommitdiffstats
path: root/src/main_dpdk.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main_dpdk.cpp')
-rwxr-xr-xsrc/main_dpdk.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp
index 441df5ce..8c9eb914 100755
--- a/src/main_dpdk.cpp
+++ b/src/main_dpdk.cpp
@@ -1874,7 +1874,7 @@ public:
bool process_rx_pkt(pkt_dir_t dir,rte_mbuf_t * m);
- virtual int update_mac_addr_from_global_cfg(pkt_dir_t dir, rte_mbuf_t *m);
+ virtual int update_mac_addr_from_global_cfg(pkt_dir_t dir, uint8_t * p);
virtual pkt_dir_t port_id_to_dir(uint8_t port_id);
@@ -2077,6 +2077,8 @@ int CCoreEthIF::send_pkt(CCorePerPort * lp_port,
CVirtualIFPerSideStats * lp_stats
){
+ //rte_pktmbuf_dump(stdout,m, rte_pktmbuf_pkt_len(m));
+
lp_stats->m_tx_pkt +=1;
lp_stats->m_tx_bytes += (rte_pktmbuf_pkt_len(m)+4);
@@ -2133,12 +2135,18 @@ int CCoreEthIFStateless::send_node(CGenNode * no){
/* check that we have mbuf */
rte_mbuf_t * m=node_sl->get_cache_mbuf();
- assert( m );
pkt_dir_t dir=(pkt_dir_t)node_sl->get_mbuf_cache_dir();
CCorePerPort * lp_port=&m_ports[dir];
CVirtualIFPerSideStats * lp_stats = &m_stats[dir];
- rte_pktmbuf_refcnt_update(m,1);
+ if (m) {
+ /* cache case */
+ rte_pktmbuf_refcnt_update(m,1);
+ }else{
+ m=node_sl->alloc_node_with_vm();
+ assert(m);
+ }
send_pkt(lp_port,m,lp_stats);
+
return (0);
};
@@ -2237,14 +2245,12 @@ int CCoreEthIF::send_node(CGenNode * node){
}
-int CCoreEthIF::update_mac_addr_from_global_cfg(pkt_dir_t dir,
- rte_mbuf_t *m){
- assert(m);
+int CCoreEthIF::update_mac_addr_from_global_cfg(pkt_dir_t dir, uint8_t * p){
+ assert(p);
assert(dir<2);
+
CCorePerPort * lp_port=&m_ports[dir];
- uint8_t *p=rte_pktmbuf_mtod(m, uint8_t*);
uint8_t p_id=lp_port->m_port->get_port_id();
-
memcpy(p,CGlobalInfo::m_options.get_dst_src_mac_addr(p_id),12);
return (0);
}