dexter has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-bsc/+/38957?usp=email )
Change subject: pcu_sock: do not receive a TXT ind. with PCU_VERSION for a specific BTS
......................................................................
pcu_sock: do not receive a TXT ind. with PCU_VERSION for a specific BTS
We receive a TXT indication that contains the PCU_VERSION from the PCU when the
connection to the PCU is established. This message contains a BTS number, which
is always 0. This is a hard coded value that does not refer to a specific BTS
object. Also it is not logical to inform a specific BTS object about the PCU
version. This information should be directed to the connecting process as a
whole. However, we use this TXT indication to trigger certain initialization
processes on the BTS object we manage inside the BSC process. Unfortunately the
BSC is currently using the BTS Number in the TXT indication to resolve the BTS
object. This is not correct, instead the BSC should iterate of over all BTS
objects and trigger the initializations for each BTS object that has a BSC
co-located PCU.
This change does not have any dependencies, it just corrects the behavior of
the BSC on initialization.
Related: OS#6507
Change-Id: I3fbf5430db8b8ea29efb147bd162706990453fc5
---
M src/osmo-bsc/pcu_sock.c
1 file changed, 31 insertions(+), 10 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/57/38957/1
diff --git a/src/osmo-bsc/pcu_sock.c b/src/osmo-bsc/pcu_sock.c
index 02a3d84..23e4479 100644
--- a/src/osmo-bsc/pcu_sock.c
+++ b/src/osmo-bsc/pcu_sock.c
@@ -665,24 +665,33 @@
return 0;
}
-static int pcu_rx_txt_ind(struct gsm_bts *bts,
+static int pcu_rx_txt_ind(struct gsm_network *net, struct gsm_bts *bts,
const struct gsm_pcu_if_txt_ind *txt)
{
- int rc;
+ int rc = 0;
switch (txt->type) {
case PCU_VERSION:
- LOG_BTS(bts, DPCU, LOGL_INFO, "OsmoPCU version %s connected\n",
+ LOGP(DPCU, LOGL_INFO, "OsmoPCU version %s connected\n",
txt->text);
- rc = pcu_tx_si_all(bts);
+
+ /* we use the reception of the PCU_VERSION as a trigger to make the PCU available for
+ * all BTSs handled by this process (currently this is exactly one BTS, see FIXME
notes) */
+ llist_for_each_entry(bts, &net->bts_list, list) {
+ if (bsc_co_located_pcu(bts)) {
+ if (pcu_tx_si_all(bts) < 0)
+ rc = -EINVAL;
+ }
+ }
if (rc < 0)
return -EINVAL;
break;
case PCU_OML_ALERT:
+ OSMO_ASSERT(bts);
LOG_BTS(bts, DPCU, LOGL_ERROR, "PCU external alarm: %s\n", txt->text);
break;
default:
- LOG_BTS(bts, DPCU, LOGL_ERROR, "Unknown TXT_IND type %u received\n",
+ LOGP(DPCU, LOGL_ERROR, "Unknown TXT_IND type %u received\n",
txt->type);
return -EINVAL;
}
@@ -699,25 +708,37 @@
return -EINVAL; \
} \
} while (0)
+
+#define ENSURE_BTS_OBJECT() \
+ if ((bts = gsm_bts_num(net, pcu_prim->bts_nr)) == NULL) { \
+ LOGP(DPCU, LOGL_ERROR, "Received PCU Prim for non-existent BTS %u\n",
pcu_prim->bts_nr); \
+ return -EINVAL; \
+ }
+
static int pcu_rx(struct gsm_network *net, uint8_t msg_type,
struct gsm_pcu_if *pcu_prim, size_t prim_len)
{
int rc = 0;
struct gsm_bts *bts;
- bts = gsm_bts_num(net, pcu_prim->bts_nr);
- if (!bts)
- return -EINVAL;
-
switch (msg_type) {
case PCU_IF_MSG_DATA_REQ:
case PCU_IF_MSG_PAG_REQ:
+ ENSURE_BTS_OBJECT();
CHECK_IF_MSG_SIZE(prim_len, pcu_prim->u.data_req);
rc = pcu_rx_data_req(bts, msg_type, &pcu_prim->u.data_req);
break;
case PCU_IF_MSG_TXT_IND:
CHECK_IF_MSG_SIZE(prim_len, pcu_prim->u.txt_ind);
- rc = pcu_rx_txt_ind(bts, &pcu_prim->u.txt_ind);
+ if (pcu_prim->u.txt_ind.type == PCU_VERSION) {
+ /* A TXT indication that carries the PCU_VERSION is always addressed to the
+ * receiving process as a whole, which means we will not resolve a specific
+ * BTS object in this case. */
+ rc = pcu_rx_txt_ind(net, NULL, &pcu_prim->u.txt_ind);
+ } else {
+ ENSURE_BTS_OBJECT();
+ rc = pcu_rx_txt_ind(NULL, bts, &pcu_prim->u.txt_ind);
+ }
break;
default:
LOGP(DPCU, LOGL_ERROR, "Received unknown PCU msg type %d\n",
--
To view, visit
https://gerrit.osmocom.org/c/osmo-bsc/+/38957?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I3fbf5430db8b8ea29efb147bd162706990453fc5
Gerrit-Change-Number: 38957
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>