summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/tx_pkt.c
diff options
context:
space:
mode:
authorDeepak S <deepak.s@linux.intel.com>2018-02-15 10:00:55 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-02-15 10:00:55 +0000
commit4a2cd9100b43e1977e22b06a4d36bfb89959b186 (patch)
tree47ee50fc994db743f3fee89f1daacfa77bd531cc /VNFs/DPPD-PROX/tx_pkt.c
parentf1b7de05ac886a58a994676a4a5b6591eed5fc91 (diff)
parent26a2e095473ba20af7f2f81aafef002145184af9 (diff)
Merge "Fix potential crash in rx and tx distribution"
Diffstat (limited to 'VNFs/DPPD-PROX/tx_pkt.c')
-rw-r--r--VNFs/DPPD-PROX/tx_pkt.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/VNFs/DPPD-PROX/tx_pkt.c b/VNFs/DPPD-PROX/tx_pkt.c
index 9ada51ca..49f46898 100644
--- a/VNFs/DPPD-PROX/tx_pkt.c
+++ b/VNFs/DPPD-PROX/tx_pkt.c
@@ -704,7 +704,10 @@ int tx_pkt_dump(struct task_base *tbase, struct rte_mbuf **mbufs, uint16_t n_pkt
task that xmits the packet, no atomic operation is needed. */
int tx_pkt_distr(struct task_base *tbase, struct rte_mbuf **mbufs, uint16_t n_pkts, uint8_t *out)
{
- tbase->aux->tx_bucket[n_pkts]++;
+ if (likely(n_pkts < TX_BUCKET_SIZE))
+ tbase->aux->tx_bucket[n_pkts]++;
+ else
+ tbase->aux->tx_bucket[TX_BUCKET_SIZE - 1]++;
return tbase->aux->tx_pkt_orig(tbase, mbufs, n_pkts, out);
}