summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/task_base.h
diff options
context:
space:
mode:
authorXavier Simonart <xavier.simonart@intel.com>2018-01-08 10:58:14 +0100
committerXavier Simonart <xavier.simonart@intel.com>2018-01-08 10:58:14 +0100
commit96b22a70386a9f8bde6a63eb383ebb7587fe4045 (patch)
tree7b7303e0c577e3a4f4030006eb9720589747fe38 /VNFs/DPPD-PROX/task_base.h
parentdd77bd89e11d84d378167468db85fb4ef35a0c7a (diff)
Fix stacking of rx receive functions
PROX can stack different RX functions, so that they are executed after each other. This feature is for instance used to dump packets or to print distribution of receive packets, without influencing the performance of the rx functions when no dump or print is needed. The previous implementation was wrong and causing some of the stacked functions not to be executed. This was causing for instance issues in latency measurement after enabling dumping packets. Change-Id: I766b8ee8e8852fa17cdaf60ee6e1fec0dc98c719 Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
Diffstat (limited to 'VNFs/DPPD-PROX/task_base.h')
-rw-r--r--VNFs/DPPD-PROX/task_base.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/VNFs/DPPD-PROX/task_base.h b/VNFs/DPPD-PROX/task_base.h
index ad00962f..f8c05242 100644
--- a/VNFs/DPPD-PROX/task_base.h
+++ b/VNFs/DPPD-PROX/task_base.h
@@ -213,8 +213,8 @@ static void task_base_add_rx_pkt_function(struct task_base *tbase, rx_pkt_func t
return;
}
- for (int16_t i = tbase->aux->rx_prev_count; i >= 0; --i) {
- tbase->aux->rx_pkt_prev[i + 1] = tbase->aux->rx_pkt_prev[i];
+ for (int16_t i = tbase->aux->rx_prev_count; i > 0; --i) {
+ tbase->aux->rx_pkt_prev[i] = tbase->aux->rx_pkt_prev[i - 1];
}
tbase->aux->rx_pkt_prev[0] = tbase->rx_pkt;
tbase->rx_pkt = to_add;
@@ -226,8 +226,13 @@ static void task_base_del_rx_pkt_function(struct task_base *tbase, rx_pkt_func t
int cur = 0;
int found = 0;
- if (tbase->aux->rx_prev_count == 1) {
+ if (unlikely(tbase->aux->rx_prev_count == 0)) {
+ return;
+ } else if (tbase->rx_pkt == to_del) {
tbase->rx_pkt = tbase->aux->rx_pkt_prev[0];
+ for (int16_t i = 0; i < tbase->aux->rx_prev_count - 1; ++i) {
+ tbase->aux->rx_pkt_prev[i] = tbase->aux->rx_pkt_prev[i + 1];
+ }
found = 1;
} else {
for (int16_t i = 0; i < tbase->aux->rx_prev_count; ++i) {