aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-10-27 20:57:35 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-10-30 21:24:13 +0100
commit5464c9baf274950b051cbe7a597001343f4f5c07 (patch)
tree320de9c63da9135c3baf04cdde2edf5dad6d87d4 /src
parent34f6e5ebe63f46ccf4ce97899c66a83f6f39d355 (diff)
tbf: Have one imsi field and assign it through a function
Have one IMSI field per TBF and assign through a function call. The IMSI should be used to look-up the TBF on the SGSN->PCU direction.
Diffstat (limited to 'src')
-rw-r--r--src/bts.cpp2
-rw-r--r--src/gprs_rlcmac_meas.cpp4
-rw-r--r--src/tbf.cpp18
-rw-r--r--src/tbf.h14
4 files changed, 23 insertions, 15 deletions
diff --git a/src/bts.cpp b/src/bts.cpp
index 285c184..91436f7 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -481,7 +481,7 @@ void BTS::trigger_dl_ass(
/* change state */
tbf_new_state(tbf, GPRS_RLCMAC_ASSIGN);
tbf->state_flags |= (1 << GPRS_RLCMAC_FLAG_CCCH);
- strncpy(tbf->dir.dl.imsi, imsi, sizeof(tbf->dir.dl.imsi));
+ tbf->assign_imsi(imsi);
/* send immediate assignment */
tbf->bts->snd_dl_ass(tbf, 0, imsi);
tbf->dir.dl.wait_confirm = 1;
diff --git a/src/gprs_rlcmac_meas.cpp b/src/gprs_rlcmac_meas.cpp
index 5bb74cd..dd9de5a 100644
--- a/src/gprs_rlcmac_meas.cpp
+++ b/src/gprs_rlcmac_meas.cpp
@@ -154,7 +154,7 @@ int gprs_rlcmac_lost_rep(struct gprs_rlcmac_tbf *tbf)
return -EINVAL;
LOGP(DRLCMACMEAS, LOGL_INFO, "DL packet loss of IMSI=%s / TLLI=0x%08x: "
- "%d%%\n", tbf->meas.imsi, tbf->tlli(),
+ "%d%%\n", tbf->imsi(), tbf->tlli(),
tbf->meas.dl_loss_lost * 100 / sum);
return 0;
@@ -179,7 +179,7 @@ int gprs_rlcmac_dl_bw(struct gprs_rlcmac_tbf *tbf, uint16_t octets)
return 0;
LOGP(DRLCMACMEAS, LOGL_INFO, "DL Bandwitdh of IMSI=%s / TLLI=0x%08x: "
- "%d KBits/s\n", tbf->meas.imsi, tbf->tlli(),
+ "%d KBits/s\n", tbf->imsi(), tbf->tlli(),
tbf->meas.dl_bw_octets / elapsed);
/* reset bandwidth values timestamp */
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 0e2481b..fac5aaf 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -72,10 +72,10 @@ static inline void tbf_update_ms_class(struct gprs_rlcmac_tbf *tbf,
tbf->ms_class = ms_class;
}
-static inline void tbf_assign_imsi(struct gprs_rlcmac_tbf *tbf,
- const char *imsi)
+void gprs_rlcmac_tbf::assign_imsi(const char *imsi)
{
- strncpy(tbf->meas.imsi, imsi, sizeof(tbf->meas.imsi) - 1);
+ strncpy(m_imsi, imsi, sizeof(m_imsi));
+ m_imsi[sizeof(m_imsi) - 1] = '\0';
}
static struct gprs_rlcmac_tbf *tbf_lookup_dl(BTS *bts,
@@ -205,14 +205,14 @@ static int tbf_new_dl_assignment(struct gprs_rlcmac_bts *bts,
memcpy(tbf->llc_frame, data, len);
tbf->llc_length = len;
+ /* Store IMSI for later look-up and PCH retransmission */
+ tbf->assign_imsi(imsi);
+
/* trigger downlink assignment and set state to ASSIGN.
* we don't use old_downlink, so the possible uplink is used
* to trigger downlink assignment. if there is no uplink,
* AGCH is used. */
tbf->bts->trigger_dl_ass(tbf, old_tbf, imsi);
-
- /* store IMSI for debugging purpose. TODO: it is more than debugging */
- tbf_assign_imsi(tbf, imsi);
return 0;
}
@@ -232,7 +232,7 @@ int tbf_handle(struct gprs_rlcmac_bts *bts,
int rc = tbf_append_data(tbf, bts, ms_class,
delay_csec, data, len);
if (rc >= 0)
- tbf_assign_imsi(tbf, imsi);
+ tbf->assign_imsi(imsi);
return rc;
}
@@ -526,9 +526,9 @@ void gprs_rlcmac_tbf::poll_timeout()
LOGP(DRLCMAC, LOGL_DEBUG, "Re-send dowlink assignment "
"for %s on PCH (IMSI=%s)\n",
tbf_name(this),
- dir.dl.imsi);
+ m_imsi);
/* send immediate assignment */
- bts->snd_dl_ass(this, 0, dir.dl.imsi);
+ bts->snd_dl_ass(this, 0, m_imsi);
dir.dl.wait_confirm = 1;
}
} else
diff --git a/src/tbf.h b/src/tbf.h
index e8b66c9..e31653d 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -122,6 +122,9 @@ struct gprs_rlcmac_tbf {
uint8_t tfi() const;
+ const char *imsi() const;
+ void assign_imsi(const char *imsi);
+
struct llist_head list;
uint32_t state_flags;
enum gprs_rlcmac_tbf_direction direction;
@@ -161,7 +164,6 @@ struct gprs_rlcmac_tbf {
uint16_t v_a; /* ack state */
char v_b[RLC_MAX_SNS/2]; /* acknowledge state array */
int32_t tx_counter; /* count all transmitted blocks */
- char imsi[16]; /* store IMSI for PCH retransmission */
uint8_t wait_confirm; /* wait for CCCH IMM.ASS cnf */
} dl;
struct {
@@ -190,8 +192,6 @@ struct gprs_rlcmac_tbf {
unsigned int num_fT_exp; /* number of consecutive fT expirations */
struct {
- char imsi[16];
-
struct timeval dl_bw_tv; /* timestamp for dl bw calculation */
uint32_t dl_bw_octets; /* number of octets since bw_tv */
@@ -227,6 +227,9 @@ struct gprs_rlcmac_tbf {
uint8_t m_tlli_valid;
uint8_t m_tfi;
+ /* store IMSI for look-up and PCH retransmission */
+ char m_imsi[16];
+
protected:
gprs_rlcmac_bts *bts_data() const;
@@ -287,4 +290,9 @@ inline uint8_t gprs_rlcmac_tbf::tfi() const
return m_tfi;
}
+inline const char *gprs_rlcmac_tbf::imsi() const
+{
+ return m_imsi;
+}
+
const char *tbf_name(gprs_rlcmac_tbf *tbf);