lynxis lazus submitted this change.

View Change

Approvals: Jenkins Builder: Verified lynxis lazus: Looks good to me, approved
iu_client: add ranap_iu_page_cs2/ranap_iu_page_ps2

ranap_iu_page_cs2 and ranap_iu_page_ps2 are using the newer osmocom
osmo_location_area_id or osmo_routing_area_id which also contain
the PLMN.

Change-Id: I1f07e96642737160d387de3e4c3f71d288d356dd
---
M TODO-RELEASE
M include/osmocom/ranap/iu_client.h
M src/iu_client.c
3 files changed, 104 insertions(+), 3 deletions(-)

diff --git a/TODO-RELEASE b/TODO-RELEASE
index 34f3506..ac52f44 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -9,3 +9,4 @@
#library what description / commit summary line
libosmo-ranap add API ranap_ran_rx_co_decode2()
libosmo-ranap deprecate API ranap_ran_rx_co_decode()
+libosmo-ranap add API iu_client.h: add ranap_iu_page_cs2/ranap_iu_page_ps2
diff --git a/include/osmocom/ranap/iu_client.h b/include/osmocom/ranap/iu_client.h
index 2e72839..86ae874 100644
--- a/include/osmocom/ranap/iu_client.h
+++ b/include/osmocom/ranap/iu_client.h
@@ -2,6 +2,7 @@

#include <stdbool.h>

+#include <osmocom/core/defs.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/gsm/gsm48.h>
#include <osmocom/sigtran/sccp_sap.h>
@@ -65,8 +66,14 @@

int ranap_iu_tx(struct msgb *msg, uint8_t sapi);

-int ranap_iu_page_cs(const char *imsi, const uint32_t *tmsi, uint16_t lac);
-int ranap_iu_page_ps(const char *imsi, const uint32_t *ptmsi, uint16_t lac, uint8_t rac);
+int ranap_iu_page_cs(const char *imsi, const uint32_t *tmsi, uint16_t lac)
+ OSMO_DEPRECATED("Use ranap_iu_page_cs2 instead");
+
+int ranap_iu_page_ps(const char *imsi, const uint32_t *ptmsi, uint16_t lac, uint8_t rac)
+ OSMO_DEPRECATED("Use ranap_iu_page_ps2 instead");
+
+int ranap_iu_page_cs2(const char *imsi, const uint32_t *tmsi, const struct osmo_location_area_id *lai);
+int ranap_iu_page_ps2(const char *imsi, const uint32_t *ptmsi, const struct osmo_routing_area_id *rai);

int ranap_iu_rab_act(struct ranap_ue_conn_ctx *ue_ctx, struct msgb *msg);
int ranap_iu_rab_deact(struct ranap_ue_conn_ctx *ue_ctx, uint8_t rab_id);
diff --git a/src/iu_client.c b/src/iu_client.c
index a9999c0..ce3030e 100644
--- a/src/iu_client.c
+++ b/src/iu_client.c
@@ -814,7 +814,7 @@
bool is_ps, uint32_t paging_cause)
{
struct msgb *msg;
- msg = ranap_new_msg_paging_cmd(imsi, tmsi, is_ps? 1 : 0, paging_cause);
+ msg = ranap_new_msg_paging_cmd(imsi, tmsi, is_ps ? 1 : 0, paging_cause);
msg->l2h = msg->data;
return osmo_sccp_tx_unitdata_msg(g_scu, &g_local_sccp_addr, called_addr, msg);
}
@@ -856,16 +856,109 @@
return paged;
}

+/*! Old paging() doesn't use PLMN and transmit paging command only to the first RNC */
int ranap_iu_page_cs(const char *imsi, const uint32_t *tmsi, uint16_t lac)
{
return iu_page(imsi, tmsi, lac, 0, false);
}

+/*! Old paging() doesn't use PLMN and transmit paging command only to the first RNC */
int ranap_iu_page_ps(const char *imsi, const uint32_t *ptmsi, uint16_t lac, uint8_t rac)
{
return iu_page(imsi, ptmsi, lac, rac, true);
}

+/*! Transmit a single page request towards all RNCs serving the specific LAI (no page retransmission).
+ *
+ * \param imsi the imsi as human readable string
+ * \param tmsi NULL or pointer to the tmsi
+ * \param lai full Location Area Identifier
+ * \return amount of paged RNCs. 0 when no RNC found.
+ */
+int ranap_iu_page_cs2(const char *imsi, const uint32_t *tmsi, const struct osmo_location_area_id *lai)
+{
+ struct ranap_iu_rnc *rnc;
+ struct iu_lac_rac_entry *entry;
+ char log_msg[32] = {};
+ int paged = 0;
+ int rc = 0;
+
+ /* find all RNCs which are serving this LA */
+ llist_for_each_entry(rnc, &rnc_list, entry) {
+ llist_for_each_entry(entry, &rnc->lac_rac_list, entry) {
+ if (osmo_lai_cmp(&entry->rai.lac, lai))
+ continue;
+
+ rc = iu_tx_paging_cmd(&rnc->sccp_addr, imsi, tmsi, false, 0);
+ if (rc > 0) {
+ LOGPIU(LOGL_ERROR, "IuCS: Failed to tx Paging RNC %s for LAC %s for IMSI %s / TMSI %08x",
+ osmo_rnc_id_name(&rnc->rnc_id),
+ osmo_lai_name(lai), imsi, tmsi ? *tmsi : GSM_RESERVED_TMSI);
+ }
+ paged++;
+ break;
+ }
+ }
+
+ if (tmsi)
+ snprintf(log_msg, sizeof(log_msg), "for TMSI %08x\n", *tmsi);
+ else
+ snprintf(log_msg, sizeof(log_msg) - 1, "for IMSI %s\n", imsi);
+
+ if (paged)
+ LOGPIU(LOGL_DEBUG, "IuPS: Paged %d RNCs on LAI %s for %s", paged, osmo_lai_name(lai), log_msg);
+ else
+ LOGPIU(LOGL_INFO, "IuPS: Found no RNC to Page on LAI %s for %s", osmo_lai_name(lai), log_msg);
+
+
+ return paged;
+}
+
+/*! Transmit a single page request towards all RNCs serving the specific RAI (no page retransmission).
+ *
+ * \param imsi the imsi as human readable string
+ * \param ptmsi NULL or pointer to the tmsi
+ * \param rai full Location Area Identifier
+ * \return amount of paged RNCs. 0 when no RNC found.
+ */
+int ranap_iu_page_ps2(const char *imsi, const uint32_t *ptmsi, const struct osmo_routing_area_id *rai)
+{
+ struct ranap_iu_rnc *rnc;
+ struct iu_lac_rac_entry *entry;
+ char log_msg[32] = {};
+ int paged = 0;
+ int rc = 0;
+
+ /* find all RNCs which are serving this RAC */
+ llist_for_each_entry(rnc, &rnc_list, entry) {
+ llist_for_each_entry(entry, &rnc->lac_rac_list, entry) {
+ if (osmo_rai_cmp(&entry->rai, rai))
+ continue;
+
+ rc = iu_tx_paging_cmd(&rnc->sccp_addr, imsi, ptmsi, true, 0);
+ if (rc > 0) {
+ LOGPIU(LOGL_ERROR, "IuPS: Failed to tx Paging RNC %s for RAC %s for IMSI %s / P-TMSI %08x",
+ osmo_rnc_id_name(&rnc->rnc_id),
+ osmo_rai_name2(rai), imsi, ptmsi ? *ptmsi : GSM_RESERVED_TMSI);
+ }
+ paged++;
+ break;
+ }
+ }
+
+ if (ptmsi)
+ snprintf(log_msg, sizeof(log_msg) - 1, "for PTMSI %08x\n", *ptmsi);
+ else
+ snprintf(log_msg, sizeof(log_msg) - 1, "for IMSI %s\n", imsi);
+
+ if (paged)
+ LOGPIU(LOGL_DEBUG, "IuPS: Paged %d RNCs on RAI %s for %s", paged, osmo_rai_name2(rai), log_msg);
+ else
+ LOGPIU(LOGL_INFO, "IuPS: Found no RNC to Page on RAI %s for %s", osmo_rai_name2(rai), log_msg);
+
+ return paged;
+}
+

/***********************************************************************
*

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

Gerrit-MessageType: merged
Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-Change-Id: I1f07e96642737160d387de3e4c3f71d288d356dd
Gerrit-Change-Number: 38946
Gerrit-PatchSet: 20
Gerrit-Owner: lynxis lazus <lynxis@fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis@fe80.eu>
Gerrit-Reviewer: neels <nhofmeyr@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>