aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/bsc/Makefile.am1
-rw-r--r--include/osmocom/bsc/abis_osmo.h33
-rw-r--r--include/osmocom/bsc/bts.h2
-rw-r--r--src/ipaccess/Makefile.am2
-rw-r--r--src/osmo-bsc/Makefile.am1
-rw-r--r--src/osmo-bsc/abis_osmo.c161
-rw-r--r--src/osmo-bsc/bts_ipaccess_nanobts.c12
-rw-r--r--src/utils/Makefile.am2
-rw-r--r--tests/abis/Makefile.am1
-rw-r--r--tests/acc/Makefile.am1
-rw-r--r--tests/bsc/Makefile.am1
-rw-r--r--tests/gsm0408/Makefile.am1
-rw-r--r--tests/handover/Makefile.am1
-rw-r--r--tests/nanobts_omlattr/Makefile.am1
14 files changed, 220 insertions, 0 deletions
diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am
index be27dae30..5e866cc01 100644
--- a/include/osmocom/bsc/Makefile.am
+++ b/include/osmocom/bsc/Makefile.am
@@ -2,6 +2,7 @@ noinst_HEADERS = \
a_reset.h \
abis_nm.h \
abis_om2000.h \
+ abis_osmo.h \
abis_rsl.h \
acc.h \
assignment_fsm.h \
diff --git a/include/osmocom/bsc/abis_osmo.h b/include/osmocom/bsc/abis_osmo.h
new file mode 100644
index 000000000..97871ace0
--- /dev/null
+++ b/include/osmocom/bsc/abis_osmo.h
@@ -0,0 +1,33 @@
+/* GSM Network Management messages on the A-bis interface
+ * 3GPP TS 12.21 version 8.0.0 Release 1999 / ETSI TS 100 623 V8.0.0 */
+
+/* (C) 2008-2009 by Harald Welte <laforge@gnumonks.org>
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#pragma once
+
+#include <stdint.h>
+
+#include <osmocom/core/msgb.h>
+
+#include <osmocom/gsm/protocol/gsm_04_08.h>
+
+struct gsm_bts;
+
+int abis_osmo_rcvmsg(struct msgb *msg);
+int abis_osmo_sendmsg(struct gsm_bts *bts, struct msgb *msg);
diff --git a/include/osmocom/bsc/bts.h b/include/osmocom/bsc/bts.h
index b6980d1fe..49691e023 100644
--- a/include/osmocom/bsc/bts.h
+++ b/include/osmocom/bsc/bts.h
@@ -291,6 +291,8 @@ struct gsm_bts {
/* Connected PCU version (if any) */
char pcu_version[MAX_VERSION_LENGTH];
+ /* PCU sign_link, over OML line: */
+ struct e1inp_sign_link *osmo_link;
/* maximum Tx power that the MS is permitted to use in this cell */
int ms_max_power;
diff --git a/src/ipaccess/Makefile.am b/src/ipaccess/Makefile.am
index e282c6f50..351f6183c 100644
--- a/src/ipaccess/Makefile.am
+++ b/src/ipaccess/Makefile.am
@@ -50,6 +50,7 @@ ipaccess_config_LDADD = \
$(top_builddir)/src/osmo-bsc/bts_sm.o \
$(top_builddir)/src/osmo-bsc/bts_trx.o \
$(top_builddir)/src/osmo-bsc/abis_nm.o \
+ $(top_builddir)/src/osmo-bsc/abis_osmo.o \
$(top_builddir)/src/osmo-bsc/acc.o \
$(top_builddir)/src/osmo-bsc/bts_ipaccess_nanobts.o \
$(top_builddir)/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.o \
@@ -74,6 +75,7 @@ ipaccess_proxy_SOURCES = \
ipaccess_proxy_LDADD = \
$(top_builddir)/src/osmo-bsc/abis_nm.o \
+ $(top_builddir)/src/osmo-bsc/abis_osmo.o \
$(top_builddir)/src/osmo-bsc/acc.o \
$(top_builddir)/src/osmo-bsc/bts.o \
$(top_builddir)/src/osmo-bsc/bts_sm.o \
diff --git a/src/osmo-bsc/Makefile.am b/src/osmo-bsc/Makefile.am
index f91c6bfec..df4e0c350 100644
--- a/src/osmo-bsc/Makefile.am
+++ b/src/osmo-bsc/Makefile.am
@@ -31,6 +31,7 @@ osmo_bsc_SOURCES = \
abis_nm_vty.c \
abis_om2000.c \
abis_om2000_vty.c \
+ abis_osmo.c \
abis_rsl.c \
acc.c \
assignment_fsm.c \
diff --git a/src/osmo-bsc/abis_osmo.c b/src/osmo-bsc/abis_osmo.c
new file mode 100644
index 000000000..39caac6df
--- /dev/null
+++ b/src/osmo-bsc/abis_osmo.c
@@ -0,0 +1,161 @@
+/* Osmocom specific protocols over Abis (IPA) */
+
+/* (C) 2021 sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
+ * Author: Pau Espin Pedrol <pespin@sysmocom.de>
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <errno.h>
+#include <osmocom/core/logging.h>
+
+#include <osmocom/core/msgb.h>
+
+#include <osmocom/gsm/protocol/ipaccess.h>
+#include <osmocom/gsm/ipa.h>
+#include <osmocom/gsm/protocol/gsm_12_21.h>
+
+#include <osmocom/bsc/abis_osmo.h>
+#include <osmocom/bsc/debug.h>
+#include <osmocom/bsc/bts.h>
+#include <osmocom/bsc/pcuif_proto.h>
+
+#define OM_HEADROOM_SIZE 128
+
+////////////////////////////////////////
+// OSMO ABIS extensions (PCU)
+///////////////////////////////////////
+#define PCUIF_HDR_SIZE ( sizeof(struct gsm_pcu_if) - sizeof(((struct gsm_pcu_if *)0)->u) )
+
+#if 0
+static struct msgb *abis_osmo_pcu_msgb_alloc(uint8_t msg_type, uint8_t bts_nr, size_t extra_size)
+{
+ struct msgb *msg;
+ struct gsm_pcu_if *pcu_prim;
+ msg = msgb_alloc_headroom(OM_HEADROOM_SIZE + sizeof(struct gsm_pcu_if) + extra_size,
+ OM_HEADROOM_SIZE, "IPA/ABIS/OSMO");
+ /* Only header is filled, caller is responible for reserving + filling
+ * message type specific contents: */
+ msgb_put(msg, PCUIF_HDR_SIZE);
+ pcu_prim = (struct gsm_pcu_if *) msgb_data(msg);
+ pcu_prim->msg_type = msg_type;
+ pcu_prim->bts_nr = bts_nr;
+ return msg;
+}
+
+/* Send a OML NM Message from BSC to BTS */
+static int abis_osmo_pcu_sendmsg(struct gsm_bts *bts, struct msgb *msg)
+{
+ ipa_prepend_header_ext(msg, IPAC_PROTO_EXT_PCU);
+ return abis_osmo_sendmsg(bts, msg);
+}
+#endif
+
+static int rcvmsg_pcu_container(struct gsm_bts *bts, struct gsm_pcu_if_container *container, size_t container_len)
+{
+ int rc;
+ uint16_t data_length = osmo_load16be(&container->length);
+
+ if (container_len < sizeof(*container) + data_length) {
+ LOGP(DNM, LOGL_ERROR, "ABIS_OSMO_PCU CONTAINER message inside (%d) too short\n",
+ container->msg_type);
+ return -EINVAL;
+ }
+
+ LOGP(DNM, LOGL_INFO, "(bts=%d) Rx ABIS_OSMO_PCU CONTAINER msg type %u\n",
+ bts->nr, container->msg_type);
+
+ switch (container->msg_type) {
+ default:
+ LOGP(DNM, LOGL_NOTICE, "(bts=%d) Rx ABIS_OSMO_PCU unexpected msg type (%u) inside container!\n",
+ bts->nr, container->msg_type);
+ rc = -1;
+ }
+
+ return rc;
+}
+
+static int rcvmsg_pcu(struct gsm_bts *bts, struct msgb *msg)
+{
+ struct gsm_pcu_if *pcu_prim;
+ int rc;
+
+ if (msgb_l2len(msg) < PCUIF_HDR_SIZE) {
+ LOGP(DNM, LOGL_ERROR, "ABIS_OSMO_PCU message too short\n");
+ return -EIO;
+ }
+
+ pcu_prim = msgb_l2(msg);
+ LOGP(DNM, LOGL_INFO, "(bts=%d) Rx ABIS_OSMO_PCU msg type %u\n",
+ pcu_prim->bts_nr, pcu_prim->msg_type);
+
+ switch (pcu_prim->msg_type) {
+ case PCU_IF_MSG_CONTAINER:
+ if (msgb_l2len(msg) < PCUIF_HDR_SIZE + sizeof(pcu_prim->u.container)) {
+ LOGP(DNM, LOGL_ERROR, "ABIS_OSMO_PCU CONTAINER message too short\n");
+ rc = -EINVAL;
+ } else {
+ rc = rcvmsg_pcu_container(bts, &pcu_prim->u.container, msgb_l2len(msg) - PCUIF_HDR_SIZE);
+ }
+ break;
+ default:
+ LOGP(DNM, LOGL_NOTICE, "(bts=%d) Rx ABIS_OSMO_PCU unexpected msg type %u!\n",
+ pcu_prim->bts_nr, pcu_prim->msg_type);
+ rc = -1;
+ }
+
+ return rc;
+}
+
+////////////////////////////////////////
+// OSMO ABIS extensions (generic code)
+///////////////////////////////////////
+
+/* High-Level API */
+/* Entry-point where L2 OSMO from BTS enters the NM code */
+int abis_osmo_rcvmsg(struct msgb *msg)
+{
+ int rc;
+ struct e1inp_sign_link *link = msg->dst;
+ struct gsm_bts *bts = link->trx->bts;
+ uint8_t *osmo_type = msgb_l2(msg);
+ msg->l2h = osmo_type + 1;
+
+ switch (*osmo_type) {
+ case IPAC_PROTO_EXT_PCU:
+ rc = rcvmsg_pcu(bts, msg);
+ break;
+ default:
+ LOGP(DNM, LOGL_ERROR, "IPAC_PROTO_EXT 0x%x not supported!\n",
+ *osmo_type);
+ rc = -EINVAL;
+ }
+
+ msgb_free(msg);
+ return rc;
+}
+
+
+/* Send a OML NM Message from BSC to BTS */
+int abis_osmo_sendmsg(struct gsm_bts *bts, struct msgb *msg)
+{
+ msg->dst = bts->osmo_link;
+
+ msg->l2h = msg->data;
+
+ return abis_sendmsg(msg);
+
+}
diff --git a/src/osmo-bsc/bts_ipaccess_nanobts.c b/src/osmo-bsc/bts_ipaccess_nanobts.c
index b97ae1c5c..26e219604 100644
--- a/src/osmo-bsc/bts_ipaccess_nanobts.c
+++ b/src/osmo-bsc/bts_ipaccess_nanobts.c
@@ -37,6 +37,7 @@
#include <osmocom/bsc/gsm_data.h>
#include <osmocom/bsc/abis_nm.h>
#include <osmocom/bsc/abis_rsl.h>
+#include <osmocom/bsc/abis_osmo.h>
#include <osmocom/bsc/debug.h>
#include <osmocom/abis/subchan_demux.h>
#include <osmocom/gsm/ipa.h>
@@ -557,6 +558,10 @@ void ipaccess_drop_oml(struct gsm_bts *bts, const char *reason)
bts->uptime = 0;
osmo_stat_item_dec(osmo_stat_item_group_get_item(bts->bts_statg, BTS_STAT_OML_CONNECTED), 1);
+ /* Also drop the associated OSMO link */
+ e1inp_sign_link_destroy(bts->osmo_link);
+ bts->osmo_link = NULL;
+
/* we have issues reconnecting RSL, drop everything. */
llist_for_each_entry(trx, &bts->trx_list, list) {
ipaccess_drop_rsl(trx, "OML link drop");
@@ -713,6 +718,10 @@ ipaccess_sign_link_up(void *unit_data, struct e1inp_line *line,
sign_link->trx->bts->ip_access.flags |= OML_UP;
}
osmo_stat_item_inc(osmo_stat_item_group_get_item(bts->bts_statg, BTS_STAT_OML_CONNECTED), 1);
+
+ /* Create link for E1INP_SIGN_OSMO */
+ //SAPI must be 0, no IPAC_PROTO_EXT_PCU, see ipaccess_bts_read_cb
+ bts->osmo_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_OSMO, bts->c0, IPAC_PROTO_OSMO, 0);
break;
case E1INP_SIGN_RSL: {
struct e1inp_ts *ts;
@@ -785,6 +794,9 @@ static int ipaccess_sign_link(struct msgb *msg)
case E1INP_SIGN_OML:
ret = abis_nm_rcvmsg(msg);
break;
+ case E1INP_SIGN_OSMO:
+ ret = abis_osmo_rcvmsg(msg);
+ break;
default:
LOGP(DLINP, LOGL_ERROR, "Unknown signal link type %d\n",
link->type);
diff --git a/src/utils/Makefile.am b/src/utils/Makefile.am
index c180390fc..39d24173f 100644
--- a/src/utils/Makefile.am
+++ b/src/utils/Makefile.am
@@ -48,6 +48,7 @@ bs11_config_SOURCES = \
bs11_config_LDADD = \
$(top_builddir)/src/osmo-bsc/abis_nm.o \
+ $(top_builddir)/src/osmo-bsc/abis_osmo.o \
$(top_builddir)/src/osmo-bsc/acc.o \
$(top_builddir)/src/osmo-bsc/bts.o \
$(top_builddir)/src/osmo-bsc/bts_sm.o \
@@ -132,6 +133,7 @@ meas_json_SOURCES = \
meas_json_LDADD = \
$(top_builddir)/src/osmo-bsc/abis_nm.o \
+ $(top_builddir)/src/osmo-bsc/abis_osmo.o \
$(top_builddir)/src/osmo-bsc/acc.o \
$(top_builddir)/src/osmo-bsc/bts.o \
$(top_builddir)/src/osmo-bsc/bts_sm.o \
diff --git a/tests/abis/Makefile.am b/tests/abis/Makefile.am
index cb327fbe2..0612827e1 100644
--- a/tests/abis/Makefile.am
+++ b/tests/abis/Makefile.am
@@ -26,6 +26,7 @@ abis_test_SOURCES = \
abis_test_LDADD = \
$(top_builddir)/src/osmo-bsc/abis_nm.o \
+ $(top_builddir)/src/osmo-bsc/abis_osmo.o \
$(top_builddir)/src/osmo-bsc/acc.o \
$(top_builddir)/src/osmo-bsc/bts.o \
$(top_builddir)/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.o \
diff --git a/tests/acc/Makefile.am b/tests/acc/Makefile.am
index 93515458a..e0044d07c 100644
--- a/tests/acc/Makefile.am
+++ b/tests/acc/Makefile.am
@@ -26,6 +26,7 @@ acc_test_SOURCES = \
acc_test_LDADD = \
$(top_builddir)/src/osmo-bsc/abis_nm.o \
+ $(top_builddir)/src/osmo-bsc/abis_osmo.o \
$(top_builddir)/src/osmo-bsc/acc.o \
$(top_builddir)/src/osmo-bsc/bts.o \
$(top_builddir)/src/osmo-bsc/bts_sm.o \
diff --git a/tests/bsc/Makefile.am b/tests/bsc/Makefile.am
index d08ca1808..a0bbb81b2 100644
--- a/tests/bsc/Makefile.am
+++ b/tests/bsc/Makefile.am
@@ -35,6 +35,7 @@ bsc_test_SOURCES = \
bsc_test_LDADD = \
$(top_builddir)/src/osmo-bsc/abis_nm.o \
+ $(top_builddir)/src/osmo-bsc/abis_osmo.o \
$(top_builddir)/src/osmo-bsc/acc.o \
$(top_builddir)/src/osmo-bsc/osmo_bsc_filter.o \
$(top_builddir)/src/osmo-bsc/bsc_subscriber.o \
diff --git a/tests/gsm0408/Makefile.am b/tests/gsm0408/Makefile.am
index 271a0fd34..186dc39b6 100644
--- a/tests/gsm0408/Makefile.am
+++ b/tests/gsm0408/Makefile.am
@@ -25,6 +25,7 @@ gsm0408_test_SOURCES = \
gsm0408_test_LDADD = \
$(top_builddir)/src/osmo-bsc/abis_nm.o \
+ $(top_builddir)/src/osmo-bsc/abis_osmo.o \
$(top_builddir)/src/osmo-bsc/acc.o \
$(top_builddir)/src/osmo-bsc/gsm_04_08_rr.o \
$(top_builddir)/src/osmo-bsc/bts.o \
diff --git a/tests/handover/Makefile.am b/tests/handover/Makefile.am
index f0b2e7a29..65eb6a890 100644
--- a/tests/handover/Makefile.am
+++ b/tests/handover/Makefile.am
@@ -45,6 +45,7 @@ handover_test_LDADD = \
$(top_builddir)/src/osmo-bsc/abis_nm_vty.o \
$(top_builddir)/src/osmo-bsc/abis_om2000.o \
$(top_builddir)/src/osmo-bsc/abis_om2000_vty.o \
+ $(top_builddir)/src/osmo-bsc/abis_osmo.o \
$(top_builddir)/src/osmo-bsc/abis_rsl.o \
$(top_builddir)/src/osmo-bsc/acc.o \
$(top_builddir)/src/osmo-bsc/assignment_fsm.o \
diff --git a/tests/nanobts_omlattr/Makefile.am b/tests/nanobts_omlattr/Makefile.am
index f2afa2b42..e31b8e921 100644
--- a/tests/nanobts_omlattr/Makefile.am
+++ b/tests/nanobts_omlattr/Makefile.am
@@ -24,6 +24,7 @@ nanobts_omlattr_test_SOURCES = \
nanobts_omlattr_test_LDADD = \
$(top_builddir)/src/osmo-bsc/abis_nm.o \
+ $(top_builddir)/src/osmo-bsc/abis_osmo.o \
$(top_builddir)/src/osmo-bsc/acc.o \
$(top_builddir)/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.o \
$(top_builddir)/src/osmo-bsc/bts.o \