Change in osmo-bts[master]: Forward GPRS SUSPEND REQ from DCCH to PCU socket

osmith gerrit-no-reply at lists.osmocom.org
Wed Mar 20 15:17:11 UTC 2019


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/13347


Change subject: Forward GPRS SUSPEND REQ from DCCH to PCU socket
......................................................................

Forward GPRS SUSPEND REQ from DCCH to PCU socket

As specified in 3GPP TS 03.60 Section 16.2.1 and 44.018 Section 3.4.15,
a Class B MS is sending a "RR GPRS SUSPEND REQ" via a DCCH to the BTS if
it wants to suspend GPRS services.  The BSS is now responsible to
somehow forward this to the SGSN.  As the Gs interface between BSC and
SGSN is both optional and doesn't have any provision to forward this
message, we have to send it over to the PCU so it can use regular BSSGP
signaling to inform the SGSN of the SUSPEND REQUEST.

This patch requires libosmocore Change-Id
I90113044460a6c511ced14f588876c4280d1cac7 for the related definition of
struct gsm48_gprs_susp_req.

Change-Id: I3c1af662c8f0d3d22da200638480f6ef05c3ed1f
Closes: OS#2249
---
M include/osmo-bts/pcu_if.h
M include/osmo-bts/pcuif_proto.h
M src/common/pcu_sock.c
M src/common/rsl.c
4 files changed, 87 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/47/13347/1

diff --git a/include/osmo-bts/pcu_if.h b/include/osmo-bts/pcu_if.h
index 98efb57..6253c84 100644
--- a/include/osmo-bts/pcu_if.h
+++ b/include/osmo-bts/pcu_if.h
@@ -15,6 +15,7 @@
 int pcu_tx_time_ind(uint32_t fn);
 int pcu_tx_pag_req(const uint8_t *identity_lv, uint8_t chan_needed);
 int pcu_tx_pch_data_cnf(uint32_t fn, uint8_t *data, uint8_t len);
+int pcu_tx_susp_req(struct gsm_lchan *lchan, uint32_t tlli, const uint8_t *ra_id, uint8_t cause);
 
 int pcu_sock_init(const char *path);
 void pcu_sock_exit(void);
diff --git a/include/osmo-bts/pcuif_proto.h b/include/osmo-bts/pcuif_proto.h
index b06077c..5a85859 100644
--- a/include/osmo-bts/pcuif_proto.h
+++ b/include/osmo-bts/pcuif_proto.h
@@ -11,7 +11,8 @@
 /* msg_type */
 #define PCU_IF_MSG_DATA_REQ	0x00	/* send data to given channel */
 #define PCU_IF_MSG_DATA_CNF	0x01	/* confirm (e.g. transmission on PCH) */
-#define PCU_IF_MSG_DATA_IND	0x02	/* receive data from given channel */
+#define PCU_IF_MSG_DATA_IND	0x02	/* receive data from given channel */	
+#define PCU_IF_MSG_SUSP_REQ	0x03	/* BTS forwards GPRS SUSP REQ to PCU */
 #define PCU_IF_MSG_RTS_REQ	0x10	/* ready to send request */
 #define PCU_IF_MSG_DATA_CNF_DT	0x11	/* confirm (with direct tlli) */
 #define PCU_IF_MSG_RACH_IND	0x22	/* receive RACH */
@@ -171,6 +172,13 @@
 	uint8_t		identity_lv[9];
 } __attribute__ ((packed));
 
+/* BTS tells PCU about a GPRS SUSPENSION REQUEST received on DCCH */
+struct gsm_pcu_if_susp_req {
+	uint32_t	tlli;
+	uint8_t		ra_id[6];
+	uint8_t		cause;
+} __attribute__ ((packed));
+
 struct gsm_pcu_if {
 	/* context based information */
 	uint8_t		msg_type;	/* message type */
@@ -182,6 +190,7 @@
 		struct gsm_pcu_if_data		data_cnf;
 		struct gsm_pcu_if_data_cnf_dt	data_cnf_dt;
 		struct gsm_pcu_if_data		data_ind;
+		struct gsm_pcu_if_susp_req	susp_req;
 		struct gsm_pcu_if_rts_req	rts_req;
 		struct gsm_pcu_if_rach_ind	rach_ind;
 		struct gsm_pcu_if_txt_ind	txt_ind;
diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c
index 2c7028e..48efe51 100644
--- a/src/common/pcu_sock.c
+++ b/src/common/pcu_sock.c
@@ -465,6 +465,23 @@
 	return pcu_sock_send(&bts_gsmnet, msg);
 }
 
+/* forward data from a RR GPRS SUSPEND REQ towards PCU */
+int pcu_tx_susp_req(struct gsm_lchan *lchan, uint32_t tlli, const uint8_t *ra_id, uint8_t cause)
+{
+	struct msgb *msg;
+	struct gsm_pcu_if *pcu_prim;
+
+	msg = pcu_msgb_alloc(PCU_IF_MSG_SUSP_REQ, lchan->ts->trx->bts->nr);
+	if (!msg)
+		return -ENOMEM;
+	pcu_prim = (struct gsm_pcu_if *) msg->data;
+	pcu_prim->u.susp_req.tlli = tlli;
+	memcpy(pcu_prim->u.susp_req.ra_id, ra_id, sizeof(pcu_prim->u.susp_req.ra_id));
+	pcu_prim->u.susp_req.cause = cause;
+
+	return pcu_sock_send(&bts_gsmnet, msg);
+}
+
 static int pcu_rx_data_req(struct gsm_bts *bts, uint8_t msg_type,
 	const struct gsm_pcu_if_data *data_req)
 {
diff --git a/src/common/rsl.c b/src/common/rsl.c
index fce3495..cac4abd 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -29,12 +29,14 @@
 #include <sys/types.h>
 #include <arpa/inet.h>
 
+#include <osmocom/core/byteswap.h>
 #include <osmocom/core/msgb.h>
 #include <osmocom/core/talloc.h>
 #include <osmocom/gsm/rsl.h>
 #include <osmocom/gsm/lapdm.h>
 #include <osmocom/gsm/protocol/gsm_12_21.h>
 #include <osmocom/gsm/protocol/gsm_08_58.h>
+#include <osmocom/gsm/protocol/gsm_04_08.h>
 #include <osmocom/gsm/protocol/ipaccess.h>
 #include <osmocom/trau/osmo_ortp.h>
 
@@ -2587,6 +2589,61 @@
 	return 0;
 }
 
+static int rslms_is_gprs_susp_req(struct msgb *msg)
+{
+	struct abis_rsl_common_hdr *rh = msgb_l2(msg);
+	struct abis_rsl_rll_hdr *rllh;
+	struct gsm48_hdr *gh;
+
+	if ((rh->msg_discr & 0xfe) != ABIS_RSL_MDISC_RLL)
+		return 0;
+
+	if (rh->msg_type != RSL_MT_UNIT_DATA_IND)
+		return 0;
+
+	rllh = msgb_l2(msg);
+	if (rsl_link_id_is_sacch(rllh->link_id))
+		return 0;
+
+	gh = msgb_l3(msg);
+	if (gh->proto_discr != GSM48_PDISC_RR)
+		return 0;
+
+	switch (gh->msg_type) {
+	case GSM48_MT_RR_GPRS_SUSP_REQ:
+		return 1;
+	default:
+		break;
+	}
+
+	return 0;
+}
+
+/* TS 44.018 9.1.13b GPRS suspension request */
+static int handle_gprs_susp_req(struct msgb *msg)
+{
+	struct gsm48_hdr *gh = msgb_l3(msg);
+	struct gsm48_gprs_susp_req *gsr;
+	uint32_t tlli;
+	int rc;
+
+	if (!gh || msgb_l3len(msg) < sizeof(*gh)+sizeof(*gsr)) {
+		LOGP(DRSL, LOGL_NOTICE, "%s Short GPRS SUSPEND REQ received, ignoring\n", gsm_lchan_name(msg->lchan));
+		return -EINVAL;
+	}
+
+	gsr = (struct gsm48_gprs_susp_req *) gh->data;
+	tlli = osmo_htonl(gsr->tlli);
+
+	LOGP(DRSL, LOGL_INFO, "%s Fwd GPRS SUSPEND REQ for TLLI=0x%08x to PCU\n",
+		gsm_lchan_name(msg->lchan), tlli);
+	rc = pcu_tx_susp_req(msg->lchan, tlli, gsr->ra_id, gsr->cause);
+
+	msgb_free(msg);
+
+	return rc;
+}
+
 static inline uint8_t ms_to2rsl(const struct gsm_lchan *lchan, const struct lapdm_entity *le)
 {
 	return (lchan->ms_t_offs >= 0) ? lchan->ms_t_offs : (lchan->p_offs - le->ta);
@@ -2727,6 +2784,8 @@
 		rc = rsl_tx_meas_res(lchan, msgb_l3(msg), msgb_l3len(msg), le);
 		msgb_free(msg);
 		return rc;
+	} else if (rslms_is_gprs_susp_req(msg)) {
+		return handle_gprs_susp_req(msg);
 	} else {
 		LOGP(DRSL, LOGL_INFO, "%s Fwd RLL msg %s from LAPDm to A-bis\n",
 			gsm_lchan_name(lchan), rsl_msg_name(rh->msg_type));

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3c1af662c8f0d3d22da200638480f6ef05c3ed1f
Gerrit-Change-Number: 13347
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190320/6be1204b/attachment.html>


More information about the gerrit-log mailing list