aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-08-24 21:26:42 +0200
committerIvan Kluchnikov <kluchnikovi@gmail.com>2013-10-18 15:17:43 +0400
commit869212836534e82c41180003cc939bcfdf79b7f7 (patch)
tree80e3f33c2c711ea3bf225d080985410fa9499018
parentbb20b2c64c5790c774bb179cee92aa01eb494cab (diff)
tbf: Move the alloc_ul_tbf into tbf.c and change signature
Add the bts parameter to the method list. This would be a static method of the class (in case the TBF would be a class)
-rw-r--r--src/gprs_rlcmac_data.cpp41
-rw-r--r--src/tbf.cpp35
-rw-r--r--src/tbf.h5
3 files changed, 43 insertions, 38 deletions
diff --git a/src/gprs_rlcmac_data.cpp b/src/gprs_rlcmac_data.cpp
index 17e1fb9b..bc55c574 100644
--- a/src/gprs_rlcmac_data.cpp
+++ b/src/gprs_rlcmac_data.cpp
@@ -21,6 +21,7 @@
#include <gprs_bssgp_pcu.h>
#include <gprs_rlcmac.h>
#include <pcu_l1_if.h>
+#include <tbf.h>
extern void *tall_pcu_ctx;
@@ -230,42 +231,6 @@ static uint8_t get_ms_class_by_capability(MS_Radio_Access_capability_t *cap)
return 0;
}
-static struct gprs_rlcmac_tbf *alloc_ul_tbf(int8_t use_trx, uint8_t ms_class,
- uint32_t tlli, uint8_t ta, struct gprs_rlcmac_tbf *dl_tbf)
-{
- struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts;
- uint8_t trx;
- struct gprs_rlcmac_tbf *tbf;
- uint8_t tfi;
-
-#warning "Copy and paste with tbf_new_dl_assignment"
- /* create new TBF, use sme TRX as DL TBF */
- tfi = tfi_find_free(bts, GPRS_RLCMAC_UL_TBF, &trx, use_trx);
- if (tfi < 0) {
- LOGP(DRLCMAC, LOGL_NOTICE, "No PDCH ressource\n");
- /* FIXME: send reject */
- return NULL;
- }
- /* use multislot class of downlink TBF */
- tbf = tbf_alloc(bts, dl_tbf, GPRS_RLCMAC_UL_TBF, tfi, trx, ms_class, 0);
- if (!tbf) {
- LOGP(DRLCMAC, LOGL_NOTICE, "No PDCH ressource\n");
- /* FIXME: send reject */
- return NULL;
- }
- tbf->tlli = tlli;
- tbf->tlli_valid = 1; /* no contention resolution */
- tbf->dir.ul.contention_resolution_done = 1;
- tbf->ta = ta; /* use current TA */
- tbf_new_state(tbf, GPRS_RLCMAC_ASSIGN);
- tbf->state_flags |= (1 << GPRS_RLCMAC_FLAG_PACCH);
- tbf_timer_start(tbf, 3169, bts->t3169, 0);
-
- return tbf;
-}
-
-
-
/* Received Uplink RLC control block. */
int gprs_rlcmac_rcv_control_block(bitvec *rlc_block, uint8_t trx, uint8_t ts,
uint32_t fn)
@@ -412,7 +377,7 @@ int gprs_rlcmac_rcv_control_block(bitvec *rlc_block, uint8_t trx, uint8_t ts,
if (ul_control_block->u.Packet_Downlink_Ack_Nack.Exist_Channel_Request_Description) {
LOGP(DRLCMAC, LOGL_DEBUG, "MS requests UL TBF in ack "
"message, so we provide one:\n");
- alloc_ul_tbf(tbf->trx, tbf->ms_class, tbf->tlli, tbf->ta, tbf);
+ tbf_alloc_ul(bts, tbf->trx, tbf->ms_class, tbf->tlli, tbf->ta, tbf);
/* schedule uplink assignment */
tbf->ul_ass_state = GPRS_RLCMAC_UL_ASS_SEND_ASS;
}
@@ -465,7 +430,7 @@ int gprs_rlcmac_rcv_control_block(bitvec *rlc_block, uint8_t trx, uint8_t ts,
ms_class = get_ms_class_by_capability(&ul_control_block->u.Packet_Resource_Request.MS_Radio_Access_capability);
if (!ms_class)
LOGP(DRLCMAC, LOGL_NOTICE, "MS does not give us a class.\n");
- tbf = alloc_ul_tbf(trx, ms_class, tlli, ta, NULL);
+ tbf = tbf_alloc_ul(bts, trx, ms_class, tlli, ta, NULL);
if (!tbf)
break;
/* set control ts to current MS's TS, until assignment complete */
diff --git a/src/tbf.cpp b/src/tbf.cpp
index cb8fb19d..79f1ea82 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -1,6 +1,7 @@
/* Copied from gprs_bssgp_pcu.cpp
*
* Copyright (C) 2012 Ivan Klyuchnikov
+ * Copyright (C) 2012 Andreas Eversberg <jolly@eversberg.eu>
* Copyright (C) 2013 by Holger Hans Peter Freyther
*
* This program is free software; you can redistribute it and/or
@@ -202,3 +203,37 @@ int tbf_handle(struct gprs_rlcmac_bts *bts,
return tbf_new_dl_assignment(bts, imsi, tlli, ms_class, data, len);
}
+
+struct gprs_rlcmac_tbf *tbf_alloc_ul(struct gprs_rlcmac_bts *bts,
+ int8_t use_trx, uint8_t ms_class,
+ uint32_t tlli, uint8_t ta, struct gprs_rlcmac_tbf *dl_tbf)
+{
+ uint8_t trx;
+ struct gprs_rlcmac_tbf *tbf;
+ uint8_t tfi;
+
+#warning "Copy and paste with tbf_new_dl_assignment"
+ /* create new TBF, use sme TRX as DL TBF */
+ tfi = tfi_find_free(bts, GPRS_RLCMAC_UL_TBF, &trx, use_trx);
+ if (tfi < 0) {
+ LOGP(DRLCMAC, LOGL_NOTICE, "No PDCH ressource\n");
+ /* FIXME: send reject */
+ return NULL;
+ }
+ /* use multislot class of downlink TBF */
+ tbf = tbf_alloc(bts, dl_tbf, GPRS_RLCMAC_UL_TBF, tfi, trx, ms_class, 0);
+ if (!tbf) {
+ LOGP(DRLCMAC, LOGL_NOTICE, "No PDCH ressource\n");
+ /* FIXME: send reject */
+ return NULL;
+ }
+ tbf->tlli = tlli;
+ tbf->tlli_valid = 1; /* no contention resolution */
+ tbf->dir.ul.contention_resolution_done = 1;
+ tbf->ta = ta; /* use current TA */
+ tbf_new_state(tbf, GPRS_RLCMAC_ASSIGN);
+ tbf->state_flags |= (1 << GPRS_RLCMAC_FLAG_PACCH);
+ tbf_timer_start(tbf, 3169, bts->t3169, 0);
+
+ return tbf;
+}
diff --git a/src/tbf.h b/src/tbf.h
index 1535e8c4..330eac1d 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -22,6 +22,11 @@
struct gprs_rlcmac_bts;
+/* dispatch Unitdata.DL messages */
int tbf_handle(struct gprs_rlcmac_bts *bts,
const uint32_t tlli, const char *imsi, const uint8_t ms_class,
const uint16_t delay_csec, const uint8_t *data, const uint16_t len);
+
+struct gprs_rlcmac_tbf *tbf_alloc_ul(struct gprs_rlcmac_bts *bts,
+ int8_t use_trx, uint8_t ms_class,
+ uint32_t tlli, uint8_t ta, struct gprs_rlcmac_tbf *dl_tbf);