summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2017-02-03 18:07:36 +0100
committerPhilipp Maier <pmaier@sysmocom.de>2017-02-24 15:18:22 +0100
commitd779aaef19cefa5006d9de4e75f635996048cff8 (patch)
tree11ee81302f6d1cf806900ad0bd3cd120ce54c15f
parent0cb1d2180d4ad59e02fa362f019262163abf95d5 (diff)
abis-rsl: Send imm.ass messages via PCH
It is possible to send immidiate assign messages through the paging channel. This commit adds the required functionality to the pcu socket interface and to the abis_rsl api
-rw-r--r--openbsc/include/openbsc/abis_rsl.h6
-rw-r--r--openbsc/include/openbsc/pcuif_proto.h3
-rw-r--r--openbsc/src/libbsc/abis_rsl.c36
-rw-r--r--openbsc/src/libbsc/pcu_sock.c36
4 files changed, 62 insertions, 19 deletions
diff --git a/openbsc/include/openbsc/abis_rsl.h b/openbsc/include/openbsc/abis_rsl.h
index e61d4ea..093935b 100644
--- a/openbsc/include/openbsc/abis_rsl.h
+++ b/openbsc/include/openbsc/abis_rsl.h
@@ -58,7 +58,11 @@ int rsl_establish_request(struct gsm_lchan *lchan, uint8_t link_id);
int rsl_relase_request(struct gsm_lchan *lchan, uint8_t link_id);
/* Ericcson vendor specific RSL extensions */
-int rsl_ericsson_imm_assign_cmd(struct gsm_bts *bts, uint32_t tlli, uint8_t len, uint8_t *val);
+int rsl_ericsson_imm_assign_cmd(struct gsm_bts *bts, uint8_t len, uint8_t *val,
+ uint32_t tlli);
+int rsl_ericsson_imm_assign_via_pch_cmd(struct gsm_bts *bts, uint8_t len,
+ uint8_t *val, uint32_t tlli,
+ uint8_t pag_grp);
/* Siemens vendor-specific RSL extensions */
int rsl_siemens_mrpci(struct gsm_lchan *lchan, struct rsl_mrpci *mrpci);
diff --git a/openbsc/include/openbsc/pcuif_proto.h b/openbsc/include/openbsc/pcuif_proto.h
index 1b391c7..79346aa 100644
--- a/openbsc/include/openbsc/pcuif_proto.h
+++ b/openbsc/include/openbsc/pcuif_proto.h
@@ -23,7 +23,7 @@
#define PCU_IF_SAPI_PDTCH 0x05 /* packet data/control/ccch block */
#define PCU_IF_SAPI_PRACH 0x06 /* packet random access channel */
#define PCU_IF_SAPI_PTCCH 0x07 /* packet TA control channel */
-#define PCU_IF_SAPI_AGCH_DT 0x08 /* assignment on AGCH but with additional TLLI */
+#define PCU_IF_SAPI_AGCH_DT 0x08 /* assignment on PCH or AGCH but with additional TLLI */
/* flags */
#define PCU_IF_FLAG_ACTIVE (1 << 0)/* BTS is active */
@@ -61,6 +61,7 @@ struct gsm_pcu_if_data {
struct gsm_pcu_if_data_cnf_dt {
uint8_t sapi;
uint32_t tlli;
+ uint8_t imsi[3];
uint32_t fn;
uint16_t arfcn;
uint8_t trx_nr;
diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c
index 54cc40d..31f25dc 100644
--- a/openbsc/src/libbsc/abis_rsl.c
+++ b/openbsc/src/libbsc/abis_rsl.c
@@ -1084,15 +1084,41 @@ int rsl_imm_assign_cmd(struct gsm_bts *bts, uint8_t len, uint8_t *val)
return abis_rsl_sendmsg(msg);
}
-/* Chapter 8.5.6 */
-int rsl_ericsson_imm_assign_cmd(struct gsm_bts *bts, uint32_t tlli, uint8_t len, uint8_t *val)
-{
- struct msgb *msg = rsl_imm_assign_cmd_common(bts, len, val);
- /* ericsson can handle a reference at the end of the message which is used in
+/* Append mobile idenitiy (tlli) to message buffer */
+static void rsl_ericsson_put_mi(struct msgb *msg, uint32_t tlli)
+{
+ /* NOTE: ericsson can handle a reference at the end of the message which is used in
* the confirm message. The confirm message is only sent if the trailer is present */
msgb_put_u8(msg, 0xf1);
msgb_put_u32(msg, tlli);
+}
+
+/* Chapter 8.5.6 (Ericcson vendor specific RSL extension) */
+int rsl_ericsson_imm_assign_cmd(struct gsm_bts *bts, uint8_t len, uint8_t *val,
+ uint32_t tlli)
+{
+ struct msgb *msg = rsl_imm_assign_cmd_common(bts, len, val);
+
+ /* Append ericsson propritary mobile identity field */
+ rsl_ericsson_put_mi(msg, tlli);
+
+ return abis_rsl_sendmsg(msg);
+}
+
+/* Chapter 8.5.6 (Ericcson vendor specific RSL extension) */
+int rsl_ericsson_imm_assign_via_pch_cmd(struct gsm_bts *bts, uint8_t len,
+ uint8_t *val, uint32_t tlli,
+ uint8_t pag_grp)
+{
+ struct msgb *msg = rsl_imm_assign_cmd_common(bts, len, val);
+
+ /* Append ericsson propritary paging group field */
+ msgb_put_u8(msg, 0x0e);
+ msgb_put_u8(msg, pag_grp);
+
+ /* Append ericsson propritary mobile identity field */
+ rsl_ericsson_put_mi(msg, tlli);
return abis_rsl_sendmsg(msg);
}
diff --git a/openbsc/src/libbsc/pcu_sock.c b/openbsc/src/libbsc/pcu_sock.c
index 418f2a0..f00d687 100644
--- a/openbsc/src/libbsc/pcu_sock.c
+++ b/openbsc/src/libbsc/pcu_sock.c
@@ -314,7 +314,7 @@ static int pcu_rx_rr_paging(struct gsm_bts *bts, uint8_t paging_group,
const uint8_t *raw_rr_msg)
{
struct gsm48_paging1 *p1 = (struct gsm48_paging1 *) raw_rr_msg;
- uint8_t chan_needed?;
+ uint8_t chan_needed;
unsigned int mi_len;
uint8_t *mi;
int rc;
@@ -325,9 +325,9 @@ static int pcu_rx_rr_paging(struct gsm_bts *bts, uint8_t paging_group,
mi_len = p1->data[0];
mi = p1->data+1;
LOGP(DPCU, LOGL_ERROR, "PCU Sends paging "
- "request type %02x (chan_needed=%02x, mi_len=%u, mi=%s)\n",
+ "request type %02x (chan_needed=0x%02x, mi_len=%u, mi=%s, paging_group=0x%02x)\n",
p1->msg_type, chan_needed, mi_len,
- osmo_hexdump_nospc(mi,mi_len));
+ osmo_hexdump_nospc(mi,mi_len), paging_group);
/* NOTE: We will have to add 2 to mi_len and subtract 2 from
* the mi pointer because rsl_paging_cmd() will perform the
* reverse operations. This is because rsl_paging_cmd() is
@@ -392,6 +392,7 @@ static int pcu_rx_data_req(struct gsm_bts *bts, uint8_t msg_type,
msg->l3h = msgb_put(msg, data_req->len);
memcpy(msg->l3h, data_req->data, data_req->len);
+ LOGP(DPCU, LOGL_DEBUG, "PCU Sends immediate assignment via AGCH\n");
if (rsl_imm_assign_cmd(bts, msg->len, msg->data)) {
msgb_free(msg);
rc = -EIO;
@@ -407,18 +408,29 @@ static int pcu_rx_data_req(struct gsm_bts *bts, uint8_t msg_type,
}
tlli = *((uint32_t *)data_req->data);
- msg = msgb_alloc(data_req->len - 4, "pcu_agch");
+ /* the first three bytes are the last three digits of
+ * the IMSI, which we need to compute the paging group */
+ imsi_digit_buf[0] = data_req->data[4];
+ imsi_digit_buf[1] = data_req->data[5];
+ imsi_digit_buf[2] = data_req->data[6];
+ imsi_digit_buf[3] = '\0';
+ pag_grp = gsm0502_calc_paging_group(&bts->si_common.chan_desc,
+ str_to_imsi(imsi_digit_buf));
+
+ msg = msgb_alloc(data_req->len - 7, "pcu_pch");
if (!msg) {
rc = -ENOMEM;
break;
}
- msg->l3h = msgb_put(msg, data_req->len - 4);
- memcpy(msg->l3h, data_req->data + 4, data_req->len - 4);
+ msg->l3h = msgb_put(msg, data_req->len - 7);
+ memcpy(msg->l3h, data_req->data + 7, data_req->len - 7);
- if (bts->type == GSM_BTS_TYPE_RBS2000)
- rc = rsl_ericsson_imm_assign_cmd(bts, tlli, msg->len, msg->data);
- else
- rc = rsl_imm_assign_cmd(bts, msg->len, msg->data);
+ if (bts->type == GSM_BTS_TYPE_RBS2000) {
+ LOGP(DPCU, LOGL_DEBUG, "PCU Sends immediate assignment via PCH (tlli=0x%08x, pag_grp=0x%02x, imsi_digit_buf=%s)\n",
+ tlli, pag_grp, imsi_digit_buf);
+ rc = rsl_ericsson_imm_assign_via_pch_cmd(bts, msg->len, msg->data, tlli, pag_grp);
+ } else
+ LOGP(DPCU, LOGL_ERROR, "This BTS does not support immediate via PCH, dropping message!\n");
if (rc) {
msgb_free(msg);
@@ -426,8 +438,8 @@ static int pcu_rx_data_req(struct gsm_bts *bts, uint8_t msg_type,
}
break;
default:
- LOGP(DPCU, LOGL_ERROR, "Received PCU data request with "
- "unsupported sapi %d\n", data_req->sapi);
+ LOGP(DPCU, LOGL_ERROR, "Received PCU data request for "
+ "unsupported channel (sapi=%d)\n", data_req->sapi);
rc = -EINVAL;
}