Introduce VTY cmd to configure Alpha in SI13

Related: SYS#5358
Change-Id: I8b97ea11bad5fe05f2f634945b5703ee9abde81d
diff --git a/include/osmocom/bsc/bts.h b/include/osmocom/bsc/bts.h
index 6797d1c..9a226f5 100644
--- a/include/osmocom/bsc/bts.h
+++ b/include/osmocom/bsc/bts.h
@@ -391,6 +391,9 @@
 			bool active; /* CCN_ACTIVE */
 			bool forced_vty; /* set by VTY ? */
 		} ccn; /* TS 44.060 sec 8.8.2 */
+		struct {
+			uint8_t alpha; /* ALPHA*10, units of 0.1, range <0-10> */
+		} pwr_ctrl; /* TS 44.060 Table 12.9.1 */
 	} gprs;
 
 	/* threshold (in percent) when BTS shall send CCCH LOAD IND */
diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c
index 9005aab..0388e8e 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -761,6 +761,8 @@
 	if (bts->gprs.ccn.forced_vty)
 		vty_out(vty, "  gprs ccn-active %d%s",
 			bts->gprs.ccn.active ? 1 : 0, VTY_NEWLINE);
+	vty_out(vty, "  gprs power-control alpha %u%s",
+		bts->gprs.pwr_ctrl.alpha, VTY_NEWLINE);
 	vty_out(vty, "  gprs cell bvci %u%s", bts->gprs.cell.bvci,
 		VTY_NEWLINE);
 	for (i = 0; i < ARRAY_SIZE(bts->gprs.cell.timer); i++)
@@ -3509,6 +3511,22 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN_USRATTR(cfg_bts_gprs_pwr_ctrl_alpha,
+	      cfg_bts_gprs_pwr_ctrl_alpha_cmd,
+	      X(BSC_VTY_ATTR_RESTART_ABIS_RSL_LINK),
+	      "gprs power-control alpha <0-10>",
+	      GPRS_TEXT
+	      "GPRS Global Power Control Parameters IE (SI13)\n"
+	      "Set alpha\n"
+	      "alpha for MS output power control in units of 0.1 (defaults to 0)\n")
+{
+	struct gsm_bts *bts = vty->index;
+
+	bts->gprs.pwr_ctrl.alpha = atoi(argv[0]);
+
+	return CMD_SUCCESS;
+}
+
 DEFUN_USRATTR(cfg_no_bts_gprs_ctrl_ack,
 	      cfg_no_bts_gprs_ctrl_ack_cmd,
 	      X(BSC_VTY_ATTR_RESTART_ABIS_RSL_LINK),
@@ -7682,6 +7700,7 @@
 	install_element(BTS_NODE, &cfg_bts_gprs_net_ctrl_ord_cmd);
 	install_element(BTS_NODE, &cfg_bts_gprs_ctrl_ack_cmd);
 	install_element(BTS_NODE, &cfg_bts_gprs_ccn_active_cmd);
+	install_element(BTS_NODE, &cfg_bts_gprs_pwr_ctrl_alpha_cmd);
 	install_element(BTS_NODE, &cfg_no_bts_gprs_ctrl_ack_cmd);
 	install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd);
 	install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd);
diff --git a/src/osmo-bsc/system_information.c b/src/osmo-bsc/system_information.c
index d018ec3..094c35e 100644
--- a/src/osmo-bsc/system_information.c
+++ b/src/osmo-bsc/system_information.c
@@ -1260,6 +1260,7 @@
 						     bts->gprs.ccn.active :
 						     osmo_bts_has_feature(&bts->model->features,
 									  BTS_FEAT_CCN);
+	si13_default.pwr_ctrl_pars.alpha = bts->gprs.pwr_ctrl.alpha;
 
 	ret = osmo_gsm48_rest_octets_si13_encode(si13->rest_octets, &si13_default);
 	if (ret < 0)