lapd_core: Perform N200 retransmissions, not N200-1

During testing with BTS_Tests_LAPDm.TC_t200_n200() it was discovered
that the existing LAPD[m] implementation always gave up at N200-1
retransmissions, rather than N200 retransmissions.

The first transmission doesn't count, and hence we must have N200
actual re-transmissions.  The Error message is then described as
"T200 expired N200+1 times", i.e. we start T200 one more time after
the last re-transmission and only give up if it expires again (i.e.
no ACK received)

Change-Id: Ic33854ee61311f73b7db55eeef10280349151097
Related: OS4037
This commit is contained in:
Harald Welte 2019-06-02 22:37:21 +02:00
parent 20de6207c2
commit 7a56952307
1 changed files with 4 additions and 4 deletions

View File

@ -564,7 +564,7 @@ static void lapd_t200_cb(void *data)
switch (dl->state) {
case LAPD_STATE_SABM_SENT:
/* 5.4.1.3 */
if (dl->retrans_ctr + 1 >= dl->n200_est_rel + 1) {
if (dl->retrans_ctr >= dl->n200_est_rel + 1) {
/* flush tx and send buffers */
lapd_dl_flush_tx(dl);
lapd_dl_flush_send(dl);
@ -589,7 +589,7 @@ static void lapd_t200_cb(void *data)
break;
case LAPD_STATE_DISC_SENT:
/* 5.4.4.3 */
if (dl->retrans_ctr + 1 >= dl->n200_est_rel + 1) {
if (dl->retrans_ctr >= dl->n200_est_rel + 1) {
/* send MDL ERROR INIDCATION to L3 */
mdl_error(MDL_CAUSE_T200_EXPIRED, &dl->lctx);
/* send RELEASE INDICATION to L3 */
@ -618,7 +618,7 @@ static void lapd_t200_cb(void *data)
/* fall through */
case LAPD_STATE_TIMER_RECOV:
dl->retrans_ctr++;
if (dl->retrans_ctr < dl->n200) {
if (dl->retrans_ctr <= dl->n200) {
uint8_t vs = sub_mod(dl->v_send, 1, dl->v_range);
uint8_t h = do_mod(vs, dl->range_hist);
/* retransmit I frame (V_s-1) with P=1, if any */
@ -671,7 +671,7 @@ static void lapd_t200_cb(void *data)
/* reestablish */
if (!dl->reestablish)
break;
LOGP(DLLAPD, LOGL_NOTICE, "N200 reached, performing "
LOGP(DLLAPD, LOGL_NOTICE, "N200+1 reached, performing "
"reestablishment. (dl=%p)\n", dl);
lapd_reestablish(dl);
}