From 7060e84f07d29fbc7ed42cee4aa131c2f017a983 Mon Sep 17 00:00:00 2001 From: Alexander Couzens Date: Fri, 2 Dec 2016 18:27:01 +0100 Subject: pcu_sock: implement direct tlli on AGCH Ericsson allows to attach a reference to immediate assignments. A confirmation of the transmission is then sent back, but only containing the reference, not the whole RLC packet. Change-Id: I945f49e62e2a74a7906e2d49940927773edd04a9 --- openbsc/include/openbsc/pcuif_proto.h | 3 ++- openbsc/src/libbsc/pcu_sock.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/openbsc/include/openbsc/pcuif_proto.h b/openbsc/include/openbsc/pcuif_proto.h index 5527238cb..60f57613c 100644 --- a/openbsc/include/openbsc/pcuif_proto.h +++ b/openbsc/include/openbsc/pcuif_proto.h @@ -1,7 +1,7 @@ #ifndef _PCUIF_PROTO_H #define _PCUIF_PROTO_H -#define PCU_IF_VERSION 0x07 +#define PCU_IF_VERSION 0x08 /* msg_type */ #define PCU_IF_MSG_DATA_REQ 0x00 /* send data to given channel */ @@ -22,6 +22,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 */ /* flags */ #define PCU_IF_FLAG_ACTIVE (1 << 0)/* BTS is active */ diff --git a/openbsc/src/libbsc/pcu_sock.c b/openbsc/src/libbsc/pcu_sock.c index 6299f4fe7..081b66caf 100644 --- a/openbsc/src/libbsc/pcu_sock.c +++ b/openbsc/src/libbsc/pcu_sock.c @@ -56,6 +56,7 @@ static const char *sapi_string[] = { [PCU_IF_SAPI_PDTCH] = "PDTCH", [PCU_IF_SAPI_PRACH] = "PRACH", [PCU_IF_SAPI_PTCCH] = "PTCCH", + [PCU_IF_SAPI_AGCH_DT] = "AGCH_DT", }; /* Check if BTS has a PCU connection */ @@ -326,6 +327,7 @@ static int pcu_rx_data_req(struct gsm_bts *bts, uint8_t msg_type, struct gsm_bts_trx_ts *ts; struct msgb *msg; char imsi_digit_buf[4]; + uint32_t tlli = -1; uint8_t pag_grp; int rc = 0; @@ -342,6 +344,7 @@ static int pcu_rx_data_req(struct gsm_bts *bts, uint8_t msg_type, imsi_digit_buf[1] = data_req->data[1]; imsi_digit_buf[2] = data_req->data[2]; imsi_digit_buf[3] = '\0'; + LOGP(DPCU, LOGL_DEBUG, "SAPI PCH imsi %s", imsi_digit_buf); pag_grp = gsm0502_calc_paging_group(&bts->si_common.chan_desc, str_to_imsi(imsi_digit_buf)); pcu_rx_rr_paging(bts, pag_grp, data_req->data+3); @@ -360,6 +363,34 @@ static int pcu_rx_data_req(struct gsm_bts *bts, uint8_t msg_type, rc = -EIO; } break; + case PCU_IF_SAPI_AGCH_DT: + /* DT = direct tlli. A tlli is prefixed */ + + if (data_req->len < 5) { + LOGP(DPCU, LOGL_ERROR, "Received PCU data request with " + "invalid/small length %d\n", data_req->len); + break; + } + tlli = *((uint32_t *)data_req->data); + + msg = msgb_alloc(data_req->len - 4, "pcu_agch"); + 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); + + 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 (rc) { + msgb_free(msg); + rc = -EIO; + } + break; default: LOGP(DPCU, LOGL_ERROR, "Received PCU data request with " "unsupported sapi %d\n", data_req->sapi); -- cgit v1.2.3