Use ALPHA value received in SI13 from PCUIF

The old VTY command is marked as deprecated and still overrides the use
in case it's used.

Related: SYS#5358
Depends: libosmocore.git Change-Id I74fb0a3afc1ac4aadbfc609b882d929401f790eb
Depends: osmo-bsc.git Change-Id I8b97ea11bad5fe05f2f634945b5703ee9abde81d
Change-Id: I46f2a955b157a409055fca7fb917dc4f75482426
diff --git a/src/bts.cpp b/src/bts.cpp
index fb7de64..11aef3f 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -918,7 +918,7 @@
 		plen = Encoding::write_immediate_assignment(
 			&bts->trx[trx_no].pdch[ts_no], tbf, bv,
 			false, rip->ra, Fn, ta, usf, false, sb_fn,
-			bts->pcu->vty.alpha, bts->pcu->vty.gamma, -1,
+			bts_get_ms_pwr_alpha(bts), bts->pcu->vty.gamma, -1,
 			rip->burst_type);
 		bts_do_rate_ctr_inc(bts, CTR_IMMEDIATE_ASSIGN_UL_TBF);
 	}
@@ -999,7 +999,7 @@
 						    tbf, immediate_assignment, true, 125,
 						    (tbf->pdch[ts_no]->last_rts_fn + 21216) % GSM_MAX_FN,
 						    tbf->ta(), 7, poll, tbf->poll_fn,
-						    bts->pcu->vty.alpha, bts->pcu->vty.gamma, -1,
+						    bts_get_ms_pwr_alpha(bts), bts->pcu->vty.gamma, -1,
 						    GSM_L1_BURST_TYPE_ACCESS_0);
 	if (plen >= 0) {
 		bts_do_rate_ctr_inc(bts, CTR_IMMEDIATE_ASSIGN_DL_TBF);
@@ -1292,3 +1292,14 @@
 {
 	return bts_ms_store(bts)->ms_list();
 }
+
+uint8_t bts_get_ms_pwr_alpha(const struct gprs_rlcmac_bts *bts)
+{
+	if (bts->pcu->vty.force_alpha != (uint8_t)-1)
+		return bts->pcu->vty.force_alpha;
+	if (bts->si13_is_set)
+		return bts->si31_ro_decoded.pwr_ctrl_pars.alpha;
+	/* default if no SI13 is received yet: closed loop control, TS 44.060
+	 * B.2 Closed loop control */
+	return 0;
+}