From 3278aa494dcb68881be740668bf73b0df512734a Mon Sep 17 00:00:00 2001
From: Robert Schmidt <robert.schmidt@eurecom.fr>
Date: Tue, 26 Jun 2018 15:20:30 +0200
Subject: [PATCH] Return immediately from pdcp_data_req

When the RLC layer returns error codes (like dropped packets), this is still
counted as PDCP layer traffic. In order to reflect dropped packets or
malfunctioning, this patch makes that upon an RLC error code, the function is
exited immediately. In this case, it is not counted as additional PDCP traffic.

An example is too much UDP traffic. If the RLC buffer is saturated and the
packet therefore refused, incoming traffic won't be counted anymore. With this
patch, the PDCP layer statistics won't count such traffic anymore.
---
 openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
index 8b96542e336..135c6e73fa9 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
@@ -399,27 +399,24 @@ boolean_t pdcp_data_req(
 
   case RLC_OP_STATUS_BAD_PARAMETER:
     LOG_W(PDCP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n");
-    ret= FALSE;
-    break;
+    return FALSE;
 
   case RLC_OP_STATUS_INTERNAL_ERROR:
     LOG_W(PDCP, "Data sending request over RLC failed with 'Internal Error' reason!\n");
-    ret= FALSE;
-    break;
+    return FALSE;
 
   case RLC_OP_STATUS_OUT_OF_RESSOURCES:
     pdcp_enb[ctxt_pP->module_id].time_buf_full[pdcp_uid] = pdcp_enb[ctxt_pP->module_id].sfn;
     LOG_W(PDCP, "Data sending request over RLC failed with 'Out of Resources' reason!\n");
     int h = TM_SKIP_FULL_BUF_MS;
     LOG_W(PDCP, "Blocking incoming traffic for %d ms\n", h);
-    ret= FALSE;
-    break;
+    return FALSE;
 
   case RLC_OP_SKIPPED_FUL_BUF:
     LOG_D(PDCP, "Skipping RLC request due to full buffer\n");
-    /* fake good return so that GTP doesn't spam us */
-    ret = TRUE;
-    break;
+    /* fake good return so that GTP doesn't spam us and return immediately so
+     * that dropped traffic is not counted in PDCP traffic stats */
+    return TRUE;
 
   default:
     LOG_W(PDCP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status);
-- 
GitLab