dexter has uploaded this change for review.
paging: rename all IMM.ASS references to MACBLOCK
The paging interface towards the PCU has a confusing API. In fact what
the PCU does when it wants to page or do an immediate assignment is
sending a ready formatted macblock to the BTS. The BTS then puts this
macblock in the paging queue and then eventually it justs sends it
without looking at the contents. For the code in paging.c it is not
imortant if the macblock is an immediate assignment, it only cares if
the paging record contains a macblock or paging parameters.
Related: OS##5927
Change-Id: Ifab37fdedaba98b160718113767e4ef6ee7d16ad
---
M include/osmo-bts/paging.h
M src/common/paging.c
M src/common/pcu_sock.c
3 files changed, 48 insertions(+), 28 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/87/32687/1
diff --git a/include/osmo-bts/paging.h b/include/osmo-bts/paging.h
index fb50323..b413606 100644
--- a/include/osmo-bts/paging.h
+++ b/include/osmo-bts/paging.h
@@ -35,9 +35,10 @@
int paging_add_identity(struct paging_state *ps, uint8_t paging_group,
const uint8_t *identity_lv, uint8_t chan_needed);
-/* Add an IMM.ASS message to the paging queue */
-int paging_add_imm_ass(struct paging_state *ps,
- const uint8_t *data, uint8_t len);
+/* Add a ready formatted MACBLOCK 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 uint8_t *data, uint8_t len);
/* 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 26ba9b0..c7a6607 100644
--- a/src/common/paging.c
+++ b/src/common/paging.c
@@ -48,8 +48,8 @@
#define MAX_BS_PA_MFRMS 9
enum paging_record_type {
- PAGING_RECORD_PAGING,
- PAGING_RECORD_IMM_ASS
+ PAGING_RECORD_NORMAL,
+ PAGING_RECORD_MACBLOCK
};
struct paging_record {
@@ -63,7 +63,7 @@
} paging;
struct {
uint8_t msg[GSM_MACBLOCK_LEN];
- } imm_ass;
+ } macblock;
} u;
};
@@ -88,9 +88,9 @@
/* The prioritization of cs pagings is controlled by a hysteresis. When the
* fill state of the paging queue exceeds the upper fill level
- * THRESHOLD_CONGESTED [%], then PS pagings (immediate assignments) will be
- * dropped until fill state of the paging queue drops under the lower fill
- * level THRESHOLD_CLEAR [%]. */
+ * THRESHOLD_CONGESTED [%], then PS pagings (immediate assignments and pagings
+ * from the PCU) will be dropped until fill state of the paging queue drops
+ * under the lower fill level THRESHOLD_CLEAR [%]. */
#define THRESHOLD_CONGESTED 66 /* (percent of num_paging_max) */
#define THRESHOLD_CLEAR 50 /* (percent of num_paging_max) */
@@ -230,7 +230,7 @@
/* Check if we already have this identity */
llist_for_each_entry(pr, group_q, list) {
- if (pr->type != PAGING_RECORD_PAGING)
+ if (pr->type != PAGING_RECORD_NORMAL)
continue;
if (identity_lv[0] == pr->u.paging.identity_lv[0] &&
!memcmp(identity_lv+1, pr->u.paging.identity_lv+1,
@@ -245,7 +245,7 @@
pr = talloc_zero(ps, struct paging_record);
if (!pr)
return -ENOMEM;
- pr->type = PAGING_RECORD_PAGING;
+ pr->type = PAGING_RECORD_NORMAL;
if (*identity_lv + 1 > sizeof(pr->u.paging.identity_lv)) {
talloc_free(pr);
@@ -267,8 +267,9 @@
return 0;
}
-/* Add an IMM.ASS message to the paging queue */
-int paging_add_imm_ass(struct paging_state *ps,
+/* Add a ready formatted MACBLOCK 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 uint8_t *data, uint8_t len)
{
struct llist_head *group_q;
@@ -285,7 +286,7 @@
}
if (len != GSM_MACBLOCK_LEN + 3) {
- LOGP(DPAG, LOGL_ERROR, "IMM.ASS invalid length %d\n", len);
+ LOGP(DPAG, LOGL_ERROR, "macblock with invalid length %d (GSM_MACBLOCK_LEN + 3)\n", len);
return -EINVAL;
}
len -= 3;
@@ -300,11 +301,11 @@
pr = talloc_zero(ps, struct paging_record);
if (!pr)
return -ENOMEM;
- pr->type = PAGING_RECORD_IMM_ASS;
+ pr->type = PAGING_RECORD_MACBLOCK;
- LOGP(DPAG, LOGL_INFO, "Add IMM.ASS to queue (group=%u)\n",
+ LOGP(DPAG, LOGL_INFO, "Add macblock to paging queue (group=%u)\n",
paging_group);
- memcpy(pr->u.imm_ass.msg, data, GSM_MACBLOCK_LEN);
+ memcpy(pr->u.macblock.msg, data, GSM_MACBLOCK_LEN);
/* enqueue the new message to the HEAD of the queue */
llist_add(&pr->list, group_q);
@@ -599,7 +600,7 @@
*is_empty = 1;
} else {
struct paging_record *pr[4];
- unsigned int num_pr = 0, imm_ass = 0;
+ unsigned int num_pr = 0, macblock = 0;
time_t now = time(NULL);
unsigned int i, num_imsi = 0;
@@ -611,9 +612,9 @@
break;
pr[i] = dequeue_pr(group_q);
- /* check for IMM.ASS */
- if (pr[i]->type == PAGING_RECORD_IMM_ASS) {
- imm_ass = 1;
+ /* check for MACBLOCK */
+ if (pr[i]->type == PAGING_RECORD_MACBLOCK) {
+ macblock = 1;
break;
}
@@ -624,16 +625,16 @@
num_imsi++;
}
- /* if we have an IMMEDIATE ASSIGNMENT */
- if (imm_ass) {
- /* re-add paging records */
+ /* if we have a MACBLOCK (from the PCU), we send a conformation back */
+ if (macblock) {
+ /* re-add normal paging records */
for (i = 0; i < num_pr; i++)
llist_add(&pr[i]->list, group_q);
- /* get message and free record */
- memcpy(out_buf, pr[num_pr]->u.imm_ass.msg,
+ /* get MACBLOCK 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.imm_ass.msg,
+ 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 2fb0524..00debad 100644
--- a/src/common/pcu_sock.c
+++ b/src/common/pcu_sock.c
@@ -675,7 +675,7 @@
switch (data_req->sapi) {
case PCU_IF_SAPI_PCH:
- paging_add_imm_ass(bts->paging_state, data_req->data, data_req->len);
+ paging_add_macblock(bts->paging_state, data_req->data, data_req->len);
break;
case PCU_IF_SAPI_AGCH:
msg = msgb_alloc(data_req->len, "pcu_agch");
To view, visit change 32687. To unsubscribe, or for help writing mail filters, visit settings.