[PATCH] osmo-bts[master]: LC15: Introduce DSP alive timer per TRX

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/.

Minh-Quang Nguyen gerrit-no-reply at lists.osmocom.org
Mon Jun 13 13:29:17 UTC 2016


Review at  https://gerrit.osmocom.org/243

LC15: Introduce DSP alive timer per TRX

Change-Id: Ic075063a5b3294b72cc502a01e9616c296797238
---
M include/osmo-bts/gsm_data.h
M src/osmo-bts-litecell15/l1_if.c
M src/osmo-bts-litecell15/l1_if.h
M src/osmo-bts-litecell15/lc15bts.c
M src/osmo-bts-litecell15/lc15bts.h
M src/osmo-bts-litecell15/lc15bts_vty.c
M src/osmo-bts-litecell15/main.c
7 files changed, 125 insertions(+), 0 deletions(-)


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

diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h
index 001dacb..ef569f8 100644
--- a/include/osmo-bts/gsm_data.h
+++ b/include/osmo-bts/gsm_data.h
@@ -118,6 +118,7 @@
 	uint8_t pedestal_mode;		/* 0: unused TS is OFF, 1: unused TS is in minimum Tx power */
 	uint8_t led_ctrl_mode;		/* 0: control by BTS, 1: not control by BTS */
 	uint8_t pwr_red_step;   	/* Tx power reduction steps in 1 dB or 2 dB */
+	uint8_t dsp_alive_period;	/* DSP alive timer period  */
 	uint8_t tx_pwr_adj_mode;	/* 0: no auto adjust power, 1: auto adjust power using RMS detector */
 	uint8_t tx_pwr_red_8psk;	/* 8-PSK maximum Tx power reduction level in dB */
 #endif
diff --git a/src/osmo-bts-litecell15/l1_if.c b/src/osmo-bts-litecell15/l1_if.c
index 0f10fcb..1faa00b 100644
--- a/src/osmo-bts-litecell15/l1_if.c
+++ b/src/osmo-bts-litecell15/l1_if.c
@@ -66,6 +66,7 @@
 #include "misc/lc15bts_par.h"
 #include "misc/lc15bts_bid.h"
 #include "utils.h"
+#include "osmo-bts/oml.h"
 
 extern unsigned int dsp_trace;
 
@@ -1398,6 +1399,73 @@
 	return 0;
 }
 
+static void dsp_alive_compl_cb(struct gsm_bts_trx *trx, struct msgb *resp, void *data)
+{
+	Litecell15_Prim_t *sysp = msgb_sysprim(resp);
+	Litecell15_IsAliveCnf_t *sac = &sysp->u.IsAliveCnf;
+	struct lc15l1_hdl *fl1h = trx_lc15l1_hdl(trx);
+
+	fl1h->hw_alive.dsp_alive_cnt++;
+	fl1h->failure_rep_sent = 0;
+	LOGP(DL1C, LOGL_NOTICE, "Rx SYS prim %s, status=%d (%d)\n",
+			get_value_string(lc15bts_sysprim_names, sysp->id), sac->status, trx->nr);
+
+	msgb_free(resp);
+}
+
+static int dsp_alive_timer_cb(void *data)
+{
+	struct lc15l1_hdl *fl1h = data;
+	struct gsm_bts_trx *trx = fl1h->phy_inst->trx;
+	struct msgb *msg = sysp_msgb_alloc();
+	int rc;
+	char log_msg[100];
+	struct gsm_failure_evt_rep failure_rep;
+
+	Litecell15_Prim_t *sys_prim =  msgb_sysprim(msg);
+	sys_prim->id = Litecell15_PrimId_IsAliveReq;
+
+	if (fl1h->hw_alive.dsp_alive_cnt == 0) {
+
+		if(fl1h->failure_rep_sent)
+			exit(23);
+
+		snprintf(log_msg, 100, "Timeout waiting for SYS prim %s primitive (%d)\n",
+				get_value_string(lc15bts_sysprim_names, sys_prim->id + 1), trx->nr);
+
+		LOGP(DL1C, LOGL_ERROR,"%s", log_msg);
+
+		if( fl1h->phy_inst->trx ){
+			failure_rep.event_type = NM_EVT_PROC_FAIL;
+			failure_rep.event_serverity = NM_SEVER_CRITICAL;
+			failure_rep.cause_type = NM_PCAUSE_T_MANUF;
+			failure_rep.event_cause = NM_MM_EVT_CRIT_SW_FATAL;
+			failure_rep.add_text = (char *)&log_msg;
+
+			fl1h->phy_inst->trx->mo.obj_inst.trx_nr = fl1h->phy_inst->trx->nr;
+
+			rc = oml_tx_failure_event_rep(&fl1h->phy_inst->trx->mo, failure_rep);
+			if(!rc)
+				fl1h->failure_rep_sent = 1;
+		}
+	}
+
+	LOGP(DL1C, LOGL_NOTICE, "Tx SYS prim %s (%d)\n",
+			get_value_string(lc15bts_sysprim_names, sys_prim->id), trx->nr);
+
+	rc = l1if_req_compl(fl1h, msg, dsp_alive_compl_cb, NULL);
+	if (rc < 0) {
+		LOGP(DL1C, LOGL_FATAL, "Failed to send %s primitive\n", get_value_string(lc15bts_sysprim_names, sys_prim->id));
+		return -EIO;
+	}
+
+	/* restart timer */
+	fl1h->hw_alive.dsp_alive_cnt = 0;
+	osmo_timer_schedule(&fl1h->hw_alive.dsp_alive_timer, fl1h->hw_alive.dsp_alive_period, 0);
+
+	return 0;
+}
+
 int bts_model_phy_link_open(struct phy_link *plink)
 {
 	struct phy_instance *pinst = phy_instance_by_num(plink, 0);
@@ -1425,6 +1493,26 @@
 
 	phy_link_state_set(plink, PHY_LINK_CONNECTED);
 
+	/* Send first IS_ALIVE primitive */
+	struct msgb *msg = sysp_msgb_alloc();
+	int rc;
+
+	Litecell15_Prim_t *sys_prim =  msgb_sysprim(msg);
+	sys_prim->id = Litecell15_PrimId_IsAliveReq;
+
+	rc = l1if_req_compl(fl1h, msg, dsp_alive_compl_cb, NULL);
+	if (rc < 0) {
+		LOGP(DL1C, LOGL_FATAL, "Failed to send %s primitive\n", get_value_string(lc15bts_sysprim_names, sys_prim->id));
+		return -EIO;
+	}
+
+	/* initialize DSP heart beat alive timer */
+	struct gsm_bts_role_bts *btsb = bts_role_bts(pinst->trx->bts);
+	fl1h->hw_alive.dsp_alive_timer.cb = dsp_alive_timer_cb;
+	fl1h->hw_alive.dsp_alive_timer.data = fl1h;
+	fl1h->hw_alive.dsp_alive_cnt = 0;
+	fl1h->hw_alive.dsp_alive_period = btsb->dsp_alive_period;
+	osmo_timer_schedule(&fl1h->hw_alive.dsp_alive_timer, fl1h->hw_alive.dsp_alive_period, 0);
 	return 0;
 }
 
diff --git a/src/osmo-bts-litecell15/l1_if.h b/src/osmo-bts-litecell15/l1_if.h
index 0c8843b..ad75ea6 100644
--- a/src/osmo-bts-litecell15/l1_if.h
+++ b/src/osmo-bts-litecell15/l1_if.h
@@ -59,6 +59,13 @@
 	struct calib_send_state st;
 
 	uint8_t last_rf_mute[8];
+
+	struct {
+		struct osmo_timer_list dsp_alive_timer;
+		unsigned int dsp_alive_cnt;
+		uint8_t dsp_alive_period;
+	} hw_alive;
+	uint8_t failure_rep_sent; /* Flag to indicate the failure report has already sent to network before stop BTS itself*/
 };
 
 #define msgb_l1prim(msg)	((GsmL1_Prim_t *)(msg)->l1h)
diff --git a/src/osmo-bts-litecell15/lc15bts.c b/src/osmo-bts-litecell15/lc15bts.c
index 172a7e4..6ce82e3 100644
--- a/src/osmo-bts-litecell15/lc15bts.c
+++ b/src/osmo-bts-litecell15/lc15bts.c
@@ -121,6 +121,8 @@
 	case Litecell15_PrimId_MuteRfCnf:        return L1P_T_CONF;
 	case Litecell15_PrimId_SetRxAttenReq:    return L1P_T_REQ;
 	case Litecell15_PrimId_SetRxAttenCnf:    return L1P_T_CONF;
+	case Litecell15_PrimId_IsAliveReq:	return L1P_T_REQ;
+	case Litecell15_PrimId_IsAliveCnf:	return L1P_T_CONF;
 	default:                                 return L1P_T_INVALID;
 	}
 }
@@ -142,6 +144,8 @@
 	{ Litecell15_PrimId_MuteRfCnf,	        "MUTE-RF.cnf" },
 	{ Litecell15_PrimId_SetRxAttenReq,	"SET-RX-ATTEN.req" },
 	{ Litecell15_PrimId_SetRxAttenCnf,	"SET-RX-ATTEN-CNF.cnf" },
+	{ Litecell15_PrimId_IsAliveReq,		"IS-ALIVE.req" },
+	{ Litecell15_PrimId_IsAliveCnf,		"IS-ALIVE-CNF.cnf" },
 	{ 0, NULL }
 };
 
@@ -155,6 +159,7 @@
 	case Litecell15_PrimId_SetCalibTblReq:   return Litecell15_PrimId_SetCalibTblCnf;
 	case Litecell15_PrimId_MuteRfReq:        return Litecell15_PrimId_MuteRfCnf;
 	case Litecell15_PrimId_SetRxAttenReq:    return Litecell15_PrimId_SetRxAttenCnf;
+	case Litecell15_PrimId_IsAliveReq:	 return Litecell15_PrimId_IsAliveCnf;
         default:                                 return -1;	// Weak
         }
 }
diff --git a/src/osmo-bts-litecell15/lc15bts.h b/src/osmo-bts-litecell15/lc15bts.h
index cada00d..a00c48f 100644
--- a/src/osmo-bts-litecell15/lc15bts.h
+++ b/src/osmo-bts-litecell15/lc15bts.h
@@ -88,6 +88,7 @@
 #define GSM_BTS_PEDESTAL_MODE_DEFAULT	0	/* Unused TS is off by default */
 #define GSM_BTS_LED_CTRL_MODE_DEFAULT	0	/* LED is controlled by BTS by default */
 #define GSM_BTS_PWR_RED_STEP_DEFAULT	2	/* Default Tx power reduction step is 2 dB */
+#define GSM_BTS_DSP_ALIVE_TMR_DEFAULT	5	/* Default DSP alive timer is 5 seconds  */
 #define GSM_BTS_TX_PWR_ADJ_DEFAULT	0	/* Default Tx power auto adjustment is none */
 #define GSM_BTS_TX_RED_PWR_8PSK_DEFAULT	0	/* Default 8-PSK maximum power level is 0 dB */
 
diff --git a/src/osmo-bts-litecell15/lc15bts_vty.c b/src/osmo-bts-litecell15/lc15bts_vty.c
index 1b2ff61..4150504 100644
--- a/src/osmo-bts-litecell15/lc15bts_vty.c
+++ b/src/osmo-bts-litecell15/lc15bts_vty.c
@@ -448,6 +448,24 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN(cfg_bts_dsp_alive_timer, cfg_bts_dsp_alive_timer_cmd,
+	"dsp-alive-period <0-60>",
+	"Set DSP alive timer period in second\n")
+{
+	struct gsm_bts *bts = vty->index;;
+	struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
+	uint8_t period = (uint8_t)atoi(argv[0]);
+
+	if (( period >  60 ) || ( period < 0 )) {
+		vty_out(vty, "DSP heart beat alive timer period must be between 0 and 60 seconds (%d) %s",
+				period, VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+
+	btsb->dsp_alive_period = period;
+	return CMD_SUCCESS;
+}
+
 DEFUN(cfg_bts_auto_tx_pwr_adj, cfg_bts_auto_tx_pwr_adj_cmd,
 	"pwr-adj-mode (none|auto)",
 	"Set output power adjustment mode\n")
@@ -498,6 +516,9 @@
 
 	vty_out(vty, " led-control-mode %s%s",
 			get_value_string(lc15_led_mode_strs, btsb->led_ctrl_mode), VTY_NEWLINE);
+
+	vty_out(vty, " dsp-alive-period %d%s",
+			btsb->dsp_alive_period, VTY_NEWLINE);
 
 	vty_out(vty, " pwr-adj-mode %s%s",
 			get_value_string(lc15_auto_adj_pwr_strs, btsb->tx_pwr_adj_mode), VTY_NEWLINE);
@@ -596,6 +617,7 @@
 	install_element(BTS_NODE, &cfg_bts_led_mode_cmd);
 	install_element(BTS_NODE, &cfg_bts_max_cell_size_cmd);
 	install_element(BTS_NODE, &cfg_bts_pwr_red_step_cmd);
+	install_element(BTS_NODE, &cfg_bts_dsp_alive_timer_cmd);
 	install_element(BTS_NODE, &cfg_bts_auto_tx_pwr_adj_cmd);
 	install_element(BTS_NODE, &cfg_bts_tx_red_pwr_8psk_cmd);
 
diff --git a/src/osmo-bts-litecell15/main.c b/src/osmo-bts-litecell15/main.c
index ce30021..6a2509b 100644
--- a/src/osmo-bts-litecell15/main.c
+++ b/src/osmo-bts-litecell15/main.c
@@ -78,6 +78,7 @@
 	btsb->diversity_mode = GSM_BTS_DIVERSITY_MODE_DEFAULT;
 	btsb->pedestal_mode = GSM_BTS_PEDESTAL_MODE_DEFAULT;
 	btsb->pwr_red_step = GSM_BTS_PWR_RED_STEP_DEFAULT;
+	btsb->dsp_alive_period = GSM_BTS_DSP_ALIVE_TMR_DEFAULT;
 	btsb->tx_pwr_adj_mode = GSM_BTS_TX_PWR_ADJ_DEFAULT;
 	btsb->tx_pwr_red_8psk = GSM_BTS_TX_RED_PWR_8PSK_DEFAULT;
 

-- 
To view, visit https://gerrit.osmocom.org/243
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic075063a5b3294b72cc502a01e9616c296797238
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Minh-Quang Nguyen <minh-quang.nguyen at nutaq.com>



More information about the gerrit-log mailing list