laforge has submitted this change. ( 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 should be 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, 36 insertions(+), 5 deletions(-)
Approvals: Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve dexter: Verified laforge: Looks good to me, approved
diff --git a/include/osmo-bts/paging.h b/include/osmo-bts/paging.h index c009831..9a30abb 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, const uint8_t *macblock); +int paging_add_macblock(struct paging_state *ps, const char *imsi, bool confirm, const uint8_t *macblock);
/* generate paging message for given gsm time */ int paging_gen_msg(struct paging_state *ps, uint8_t *out_buf, struct gsm_time *gt, diff --git a/src/common/paging.c b/src/common/paging.c index f49a36b..55f85f6 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, const uint8_t *macblock) +int paging_add_macblock(struct paging_state *ps, const char *imsi, bool confirm, const uint8_t *macblock) { struct llist_head *group_q; struct paging_record *pr; @@ -306,6 +307,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); @@ -634,8 +636,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 ea244b8..811cea4 100644 --- a/src/common/pcu_sock.c +++ b/src/common/pcu_sock.c @@ -676,6 +676,9 @@
switch (data_req->sapi) { case PCU_IF_SAPI_PCH: + { + const struct gsm48_imm_ass *gsm48_imm_ass; + bool confirm; OSMO_STRLCPY_ARRAY(imsi, (char *)data_req->data); if (data_req->len-3 != GSM_MACBLOCK_LEN) { LOGP(DPCU, LOGL_ERROR, "MAC block with invalid length %d (expecting GSM_MACBLOCK_LEN = %d)\n", @@ -683,8 +686,11 @@ rc = -ENOMEM; break; } - paging_add_macblock(bts->paging_state, imsi, data_req->data + 3); + gsm48_imm_ass = (struct gsm48_imm_ass *)(data_req->data + 3); + confirm = (gsm48_imm_ass->msg_type == GSM48_MT_RR_IMM_ASS); + paging_add_macblock(bts->paging_state, imsi, confirm, data_req->data + 3); break; + } case PCU_IF_SAPI_AGCH: msg = msgb_alloc(data_req->len, "pcu_agch"); if (!msg) {