Change in libosmocore[master]: WIP: gprs_bssgp: add remaining stuff for PCU to react on SGSN origina...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

lynxis lazus gerrit-no-reply at lists.osmocom.org
Wed Feb 17 01:31:03 UTC 2021


lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/22945 )


Change subject: WIP: gprs_bssgp: add remaining stuff for PCU to react on SGSN originated BSSGP-RESET
......................................................................

WIP: gprs_bssgp: add remaining stuff for PCU to react on SGSN originated BSSGP-RESET

Change-Id: Ibcbaffa94cbdc4296a8a7c372304ac11d50d9559
---
M include/osmocom/gprs/gprs_bssgp.h
M src/gb/gprs_bssgp.c
2 files changed, 43 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/45/22945/1

diff --git a/include/osmocom/gprs/gprs_bssgp.h b/include/osmocom/gprs/gprs_bssgp.h
index e55fa52..f8c1f0b 100644
--- a/include/osmocom/gprs/gprs_bssgp.h
+++ b/include/osmocom/gprs/gprs_bssgp.h
@@ -125,6 +125,7 @@
 	/*! default bucket leak rate of per-MS bucket in octests/s */
 	uint32_t r_default_ms;
 
+	bool is_sgsn;
 	/* we might want to add this as a shortcut later, avoiding the NSVC
 	 * lookup for every packet, similar to a routing cache */
 	//struct gprs_nsvc *nsvc;
diff --git a/src/gb/gprs_bssgp.c b/src/gb/gprs_bssgp.c
index 926b0ef..5c71699 100644
--- a/src/gb/gprs_bssgp.c
+++ b/src/gb/gprs_bssgp.c
@@ -126,6 +126,35 @@
 	return bssgp_ns_send(bssgp_ns_send_data, msg);
 }
 
+/*! Transmit a BVC-RESET-ACK message with a given nsei and bvci (Chapter 10.4.12)
+ *  \param[in] nsei The NSEI to transmit over
+ *  \param[in] bvci BVCI of the BVC to reset
+ *  \param[in] ra_id Pointer to the ra_id to include. If NULL no cell information will be included
+ *  \param[in] cell_id The cell_id to include (if ra_id is not NULL)
+ */
+int bssgp_tx_bvc_reset_ack_nsei_bvci(uint16_t nsei, uint16_t bvci, const struct gprs_ra_id *ra_id, uint16_t cell_id)
+{
+	struct msgb *msg = bssgp_msgb_alloc();
+	struct bssgp_normal_hdr *bgph =
+		(struct bssgp_normal_hdr *) msgb_put(msg, sizeof(*bgph));
+	uint16_t _bvci = osmo_htons(bvci);
+
+	msgb_nsei(msg) = nsei;
+	msgb_bvci(msg) = 0; /* Signalling */
+	bgph->pdu_type = BSSGP_PDUT_BVC_RESET_ACK;
+	LOGP(DLBSSGP, LOGL_NOTICE, "BSSGP (BVCI=%u) Tx BVC-RESET-ACK ", bvci);
+
+	msgb_tvlv_put(msg, BSSGP_IE_BVCI, 2, (uint8_t *) &_bvci);
+	if (ra_id) {
+		uint8_t bssgp_cid[8];
+		bssgp_create_cell_id(bssgp_cid, ra_id, cell_id);
+		msgb_tvlv_put(msg, BSSGP_IE_CELL_ID, sizeof(bssgp_cid), bssgp_cid);
+	}
+
+	/* Optional: Feature Bitmap */
+	return bssgp_ns_send(bssgp_ns_send_data, msg);
+}
+
 /*! Initiate reset procedure for all PTP BVC on a given NSEI.
  *
  *  This function initiates reset procedure for all PTP BVC with a given cause.
@@ -178,6 +207,7 @@
 		return NULL;
 	ctx->bvci = bvci;
 	ctx->nsei = nsei;
+	ctx->is_sgsn = true;
 	/* FIXME: BVCI is not unique, only BVCI+NSEI ?!? */
 	ctx->ctrg = rate_ctr_group_alloc(ctx, &bssgp_ctrg_desc, bvci);
 	if (!ctx->ctrg)
@@ -350,7 +380,7 @@
 
 	/* When we receive a BVC-RESET PDU (at least of a PTP BVCI), the BSS
 	 * informs us about its RAC + Cell ID, so we can create a mapping */
-	if (bvci != 0 && bvci != 1) {
+	if (bctx->is_sgsn && bvci != 0 && bvci != 1) {
 		if (!TLVP_PRES_LEN(tp, BSSGP_IE_CELL_ID, 8)) {
 			LOGP(DLBSSGP, LOGL_ERROR, "BSSGP BVCI=%u Rx RESET "
 				"missing mandatory IE\n", bvci);
@@ -363,6 +393,13 @@
 		     osmo_rai_name(&bctx->ra_id), bctx->cell_id, bvci);
 	}
 
+	/* Acknowledge the RESET to the BTS */
+	if (bvci == 0 || bvci == 1 || bctx->is_sgsn)
+		bssgp_tx_simple_bvci(BSSGP_PDUT_BVC_RESET_ACK,
+				     nsei, bvci, ns_bvci);
+	else
+		bssgp_tx_bvc_reset_ack_nsei_bvci(nsei, bvci, &bctx->ra_id, bctx->cell_id);
+
 	/* Send NM_BVC_RESET.ind to NM */
 	memset(&nmp, 0, sizeof(nmp));
 	nmp.nsei = nsei;
@@ -372,10 +409,6 @@
 	osmo_prim_init(&nmp.oph, SAP_BSSGP_NM, PRIM_NM_BVC_RESET,
 			PRIM_OP_INDICATION, msg);
 	bssgp_prim_cb(&nmp.oph, NULL);
-
-	/* Acknowledge the RESET to the BTS */
-	bssgp_tx_simple_bvci(BSSGP_PDUT_BVC_RESET_ACK,
-			     nsei, bvci, ns_bvci);
 	return 0;
 }
 
@@ -972,6 +1005,9 @@
 	case BSSGP_PDUT_STATUS:
 		/* This is already handled in bssgp_rcvmsg() */
 		break;
+	case BSSGP_PDUT_BVC_RESET:
+		rc = bssgp_rx_bvc_reset(msg, tp, bctx->bvci);
+		break;
 	case BSSGP_PDUT_DOWNLOAD_BSS_PFC:
 	case BSSGP_PDUT_CREATE_BSS_PFC_ACK:
 	case BSSGP_PDUT_CREATE_BSS_PFC_NACK:
@@ -1060,7 +1096,7 @@
 		LOGP(DLBSSGP, LOGL_ERROR, "BSSGP BVCI=%u Rx BVC-RESET-ACK\n", bvci);
 		break;
 	case BSSGP_PDUT_BVC_RESET:
-		/* BSS tells us that BVC init is required */
+		/* SGSN or BSS tells us that BVC init is required */
 		if (!TLVP_PRES_LEN(tp, BSSGP_IE_BVCI, 2) ||
 		    !TLVP_PRES_LEN(tp, BSSGP_IE_CAUSE, 1)) {
 			LOGP(DLBSSGP, LOGL_ERROR, "BSSGP Rx BVC-RESET "

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/22945
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ibcbaffa94cbdc4296a8a7c372304ac11d50d9559
Gerrit-Change-Number: 22945
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210217/aea7d9df/attachment.htm>


More information about the gerrit-log mailing list