diff options
author | Philipp Maier <pmaier@sysmocom.de> | 2023-05-16 12:05:14 +0200 |
---|---|---|
committer | Philipp Maier <pmaier@sysmocom.de> | 2023-06-07 12:25:27 +0200 |
commit | c9a8eca543e788cb731f521a9d67682d9d7e6e47 (patch) | |
tree | 9e6472c55dab49d528d314646e2bffb2b3382e3c | |
parent | 9b5721b3fbe8b2d9388c90beeae663929cdbcbd8 (diff) |
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
-rw-r--r-- | include/osmo-bts/paging.h | 2 | ||||
-rw-r--r-- | src/common/paging.c | 10 | ||||
-rw-r--r-- | src/common/pcu_sock.c | 8 |
3 files changed, 15 insertions, 5 deletions
diff --git a/include/osmo-bts/paging.h b/include/osmo-bts/paging.h index c0098316..9a30abb4 100644 --- a/include/osmo-bts/paging.h +++ b/include/osmo-bts/paging.h @@ -37,7 +37,7 @@ int paging_add_identity(struct paging_state *ps, uint8_t paging_group, /* 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 f49a36b8..55f85f6a 100644 --- a/src/common/paging.c +++ b/src/common/paging.c @@ -63,6 +63,7 @@ struct paging_record { } normal; struct { uint8_t msg[GSM_MACBLOCK_LEN]; + bool confirm; } macblock; } u; }; @@ -269,7 +270,7 @@ int paging_add_identity(struct paging_state *ps, uint8_t paging_group, /* 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 @@ int paging_add_macblock(struct paging_state *ps, const char *imsi, const uint8_t 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 @@ int paging_gen_msg(struct paging_state *ps, uint8_t *out_buf, struct gsm_time *g /* 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 ea244b80..811cea4d 100644 --- a/src/common/pcu_sock.c +++ b/src/common/pcu_sock.c @@ -676,6 +676,9 @@ static int pcu_rx_data_req(struct gsm_bts *bts, uint8_t msg_type, 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 @@ static int pcu_rx_data_req(struct gsm_bts *bts, uint8_t msg_type, 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) { |