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
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);
 		}