aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-11-27 15:17:34 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-12-15 15:17:51 +0100
commit86b6f05d19c8559b99d548730e54c1a4bfb7beba (patch)
treef22e5bd988217e5f2b4164d0613381829b69a58b /src
parent5643f35fb4d09b160c4cd14c8e0ef6f2b7dce07e (diff)
edge: Support EGPRS multislot class handling in tbf_alloc
Add an egprs_ms_class argument to the allocation functions and set/pass it where necessary. Sponsored-by: On-Waves ehf
Diffstat (limited to 'src')
-rw-r--r--src/bts.cpp11
-rw-r--r--src/bts.h2
-rw-r--r--src/tbf.cpp25
-rw-r--r--src/tbf.h6
-rw-r--r--src/tbf_dl.cpp7
5 files changed, 28 insertions, 23 deletions
diff --git a/src/bts.cpp b/src/bts.cpp
index 26077c2..0e3e8f0 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -491,7 +491,7 @@ int BTS::rcv_rach(uint8_t ra, uint32_t Fn, int16_t qta)
// Create new TBF
#warning "Copy and pate with other routines.."
/* set class to 0, since we don't know the multislot class yet */
- tbf = tbf_alloc_ul_tbf(&m_bts, NULL, -1, 0, 1);
+ tbf = tbf_alloc_ul_tbf(&m_bts, NULL, -1, 0, 0, 1);
if (!tbf) {
LOGP(DRLCMAC, LOGL_NOTICE, "No PDCH resource\n");
/* FIXME: send reject */
@@ -580,13 +580,14 @@ void BTS::snd_dl_ass(gprs_rlcmac_tbf *tbf, uint8_t poll, const char *imsi)
}
-GprsMs *BTS::ms_alloc(uint8_t ms_class)
+GprsMs *BTS::ms_alloc(uint8_t ms_class, uint8_t egprs_ms_class)
{
GprsMs *ms;
ms = ms_store().create_ms();
ms->set_timeout(m_bts.ms_idle_sec);
ms->set_ms_class(ms_class);
+ ms->set_egprs_ms_class(egprs_ms_class);
return ms;
}
@@ -968,7 +969,8 @@ void gprs_rlcmac_pdch::rcv_control_dl_ack_nack(Packet_Downlink_Ack_Nack_t *ack_n
"message, so we provide one:\n");
/* This call will register the new TBF with the MS on success */
- tbf_alloc_ul(bts_data(), tbf->trx->trx_no, tbf->ms_class(),
+ tbf_alloc_ul(bts_data(), tbf->trx->trx_no,
+ tbf->ms_class(), tbf->ms()->egprs_ms_class(),
tbf->tlli(), tbf->ta(), tbf->ms());
/* schedule uplink assignment */
@@ -1053,7 +1055,8 @@ void gprs_rlcmac_pdch::rcv_resource_request(Packet_Resource_Request_t *request,
LOGP(DRLCMAC, LOGL_NOTICE,
"MS supports EGPRS multislot class %d.\n",
egprs_ms_class);
- ul_tbf = tbf_alloc_ul(bts_data(), trx_no(), ms_class, tlli, ta, ms);
+ ul_tbf = tbf_alloc_ul(bts_data(), trx_no(), ms_class,
+ egprs_ms_class, tlli, ta, ms);
if (!ul_tbf)
return;
diff --git a/src/bts.h b/src/bts.h
index 002d450..8831aca 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -275,7 +275,7 @@ public:
GprsMsStorage &ms_store();
GprsMs *ms_by_tlli(uint32_t tlli, uint32_t old_tlli = 0);
GprsMs *ms_by_imsi(const char *imsi);
- GprsMs *ms_alloc(uint8_t ms_class);
+ GprsMs *ms_alloc(uint8_t ms_class, uint8_t egprs_ms_class = 0);
/*
* Statistics
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 0fc6edf..2d0aa9f 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -271,7 +271,7 @@ void gprs_rlcmac_tbf::update_ms(uint32_t tlli, enum gprs_rlcmac_tbf_direction di
}
gprs_rlcmac_ul_tbf *tbf_alloc_ul(struct gprs_rlcmac_bts *bts,
- int8_t use_trx, uint8_t ms_class,
+ int8_t use_trx, uint8_t ms_class, uint8_t egprs_ms_class,
uint32_t tlli, uint8_t ta, GprsMs *ms)
{
struct gprs_rlcmac_ul_tbf *tbf;
@@ -279,7 +279,7 @@ gprs_rlcmac_ul_tbf *tbf_alloc_ul(struct gprs_rlcmac_bts *bts,
#warning "Copy and paste with tbf_new_dl_assignment"
/* create new TBF, use same TRX as DL TBF */
/* use multislot class of downlink TBF */
- tbf = tbf_alloc_ul_tbf(bts, ms, use_trx, ms_class, 0);
+ tbf = tbf_alloc_ul_tbf(bts, ms, use_trx, ms_class, egprs_ms_class, 0);
if (!tbf) {
LOGP(DRLCMAC, LOGL_NOTICE, "No PDCH resource\n");
/* FIXME: send reject */
@@ -537,7 +537,7 @@ void gprs_rlcmac_tbf::poll_timeout()
static int setup_tbf(struct gprs_rlcmac_tbf *tbf,
GprsMs *ms, int8_t use_trx,
- uint8_t ms_class, uint8_t single_slot)
+ uint8_t ms_class, uint8_t egprs_ms_class, uint8_t single_slot)
{
int rc;
struct gprs_rlcmac_bts *bts;
@@ -594,14 +594,14 @@ static int ul_tbf_dtor(struct gprs_rlcmac_ul_tbf *tbf)
struct gprs_rlcmac_ul_tbf *tbf_alloc_ul_tbf(struct gprs_rlcmac_bts *bts,
GprsMs *ms, int8_t use_trx,
- uint8_t ms_class, uint8_t single_slot)
+ uint8_t ms_class, uint8_t egprs_ms_class, uint8_t single_slot)
{
struct gprs_rlcmac_ul_tbf *tbf;
int rc;
LOGP(DRLCMAC, LOGL_DEBUG, "********** TBF starts here **********\n");
- LOGP(DRLCMAC, LOGL_INFO, "Allocating %s TBF: MS_CLASS=%d\n",
- "UL", ms_class);
+ LOGP(DRLCMAC, LOGL_INFO, "Allocating %s TBF: MS_CLASS=%d/%d\n",
+ "UL", ms_class, egprs_ms_class);
tbf = talloc(tall_pcu_ctx, struct gprs_rlcmac_ul_tbf);
@@ -612,9 +612,9 @@ struct gprs_rlcmac_ul_tbf *tbf_alloc_ul_tbf(struct gprs_rlcmac_bts *bts,
new (tbf) gprs_rlcmac_ul_tbf(bts->bts);
if (!ms)
- ms = bts->bts->ms_alloc(ms_class);
+ ms = bts->bts->ms_alloc(ms_class, egprs_ms_class);
- rc = setup_tbf(tbf, ms, use_trx, ms_class, single_slot);
+ rc = setup_tbf(tbf, ms, use_trx, ms_class, egprs_ms_class, single_slot);
/* if no resource */
if (rc < 0) {
talloc_free(tbf);
@@ -656,7 +656,7 @@ static int dl_tbf_dtor(struct gprs_rlcmac_dl_tbf *tbf)
struct gprs_rlcmac_dl_tbf *tbf_alloc_dl_tbf(struct gprs_rlcmac_bts *bts,
GprsMs *ms, int8_t use_trx,
- uint8_t ms_class, uint8_t single_slot)
+ uint8_t ms_class, uint8_t egprs_ms_class, uint8_t single_slot)
{
struct gprs_rlcmac_dl_tbf *tbf;
int rc;
@@ -674,9 +674,9 @@ struct gprs_rlcmac_dl_tbf *tbf_alloc_dl_tbf(struct gprs_rlcmac_bts *bts,
new (tbf) gprs_rlcmac_dl_tbf(bts->bts);
if (!ms)
- ms = bts->bts->ms_alloc(ms_class);
+ ms = bts->bts->ms_alloc(ms_class, egprs_ms_class);
- rc = setup_tbf(tbf, ms, use_trx, ms_class, single_slot);
+ rc = setup_tbf(tbf, ms, use_trx, ms_class, 0, single_slot);
/* if no resource */
if (rc < 0) {
talloc_free(tbf);
@@ -971,7 +971,8 @@ int gprs_rlcmac_tbf::establish_dl_tbf_on_pacch()
bts->tbf_reused();
new_tbf = tbf_alloc_dl_tbf(bts->bts_data(), ms(),
- this->trx->trx_no, ms_class(), 0);
+ this->trx->trx_no, ms_class(),
+ ms() ? ms()->egprs_ms_class() : 0, 0);
if (!new_tbf) {
LOGP(DRLCMAC, LOGL_NOTICE, "No PDCH resource\n");
diff --git a/src/tbf.h b/src/tbf.h
index 43da206..9775397 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -258,16 +258,16 @@ private:
struct gprs_rlcmac_ul_tbf *tbf_alloc_ul(struct gprs_rlcmac_bts *bts,
- int8_t use_trx, uint8_t ms_class,
+ int8_t use_trx, uint8_t ms_class, uint8_t egprs_ms_class,
uint32_t tlli, uint8_t ta, GprsMs *ms);
struct gprs_rlcmac_ul_tbf *tbf_alloc_ul_tbf(struct gprs_rlcmac_bts *bts,
GprsMs *ms, int8_t use_trx,
- uint8_t ms_class, uint8_t single_slot);
+ uint8_t ms_class, uint8_t egprs_ms_class, uint8_t single_slot);
struct gprs_rlcmac_dl_tbf *tbf_alloc_dl_tbf(struct gprs_rlcmac_bts *bts,
GprsMs *ms, int8_t use_trx,
- uint8_t ms_class, uint8_t single_slot);
+ uint8_t ms_class, uint8_t egprs_ms_class, uint8_t single_slot);
void tbf_free(struct gprs_rlcmac_tbf *tbf);
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 64fbef4..d07f323 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -128,6 +128,7 @@ static int tbf_new_dl_assignment(struct gprs_rlcmac_bts *bts,
const char *imsi,
const uint32_t tlli, const uint32_t tlli_old,
const uint8_t ms_class,
+ const uint8_t egprs_ms_class,
struct gprs_rlcmac_dl_tbf **tbf)
{
uint8_t ss;
@@ -161,7 +162,7 @@ static int tbf_new_dl_assignment(struct gprs_rlcmac_bts *bts,
// Create new TBF (any TRX)
#warning "Copy and paste with alloc_ul_tbf"
/* set number of downlink slots according to multislot class */
- dl_tbf = tbf_alloc_dl_tbf(bts, ms, use_trx, ms_class, ss);
+ dl_tbf = tbf_alloc_dl_tbf(bts, ms, use_trx, ms_class, egprs_ms_class, ss);
if (!dl_tbf) {
LOGP(DRLCMAC, LOGL_NOTICE, "No PDCH resource\n");
@@ -235,8 +236,8 @@ int gprs_rlcmac_dl_tbf::handle(struct gprs_rlcmac_bts *bts,
}
if (!dl_tbf) {
- rc = tbf_new_dl_assignment(bts, imsi, tlli, tlli_old, ms_class,
- &dl_tbf);
+ rc = tbf_new_dl_assignment(bts, imsi, tlli, tlli_old,
+ ms_class, 0, &dl_tbf);
if (rc < 0)
return rc;
}