aboutsummaryrefslogtreecommitdiffstats
path: root/src/tbf_dl.cpp
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2014-08-15 16:52:09 +0200
committerDaniel Willmann <daniel@totalueberwachung.de>2014-09-10 19:04:46 +0200
commite481815583d9f7b93e9e0d76b1e29b5444f4a732 (patch)
tree9da32053ed65d759ee689f4f8ccbc7ea7cc0641f /src/tbf_dl.cpp
parent08e57c836699d3e509ad2c9539ac3b70f9df09e4 (diff)
tbf,bts: Keep track of new TBF for dl/ul assignment in m_new_tbf
There are a couple of possibilities where one TBF is used to assign a new one: 1. Assign a DL TBF from a UL TBF 2. Assign a UL TBF from a DL TBF 3. Assign a DL TBF from a DL TBF which is in wait-release state (T3193 is running) In these cases the assignment is sent on the existing TBF and triggers the assignement of the new TBF (with different TFI/direction). The current code detects these situations by looking at dl/ul_ass_state and then chosing the TBF with the opposite direction (DL/UL) that has the same TLLI. This does not work in the case 3 above where a new DL TBF is triggered for a DL TBF. The current code reuses the old TBF (and TFI), but this violates the spec. This patch introduces a m_new_tbf member which is set to the new TBF to be assigned. When receiving a control ack the code looks up the n_new_tbf member of the tbf that requested the control ack and completes the ul/dl assignment. If the old TBF was in the wait release state (T3193 is running) it is released. From 3GPP TS 04.60 9.3.2.6: """ If the network has received the PACKET DOWNLINK ACK/NACK message with the Final Ack Indicator bit set to '1' and has new data to transmit for the mobile station, the network may establish a new downlink TBF for the mobile station by sending the PACKET DOWNLINK ASSIGNMENT or PACKET TIMESLOT RECONFIGURE message with the Control Ack bit set to '1' on PACCH. In case the network establishes a new downlink TBF for the mobile station, the network shall stop timer T3193. """ reuse_tbf() is modified to allocate a new TBF with a new TFI and trigger a dl assignment for that TBF on the old TBF. All pending data is moved to the new TBF. Ticket: SYS#382 Sponsored-by: On-Waves ehf
Diffstat (limited to 'src/tbf_dl.cpp')
-rw-r--r--src/tbf_dl.cpp33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 8abea201..a715af78 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -643,10 +643,39 @@ int gprs_rlcmac_dl_tbf::rcvd_dl_ack(uint8_t final_ack, uint8_t ssn, uint8_t *rbb
void gprs_rlcmac_dl_tbf::reuse_tbf(const uint8_t *data, const uint16_t len)
{
+ uint8_t trx;
+ struct gprs_rlcmac_dl_tbf *new_tbf;
+ int8_t tfi; /* must be signed */
+ int rc;
+ struct msgb *msg;
+
bts->tbf_reused();
- m_llc.put_frame(data, len);
+
+ tfi = bts->tfi_find_free(GPRS_RLCMAC_DL_TBF, &trx, this->trx->trx_no);
+ if (tfi < 0) {
+ LOGP(DRLCMAC, LOGL_NOTICE, "No PDCH resource\n");
+ /* FIXME: send reject */
+ return;
+ }
+ new_tbf = tbf_alloc_dl_tbf(bts->bts_data(), NULL, tfi, trx, ms_class, 0);
+ if (!new_tbf) {
+ LOGP(DRLCMAC, LOGL_NOTICE, "No PDCH resource\n");
+ /* FIXME: send reject */
+ return;
+ }
+
+ new_tbf->m_tlli = m_tlli;
+ new_tbf->m_tlli_valid = m_tlli_valid;
+ new_tbf->ta = ta;
+ new_tbf->assign_imsi(m_imsi);
+
+ /* Copy over all data to the new TBF */
+ new_tbf->m_llc.put_frame(data, len);
bts->llc_frame_sched();
+ while ((msg = m_llc.dequeue()))
+ new_tbf->m_llc.enqueue(msg);
+
/* reset rlc states */
m_tx_counter = 0;
m_wait_confirm = 0;
@@ -661,7 +690,7 @@ void gprs_rlcmac_dl_tbf::reuse_tbf(const uint8_t *data, const uint16_t len)
LOGP(DRLCMAC, LOGL_DEBUG, "%s Trigger dowlink assignment on PACCH, "
"because another LLC PDU has arrived in between\n",
tbf_name(this));
- bts->trigger_dl_ass(this, this, NULL);
+ bts->trigger_dl_ass(new_tbf, this, NULL);
}
bool gprs_rlcmac_dl_tbf::dl_window_stalled() const