Change in osmo-bts[master]: l1sap: add repeated downlink FACCH

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

dexter gerrit-no-reply at lists.osmocom.org
Mon Nov 2 00:12:49 UTC 2020


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/21014 )


Change subject: l1sap: add repeated downlink FACCH
......................................................................

l1sap: add repeated downlink FACCH

3GPP TS 44.006, section 10 describes a method how the downlink
FACCH transmission can be repeated to increase transmission
reliability.

Change-Id: I72f0cf7eaaef9f80fc35e752c90ae0e2d24d0c75
Related: OS#4796 SYS#5114
---
M include/osmo-bts/bts.h
M include/osmo-bts/gsm_data.h
M src/common/l1sap.c
M src/common/vty.c
4 files changed, 95 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/14/21014/1

diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index ce7d9d4..fdcc67b 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -338,6 +338,9 @@
 	struct osmo_fsm_inst *shutdown_fi; /* FSM instance to manage shutdown procedure during process exit */
 	struct osmo_tdef *T_defs; /* Timer defines */
 
+	/* 3GPP TS 44.006, section 10, Repeated Downlink FACCH */
+	bool facch_repetition_enabled;
+
 	void *model_priv; /* Allocated by bts_model, contains model specific data pointer */
 };
 
diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h
index 1c1c5d4..4689e88 100644
--- a/include/osmo-bts/gsm_data.h
+++ b/include/osmo-bts/gsm_data.h
@@ -256,6 +256,17 @@
 		} dtx;
 		uint8_t last_cmr;
 		uint32_t last_fn;
+
+		struct {
+			/* SLOT #1 */
+			struct msgb *msg_1;
+			uint32_t fn_1;
+
+			/* SLOT #2 */
+			struct msgb *msg_2;
+			uint32_t fn_2;
+		} rep_facch;
+
 	} tch;
 
 	/* 3GPP TS 48.058 § 9.3.37: [0; 255] ok, -1 means invalid*/
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index c9ec9bf..20b1f55 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -907,6 +907,51 @@
 		bts->fn_stats.avg_count++;
 	}
 }
+/* Common dequeueing function */
+static inline struct msgb *lapdm_phsap_dequeue_msg(struct lapdm_entity *le)
+{
+	struct osmo_phsap_prim pp;
+	if (lapdm_phsap_dequeue_prim(le, &pp) < 0)
+		return NULL;
+	return pp.oph.msg;
+}
+
+/* Special dequeueing function with FACCH repetition (3GPP TS 44.006, section 10) */
+static inline struct msgb *lapdm_phsap_dequeue_msg_facch(struct gsm_lchan *lchan, struct lapdm_entity *le, uint32_t fn)
+{
+	struct osmo_phsap_prim pp;
+	struct msgb *msg;
+
+	if (lchan->tch.rep_facch.msg_1 && lchan->tch.rep_facch.fn_1 + 8 <= fn) {
+		/* Re-use stored FACCH message buffer from SLOT 1 for repetition. */
+		msg = lchan->tch.rep_facch.msg_1;
+		lchan->tch.rep_facch.msg_1 = NULL;
+	} else if (lchan->tch.rep_facch.msg_2 && lchan->tch.rep_facch.fn_2 + 8 <= fn) {
+		/* Re-use stored FACCH message buffer from SLOT 2 for repetition. */
+		msg = lchan->tch.rep_facch.msg_2;
+		lchan->tch.rep_facch.msg_2 = NULL;
+	} else {
+		/* Fetch new FACCH from queue ... */
+		if (lapdm_phsap_dequeue_prim(le, &pp) < 0)
+			return NULL;
+		msg = pp.oph.msg;
+
+		/* ... and store the message buffer for repetition. */
+		if (lchan->tch.rep_facch.msg_1 == NULL) {
+			lchan->tch.rep_facch.msg_1 = msgb_copy(msg, "rep_facch_1");
+			lchan->tch.rep_facch.fn_1 = fn;
+		} else if (lchan->tch.rep_facch.msg_2 == NULL) {
+			lchan->tch.rep_facch.msg_2 = msgb_copy(msg, "rep_facch_2");
+			lchan->tch.rep_facch.fn_2 = fn;
+		} else {
+			/* By definition 3GPP TS 05.02 does not allow more than two (for TCH/H only one) FACCH instances
+			 * to be transmitted simultaniously. */
+			OSMO_ASSERT(false);
+		}
+	}
+
+	return msg;
+}
 
 /* PH-RTS-IND prim received from bts model */
 static int l1sap_ph_rts_ind(struct gsm_bts_trx *trx,
@@ -920,7 +965,7 @@
 	uint32_t fn;
 	uint8_t *p, *si;
 	struct lapdm_entity *le;
-	struct osmo_phsap_prim pp;
+	struct msgb *pp_msg;
 	bool dtxd_facch = false;
 	int rc;
 	int is_ag_res;
@@ -988,13 +1033,17 @@
 			p[0] = lchan->ms_power_ctrl.current;
 			p[1] = lchan->rqd_ta;
 			le = &lchan->lapdm_ch.lapdm_acch;
+			pp_msg = lapdm_phsap_dequeue_msg(le);
 		} else {
 			if (lchan->ts->trx->bts->dtxd)
 				dtxd_facch = true;
 			le = &lchan->lapdm_ch.lapdm_dcch;
+			if (lchan->ts->trx->bts->facch_repetition_enabled && lchan->rsl_cmode != RSL_CMOD_SPD_SIGN)
+				pp_msg = lapdm_phsap_dequeue_msg_facch(lchan, le, fn);
+			else
+				pp_msg = lapdm_phsap_dequeue_msg(le);
 		}
-		rc = lapdm_phsap_dequeue_prim(le, &pp);
-		if (rc < 0) {
+		if (!pp_msg) {
 			if (L1SAP_IS_LINK_SACCH(link_id)) {
 				/* No SACCH data from LAPDM pending, send SACCH filling */
 				uint8_t *si = lchan_sacch_get(lchan);
@@ -1019,16 +1068,16 @@
 		} else {
 			/* The +2 is empty space where the DSP inserts the L1 hdr */
 			if (L1SAP_IS_LINK_SACCH(link_id))
-				memcpy(p + 2, pp.oph.msg->data + 2, GSM_MACBLOCK_LEN - 2);
+				memcpy(p + 2, pp_msg->data + 2, GSM_MACBLOCK_LEN - 2);
 			else {
 				p = msgb_put(msg, GSM_MACBLOCK_LEN);
-				memcpy(p, pp.oph.msg->data, GSM_MACBLOCK_LEN);
+				memcpy(p, pp_msg->data, GSM_MACBLOCK_LEN);
 				/* check if it is a RR CIPH MODE CMD. if yes, enable RX ciphering */
-				check_for_ciph_cmd(pp.oph.msg, lchan, chan_nr);
+				check_for_ciph_cmd(pp_msg, lchan, chan_nr);
 				if (dtxd_facch)
 					dtx_dispatch(lchan, E_FACCH);
 			}
-			msgb_free(pp.oph.msg);
+			msgb_free(pp_msg);
 		}
 	} else if (L1SAP_IS_CHAN_AGCH_PCH(chan_nr)) {
 		p = msgb_put(msg, GSM_MACBLOCK_LEN);
diff --git a/src/common/vty.c b/src/common/vty.c
index d20b143..53f75e9 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -305,6 +305,8 @@
 	vty_out(vty, " smscb queue-max-length %d%s", bts->smscb_queue_max_len, VTY_NEWLINE);
 	vty_out(vty, " smscb queue-target-length %d%s", bts->smscb_queue_tgt_len, VTY_NEWLINE);
 	vty_out(vty, " smscb queue-hysteresis %d%s", bts->smscb_queue_hyst, VTY_NEWLINE);
+	if (bts->facch_repetition_enabled)
+		vty_out(vty, " facch-repetition%s", VTY_NEWLINE);
 
 	bts_model_config_write_bts(vty, bts);
 
@@ -789,6 +791,27 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN_ATTR(cfg_bts_facch_repetition, cfg_bts_facch_repetition_cmd,
+	   "facch-repetition",
+	   "enable downlink FACCH repetition\n",
+	   CMD_ATTR_IMMEDIATE)
+{
+	struct gsm_bts *bts = vty->index;
+
+	bts->facch_repetition_enabled = true;
+	return CMD_SUCCESS;
+}
+
+DEFUN_ATTR(cfg_bts_no_facch_repetition, cfg_bts_no_facch_repetition_cmd,
+	   "no facch-repetition",
+	   "disable downlink FACCH repetition\n",
+	   CMD_ATTR_IMMEDIATE)
+{
+	struct gsm_bts *bts = vty->index;
+
+	bts->facch_repetition_enabled = false;
+	return CMD_SUCCESS;
+}
 
 #define DB_MDB_STR 							\
 	"Unit is dB (decibels)\n"					\
@@ -1886,6 +1909,8 @@
 	install_element(BTS_NODE, &cfg_bts_smscb_max_qlen_cmd);
 	install_element(BTS_NODE, &cfg_bts_smscb_tgt_qlen_cmd);
 	install_element(BTS_NODE, &cfg_bts_smscb_qhyst_cmd);
+	install_element(BTS_NODE, &cfg_bts_facch_repetition_cmd);
+	install_element(BTS_NODE, &cfg_bts_no_facch_repetition_cmd);
 
 	install_element(BTS_NODE, &cfg_trx_gsmtap_sapi_all_cmd);
 	install_element(BTS_NODE, &cfg_trx_gsmtap_sapi_cmd);

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/21014
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I72f0cf7eaaef9f80fc35e752c90ae0e2d24d0c75
Gerrit-Change-Number: 21014
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201102/4b022f76/attachment.htm>


More information about the gerrit-log mailing list