Change in ...libosmocore[master]: lapd_core: Perform N200 retransmissions, not N200-1

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun Jun 2 20:41:16 UTC 2019


Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/14347


Change subject: lapd_core: Perform N200 retransmissions, not N200-1
......................................................................

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
---
M src/gsm/lapd_core.c
1 file changed, 4 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/47/14347/1

diff --git a/src/gsm/lapd_core.c b/src/gsm/lapd_core.c
index a2ff230..19dff4f 100644
--- a/src/gsm/lapd_core.c
+++ b/src/gsm/lapd_core.c
@@ -564,7 +564,7 @@
 	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 @@
 		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 @@
 		/* 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 @@
 			/* 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);
 		}

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/14347
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ic33854ee61311f73b7db55eeef10280349151097
Gerrit-Change-Number: 14347
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190602/6e741914/attachment.html>


More information about the gerrit-log mailing list