aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-10-31 12:20:49 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-11-14 09:23:38 +0100
commitabdf02b9b988a816201b4530f36f709ca4c146ac (patch)
treedcdbadef88738162fea5bdd033e922b3ae561219
parenta790456f1b826ea204f47c4aa4973dc777d00d2a (diff)
sgsn: Split gsm0408_gprs_force_reattach into 2 functions
This patch replaces gsm0408_gprs_force_reattach(msg, mmctx) by two functions - gsm0408_gprs_force_reattach(mmctx) - gsm0408_gprs_force_reattach_oldmsg(msg) The old function basically consists of the code of the two new functions, where the code path selected depends on mmctx == NULL, which is harder to maintain, less obvious to use, and not consistent with many other SGSN functions. Sponsored-by: On-Waves ehf
-rw-r--r--openbsc/include/openbsc/gprs_gmm.h3
-rw-r--r--openbsc/src/gprs/gprs_gmm.c17
-rw-r--r--openbsc/src/gprs/gprs_sgsn.c2
3 files changed, 14 insertions, 8 deletions
diff --git a/openbsc/include/openbsc/gprs_gmm.h b/openbsc/include/openbsc/gprs_gmm.h
index e13b9dc65..0a7c5b355 100644
--- a/openbsc/include/openbsc/gprs_gmm.h
+++ b/openbsc/include/openbsc/gprs_gmm.h
@@ -11,7 +11,8 @@ int gsm48_tx_gsm_act_pdp_acc(struct sgsn_pdp_ctx *pdp);
int gsm48_tx_gsm_deact_pdp_acc(struct sgsn_pdp_ctx *pdp);
int gsm0408_gprs_rcvmsg(struct msgb *msg, struct gprs_llc_llme *llme);
-int gsm0408_gprs_force_reattach(struct msgb *msg, struct sgsn_mm_ctx *mmctx);
+int gsm0408_gprs_force_reattach(struct sgsn_mm_ctx *mmctx);
+int gsm0408_gprs_force_reattach_oldmsg(struct msgb *msg);
int gprs_gmm_rx_suspend(struct gprs_ra_id *raid, uint32_t tlli);
int gprs_gmm_rx_resume(struct gprs_ra_id *raid, uint32_t tlli,
diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c
index 389123d05..711981680 100644
--- a/openbsc/src/gprs/gprs_gmm.c
+++ b/openbsc/src/gprs/gprs_gmm.c
@@ -1689,16 +1689,21 @@ static int gsm0408_rcv_gsm(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
return rc;
}
-int gsm0408_gprs_force_reattach(struct msgb *msg, struct sgsn_mm_ctx *mmctx)
+int gsm0408_gprs_force_reattach_oldmsg(struct msgb *msg)
{
+ int rc;
gprs_llgmm_reset_oldmsg(msg, GPRS_SAPI_GMM);
- if (!mmctx)
- return gsm48_tx_gmm_detach_req_oldmsg(
- msg, GPRS_DET_T_MT_REATT_REQ, GMM_CAUSE_IMPL_DETACHED);
+ rc = gsm48_tx_gmm_detach_req_oldmsg(
+ msg, GPRS_DET_T_MT_REATT_REQ, GMM_CAUSE_IMPL_DETACHED);
+
+ return rc;
+}
- /* Mark MM state as deregistered initiated */
- mmctx->mm_state = GMM_DEREGISTERED_INIT;
+int gsm0408_gprs_force_reattach(struct sgsn_mm_ctx *mmctx)
+{
+ int rc;
+ gprs_llgmm_reset(mmctx->llme);
/* Delete all existing PDP contexts for this MS */
delete_pdp_contexts(mmctx, "forced reattach");
diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c
index 15f475394..c4ff3c27d 100644
--- a/openbsc/src/gprs/gprs_sgsn.c
+++ b/openbsc/src/gprs/gprs_sgsn.c
@@ -448,6 +448,6 @@ int drop_all_pdp_for_ggsn(struct sgsn_ggsn_ctx *ggsn)
int sgsn_force_reattach_oldmsg(struct msgb *oldmsg)
{
- return gsm0408_gprs_force_reattach(oldmsg, NULL);
+ return gsm0408_gprs_force_reattach_oldmsg(oldmsg);
}