Change in openbsc[master]: Move DTX settings to BTS
diff mbox

Message ID 20160517161755.7EDDD22CDF@lists.osmocom.org
State New
Headers show

Commit Message

gerrit-no-reply@lists.osmocom.org May 17, 2016, 4:17 p.m. UTC
From Holger Freyther <holger@freyther.de>:

Holger Freyther has submitted this change and it was merged.

Change subject: Move DTX settings to BTS
......................................................................


Move DTX settings to BTS

* Add per-BTS DTX settings
* Configure Uplink and Downlink DTX separately
* Deprecate global DTX option (it was never tested/used anyway)
* Use libosmocore function for DTX indicator in System
  Information (previously it was incorrectly assigned for half-rate
  channels)

Related: OS#22
Change-Id: I3d55168475ad47044b6238b55846ea22bdd518a4
Reviewed-on: https://gerrit.osmocom.org/40
Tested-by: Jenkins Builder
Reviewed-by: Holger Freyther <holger@freyther.de>
---
M openbsc/doc/examples/osmo-bsc/osmo-bsc.cfg
M openbsc/doc/examples/osmo-nitb/rbs2308/openbsc.cfg
M openbsc/include/openbsc/gsm_data.h
M openbsc/include/openbsc/gsm_data_shared.h
M openbsc/src/libbsc/abis_rsl.c
M openbsc/src/libbsc/bsc_init.c
M openbsc/src/libbsc/bsc_vty.c
M openbsc/src/libbsc/system_information.c
M openbsc/src/libcommon/gsm_data.c
9 files changed, 98 insertions(+), 28 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Holger Freyther: Looks good to me, approved

Patch
diff mbox

diff --git a/openbsc/doc/examples/osmo-bsc/osmo-bsc.cfg b/openbsc/doc/examples/osmo-bsc/osmo-bsc.cfg
index a17127d..56e4724 100644
--- a/openbsc/doc/examples/osmo-bsc/osmo-bsc.cfg
+++ b/openbsc/doc/examples/osmo-bsc/osmo-bsc.cfg
@@ -40,7 +40,6 @@ 
  timer t3119 0
  timer t3122 0
  timer t3141 0
- dtx-used 0
  subscriber-keep-in-ram 0
  bts 0
   type nanobts
@@ -55,6 +54,8 @@ 
   channel allocator ascending
   rach tx integer 9
   rach max transmission 7
+  dtx uplink force
+  dtx downlink
   ip.access unit_id 0 0
   oml ip.access stream_id 255 line 0
   neighbor-list mode manual-si5
diff --git a/openbsc/doc/examples/osmo-nitb/rbs2308/openbsc.cfg b/openbsc/doc/examples/osmo-nitb/rbs2308/openbsc.cfg
index b1ebdd2..0226920 100644
--- a/openbsc/doc/examples/osmo-nitb/rbs2308/openbsc.cfg
+++ b/openbsc/doc/examples/osmo-nitb/rbs2308/openbsc.cfg
@@ -37,7 +37,6 @@ 
  timer t3119 0
  timer t3122 0
  timer t3141 0
- dtx-used 0
  subscriber-keep-in-ram 0
  bts 0
   type rbs2000
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h
index f229e74..91d84db 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -269,9 +269,6 @@ 
 		enum rrlp_mode mode;
 	} rrlp;
 
-	/* enable the DTXu and DTXd for this network */
-	int dtx_enabled;
-
 	enum gsm_chan_t ctype_by_chreq[16];
 
 	/* Use a TCH for handling requests of type paging any */
diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h
index 8658fe7..c3d5978 100644
--- a/openbsc/include/openbsc/gsm_data_shared.h
+++ b/openbsc/include/openbsc/gsm_data_shared.h
@@ -14,7 +14,7 @@ 
 #include <osmocom/gsm/rxlev_stat.h>
 #include <osmocom/gsm/sysinfo.h>
 #include <osmocom/gsm/meas_rep.h>
-
+#include <osmocom/gsm/protocol/gsm_04_08.h>
 #include <osmocom/gsm/protocol/gsm_08_58.h>
 #include <osmocom/gsm/protocol/gsm_12_21.h>
 
@@ -594,6 +594,10 @@ 
 	/* number of this BTS on given E1 link */
 	uint8_t bts_nr;
 
+	/* DTX features of this BTS */
+	enum gsm48_dtx_mode dtxu;
+	bool dtxd;
+
 	/* paging state and control */
 	struct gsm_bts_paging_state paging;
 
diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c
index df76788..6cf4e0b 100644
--- a/openbsc/src/libbsc/abis_rsl.c
+++ b/openbsc/src/libbsc/abis_rsl.c
@@ -35,6 +35,8 @@ 
 #include <openbsc/bsc_rll.h>
 #include <openbsc/debug.h>
 #include <osmocom/gsm/tlv.h>
+#include <osmocom/gsm/protocol/gsm_04_08.h>
+#include <osmocom/gsm/protocol/gsm_08_58.h>
 #include <openbsc/paging.h>
 #include <openbsc/signal.h>
 #include <openbsc/meas_rep.h>
@@ -345,10 +347,11 @@ 
 	memset(cm, 0, sizeof(*cm));
 
 	/* FIXME: what to do with data calls ? */
-	if (lchan->ts->trx->bts->network->dtx_enabled)
-		cm->dtx_dtu = 0x03;
-	else
-		cm->dtx_dtu = 0x00;
+	cm->dtx_dtu = 0;
+	if (lchan->ts->trx->bts->dtxu != GSM48_DTX_SHALL_NOT_BE_USED)
+		cm->dtx_dtu |= RSL_CMOD_DTXu;
+	if (lchan->ts->trx->bts->dtxd)
+		cm->dtx_dtu |= RSL_CMOD_DTXd;
 
 	/* set TCH Speech/Data */
 	cm->spd_ind = lchan->rsl_cmode;
diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c
index fea6562..5c27862 100644
--- a/openbsc/src/libbsc/bsc_init.c
+++ b/openbsc/src/libbsc/bsc_init.c
@@ -458,12 +458,6 @@ 
 		return -EINVAL;
 	}
 
-	/* allow/disallow DTXu */
-	if (bts->network->dtx_enabled)
-		bts->si_common.cell_options.dtx = 0;
-	else
-		bts->si_common.cell_options.dtx = 2;
-
 	bts->si_common.cell_options.pwrc = 0; /* PWRC not set */
 
 	bts->si_common.cell_sel_par.acs = 0;
diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c
index b928738..46ad457 100644
--- a/openbsc/src/libbsc/bsc_vty.c
+++ b/openbsc/src/libbsc/bsc_vty.c
@@ -18,6 +18,7 @@ 
  */
 
 #include <stdlib.h>
+#include <stdbool.h>
 #include <unistd.h>
 
 #include <osmocom/vty/command.h>
@@ -27,7 +28,7 @@ 
 #include <osmocom/vty/stats.h>
 #include <osmocom/vty/telnet_interface.h>
 #include <osmocom/vty/misc.h>
-
+#include <osmocom/gsm/protocol/gsm_04_08.h>
 #include <osmocom/gsm/gsm0502.h>
 
 #include <arpa/inet.h>
@@ -273,6 +274,14 @@ 
 		VTY_NEWLINE);
 	if (bts->si_common.rach_control.cell_bar)
 		vty_out(vty, "  CELL IS BARRED%s", VTY_NEWLINE);
+	if (bts->dtxu != GSM48_DTX_SHALL_NOT_BE_USED)
+		vty_out(vty, "Uplink DTX: %s%s",
+			(bts->dtxu != GSM48_DTX_SHALL_BE_USED) ?
+			"enabled" : "forced", VTY_NEWLINE);
+	else
+		vty_out(vty, "Uplink DTX: not enabled%s", VTY_NEWLINE);
+	vty_out(vty, "Downlink DTX: %senabled%s", bts->dtxd ? "" : "not ",
+		VTY_NEWLINE);
 	vty_out(vty, "Channel Description Attachment: %s%s",
 		(bts->si_common.chan_desc.att) ? "yes" : "no", VTY_NEWLINE);
 	vty_out(vty, "Channel Description BS-PA-MFRMS: %u%s",
@@ -549,6 +558,12 @@ 
 	vty_out(vty, "  cell_identity %u%s", bts->cell_identity, VTY_NEWLINE);
 	vty_out(vty, "  location_area_code %u%s", bts->location_area_code,
 		VTY_NEWLINE);
+	if (bts->dtxu != GSM48_DTX_SHALL_NOT_BE_USED)
+		vty_out(vty, "  dtx uplink%s%s",
+			(bts->dtxu != GSM48_DTX_SHALL_BE_USED) ? "" : " force",
+			VTY_NEWLINE);
+	if (bts->dtxd)
+		vty_out(vty, "  dtx downlink%s", VTY_NEWLINE);
 	vty_out(vty, "  base_station_id_code %u%s", bts->bsic, VTY_NEWLINE);
 	if (bts->tz.override != 0) {
 		if (bts->tz.dst)
@@ -809,7 +824,6 @@ 
 	vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE);
 	vty_out(vty, " timer t3122 %u%s", gsmnet->T3122, VTY_NEWLINE);
 	vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE);
-	vty_out(vty, " dtx-used %u%s", gsmnet->dtx_enabled, VTY_NEWLINE);
 	vty_out(vty, " subscriber-keep-in-ram %d%s",
 		gsmnet->subscr_group->keep_subscr, VTY_NEWLINE);
 
@@ -1613,15 +1627,14 @@ 
 DECLARE_TIMER(3122, "Waiting time (seconds) after IMM ASS REJECT\n")
 DECLARE_TIMER(3141, "Currently not used.\n")
 
-DEFUN(cfg_net_dtx,
-      cfg_net_dtx_cmd,
-      "dtx-used (0|1)",
-      "Enable the usage of DTX.\n"
-      "DTX is disabled\n" "DTX is enabled\n")
+DEFUN_DEPRECATED(cfg_net_dtx,
+		 cfg_net_dtx_cmd,
+		 "dtx-used (0|1)",
+		 ".HIDDEN\n""Obsolete\n""Obsolete\n")
 {
-	struct gsm_network *gsmnet = gsmnet_from_vty(vty);
-	gsmnet->dtx_enabled = atoi(argv[0]);
-	return CMD_SUCCESS;
+	vty_out(vty, "%% 'dtx-used' is now deprecated: use dtx * "
+		"configuration options of BTS instead%s", VTY_NEWLINE);
+       return CMD_SUCCESS;
 }
 
 DEFUN(cfg_net_subscr_keep,
@@ -1700,6 +1713,54 @@ 
 	}
 
 	bts->band = band;
+
+	return CMD_SUCCESS;
+}
+
+DEFUN(cfg_bts_dtxu, cfg_bts_dtxu_cmd, "dtx uplink [force]",
+      "Configure discontinuous transmission\n"
+      "Enable Uplink DTX for this BTS\n"
+      "MS 'shall' use DTXu instead of 'may' use (might not be supported by "
+      "older phones).\n")
+{
+	struct gsm_bts *bts = vty->index;
+
+	bts->dtxu = (argc > 0) ? GSM48_DTX_SHALL_BE_USED : GSM48_DTX_MAY_BE_USED;
+
+	return CMD_SUCCESS;
+}
+
+DEFUN(cfg_bts_no_dtxu, cfg_bts_no_dtxu_cmd, "no dtx uplink",
+      NO_STR
+      "Configure discontinuous transmission\n"
+      "Disable Uplink DTX for this BTS\n")
+{
+	struct gsm_bts *bts = vty->index;
+
+	bts->dtxu = GSM48_DTX_SHALL_NOT_BE_USED;
+
+	return CMD_SUCCESS;
+}
+
+DEFUN(cfg_bts_dtxd, cfg_bts_dtxd_cmd, "dtx downlink",
+      "Configure discontinuous transmission\n"
+      "Enable Downlink DTX for this BTS\n")
+{
+	struct gsm_bts *bts = vty->index;
+
+	bts->dtxd = true;
+
+	return CMD_SUCCESS;
+}
+
+DEFUN(cfg_bts_no_dtxd, cfg_bts_no_dtxd_cmd, "no dtx downlink",
+      NO_STR
+      "Configure discontinuous transmission\n"
+      "Disable Downlink DTX for this BTS\n")
+{
+	struct gsm_bts *bts = vty->index;
+
+	bts->dtxd = false;
 
 	return CMD_SUCCESS;
 }
@@ -3948,6 +4009,10 @@ 
 	install_element(BTS_NODE, &cfg_no_description_cmd);
 	install_element(BTS_NODE, &cfg_bts_band_cmd);
 	install_element(BTS_NODE, &cfg_bts_ci_cmd);
+	install_element(BTS_NODE, &cfg_bts_dtxu_cmd);
+	install_element(BTS_NODE, &cfg_bts_dtxd_cmd);
+	install_element(BTS_NODE, &cfg_bts_no_dtxu_cmd);
+	install_element(BTS_NODE, &cfg_bts_no_dtxd_cmd);
 	install_element(BTS_NODE, &cfg_bts_lac_cmd);
 	install_element(BTS_NODE, &cfg_bts_tsc_cmd);
 	install_element(BTS_NODE, &cfg_bts_bsic_cmd);
diff --git a/openbsc/src/libbsc/system_information.c b/openbsc/src/libbsc/system_information.c
index 0d96621..1f1d81e 100644
--- a/openbsc/src/libbsc/system_information.c
+++ b/openbsc/src/libbsc/system_information.c
@@ -717,6 +717,9 @@ 
 	si3->cell_sel_par = bts->si_common.cell_sel_par;
 	si3->rach_control = bts->si_common.rach_control;
 
+	/* allow/disallow DTXu */
+	gsm48_set_dtx(&si3->cell_options, bts->dtxu, bts->dtxu, true);
+
 	if ((bts->si_valid & (1 << SYSINFO_TYPE_2ter))) {
 		LOGP(DRR, LOGL_INFO, "SI 2ter is included.\n");
 		si_info.si2ter_indicator = 1;
@@ -928,6 +931,8 @@ 
 			   bts->location_area_code);
 	si6->cell_options = bts->si_common.cell_options;
 	si6->ncc_permitted = bts->si_common.ncc_permitted;
+	/* allow/disallow DTXu */
+	gsm48_set_dtx(&si6->cell_options, bts->dtxu, bts->dtxu, true);
 
 	/* SI6 Rest Octets: 10.5.2.35a: PCH / NCH info, VBS/VGCS options */
 
diff --git a/openbsc/src/libcommon/gsm_data.c b/openbsc/src/libcommon/gsm_data.c
index 242c014..4e235fd 100644
--- a/openbsc/src/libcommon/gsm_data.c
+++ b/openbsc/src/libcommon/gsm_data.c
@@ -23,7 +23,7 @@ 
 #include <string.h>
 #include <errno.h>
 #include <ctype.h>
-
+#include <stdbool.h>
 #include <netinet/in.h>
 
 #include <osmocom/core/linuxlist.h>
@@ -31,6 +31,7 @@ 
 #include <osmocom/gsm/gsm_utils.h>
 #include <osmocom/gsm/abis_nm.h>
 #include <osmocom/core/statistics.h>
+#include <osmocom/gsm/protocol/gsm_04_08.h>
 
 #include <openbsc/gsm_data.h>
 #include <openbsc/osmo_msc_data.h>
@@ -311,7 +312,8 @@ 
 	bts->type = type;
 	bts->model = model;
 	bts->bsic = bsic;
-
+	bts->dtxu = GSM48_DTX_SHALL_NOT_BE_USED;
+	bts->dtxd = false;
 	bts->neigh_list_manual_mode = 0;
 	bts->si_common.cell_sel_par.cell_resel_hyst = 2; /* 4 dB */
 	bts->si_common.cell_sel_par.rxlev_acc_min = 0;