dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/32734 )
Change subject: paging: do not confirm PAGING COMMAND messages ......................................................................
paging: do not confirm PAGING COMMAND messages
when osmo-bts receives a MAC block from osmo-pcu through the PCUIF it puts it in the review queue without further interpreting it. This also means that it will send confirmations to the PCU for IMMEDIATE ASSIGNMENT and PAGING COMMAND. This is not entirely correct because only IMMEDIATE ASSIGNMENT messages shouldbe confirmed. osmo-pcu has no problem with this since it silently drops the confirmations for PAGING COMMAND messages. This peculiarity of the PCUIF implementation makes the confirmation logic hard to understand, so let's add some logic to osmo-bts that makes sure that only IMMEDIATE ASSIGNMENT messages are confirmed.
Related: OS#5927 Change-Id: I8b8264d28b1b1deb08774cdba58dd4c6dafe115d --- M include/osmo-bts/paging.h M src/common/paging.c M src/common/pcu_sock.c 3 files changed, 35 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/34/32734/1
diff --git a/include/osmo-bts/paging.h b/include/osmo-bts/paging.h index 1afb254..45ff754 100644 --- a/include/osmo-bts/paging.h +++ b/include/osmo-bts/paging.h @@ -37,7 +37,7 @@
/* Add a ready formatted MAC block message to the paging queue, this can be an IMMEDIATE ASSIGNMENT, or a * PAGING COMMAND (from the PCU) */ -int paging_add_macblock(struct paging_state *ps, const char *imsi, +int paging_add_macblock(struct paging_state *ps, const char *imsi, bool confirm, const uint8_t *macblock, uint8_t macblock_len);
/* generate paging message for given gsm time */ diff --git a/src/common/paging.c b/src/common/paging.c index 5e11a98..4698c7c 100644 --- a/src/common/paging.c +++ b/src/common/paging.c @@ -63,6 +63,7 @@ } normal; struct { uint8_t msg[GSM_MACBLOCK_LEN]; + bool confirm; } macblock; } u; }; @@ -269,7 +270,7 @@
/* Add a ready formatted MAC block message to the paging queue, this can be an IMMEDIATE ASSIGNMENT, or a * PAGING COMMAND (from the PCU) */ -int paging_add_macblock(struct paging_state *ps, const char *imsi, +int paging_add_macblock(struct paging_state *ps, const char *imsi, bool confirm, const uint8_t *macblock, uint8_t macblock_len) { struct llist_head *group_q; @@ -312,6 +313,7 @@ LOGP(DPAG, LOGL_INFO, "Add MAC block to paging queue (group=%u)\n", paging_group); memcpy(pr->u.macblock.msg, macblock, GSM_MACBLOCK_LEN); + pr->u.macblock.confirm = confirm;
/* enqueue the new message to the HEAD of the queue */ llist_add(&pr->list, group_q); @@ -640,8 +642,10 @@ /* get MAC block message and free record */ memcpy(out_buf, pr[num_pr]->u.macblock.msg, GSM_MACBLOCK_LEN); - pcu_tx_pch_data_cnf(gt->fn, pr[num_pr]->u.macblock.msg, - GSM_MACBLOCK_LEN); + if (pr[num_pr]->u.macblock.confirm) { + pcu_tx_pch_data_cnf(gt->fn, pr[num_pr]->u.macblock.msg, + GSM_MACBLOCK_LEN); + } talloc_free(pr[num_pr]); return GSM_MACBLOCK_LEN; } diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c index 2b5b99c..1d1ef08 100644 --- a/src/common/pcu_sock.c +++ b/src/common/pcu_sock.c @@ -668,6 +668,8 @@ struct msgb *msg; int rc = 0; char imsi[4] = { 0 }; + struct gsm48_imm_ass *gsm48_imm_ass; + bool confirm = false;
LOGP(DPCU, LOGL_DEBUG, "Data request received: sapi=%s arfcn=%d " "block=%d data=%s\n", sapi_string[data_req->sapi], @@ -677,7 +679,10 @@ switch (data_req->sapi) { case PCU_IF_SAPI_PCH: memcpy(imsi, data_req->data, 3); - paging_add_macblock(bts->paging_state, imsi, data_req->data + 3, data_req->len-3); + gsm48_imm_ass = (struct gsm48_imm_ass *)data_req->data + 3; + if (gsm48_imm_ass->msg_type == GSM48_MT_RR_IMM_ASS) + confirm = true; + paging_add_macblock(bts->paging_state, imsi, confirm, data_req->data + 3, data_req->len-3); break; case PCU_IF_SAPI_AGCH: msg = msgb_alloc(data_req->len, "pcu_agch");