dexter has uploaded this change for review.

View Change

pcu_sock: forward downlink IMMEDAITE ASSIGNMENT to AGCH

When the SAPI PCU_IF_SAPI_PCH_DT is used, messages should include an
IMSI. However, there may be situations in the PCU where no IMSI is
available when sending an IMMEDIATE ASSIGNMENT through the PCH. In those
cases we cannot calculate the paging group. Even though it would work to
use the paging group 0, it is more appropriate to send the IMMEDIATE
ASSIGNMENT through the AGCH then.

Related: OS#6097
Change-Id: Iaa3e5cdcf86578821e149b3e23482a0bcee19f7b
---
M include/osmo-bts/bts.h
M src/common/bts.c
M src/common/pcu_sock.c
3 files changed, 61 insertions(+), 4 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/29/33829/1
diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index a17278e..ac3c58b 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -430,4 +430,7 @@

int bts_set_c0_pwr_red(struct gsm_bts *bts, const uint8_t red);

+#define BTS_MSGB_CB_GET_TLLI(__msgb) ((__msgb)->cb[0])
+#define BTS_MSGB_CB_PUT_TLLI(__msgb, tlli) __msgb->cb[0] = tlli
+
#endif /* _BTS_H */
diff --git a/src/common/bts.c b/src/common/bts.c
index 3141eef..9ada91f 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -56,6 +56,7 @@
#include <osmo-bts/nm_common_fsm.h>
#include <osmo-bts/power_control.h>
#include <osmo-bts/osmux.h>
+#include <osmo-bts/pcu_if.h>

#define MIN_QUAL_RACH 50 /* minimum link quality (in centiBels) for Access Bursts */
#define MIN_QUAL_NORM -5 /* minimum link quality (in centiBels) for Normal Bursts */
@@ -750,13 +751,18 @@
/* Copy AGCH message */
memcpy(out_buf, msgb_l3(msg), msgb_l3len(msg));
rc = msgb_l3len(msg);
+
+ /* In case a confirmation is ordered (a valid TLLI is attached to this
+ * message buffer), send confirmation back to PCU. */
+ if (BTS_MSGB_CB_GET_TLLI(msg) != GSM_RESERVED_TMSI)
+ pcu_tx_pch_data_cnf(gt->fn, BTS_MSGB_CB_GET_TLLI(msg));
+
msgb_free(msg);

if (is_ag_res)
bts->agch_queue.agch_msgs++;
else
bts->agch_queue.pch_msgs++;
-
return rc;
}

diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c
index 9e34fe8..6bbaa47 100644
--- a/src/common/pcu_sock.c
+++ b/src/common/pcu_sock.c
@@ -34,6 +34,7 @@
#include <osmocom/core/write_queue.h>
#include <osmocom/gsm/gsm23003.h>
#include <osmocom/gsm/abis_nm.h>
+#include <osmocom/gsm/gsm48.h>
#include <osmo-bts/logging.h>
#include <osmo-bts/gsm_data.h>
#include <osmo-bts/pcu_if.h>
@@ -688,9 +689,38 @@

gsm_pcu_if_pch_dt = (struct gsm_pcu_if_pch_dt *)data_req->data;
gsm48_imm_ass = (struct gsm48_imm_ass *)gsm_pcu_if_pch_dt->data;
- confirm = (gsm48_imm_ass->msg_type == GSM48_MT_RR_IMM_ASS);
- rc = paging_add_macblock(bts->paging_state, gsm_pcu_if_pch_dt->tlli,
- gsm_pcu_if_pch_dt->imsi, confirm, gsm_pcu_if_pch_dt->data);
+
+ if (strlen(gsm_pcu_if_pch_dt->imsi) == 0 && gsm48_imm_ass->msg_type == GSM48_MT_RR_IMM_ASS) {
+ /* This is a backup path in case no IMSI is included in struct gsm_pcu_if_pch_dt and the MAC
+ * block contains an IMMEDIATE ASSIGNMENT message. In this case we may forward the MAC block
+ * to the AGCH. The MS may still be able to receive the MAC block when it is listening on all
+ * CCCH blocks in non-DRX mode. Non-DRX mode is usually active in the GMM ATTACH REQUEST phase.
+ * See also: 3gpp TS 44.060, section 5.5.1.5 and 3gpp TS 45.002, section 6.5.3, 6.5.6
+ *
+ * FIXME: It should be noted that the imsi struct member in struct gsm_pcu_if_pch_dt is not an
+ * optional parameter and leaving it unpopulated is a violation of the protocol. This backup
+ * path exists as an intermediate solution since it is not possible to send downlink IMMEDIATE
+ * ASSIGNMENT messages directly through PCU_IF_SAPI_AGCH yet. The reason for this is that
+ * the downlink IMMEDAITE ASSIGNMNET has to be confirmed and there is currently no way to
+ * attach the TLLI in messages for PCU_IF_SAPI_AGCH. See also: OS#6097 */
+ LOGP(DPCU, LOGL_NOTICE, "Rx DATA.req for PCH without IMSI, cannot calculate paging group, forwarding to AGCH\n");
+ msg = msgb_alloc(data_req->len, "pcu_agch");
+ if (!msg) {
+ rc = -ENOMEM;
+ break;
+ }
+ msg->l3h = msgb_put(msg, GSM_MACBLOCK_LEN);
+ memcpy(msg->l3h, gsm_pcu_if_pch_dt->data, GSM_MACBLOCK_LEN);
+ BTS_MSGB_CB_PUT_TLLI(msg, gsm_pcu_if_pch_dt->tlli);
+ if (bts_agch_enqueue(bts, msg) < 0) {
+ msgb_free(msg);
+ rc = -EIO;
+ }
+ } else {
+ confirm = (gsm48_imm_ass->msg_type == GSM48_MT_RR_IMM_ASS);
+ rc = paging_add_macblock(bts->paging_state, gsm_pcu_if_pch_dt->tlli,
+ gsm_pcu_if_pch_dt->imsi, confirm, gsm_pcu_if_pch_dt->data);
+ }
break;
}
case PCU_IF_SAPI_AGCH:
@@ -701,6 +731,7 @@
}
msg->l3h = msgb_put(msg, data_req->len);
memcpy(msg->l3h, data_req->data, data_req->len);
+ BTS_MSGB_CB_PUT_TLLI(msg, GSM_RESERVED_TMSI);
if (bts_agch_enqueue(bts, msg) < 0) {
msgb_free(msg);
rc = -EIO;

To view, visit change 33829. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Iaa3e5cdcf86578821e149b3e23482a0bcee19f7b
Gerrit-Change-Number: 33829
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier@sysmocom.de>
Gerrit-MessageType: newchange