aboutsummaryrefslogtreecommitdiffstats
path: root/src/gprs_bssgp_pcu.cpp
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-07-21 17:25:52 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-07-21 19:26:23 +0200
commit66ba0844be5058032cb31c6ee3e31428417b171f (patch)
tree3dcda8f238959987e9a058f0d2b033ab3e9cf48e /src/gprs_bssgp_pcu.cpp
parent6eed1911fd619fb594a9d1a7fc734c1f62ff2f08 (diff)
bssgp: Use measured leak rate for flow control (EXPERIMENTAL)
THIS IS EXPERIMENTAL, DO NOT USE IN PRODUCTION The leak rate sent to the SGSN does not reflect the current CS level, lost frames, and control message overhead. Use the ratio between sent blocks and successfully received bytes to derive the net leak rate. TODO: - The values are not stable, possibly resulting from interference with the sampling rate or from the interval between send and receive if they fall into different sampling intervals. - Perhaps the rate can be computed from sent data bytes / sent data frames or from the average packet size and the global nack rate.
Diffstat (limited to 'src/gprs_bssgp_pcu.cpp')
-rw-r--r--src/gprs_bssgp_pcu.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index 7601b21..f909aea 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -586,6 +586,23 @@ static uint32_t get_and_reset_avg_queue_delay(void)
return avg_delay_ms;
}
+static int get_and_reset_measured_leak_rate(int num_pdch)
+{
+ int rate; /* byte per second */
+
+ if (the_pcu.queue_frames_sent == 0)
+ return -1;
+
+ /* 20ms/num_pdch is the average RLC block duration */
+ rate = the_pcu.queue_bytes_recv * 1000 * num_pdch /
+ (20 * the_pcu.queue_frames_sent);
+
+ the_pcu.queue_frames_sent = 0;
+ the_pcu.queue_bytes_recv = 0;
+
+ return rate;
+}
+
int gprs_bssgp_tx_fc_bvc(void)
{
struct gprs_rlcmac_bts *bts;
@@ -625,6 +642,20 @@ int gprs_bssgp_tx_fc_bvc(void)
ms_leak_rate = bts->fc_ms_leak_rate;
if (leak_rate == 0) {
+ int meas_rate;
+
+ if (num_pdch < 0)
+ num_pdch = count_pdch(bts);
+
+ meas_rate = get_and_reset_measured_leak_rate(num_pdch);
+ if (meas_rate > 0) {
+ leak_rate = meas_rate;
+ LOGP(DBSSGP, LOGL_DEBUG,
+ "Measured BVC leak rate = %d\n", leak_rate);
+ }
+ }
+
+ if (leak_rate == 0) {
if (num_pdch < 0)
num_pdch = count_pdch(bts);
@@ -823,6 +854,16 @@ struct bssgp_bvc_ctx *gprs_bssgp_pcu_current_bctx(void)
return the_pcu.bctx;
}
+void gprs_bssgp_update_frames_sent()
+{
+ the_pcu.queue_frames_sent += 1;
+}
+
+void gprs_bssgp_update_bytes_received(unsigned bytes_recv)
+{
+ the_pcu.queue_bytes_recv += bytes_recv;
+}
+
void gprs_bssgp_update_queue_delay(const struct timeval *tv_recv,
const struct timeval *tv_now)
{