summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2017-06-29 19:48:29 +0200
committerHarald Welte <laforge@gnumonks.org>2017-07-28 14:54:35 +0000
commit8b8938f6aec59485d258e8e213d5912be4d18a11 (patch)
treec3b7b4d8f32f84bc13bf91af87616f55131dc4d3 /src
parentb970e1023d177991d78e71c9aae7d0caaa2fecd2 (diff)
BSSGP: add function to reset all PTP BVC
Change-Id: I9bf8f4dd784ccddbb9926492a85fff3293a0e913 Related: OS#1638
Diffstat (limited to 'src')
-rw-r--r--src/gb/gprs_bssgp.c26
-rw-r--r--src/gb/libosmogb.map1
2 files changed, 27 insertions, 0 deletions
diff --git a/src/gb/gprs_bssgp.c b/src/gb/gprs_bssgp.c
index 8daf39f0..25528490 100644
--- a/src/gb/gprs_bssgp.c
+++ b/src/gb/gprs_bssgp.c
@@ -35,6 +35,7 @@
#include <osmocom/core/stats.h>
#include <osmocom/gprs/gprs_bssgp.h>
+#include <osmocom/gprs/gprs_bssgp_bss.h>
#include <osmocom/gprs/gprs_ns.h>
#include "common_vty.h"
@@ -77,6 +78,31 @@ struct bssgp_bvc_ctx *btsctx_by_raid_cid(const struct gprs_ra_id *raid, uint16_t
return NULL;
}
+/*! Initiate reset procedure for all PTP BVC on a given NSEI.
+ *
+ * This function initiates reset procedure for all PTP BVC with a given cause.
+ * \param[in] nsei NSEI to which PTP BVC should belong to
+ * \param[in] cause Cause of BVC RESET
+ * \returns 0 on success, negative error code otherwise
+ */
+int bssgp_tx_bvc_ptp_reset(uint16_t nsei, enum gprs_bssgp_cause cause)
+{
+ int rc;
+ struct bssgp_bvc_ctx *bctx;
+
+ llist_for_each_entry(bctx, &bssgp_bvc_ctxts, list) {
+ if (bctx->nsei == nsei && bctx->bvci != BVCI_SIGNALLING) {
+ LOGP(DBSSGP, LOGL_DEBUG, "NSEI=%u/BVCI=%u RESET due to %s\n",
+ nsei, bctx->bvci, bssgp_cause_str(cause));
+ rc = bssgp_tx_bvc_reset(bctx, bctx->bvci, cause);
+ if (rc < 0)
+ return rc;
+ }
+ }
+
+ return 0;
+}
+
/* Find a BTS context based on BVCI+NSEI tuple */
struct bssgp_bvc_ctx *btsctx_by_bvci_nsei(uint16_t bvci, uint16_t nsei)
{
diff --git a/src/gb/libosmogb.map b/src/gb/libosmogb.map
index 6aad8fd6..9a0dba5a 100644
--- a/src/gb/libosmogb.map
+++ b/src/gb/libosmogb.map
@@ -34,6 +34,7 @@ bssgp_rcvmsg;
bssgp_rx_paging;
bssgp_set_log_ss;
bssgp_tx_dl_ud;
+bssgp_tx_bvc_ptp_reset;
bssgp_tx_paging;
bssgp_vty_init;
bssgp_nsi;