diff options
author | Xavier Simonart <xavier.simonart@intel.com> | 2018-01-08 12:32:23 +0100 |
---|---|---|
committer | Xavier Simonart <xavier.simonart@intel.com> | 2018-01-16 16:39:40 +0100 |
commit | 2fbaf3b39062ae832ced4b62f823e6191ac79995 (patch) | |
tree | bf3e4b5b122d810702ceba4f2fbdccd74028d518 /VNFs | |
parent | deab1ee8197298bd7cf30d259a28206841d59383 (diff) |
Fix dumping receive packets
There were two issues identified in dump receive packets
- when the receive packets was going to be dropped (and not transmitted),
it was also printed as TX[255].
- a potential crash when using the dump function with modes like
lat which can receive more than MAX_RING_BURST.
Those issues have been fixed.
Change-Id: Ia2297539d64961a211389d68e3c9c6280472243c
Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
Diffstat (limited to 'VNFs')
-rw-r--r-- | VNFs/DPPD-PROX/lconf.c | 9 | ||||
-rw-r--r-- | VNFs/DPPD-PROX/rx_pkt.c | 11 |
2 files changed, 15 insertions, 5 deletions
diff --git a/VNFs/DPPD-PROX/lconf.c b/VNFs/DPPD-PROX/lconf.c index 682c106f..935bac5d 100644 --- a/VNFs/DPPD-PROX/lconf.c +++ b/VNFs/DPPD-PROX/lconf.c @@ -198,6 +198,15 @@ int lconf_do_flags(struct lcore_cfg *lconf) struct task_base *t; int ret = 0; + if ((lconf->msg.type == LCONF_MSG_TRACE) && (lconf->tasks_all[lconf->msg.task_id]->tx_pkt == tx_pkt_drop_all)) { + /* We are asked to dump packets through command dump. + * This usually means map RX and TX packets before printing them. + * However we do not transmit the packets in this case => use the DUMP_RX function. + * This will prevent seeing the received packets also printed as TX[255] (= dropped) + */ + lconf->msg.type = LCONF_MSG_DUMP_RX; + } + switch (lconf->msg.type) { case LCONF_MSG_STOP: msg_stop(lconf); diff --git a/VNFs/DPPD-PROX/rx_pkt.c b/VNFs/DPPD-PROX/rx_pkt.c index bd06b267..fd0f7e5c 100644 --- a/VNFs/DPPD-PROX/rx_pkt.c +++ b/VNFs/DPPD-PROX/rx_pkt.c @@ -77,7 +77,7 @@ static void next_port_pow2(struct rx_params_hw *rx_params_hw) static inline void dump_l3(struct task_base *tbase, struct rte_mbuf *mbuf) { if (unlikely(tbase->aux->task_rt_dump.n_print_rx)) { - if (tbase->aux->task_rt_dump.input->reply == NULL) { + if ((tbase->aux->task_rt_dump.input == NULL) || (tbase->aux->task_rt_dump.input->reply == NULL)) { plogdx_info(mbuf, "RX: "); } else { struct input *input = tbase->aux->task_rt_dump.input; @@ -408,7 +408,7 @@ uint16_t rx_pkt_dump(struct task_base *tbase, struct rte_mbuf ***mbufs) uint32_t n_dump = tbase->aux->task_rt_dump.n_print_rx; n_dump = ret < n_dump? ret : n_dump; - if (tbase->aux->task_rt_dump.input->reply == NULL) { + if ((tbase->aux->task_rt_dump.input == NULL) || (tbase->aux->task_rt_dump.input->reply == NULL)) { for (uint32_t i = 0; i < n_dump; ++i) { plogdx_info((*mbufs)[i], "RX: "); } @@ -453,12 +453,13 @@ uint16_t rx_pkt_trace(struct task_base *tbase, struct rte_mbuf ***mbufs) if (ret) { uint32_t n_trace = tbase->aux->task_rt_dump.n_trace; n_trace = ret < n_trace? ret : n_trace; + n_trace = n_trace <= MAX_RING_BURST ? n_trace : MAX_RING_BURST; for (uint32_t i = 0; i < n_trace; ++i) { uint8_t *pkt = rte_pktmbuf_mtod((*mbufs)[i], uint8_t *); - rte_memcpy(tbase->aux->task_rt_dump.pkt_cpy[tbase->aux->task_rt_dump.cur_trace + i], pkt, sizeof(tbase->aux->task_rt_dump.pkt_cpy[i])); - tbase->aux->task_rt_dump.pkt_cpy_len[tbase->aux->task_rt_dump.cur_trace + i] = rte_pktmbuf_pkt_len((*mbufs)[i]); - tbase->aux->task_rt_dump.pkt_mbuf_addr[tbase->aux->task_rt_dump.cur_trace + i] = (*mbufs)[i]; + rte_memcpy(tbase->aux->task_rt_dump.pkt_cpy[i], pkt, sizeof(tbase->aux->task_rt_dump.pkt_cpy[i])); + tbase->aux->task_rt_dump.pkt_cpy_len[i] = rte_pktmbuf_pkt_len((*mbufs)[i]); + tbase->aux->task_rt_dump.pkt_mbuf_addr[i] = (*mbufs)[i]; } tbase->aux->task_rt_dump.cur_trace += n_trace; |