aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2019-09-17 01:43:50 +0200
committerlaforge <laforge@osmocom.org>2019-10-17 08:01:10 +0000
commit030824e172bbcc29edd01a9906e2108615541cf0 (patch)
tree638ede78b5ce6f89334437e3ae8bf33e4291d8ae
parent0e124d3131a812d39b817daf77bd8d92cfa7068d (diff)
sgsn_libgtp: refactor ps paging into gprs_gb
Paging should be done in gprs_gb Change-Id: I3020020f52005aa460ca6b245ee2297aec9821b3
-rw-r--r--include/osmocom/sgsn/gprs_gb.h3
-rw-r--r--src/sgsn/gprs_gb.c23
-rw-r--r--src/sgsn/sgsn_libgtp.c13
3 files changed, 28 insertions, 11 deletions
diff --git a/include/osmocom/sgsn/gprs_gb.h b/include/osmocom/sgsn/gprs_gb.h
index 47f2a3184..461eee319 100644
--- a/include/osmocom/sgsn/gprs_gb.h
+++ b/include/osmocom/sgsn/gprs_gb.h
@@ -9,3 +9,6 @@ int gsm0408_gprs_rcvmsg_gb(struct msgb *msg, struct gprs_llc_llme *llme,
bool drop_cipherable);
/* Has to be called whenever any PDU (signaling, data, ...) has been received */
void gprs_gb_recv_pdu(struct sgsn_mm_ctx *mmctx);
+
+/* page a MS in its routing area */
+int gprs_gb_page_ps_ra(struct sgsn_mm_ctx *mmctx);
diff --git a/src/sgsn/gprs_gb.c b/src/sgsn/gprs_gb.c
index 9fa8e00b4..d470cfab9 100644
--- a/src/sgsn/gprs_gb.c
+++ b/src/sgsn/gprs_gb.c
@@ -80,3 +80,26 @@ int gsm0408_gprs_rcvmsg_gb(struct msgb *msg, struct gprs_llc_llme *llme,
return rc;
}
+
+
+int gprs_gb_page_ps_ra(struct sgsn_mm_ctx *mmctx)
+{
+ struct bssgp_paging_info pinfo;
+ int rc;
+
+ /* FIXME: page whole routing area, not only the last known cell */
+
+ /* initiate PS PAGING procedure */
+ memset(&pinfo, 0, sizeof(pinfo));
+ pinfo.mode = BSSGP_PAGING_PS;
+ pinfo.scope = BSSGP_PAGING_BVCI;
+ pinfo.bvci = mmctx->gb.bvci;
+ pinfo.imsi = mmctx->imsi;
+ pinfo.ptmsi = &mmctx->p_tmsi;
+ pinfo.drx_params = mmctx->drx_parms;
+ pinfo.qos[0] = 0; // FIXME
+ rc = bssgp_tx_paging(mmctx->gb.nsei, 0, &pinfo);
+ rate_ctr_inc(&mmctx->ctrg->ctr[GMM_CTR_PAGING_PS]);
+
+ return rc;
+}
diff --git a/src/sgsn/sgsn_libgtp.c b/src/sgsn/sgsn_libgtp.c
index c5bc5b811..a39687f8a 100644
--- a/src/sgsn/sgsn_libgtp.c
+++ b/src/sgsn/sgsn_libgtp.c
@@ -45,6 +45,7 @@
#include <osmocom/sgsn/signal.h>
#include <osmocom/sgsn/debug.h>
#include <osmocom/sgsn/sgsn.h>
+#include <osmocom/sgsn/gprs_gb.h>
#include <osmocom/sgsn/gprs_llc.h>
#include <osmocom/sgsn/gprs_sgsn.h>
#include <osmocom/sgsn/gprs_gmm.h>
@@ -614,7 +615,6 @@ static int cb_extheader_ind(struct sockaddr_in *peer)
/* Called whenever we receive a DATA packet */
static int cb_data_ind(struct pdp_t *lib, void *packet, unsigned int len)
{
- struct bssgp_paging_info pinfo;
struct sgsn_pdp_ctx *pdp;
struct sgsn_mm_ctx *mm;
struct msgb *msg;
@@ -660,16 +660,7 @@ static int cb_data_ind(struct pdp_t *lib, void *packet, unsigned int len)
switch (mm->gmm_fsm->state) {
case ST_GMM_REGISTERED_SUSPENDED:
/* initiate PS PAGING procedure */
- memset(&pinfo, 0, sizeof(pinfo));
- pinfo.mode = BSSGP_PAGING_PS;
- pinfo.scope = BSSGP_PAGING_BVCI;
- pinfo.bvci = mm->gb.bvci;
- pinfo.imsi = mm->imsi;
- pinfo.ptmsi = &mm->p_tmsi;
- pinfo.drx_params = mm->drx_parms;
- pinfo.qos[0] = 0; // FIXME
- bssgp_tx_paging(mm->gb.nsei, 0, &pinfo);
- rate_ctr_inc(&mm->ctrg->ctr[GMM_CTR_PAGING_PS]);
+ gprs_gb_page_ps_ra(mm);
/* FIXME: queue the packet we received from GTP */
break;
case ST_GMM_REGISTERED_NORMAL: