This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Max gerrit-no-reply at lists.osmocom.orgHello Harald Welte, Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/3156
to look at the new patch set (#3).
Move common code into functions
* separate channel request responder into inline function
* move generic TBF poll check into inline function
Change-Id: I9ec3ab8de100f0bc75044f55ac769d1083d52806
Related: OS#1539
---
M src/bts.cpp
1 file changed, 36 insertions(+), 57 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/56/3156/3
diff --git a/src/bts.cpp b/src/bts.cpp
index 799188b..21d5b17 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -360,39 +360,37 @@
return 0;
}
+static inline bool tbf_check(gprs_rlcmac_tbf *tbf, uint32_t fn, uint8_t trx_no, uint8_t ts)
+{
+ if (tbf->state_is_not(GPRS_RLCMAC_RELEASING) && tbf->poll_state == GPRS_RLCMAC_POLL_SCHED
+ && tbf->poll_fn == fn && tbf->trx->trx_no == trx_no && tbf->poll_ts == ts)
+ return true;
+
+ return false;
+}
+
gprs_rlcmac_dl_tbf *BTS::dl_tbf_by_poll_fn(uint32_t fn, uint8_t trx, uint8_t ts)
{
- struct gprs_rlcmac_dl_tbf *tbf;
LListHead<gprs_rlcmac_tbf> *pos;
/* only one TBF can poll on specific TS/FN, because scheduler can only
* schedule one downlink control block (with polling) at a FN per TS */
llist_for_each(pos, &m_dl_tbfs) {
- tbf = as_dl_tbf(pos->entry());
- if (tbf->state_is_not(GPRS_RLCMAC_RELEASING)
- && tbf->poll_state == GPRS_RLCMAC_POLL_SCHED
- && tbf->poll_fn == fn && tbf->trx->trx_no == trx
- && tbf->poll_ts == ts) {
- return tbf;
- }
+ if (tbf_check(pos->entry(), fn, trx, ts))
+ return as_dl_tbf(pos->entry());
}
return NULL;
}
+
gprs_rlcmac_ul_tbf *BTS::ul_tbf_by_poll_fn(uint32_t fn, uint8_t trx, uint8_t ts)
{
- struct gprs_rlcmac_ul_tbf *tbf;
LListHead<gprs_rlcmac_tbf> *pos;
/* only one TBF can poll on specific TS/FN, because scheduler can only
* schedule one downlink control block (with polling) at a FN per TS */
llist_for_each(pos, &m_ul_tbfs) {
- tbf = as_ul_tbf(pos->entry());
- if (tbf->state_is_not(GPRS_RLCMAC_RELEASING)
- && tbf->poll_state == GPRS_RLCMAC_POLL_SCHED
- && tbf->poll_fn == fn && tbf->trx->trx_no == trx
- && tbf->poll_ts == ts) {
- return tbf;
- }
+ if (tbf_check(pos->entry(), fn, trx, ts))
+ return as_ul_tbf(pos->entry());
}
return NULL;
}
@@ -1147,6 +1145,24 @@
}
}
+static inline void sched_ul_ass_or_rej(BTS *bts, gprs_rlcmac_bts *bts_data, struct gprs_rlcmac_dl_tbf *tbf)
+{
+ bts->channel_request_description();
+
+ /* This call will register the new TBF with the MS on success */
+ gprs_rlcmac_ul_tbf *ul_tbf = 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 or reject */
+ if (ul_tbf) {
+ LOGP(DRLCMAC, LOGL_DEBUG, "MS requests UL TBF in ack message, so we provide one:\n");
+ tbf->ul_ass_state = GPRS_RLCMAC_UL_ASS_SEND_ASS;
+ } else {
+ LOGP(DRLCMAC, LOGL_DEBUG, "MS requests UL TBF in ack message, so we packet access reject:\n");
+ tbf->ul_ass_state = GPRS_RLCMAC_UL_ASS_SEND_ASS_REJ;
+ }
+}
+
void gprs_rlcmac_pdch::rcv_control_dl_ack_nack(Packet_Downlink_Ack_Nack_t *ack_nack, uint32_t fn)
{
int8_t tfi = 0; /* must be signed */
@@ -1201,27 +1217,9 @@
return;
}
/* check for channel request */
- if (ack_nack->Exist_Channel_Request_Description) {
+ if (ack_nack->Exist_Channel_Request_Description)
+ sched_ul_ass_or_rej(bts(), bts_data(), tbf);
- bts()->channel_request_description();
-
- /* This call will register the new TBF with the MS on success */
- gprs_rlcmac_ul_tbf *ul_tbf = 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 or reject*/
- if (ul_tbf) {
- LOGP(DRLCMAC, LOGL_DEBUG, "MS requests UL TBF in ack "
- "message, so we provide one:\n");
- tbf->ul_ass_state = GPRS_RLCMAC_UL_ASS_SEND_ASS;
- } else {
- LOGP(DRLCMAC, LOGL_DEBUG, "MS requests UL TBF in ack "
- "message, so we pacekt access reject:\n");
- tbf->ul_ass_state = GPRS_RLCMAC_UL_ASS_SEND_ASS_REJ;
- }
- }
/* get measurements */
if (tbf->ms()) {
get_meas(&meas, &ack_nack->Channel_Quality_Report);
@@ -1306,27 +1304,8 @@
}
/* check for channel request */
- if (ack_nack->Exist_ChannelRequestDescription) {
-
- bts()->channel_request_description();
-
- /* This call will register the new TBF with the MS on success */
- gprs_rlcmac_ul_tbf *ul_tbf = 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 or reject*/
- if (ul_tbf) {
- LOGP(DRLCMAC, LOGL_DEBUG, "MS requests UL TBF in ack "
- "message, so we provide one:\n");
- tbf->ul_ass_state = GPRS_RLCMAC_UL_ASS_SEND_ASS;
- } else {
- LOGP(DRLCMAC, LOGL_DEBUG, "MS requests UL TBF in ack "
- "message, so we send packet access reject:\n");
- tbf->ul_ass_state = GPRS_RLCMAC_UL_ASS_SEND_ASS_REJ;
- }
- }
+ if (ack_nack->Exist_ChannelRequestDescription)
+ sched_ul_ass_or_rej(bts(), bts_data(), tbf);
/* get measurements */
if (tbf->ms()) {
--
To view, visit https://gerrit.osmocom.org/3156
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I9ec3ab8de100f0bc75044f55ac769d1083d52806
Gerrit-PatchSet: 3
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder