bts: Simplify rcv_resource_request, remove logically dead code
tbf = find if (tbf) { tbf_free(tbf); tbf = NULL; } if (!tbf) { code... } Remove the if (!tbf) and indention as the tbf is always to be NULL.
This commit is contained in:
parent
8021644e9d
commit
6b88cddc21
112
src/bts.cpp
112
src/bts.cpp
|
@ -1019,6 +1019,10 @@ void gprs_rlcmac_pdch::rcv_resource_request(Packet_Resource_Request_t *request,
|
||||||
|
|
||||||
if (request->ID.UnionType) {
|
if (request->ID.UnionType) {
|
||||||
uint32_t tlli = request->ID.u.TLLI;
|
uint32_t tlli = request->ID.u.TLLI;
|
||||||
|
uint8_t ms_class = 0;
|
||||||
|
struct gprs_rlcmac_tbf *dl_tbf;
|
||||||
|
uint8_t ta;
|
||||||
|
|
||||||
tbf = bts()->tbf_by_tlli(tlli, GPRS_RLCMAC_UL_TBF);
|
tbf = bts()->tbf_by_tlli(tlli, GPRS_RLCMAC_UL_TBF);
|
||||||
if (tbf) {
|
if (tbf) {
|
||||||
LOGP(DRLCMACUL, LOGL_NOTICE, "Got RACH from "
|
LOGP(DRLCMACUL, LOGL_NOTICE, "Got RACH from "
|
||||||
|
@ -1028,69 +1032,65 @@ void gprs_rlcmac_pdch::rcv_resource_request(Packet_Resource_Request_t *request,
|
||||||
tbf_free(tbf);
|
tbf_free(tbf);
|
||||||
tbf = NULL;
|
tbf = NULL;
|
||||||
}
|
}
|
||||||
if (!tbf) {
|
|
||||||
uint8_t ms_class = 0;
|
|
||||||
struct gprs_rlcmac_tbf *dl_tbf;
|
|
||||||
uint8_t ta;
|
|
||||||
|
|
||||||
if ((dl_tbf = bts()->tbf_by_tlli(tlli, GPRS_RLCMAC_DL_TBF))) {
|
if ((dl_tbf = bts()->tbf_by_tlli(tlli, GPRS_RLCMAC_DL_TBF))) {
|
||||||
LOGP(DRLCMACUL, LOGL_NOTICE, "Got RACH from "
|
LOGP(DRLCMACUL, LOGL_NOTICE, "Got RACH from "
|
||||||
"TLLI=0x%08x while DL TFI=%d still exists. "
|
"TLLI=0x%08x while DL TFI=%d still exists. "
|
||||||
"Killing pending DL TBF\n", tlli,
|
"Killing pending DL TBF\n", tlli,
|
||||||
dl_tbf->tfi);
|
dl_tbf->tfi);
|
||||||
tbf_free(dl_tbf);
|
tbf_free(dl_tbf);
|
||||||
}
|
}
|
||||||
LOGP(DRLCMAC, LOGL_DEBUG, "MS requests UL TBF "
|
LOGP(DRLCMAC, LOGL_DEBUG, "MS requests UL TBF "
|
||||||
|
"in packet resource request of single "
|
||||||
|
"block, so we provide one:\n");
|
||||||
|
sba = bts()->sba()->find(this, fn);
|
||||||
|
if (!sba) {
|
||||||
|
LOGP(DRLCMAC, LOGL_NOTICE, "MS requests UL TBF "
|
||||||
"in packet resource request of single "
|
"in packet resource request of single "
|
||||||
"block, so we provide one:\n");
|
"block, but there is no resource request "
|
||||||
sba = bts()->sba()->find(this, fn);
|
"scheduled!\n");
|
||||||
if (!sba) {
|
rc = bts()->timing_advance()->recall(tlli);
|
||||||
LOGP(DRLCMAC, LOGL_NOTICE, "MS requests UL TBF "
|
if (rc >= 0)
|
||||||
"in packet resource request of single "
|
ta = rc;
|
||||||
"block, but there is no resource request "
|
else
|
||||||
"scheduled!\n");
|
ta = 0;
|
||||||
rc = bts()->timing_advance()->recall(tlli);
|
} else {
|
||||||
if (rc >= 0)
|
ta = sba->ta;
|
||||||
ta = rc;
|
bts()->timing_advance()->remember(tlli, ta);
|
||||||
else
|
bts()->sba()->free_sba(sba);
|
||||||
ta = 0;
|
}
|
||||||
} else {
|
if (request->Exist_MS_Radio_Access_capability)
|
||||||
ta = sba->ta;
|
ms_class = Decoding::get_ms_class_by_capability(&request->MS_Radio_Access_capability);
|
||||||
bts()->timing_advance()->remember(tlli, ta);
|
if (!ms_class)
|
||||||
bts()->sba()->free_sba(sba);
|
LOGP(DRLCMAC, LOGL_NOTICE, "MS does not give us a class.\n");
|
||||||
}
|
tbf = tbf_alloc_ul(bts_data(), trx_no(), ms_class, tlli, ta, NULL);
|
||||||
if (request->Exist_MS_Radio_Access_capability)
|
if (!tbf)
|
||||||
ms_class = Decoding::get_ms_class_by_capability(&request->MS_Radio_Access_capability);
|
return;
|
||||||
if (!ms_class)
|
/* set control ts to current MS's TS, until assignment complete */
|
||||||
LOGP(DRLCMAC, LOGL_NOTICE, "MS does not give us a class.\n");
|
LOGP(DRLCMAC, LOGL_DEBUG, "Change control TS to %d until assinment is complete.\n", ts_no);
|
||||||
tbf = tbf_alloc_ul(bts_data(), trx_no(), ms_class, tlli, ta, NULL);
|
tbf->control_ts = ts_no;
|
||||||
if (!tbf)
|
/* schedule uplink assignment */
|
||||||
return;
|
tbf->ul_ass_state = GPRS_RLCMAC_UL_ASS_SEND_ASS;
|
||||||
/* set control ts to current MS's TS, until assignment complete */
|
debug_diagram(bts->bts, tbf->diag, "Res. REQ");
|
||||||
LOGP(DRLCMAC, LOGL_DEBUG, "Change control TS to %d until assinment is complete.\n", ts_no);
|
return;
|
||||||
tbf->control_ts = ts_no;
|
}
|
||||||
/* schedule uplink assignment */
|
|
||||||
tbf->ul_ass_state = GPRS_RLCMAC_UL_ASS_SEND_ASS;
|
if (request->ID.u.Global_TFI.UnionType) {
|
||||||
debug_diagram(bts->bts, tbf->diag, "Res. REQ");
|
int8_t tfi = request->ID.u.Global_TFI.u.DOWNLINK_TFI;
|
||||||
|
tbf = bts()->tbf_by_tfi(tfi, trx_no(), GPRS_RLCMAC_DL_TBF);
|
||||||
|
if (!tbf) {
|
||||||
|
LOGP(DRLCMAC, LOGL_NOTICE, "PACKET RESSOURCE REQ unknown downlink TFI=%d\n", tfi);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (request->ID.u.Global_TFI.UnionType) {
|
int8_t tfi = request->ID.u.Global_TFI.u.UPLINK_TFI;
|
||||||
int8_t tfi = request->ID.u.Global_TFI.u.DOWNLINK_TFI;
|
tbf = bts()->tbf_by_tfi(tfi, trx_no(), GPRS_RLCMAC_UL_TBF);
|
||||||
tbf = bts()->tbf_by_tfi(tfi, trx_no(), GPRS_RLCMAC_DL_TBF);
|
if (!tbf) {
|
||||||
if (!tbf) {
|
LOGP(DRLCMAC, LOGL_NOTICE, "PACKET RESSOURCE REQ unknown uplink TFI=%d\n", tfi);
|
||||||
LOGP(DRLCMAC, LOGL_NOTICE, "PACKET RESSOURCE REQ unknown downlink TFI=%d\n", tfi);
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
int8_t tfi = request->ID.u.Global_TFI.u.UPLINK_TFI;
|
|
||||||
tbf = bts()->tbf_by_tfi(tfi, trx_no(), GPRS_RLCMAC_UL_TBF);
|
|
||||||
if (!tbf) {
|
|
||||||
LOGP(DRLCMAC, LOGL_NOTICE, "PACKET RESSOURCE REQ unknown uplink TFI=%d\n", tfi);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGP(DRLCMAC, LOGL_ERROR, "RX: [PCU <- BTS] %s TFI: %u TLLI: 0x%08x FIXME: Packet resource request\n", (tbf->direction == GPRS_RLCMAC_UL_TBF) ? "UL" : "DL", tbf->tfi, tbf->tlli);
|
LOGP(DRLCMAC, LOGL_ERROR, "RX: [PCU <- BTS] %s TFI: %u TLLI: 0x%08x FIXME: Packet resource request\n", (tbf->direction == GPRS_RLCMAC_UL_TBF) ? "UL" : "DL", tbf->tfi, tbf->tlli);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue