Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/6203

to look at the new patch set (#2).

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

Change-Id: I0a899d9c866ed09dc301694dbbcad304b1ed49e5
---
M include/osmocom/bsc/abis_rsl.h
M include/osmocom/bsc/pcuif_proto.h
M src/libbsc/abis_rsl.c
M src/libbsc/pcu_sock.c
4 files changed, 55 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/03/6203/2

diff --git a/include/osmocom/bsc/abis_rsl.h b/include/osmocom/bsc/abis_rsl.h
index b30702f..705b692 100644
--- a/include/osmocom/bsc/abis_rsl.h
+++ b/include/osmocom/bsc/abis_rsl.h
@@ -61,6 +61,8 @@
 
 /* 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_via_pch(struct gsm_bts *bts, uint32_t tlli,
+            uint8_t len, uint8_t *val, uint8_t pag_grp);
 
 /* Siemens vendor-specific RSL extensions */
 int rsl_siemens_mrpci(struct gsm_lchan *lchan, struct rsl_mrpci *mrpci);
diff --git a/include/osmocom/bsc/pcuif_proto.h 
b/include/osmocom/bsc/pcuif_proto.h
index b9f61b6..8f4a3f9 100644
--- a/include/osmocom/bsc/pcuif_proto.h
+++ b/include/osmocom/bsc/pcuif_proto.h
@@ -3,7 +3,7 @@
 
 #include <osmocom/gsm/l1sap.h>
 
-#define PCU_IF_VERSION         0x09
+#define PCU_IF_VERSION         0x10
 #define TXT_MAX_LEN    128
 
 /* msg_type */
@@ -27,7 +27,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 */
@@ -75,6 +75,7 @@
 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/src/libbsc/abis_rsl.c b/src/libbsc/abis_rsl.c
index 2017d2c..656fc84 100644
--- a/src/libbsc/abis_rsl.c
+++ b/src/libbsc/abis_rsl.c
@@ -1096,6 +1096,15 @@
        return abis_rsl_sendmsg(msg);
 }
 
+/* Append mobile idenitiy (tlli) to message buffer */
+static void rsl_ericsson_put_mi(struct msgb *msg, uint32_t tlli)
+{
+       /* 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, RSL_IE_ERIC_MOBILE_ID);
+       msgb_put_u32(msg, tlli);
+}
+
 /* Chapter 8.5.6 */
 int rsl_ericsson_imm_assign_cmd(struct gsm_bts *bts, uint32_t tlli, uint8_t 
len, uint8_t *val)
 {
@@ -1103,10 +1112,24 @@
        if (!msg)
                return 1;
 
-       /* 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, RSL_IE_ERIC_MOBILE_ID);
-       msgb_put_u32(msg, tlli);
+       /* 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_cmd_via_pch(struct gsm_bts *bts, uint32_t tlli,
+                    uint8_t len, uint8_t *val, 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, RSL_IE_ERIC_PAGING_GROUP);
+       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/src/libbsc/pcu_sock.c b/src/libbsc/pcu_sock.c
index 64422c7..2c477e1 100644
--- a/src/libbsc/pcu_sock.c
+++ b/src/libbsc/pcu_sock.c
@@ -326,9 +326,9 @@
                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
@@ -390,6 +390,7 @@
                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;
@@ -405,18 +406,29 @@
                }
                memcpy(&tlli, data_req->data, 4);
 
-               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);
+               LOGP(DPCU, LOGL_DEBUG, "PCU Sends immediate assignment via PCH 
(tlli=0x%08x, pag_grp=0x%02x)\n",
+                    tlli, pag_grp);
+               if (bts->type == GSM_BTS_TYPE_RBS2000) {
+                       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);
@@ -424,8 +436,8 @@
                }
                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;
        }
 

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I0a899d9c866ed09dc301694dbbcad304b1ed49e5
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus <lyn...@fe80.eu>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pma...@sysmocom.de>
Gerrit-Reviewer: lynxis lazus <lyn...@fe80.eu>

Reply via email to