poll: Count failed procedures

When a timeout has occured several times, the procedures handled by
poll_timeout are aborted. This happens when the number of repetitions
exceed N3105. Currently only the timeouts themselves are counted.

This commits adds counters that are incremented if a procedure has
really failed.

New counter:
- rlc.ass.failed:   Count failing UL and DL assigments via PACCH
- rlc.ack.failed:   Count failing DL Ack/Nack requests

Sponsored-by: On-Waves ehf
diff --git a/src/bts.cpp b/src/bts.cpp
index 39737f4..122ff20 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -62,7 +62,9 @@
 	{ "rlc.stalled",		"RLC Stalled          "},
 	{ "rlc.nacked",			"RLC Nacked           "},
 	{ "rlc.ass.timedout",		"RLC Assign Timeout   "},
+	{ "rlc.ass.failed",		"RLC Assign Failed    "},
 	{ "rlc.ack.timedout",		"RLC Ack Timeout      "},
+	{ "rlc.ack.failed",		"RLC Ack Failed       "},
 	{ "rlc.rel.timedout",		"RLC Release Timeout  "},
 	{ "rlc.late-block",		"RLC Late Block       "},
 	{ "decode.errors",		"Decode Errors        "},
diff --git a/src/bts.h b/src/bts.h
index eee62a7..4129483 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -218,7 +218,9 @@
 		CTR_RLC_STALLED,
 		CTR_RLC_NACKED,
 		CTR_RLC_ASS_TIMEDOUT,
+		CTR_RLC_ASS_FAILED,
 		CTR_RLC_ACK_TIMEDOUT,
+		CTR_RLC_ACK_FAILED,
 		CTR_RLC_REL_TIMEDOUT,
 		CTR_RLC_LATE_BLOCK,
 		CTR_DECODE_ERRORS,
@@ -285,7 +287,9 @@
 	void rlc_stalled();
 	void rlc_nacked();
 	void rlc_ass_timedout();
+	void rlc_ass_failed();
 	void rlc_ack_timedout();
+	void rlc_ack_failed();
 	void rlc_rel_timedout();
 	void rlc_late_block();
 	void decode_error();
@@ -393,7 +397,9 @@
 CREATE_COUNT_INLINE(rlc_stalled, CTR_RLC_STALLED)
 CREATE_COUNT_INLINE(rlc_nacked, CTR_RLC_NACKED)
 CREATE_COUNT_INLINE(rlc_ass_timedout, CTR_RLC_ASS_TIMEDOUT);
+CREATE_COUNT_INLINE(rlc_ass_failed, CTR_RLC_ASS_FAILED);
 CREATE_COUNT_INLINE(rlc_ack_timedout, CTR_RLC_ACK_TIMEDOUT);
+CREATE_COUNT_INLINE(rlc_ack_failed, CTR_RLC_ACK_FAILED);
 CREATE_COUNT_INLINE(rlc_rel_timedout, CTR_RLC_REL_TIMEDOUT);
 CREATE_COUNT_INLINE(rlc_late_block, CTR_RLC_LATE_BLOCK);
 CREATE_COUNT_INLINE(decode_error, CTR_DECODE_ERRORS)
diff --git a/src/tbf.cpp b/src/tbf.cpp
index b604c68..6c1320f 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -473,6 +473,7 @@
 			LOGP(DRLCMAC, LOGL_NOTICE, "- N3105 exceeded\n");
 			set_state(GPRS_RLCMAC_RELEASING);
 			tbf_timer_start(this, 3195, bts_data()->t3195, 0);
+			bts->rlc_ass_failed();
 			return;
 		}
 		/* reschedule UL assignment */
@@ -492,6 +493,7 @@
 			LOGP(DRLCMAC, LOGL_NOTICE, "- N3105 exceeded\n");
 			set_state(GPRS_RLCMAC_RELEASING);
 			tbf_timer_start(this, 3195, bts_data()->t3195, 0);
+			bts->rlc_ass_failed();
 			return;
 		}
 		/* reschedule DL assignment */
@@ -514,6 +516,7 @@
 			LOGP(DRLCMAC, LOGL_NOTICE, "- N3105 exceeded\n");
 			dl_tbf->set_state(GPRS_RLCMAC_RELEASING);
 			tbf_timer_start(dl_tbf, 3195, dl_tbf->bts_data()->t3195, 0);
+			bts->rlc_ack_failed();
 			return;
 		}
 		/* resend IMM.ASS on CCCH on timeout */