aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gprs_rlcmac.h6
-rw-r--r--src/gprs_rlcmac_meas.cpp28
-rw-r--r--src/tbf.cpp10
-rw-r--r--src/tbf.h17
4 files changed, 33 insertions, 28 deletions
diff --git a/src/gprs_rlcmac.h b/src/gprs_rlcmac.h
index 148250ae..6f8a7a4f 100644
--- a/src/gprs_rlcmac.h
+++ b/src/gprs_rlcmac.h
@@ -62,10 +62,10 @@ struct gprs_rlcmac_cs {
uint8_t block_payload;
};
-int gprs_rlcmac_received_lost(struct gprs_rlcmac_tbf *tbf, uint16_t received,
+int gprs_rlcmac_received_lost(struct gprs_rlcmac_dl_tbf *tbf, uint16_t received,
uint16_t lost);
-int gprs_rlcmac_lost_rep(struct gprs_rlcmac_tbf *tbf);
+int gprs_rlcmac_lost_rep(struct gprs_rlcmac_dl_tbf *tbf);
int gprs_rlcmac_meas_rep(Packet_Measurement_Report_t *pmr);
@@ -73,7 +73,7 @@ int gprs_rlcmac_rssi(struct gprs_rlcmac_tbf *tbf, int8_t rssi);
int gprs_rlcmac_rssi_rep(struct gprs_rlcmac_tbf *tbf);
-int gprs_rlcmac_dl_bw(struct gprs_rlcmac_tbf *tbf, uint16_t octets);
+int gprs_rlcmac_dl_bw(struct gprs_rlcmac_dl_tbf *tbf, uint16_t octets);
/* TS 44.060 Section 10.4.7 Table 10.4.7.1: Payload Type field */
enum gprs_rlcmac_block_type {
diff --git a/src/gprs_rlcmac_meas.cpp b/src/gprs_rlcmac_meas.cpp
index 30958fc1..5a2e38e9 100644
--- a/src/gprs_rlcmac_meas.cpp
+++ b/src/gprs_rlcmac_meas.cpp
@@ -112,10 +112,10 @@ int gprs_rlcmac_rssi_rep(struct gprs_rlcmac_tbf *tbf)
*/
/* Lost frames reported from RLCMAC layer */
-int gprs_rlcmac_received_lost(struct gprs_rlcmac_tbf *tbf, uint16_t received,
+int gprs_rlcmac_received_lost(struct gprs_rlcmac_dl_tbf *tbf, uint16_t received,
uint16_t lost)
{
- struct timeval now_tv, *loss_tv = &tbf->meas.dl_loss_tv;
+ struct timeval now_tv, *loss_tv = &tbf->m_bw.dl_loss_tv;
uint32_t elapsed;
uint16_t sum = received + lost;
@@ -126,8 +126,8 @@ int gprs_rlcmac_received_lost(struct gprs_rlcmac_tbf *tbf, uint16_t received,
LOGP(DRLCMACMEAS, LOGL_DEBUG, "DL Loss of TLLI 0x%08x: Received: %4d "
"Lost: %4d Sum: %4d\n", tbf->tlli(), received, lost, sum);
- tbf->meas.dl_loss_received += received;
- tbf->meas.dl_loss_lost += lost;
+ tbf->m_bw.dl_loss_received += received;
+ tbf->m_bw.dl_loss_lost += lost;
gettimeofday(&now_tv, NULL);
elapsed = ((now_tv.tv_sec - loss_tv->tv_sec) << 7)
@@ -139,16 +139,16 @@ int gprs_rlcmac_received_lost(struct gprs_rlcmac_tbf *tbf, uint16_t received,
/* reset lost values and timestamp */
memcpy(loss_tv, &now_tv, sizeof(struct timeval));
- tbf->meas.dl_loss_received = 0;
- tbf->meas.dl_loss_lost = 0;
+ tbf->m_bw.dl_loss_received = 0;
+ tbf->m_bw.dl_loss_lost = 0;
return 0;
}
/* Give Lost report */
-int gprs_rlcmac_lost_rep(struct gprs_rlcmac_tbf *tbf)
+int gprs_rlcmac_lost_rep(struct gprs_rlcmac_dl_tbf *tbf)
{
- uint16_t sum = tbf->meas.dl_loss_lost + tbf->meas.dl_loss_received;
+ uint16_t sum = tbf->m_bw.dl_loss_lost + tbf->m_bw.dl_loss_received;
/* No measurement values */
if (!sum)
@@ -156,7 +156,7 @@ int gprs_rlcmac_lost_rep(struct gprs_rlcmac_tbf *tbf)
LOGP(DRLCMACMEAS, LOGL_INFO, "DL packet loss of IMSI=%s / TLLI=0x%08x: "
"%d%%\n", tbf->imsi(), tbf->tlli(),
- tbf->meas.dl_loss_lost * 100 / sum);
+ tbf->m_bw.dl_loss_lost * 100 / sum);
return 0;
}
@@ -166,12 +166,12 @@ int gprs_rlcmac_lost_rep(struct gprs_rlcmac_tbf *tbf)
* downlink bandwidth
*/
-int gprs_rlcmac_dl_bw(struct gprs_rlcmac_tbf *tbf, uint16_t octets)
+int gprs_rlcmac_dl_bw(struct gprs_rlcmac_dl_tbf *tbf, uint16_t octets)
{
- struct timeval now_tv, *bw_tv = &tbf->meas.dl_bw_tv;
+ struct timeval now_tv, *bw_tv = &tbf->m_bw.dl_bw_tv;
uint32_t elapsed;
- tbf->meas.dl_bw_octets += octets;
+ tbf->m_bw.dl_bw_octets += octets;
gettimeofday(&now_tv, NULL);
elapsed = ((now_tv.tv_sec - bw_tv->tv_sec) << 7)
@@ -181,11 +181,11 @@ int gprs_rlcmac_dl_bw(struct gprs_rlcmac_tbf *tbf, uint16_t octets)
LOGP(DRLCMACMEAS, LOGL_INFO, "DL Bandwitdh of IMSI=%s / TLLI=0x%08x: "
"%d KBits/s\n", tbf->imsi(), tbf->tlli(),
- tbf->meas.dl_bw_octets / elapsed);
+ tbf->m_bw.dl_bw_octets / elapsed);
/* reset bandwidth values timestamp */
memcpy(bw_tv, &now_tv, sizeof(struct timeval));
- tbf->meas.dl_bw_octets = 0;
+ tbf->m_bw.dl_bw_octets = 0;
return 0;
}
diff --git a/src/tbf.cpp b/src/tbf.cpp
index e5b8863c..647710c2 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -268,7 +268,10 @@ void tbf_free(struct gprs_rlcmac_tbf *tbf)
{
/* Give final measurement report */
gprs_rlcmac_rssi_rep(tbf);
- gprs_rlcmac_lost_rep(tbf);
+ if (tbf->direction == GPRS_RLCMAC_DL_TBF) {
+ gprs_rlcmac_dl_tbf *dl_tbf = static_cast<gprs_rlcmac_dl_tbf *>(tbf);
+ gprs_rlcmac_lost_rep(dl_tbf);
+ }
LOGP(DRLCMAC, LOGL_INFO, "%s free\n", tbf_name(tbf));
if (tbf->ul_ass_state != GPRS_RLCMAC_UL_ASS_NONE)
@@ -519,9 +522,7 @@ static int setup_tbf(struct gprs_rlcmac_tbf *tbf, struct gprs_rlcmac_bts *bts,
}
/* set timestamp */
- gettimeofday(&tbf->meas.dl_bw_tv, NULL);
gettimeofday(&tbf->meas.rssi_tv, NULL);
- gettimeofday(&tbf->meas.dl_loss_tv, NULL);
tbf->m_llc.init();
return 0;
@@ -591,6 +592,9 @@ struct gprs_rlcmac_dl_tbf *tbf_alloc_dl_tbf(struct gprs_rlcmac_bts *bts,
llist_add(&tbf->list.list, &bts->dl_tbfs);
tbf->bts->tbf_dl_created();
+ gettimeofday(&tbf->m_bw.dl_bw_tv, NULL);
+ gettimeofday(&tbf->m_bw.dl_loss_tv, NULL);
+
return tbf;
}
diff --git a/src/tbf.h b/src/tbf.h
index 22504e7e..54781c0f 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -179,17 +179,9 @@ struct gprs_rlcmac_tbf {
unsigned int num_fT_exp; /* number of consecutive fT expirations */
struct {
- struct timeval dl_bw_tv; /* timestamp for dl bw calculation */
- uint32_t dl_bw_octets; /* number of octets since bw_tv */
-
struct timeval rssi_tv; /* timestamp for rssi calculation */
int32_t rssi_sum; /* sum of rssi values */
int rssi_num; /* number of rssi values added since rssi_tv */
-
- struct timeval dl_loss_tv; /* timestamp for loss calculation */
- uint16_t dl_loss_lost; /* sum of lost packets */
- uint16_t dl_loss_received; /* sum of received packets */
-
} meas;
uint8_t cs; /* current coding scheme */
@@ -319,6 +311,15 @@ struct gprs_rlcmac_dl_tbf : public gprs_rlcmac_tbf {
int32_t m_tx_counter; /* count all transmitted blocks */
uint8_t m_wait_confirm; /* wait for CCCH IMM.ASS cnf */
+ struct {
+ struct timeval dl_bw_tv; /* timestamp for dl bw calculation */
+ uint32_t dl_bw_octets; /* number of octets since bw_tv */
+
+ struct timeval dl_loss_tv; /* timestamp for loss calculation */
+ uint16_t dl_loss_lost; /* sum of lost packets */
+ uint16_t dl_loss_received; /* sum of received packets */
+ } m_bw;
+
protected:
struct msgb *create_new_bsn(const uint32_t fn, const uint8_t ts);
struct msgb *create_dl_acked_block(const uint32_t fn, const uint8_t ts,