From 5e043dac8c961995f6bd94b6c0206063efea63ec Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Sun, 15 Jul 2012 06:51:30 +0200 Subject: [PATCH] Polling for downlink ack/nack is performed only on suitable slot The slot must be the control channel TS, which is selected by the allocation algorithm. The MS must be able to respond at this TS. The counter to trigger polling is incremented until polling has to be performed. Then the counter stops. When the transmission of data block is requested on control channel TS, the counter is reset. The counter-value is also used to poll immediately when the transmission has finished. --- src/gprs_rlcmac_data.cpp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/gprs_rlcmac_data.cpp b/src/gprs_rlcmac_data.cpp index bbbcfd55..c95f41cf 100644 --- a/src/gprs_rlcmac_data.cpp +++ b/src/gprs_rlcmac_data.cpp @@ -1092,6 +1092,8 @@ do_resend: "done.\n"); li->e = 1; /* we cannot extend */ rh->fbi = 1; /* we indicate final block */ + tbf->dir.dl.tx_counter = ACK_AFTER_FRAMES + 1; + /* + 1 indicates: force polling */ tbf_new_state(tbf, GPRS_RLCMAC_FINISHED); break; } @@ -1116,27 +1118,31 @@ tx_block: len = tbf->rlc_block_len[index]; rh = (struct rlc_dl_header *)data; - /* Increment TX-counter */ - tbf->dir.dl.tx_counter++; - /* Clear Polling, if still set in history buffer */ rh->s_p = 0; /* poll after ACK_AFTER_FRAMES frames, or when final block is tx. */ - if (rh->fbi == 1 || (tbf->dir.dl.tx_counter % ACK_AFTER_FRAMES) == 0) { - if (rh->fbi == 1) { + if (tbf->dir.dl.tx_counter >= ACK_AFTER_FRAMES) { + if (tbf->dir.dl.tx_counter > ACK_AFTER_FRAMES) { + /* if rx_counter is ACK_AFTER_FRAMES + 1, this + * indicates: poll caused by final ack. */ LOGP(DRLCMACDL, LOGL_DEBUG, "- Scheduling Ack/Nack " "polling, because final block sent.\n"); - } - if ((tbf->dir.dl.tx_counter % ACK_AFTER_FRAMES) == 0) { + } else { LOGP(DRLCMACDL, LOGL_DEBUG, "- Scheduling Ack/Nack " "polling, because %d blocks sent.\n", ACK_AFTER_FRAMES); } + tbf->dir.dl.tx_counter = 0; + /* scheduling not possible, because: */ if (tbf->poll_state != GPRS_RLCMAC_POLL_NONE) - LOGP(DRLCMACDL, LOGL_DEBUG, "Polling is already " + LOGP(DRLCMAC, LOGL_DEBUG, "Polling is already " "sheduled for TBF=%d, so we must wait for " "requesting downlink ack\n", tbf->tfi); + else if (tbf->control_ts != ts) + LOGP(DRLCMAC, LOGL_DEBUG, "Polling cannot be " + "sheduled in this TS %d, waiting for " + "TS %d\n", ts, tbf->control_ts); else { /* start timer whenever we send the final block */ if (rh->fbi == 1) @@ -1149,7 +1155,13 @@ tx_block: /* set polling in header */ rh->rrbp = 0; /* N+13 */ rh->s_p = 1; /* Polling */ + + /* Increment TX-counter */ + tbf->dir.dl.tx_counter++; } + } else { + /* Increment TX-counter */ + tbf->dir.dl.tx_counter++; } /* return data block as message */