aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-trx/trx_if.c
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-11-26 13:59:52 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2018-12-04 16:57:52 +0000
commitc606103d9f6dd406c59c4927f703281d7817f5c9 (patch)
tree6c7ab5bba049dfa0a7775c8d64417dc1ea6c1668 /src/osmo-bts-trx/trx_if.c
parent19ff607e99b3a8c7c5b6428b4346ed7375ea3bc3 (diff)
bts-trx: (n)ack PDCH DEACT only after TRX answered SETSLOT
Before this patch, PDCH DEACT was (n)acked to the BSC without taking into account if TRX succeeded or failed to set the TS: 20181123044720655 DRLL rsl.c:2523 (bts=0,trx=0,ts=0,ss=0) Rx RLL DATA_REQ Abis -> LAPDm 20181123044720700 DRSL rsl.c:2805 (bts=0,trx=0,ts=6,pchan=TCH/F_PDCH as PDCH) ss=0 Rx RSL IPAC_PDCH_DEACT 20181123044720700 DRSL rsl.c:2205 (bts=0,trx=0,ts=6,pchan=TCH/F_PDCH as PDCH) Request to PDCH DEACT, but lchan is still active 20181123044720700 DRSL rsl.c:2131 (bts=0,trx=0,ts=6,ss=0) Tx PDCH DEACT NACK (cause = 0x0f) 20181123044720700 DPCU pcu_sock.c:124 Sending info 20181123044720700 DPCU pcu_sock.c:139 BTS is up 20181123044720700 DPCU pcu_sock.c:232 trx=0 ts=7: available (tsc=7 arfcn=868) 20181123044720703 DPCU pcu_sock.c:608 Deactivate request received: TRX=0 TX=6 20181123044720703 DL1C l1sap.c:1519 deactivating channel chan_nr=TCH/F on TS6 trx=0 20181123044720703 DTRX trx_if.c:242 Enqueuing TRX control command 'CMD NOHANDOVER 6 0' 20181123044720703 DL1C l1sap.c:648 deactivate confirm chan_nr=TCH/F on TS6 trx=0 20181123044720703 DRSL rsl.c:714 (bts=0,trx=0,ts=6,ss=0) not sending REL ACK 20181123044720703 DRSL rsl.c:2264 (bts=0,trx=0,ts=6,ss=0) PDCH DEACT operation: channel disconnected, will reconnect as TCH 20181123044720703 DL1C scheduler.c:593 Configuring multiframe with TCH/F+SACCH trx=0 ts=6 20181123044720703 DTRX trx_if.c:242 Enqueuing TRX control command 'CMD SETSLOT 6 1' 20181123044720703 DL1C l1_if.c:780 (bts=0,trx=0,ts=6) bts_model_ts_connect(as_pchan=TCH/F) success, calling cb_ts_connected() 20181123044720703 DRSL rsl.c:2339 (bts=0,trx=0,ts=6,ss=0) PDCH DEACT operation: timeslot connected as TCH/F 20181123044720703 DRSL rsl.c:2440 (bts=0,trx=0,ts=6,ss=0) TCH/F_PDCH switched to TCH/F mode (ts->flags == 0) 20181123044720703 DRSL rsl.c:2103 (bts=0,trx=0,ts=6,ss=0) Tx PDCH DEACT ACK 20181123044720704 DTRX trx_if.c:492 Response message: 'RSP NOHANDOVER 0 6' 20181123044720705 DTRX trx_if.c:492 Response message: 'RSP SETSLOT 0 6 1' Change-Id: I888de761b65c3ea8bfe623fcf009f3b2b57c926c
Diffstat (limited to 'src/osmo-bts-trx/trx_if.c')
-rw-r--r--src/osmo-bts-trx/trx_if.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c
index abe6846d..89145576 100644
--- a/src/osmo-bts-trx/trx_if.c
+++ b/src/osmo-bts-trx/trx_if.c
@@ -189,6 +189,8 @@ void trx_if_init(struct trx_l1h *l1h)
/*! Send a new TRX control command.
* \param[inout] l1h TRX Layer1 handle to which to send command
* \param[in] criticial
+ * \param[in] cb callback function to be called when valid response is
+ * received. Type of cb depends on type of message.
* \param[in] cmd zero-terminated string containing command
* \param[in] fmt Format string (+ variable list of arguments)
* \returns 0 on success; negative on error
@@ -196,7 +198,7 @@ void trx_if_init(struct trx_l1h *l1h)
* The new ocommand will be added to the end of the control command
* queue.
*/
-static int trx_ctrl_cmd(struct trx_l1h *l1h, int critical, const char *cmd,
+static int trx_ctrl_cmd_cb(struct trx_l1h *l1h, int critical, void *cb, const char *cmd,
const char *fmt, ...)
{
struct trx_ctrl_msg *tcm;
@@ -231,6 +233,7 @@ static int trx_ctrl_cmd(struct trx_l1h *l1h, int critical, const char *cmd,
tcm->params_len = 0;
}
tcm->critical = critical;
+ tcm->cb = cb;
/* Avoid adding consecutive duplicate messages, eg: two consecutive POWEROFF */
if(pending)
@@ -249,6 +252,7 @@ static int trx_ctrl_cmd(struct trx_l1h *l1h, int critical, const char *cmd,
return 0;
}
+#define trx_ctrl_cmd(l1h, critical, cmd, fmt, ...) trx_ctrl_cmd_cb(l1h, critical, NULL, cmd, fmt, ##__VA_ARGS__)
/*! Send "POWEROFF" command to TRX */
int trx_if_cmd_poweroff(struct trx_l1h *l1h)
@@ -315,9 +319,9 @@ int trx_if_cmd_setmaxdlynb(struct trx_l1h *l1h, int dly)
}
/*! Send "SETSLOT" command to TRX: Configure Channel Combination for TS */
-int trx_if_cmd_setslot(struct trx_l1h *l1h, uint8_t tn, uint8_t type)
+int trx_if_cmd_setslot(struct trx_l1h *l1h, uint8_t tn, uint8_t type, trx_if_cmd_setslot_cb *cb)
{
- return trx_ctrl_cmd(l1h, 1, "SETSLOT", "%d %d", tn, type);
+ return trx_ctrl_cmd_cb(l1h, 1, cb, "SETSLOT", "%d %d", tn, type);
}
/*! Send "RXTUNE" command to TRX: Tune Receiver to given ARFCN */
@@ -374,6 +378,7 @@ struct trx_ctrl_rsp {
char cmd[50];
char params[100];
int status;
+ void *cb;
};
static int parse_rsp(const char *buf_in, size_t len_in, struct trx_ctrl_rsp *rsp)
@@ -437,6 +442,30 @@ static bool cmd_matches_rsp(struct trx_ctrl_msg *tcm, struct trx_ctrl_rsp *rsp)
return true;
}
+static int trx_ctrl_rx_rsp_setslot(struct trx_l1h *l1h, struct trx_ctrl_rsp *rsp)
+{
+ trx_if_cmd_setslot_cb *cb = (trx_if_cmd_setslot_cb*) rsp->cb;
+ struct phy_instance *pinst = l1h->phy_inst;
+ unsigned int tn, ts_type;
+
+ if (rsp->status)
+ LOGP(DTRX, LOGL_ERROR, "transceiver (%s) SETSLOT failed with status %d\n",
+ phy_instance_name(pinst), rsp->status);
+
+ /* Since message was already validated against CMD we sent, we know format
+ * of params is: "<TN> <TS_TYPE>" */
+ if (sscanf(rsp->params, "%u %u", &tn, &ts_type) < 2) {
+ LOGP(DTRX, LOGL_ERROR, "transceiver (%s) SETSLOT unable to parse params\n",
+ phy_instance_name(pinst));
+ return -EINVAL;
+ }
+
+ if (cb)
+ cb(l1h, tn, ts_type, rsp->status);
+
+ return rsp->status == 0 ? 0 : -EINVAL;
+}
+
/* -EINVAL: unrecoverable error, exit BTS
* N > 0: try sending originating command again after N seconds
* 0: Done with response, get originating command out from send queue
@@ -459,6 +488,8 @@ static int trx_ctrl_rx_rsp(struct trx_l1h *l1h, struct trx_ctrl_rsp *rsp, bool c
phy_link_state_set(pinst->phy_link, PHY_LINK_SHUTDOWN);
return 5;
}
+ } else if (strcmp(rsp->cmd, "SETSLOT") == 0) {
+ return trx_ctrl_rx_rsp_setslot(l1h, rsp);
}
if (rsp->status) {
@@ -526,6 +557,8 @@ static int trx_ctrl_read_cb(struct osmo_fd *ofd, unsigned int what)
goto rsp_error;
}
+ rsp.cb = tcm->cb;
+
/* check for response code */
rc = trx_ctrl_rx_rsp(l1h, &rsp, tcm->critical);
if (rc == -EINVAL)