diff options
author | Xavier Simonart <xavier.simonart@intel.com> | 2018-01-13 21:44:49 +0100 |
---|---|---|
committer | Patrice Buriez <patrice.buriez@intel.com> | 2018-02-13 12:44:17 +0000 |
commit | 26a2e095473ba20af7f2f81aafef002145184af9 (patch) | |
tree | bb97ba908ca615c81bac266585c3b02f7854c778 /VNFs/DPPD-PROX/tx_pkt.c | |
parent | aa09ff9157159b26c431ba61a6f0a08308d123dd (diff) |
Fix potential crash in rx and tx distribution
In some (rare) modes, more than 64 packets can be received through
one rx function. This is for instance the case of the lat mode.
Change-Id: Ie733c927a8e116c679c464f2551768185ef85366
Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
Diffstat (limited to 'VNFs/DPPD-PROX/tx_pkt.c')
-rw-r--r-- | VNFs/DPPD-PROX/tx_pkt.c | 5 |
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); } |