diff options
author | Philipp Maier <pmaier@sysmocom.de> | 2020-12-16 21:07:04 +0100 |
---|---|---|
committer | laforge <laforge@osmocom.org> | 2021-01-04 21:47:19 +0000 |
commit | 1eaa7bc93164026014a51b209552655092cf2a74 (patch) | |
tree | 561359fbfacf01aed44cd13796570b5f9beca18c | |
parent | 833e8fac82480f9d19edc233a4fc3aca287efa81 (diff) |
gprs_bssgp: add handling for BSSGP RIM primitives
Receive and forward RIM messages to bssgp_prim_cb()
Change-Id: Idfd0a65872a2cc6089885afd8d31b0b029d85d47
Related: SYS#5103
-rw-r--r-- | include/osmocom/gprs/gprs_bssgp.h | 2 | ||||
-rw-r--r-- | include/osmocom/gsm/prim.h | 2 | ||||
-rw-r--r-- | src/gb/gprs_bssgp.c | 42 |
3 files changed, 46 insertions, 0 deletions
diff --git a/include/osmocom/gprs/gprs_bssgp.h b/include/osmocom/gprs/gprs_bssgp.h index 70770449..d228c53c 100644 --- a/include/osmocom/gprs/gprs_bssgp.h +++ b/include/osmocom/gprs/gprs_bssgp.h @@ -56,6 +56,8 @@ enum bssgp_prim { PRIM_NM_BVC_BLOCK, PRIM_NM_BVC_UNBLOCK, PRIM_NM_STATUS, + + PRIM_BSSGP_RIM_PDU_TRANSFER, }; struct osmo_bssgp_prim { diff --git a/include/osmocom/gsm/prim.h b/include/osmocom/gsm/prim.h index e7a60e30..045e353b 100644 --- a/include/osmocom/gsm/prim.h +++ b/include/osmocom/gsm/prim.h @@ -16,4 +16,6 @@ enum osmo_gsm_sap { SAP_BSSGP_PFM, SAP_NS, + + SAP_BSSGP_RIM, }; diff --git a/src/gb/gprs_bssgp.c b/src/gb/gprs_bssgp.c index 09f63739..fd2a48ce 100644 --- a/src/gb/gprs_bssgp.c +++ b/src/gb/gprs_bssgp.c @@ -734,6 +734,39 @@ int bssgp_rx_status(struct msgb *msg, struct tlv_parsed *tp, return bssgp_prim_cb(&nmp.oph, NULL); } +static int bssgp_rx_rim(struct msgb *msg, struct tlv_parsed *tp, uint16_t bvci) +{ + struct osmo_bssgp_prim nmp; + uint16_t nsei = msgb_nsei(msg); + struct bssgp_normal_hdr *bgph = (struct bssgp_normal_hdr *)msgb_bssgph(msg); + enum bssgp_prim prim; + + DEBUGP(DLBSSGP, "BSSGP BVCI=%u Rx RIM-PDU:%s\n", bvci, bssgp_pdu_str(bgph->pdu_type)); + + /* Specify PRIM type based on the RIM PDU */ + switch (bgph->pdu_type) { + case BSSGP_PDUT_RAN_INFO: + case BSSGP_PDUT_RAN_INFO_REQ: + case BSSGP_PDUT_RAN_INFO_ACK: + case BSSGP_PDUT_RAN_INFO_ERROR: + case BSSGP_PDUT_RAN_INFO_APP_ERROR: + prim = PRIM_BSSGP_RIM_PDU_TRANSFER; + break; + default: + /* Caller already makes sure that this can't happen. */ + OSMO_ASSERT(false); + } + + /* Send BSSGP RIM indication to NM */ + memset(&nmp, 0, sizeof(nmp)); + nmp.nsei = nsei; + nmp.bvci = bvci; + nmp.tp = tp; + osmo_prim_init(&nmp.oph, SAP_BSSGP_RIM, prim, PRIM_OP_INDICATION, msg); + bssgp_prim_cb(&nmp.oph, NULL); + + return 0; +} /* One element (msgb) in a BSSGP Flow Control queue */ struct bssgp_fc_queue_element { @@ -1159,6 +1192,15 @@ static int bssgp_rx_sign(struct msgb *msg, struct tlv_parsed *tp, case BSSGP_PDUT_STATUS: /* This is already handled in bssgp_rcvmsg() */ break; + + case BSSGP_PDUT_RAN_INFO: + case BSSGP_PDUT_RAN_INFO_REQ: + case BSSGP_PDUT_RAN_INFO_ACK: + case BSSGP_PDUT_RAN_INFO_ERROR: + case BSSGP_PDUT_RAN_INFO_APP_ERROR: + bssgp_rx_rim(msg, tp, bvci); + break; + /* those only exist in the SGSN -> BSS direction */ case BSSGP_PDUT_PAGING_PS: case BSSGP_PDUT_PAGING_CS: |