From fccce1ef79294066fc7e3dc5b36c5915573d0e47 Mon Sep 17 00:00:00 2001 From: Xavier Simonart Date: Wed, 26 Dec 2018 15:26:27 +0100 Subject: Prevent dropping ARP packets JIRA: SAMPLEVNF-152 When system is overloaded, ARP packets were sometimes dropped, as any other packets. This was causing two issues: - The count of TX non dataplane packets was wrong - If many consecutive ARP packets were dropped, the underlying switch might see its ARP timer expiring, causing performance degradation (packets being broadcasted). ARP packets are now always sent as no-drop. Change-Id: I9a86cbf8c4b56a178f86bc789153f1fa49ddf73f Signed-off-by: Xavier Simonart --- VNFs/DPPD-PROX/tx_pkt.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'VNFs/DPPD-PROX/tx_pkt.c') diff --git a/VNFs/DPPD-PROX/tx_pkt.c b/VNFs/DPPD-PROX/tx_pkt.c index c5047e56..d494236c 100644 --- a/VNFs/DPPD-PROX/tx_pkt.c +++ b/VNFs/DPPD-PROX/tx_pkt.c @@ -762,6 +762,39 @@ int tx_pkt_drop_all(struct task_base *tbase, struct rte_mbuf **mbufs, uint16_t n } return n_pkts; } +static inline void dump_pkts(struct task_base *tbase, struct rte_mbuf **mbufs, uint16_t n_pkts) +{ + uint32_t n_dump = tbase->aux->task_rt_dump.n_print_tx; + uint32_t n_trace = tbase->aux->task_rt_dump.n_trace; + + if (unlikely(n_dump)) { + n_dump = n_pkts < n_dump? n_pkts : n_dump; + for (uint32_t i = 0; i < n_dump; ++i) { + plogdx_info(mbufs[i], "TX: "); + } + tbase->aux->task_rt_dump.n_print_tx -= n_dump; + } else if (unlikely(n_trace)) { + n_trace = n_pkts < n_trace? n_pkts : n_trace; + for (uint32_t i = 0; i < n_trace; ++i) { + plogdx_info(mbufs[i], "TX: "); + } + tbase->aux->task_rt_dump.n_trace - n_trace; + } +} + +// ctrlplane packets are slow path, hence cost of checking if dump ortrace is needed in not too important +// easier to have this implementation than an implementation similar to dataplane tx +int tx_ctrlplane_hw(struct task_base *tbase, struct rte_mbuf **mbufs, uint16_t n_pkts, __attribute__((unused)) uint8_t *out) +{ + dump_pkts(tbase, mbufs, n_pkts); + return txhw_no_drop(&tbase->tx_params_hw.tx_port_queue[0], mbufs, n_pkts, tbase); +} + +int tx_ctrlplane_sw(struct task_base *tbase, struct rte_mbuf **mbufs, const uint16_t n_pkts, __attribute__((unused)) uint8_t *out) +{ + dump_pkts(tbase, mbufs, n_pkts); + return ring_enq_no_drop(tbase->tx_params_sw.tx_rings[0], mbufs, n_pkts, tbase); +} static inline int tx_ring_all(struct task_base *tbase, struct rte_ring *ring, uint16_t command, struct rte_mbuf *mbuf, uint8_t core_id, uint8_t task_id, uint32_t ip) { -- cgit 1.2.3-korg