alloc: Add 'dynamic' allocation algorithm

The idea behind this meta algorithm is to automatically select one of
the other algorithms based on the system state. Basically algorithm B
will be selected if the PDCH usage is low to improve throughput and
latency. Algorithm A will be selected to support more concurrent MS.

This commit adds a first simple state-less version of this algorithm
that always tries B first and only if that fails A is tried
afterwards.

The following VTY command is added to the 'pcu' node:

 - alloc-algorithm dynamic

Ticket: #1934
Sponsored-by: On-Waves ehf
diff --git a/src/pcu_vty.c b/src/pcu_vty.c
index 4c0730c..ed708f8 100644
--- a/src/pcu_vty.c
+++ b/src/pcu_vty.c
@@ -120,6 +120,8 @@
 		vty_out(vty, " alloc-algorithm a%s", VTY_NEWLINE);
 	if (bts->alloc_algorithm == alloc_algorithm_b)
 		vty_out(vty, " alloc-algorithm b%s", VTY_NEWLINE);
+	if (bts->alloc_algorithm == alloc_algorithm_dynamic)
+		vty_out(vty, " alloc-algorithm dynamic%s", VTY_NEWLINE);
 	if (bts->force_two_phase)
 		vty_out(vty, " two-phase-access%s", VTY_NEWLINE);
 	vty_out(vty, " alpha %d%s", bts->alpha, VTY_NEWLINE);
@@ -447,10 +449,12 @@
 
 DEFUN(cfg_pcu_alloc,
       cfg_pcu_alloc_cmd,
-      "alloc-algorithm (a|b)",
+      "alloc-algorithm (a|b|dynamic)",
       "Select slot allocation algorithm to use when assigning timeslots on "
-      "PACCH\nSingle slot is assigned only\nMultiple slots are assigned for "
-      "semi-duplex operation")
+      "PACCH\n"
+      "Single slot is assigned only\n"
+      "Multiple slots are assigned for semi-duplex operation\n"
+      "Dynamically select the algorithm based on the system state\n")
 {
 	struct gprs_rlcmac_bts *bts = bts_main_data();
 
@@ -461,6 +465,9 @@
 	case 'b':
 		bts->alloc_algorithm = alloc_algorithm_b;
 		break;
+	default:
+		bts->alloc_algorithm = alloc_algorithm_dynamic;
+		break;
 	}
 
 	return CMD_SUCCESS;