aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gprs_bssgp_pcu.cpp30
-rw-r--r--src/gprs_bssgp_pcu.h1
2 files changed, 31 insertions, 0 deletions
diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index 7601b218..7f50e17d 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -503,6 +503,11 @@ static int nsvc_signal_cb(unsigned int subsys, unsigned int signal,
LOGP(DPCU, LOGL_NOTICE, "NS-VC is blocked.\n");
}
break;
+ case S_NS_ALIVE_EXP:
+ LOGP(DPCU, LOGL_NOTICE, "Tns alive expired too often, "
+ "re-starting RESET procedure\n");
+ gprs_ns_reconnect(nssd->nsvc);
+ break;
}
return 0;
@@ -723,6 +728,31 @@ static void bvc_timeout(void *_priv)
osmo_timer_schedule(&the_pcu.bvc_timer, the_pcu.bts->fc_interval, 0);
}
+int gprs_ns_reconnect(struct gprs_nsvc *nsvc)
+{
+ struct gprs_nsvc *nsvc2;
+
+ if (!bssgp_nsi) {
+ LOGP(DBSSGP, LOGL_ERROR, "NS instance does not exist\n");
+ return -EINVAL;
+ }
+
+ if (nsvc != the_pcu.nsvc) {
+ LOGP(DBSSGP, LOGL_ERROR, "NSVC is invalid\n");
+ return -EBADF;
+ }
+
+ nsvc2 = gprs_ns_nsip_connect(bssgp_nsi, &nsvc->ip.bts_addr,
+ nsvc->nsei, nsvc->nsvci);
+
+ if (!nsvc2) {
+ LOGP(DBSSGP, LOGL_ERROR, "Failed to reconnect NSVC\n");
+ return -EIO;
+ }
+
+ return 0;
+}
+
/* create BSSGP/NS layer instances */
struct gprs_bssgp_pcu *gprs_bssgp_create_and_connect(struct gprs_rlcmac_bts *bts,
uint16_t local_port, uint32_t sgsn_ip,
diff --git a/src/gprs_bssgp_pcu.h b/src/gprs_bssgp_pcu.h
index 112a8888..e0b83121 100644
--- a/src/gprs_bssgp_pcu.h
+++ b/src/gprs_bssgp_pcu.h
@@ -80,6 +80,7 @@ struct gprs_bssgp_pcu *gprs_bssgp_create_and_connect(struct gprs_rlcmac_bts *bts
uint16_t lac, uint16_t rac, uint16_t cell_id);
void gprs_bssgp_destroy(void);
+int gprs_ns_reconnect(struct gprs_nsvc *nsvc);
struct bssgp_bvc_ctx *gprs_bssgp_pcu_current_bctx(void);