summaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-05-02 11:54:55 +0200
committerHarald Welte <laforge@gnumonks.org>2010-05-04 07:20:43 +0200
commita2ca4ed96073328c33cc6fd8fdf626b2685463f8 (patch)
tree41fee5e812f531cf581414f42ca0d118692f7a10 /openbsc
parent8f9a3ee67bf25b62936ffbcd88936936916ad0e9 (diff)
[gprs] pass BSSGP UL-UNITDATA Cell ID up into GMM layer
BSSGP stores a pointer to the Cell Identifier IE in msgb->cb, which is later used by the GMM layer to identify the cell that has sent a given message. This now also means that the gsm_04_08_gprs.c code is free of any legacy references to msg->trx or struct gsm_bts.
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/include/openbsc/gprs_bssgp.h1
-rw-r--r--openbsc/src/gprs_bssgp.c11
2 files changed, 7 insertions, 5 deletions
diff --git a/openbsc/include/openbsc/gprs_bssgp.h b/openbsc/include/openbsc/gprs_bssgp.h
index c70868af..c1094b35 100644
--- a/openbsc/include/openbsc/gprs_bssgp.h
+++ b/openbsc/include/openbsc/gprs_bssgp.h
@@ -140,6 +140,7 @@ enum gprs_bssgp_cause {
#include <osmocore/tlv.h>
extern int gprs_bssgp_rcvmsg(struct msgb *msg);
+uint16_t bssgp_parse_cell_id(struct gprs_ra_id *raid, const uint8_t *buf);
/* Wrapper around TLV parser to parse BSSGP IEs */
static inline int bssgp_tlv_parse(struct tlv_parsed *tp, uint8_t *buf, int len)
diff --git a/openbsc/src/gprs_bssgp.c b/openbsc/src/gprs_bssgp.c
index a3fa3ecc..aceedb58 100644
--- a/openbsc/src/gprs_bssgp.c
+++ b/openbsc/src/gprs_bssgp.c
@@ -205,13 +205,12 @@ int bssgp_tx_status(uint8_t cause, uint16_t *bvci, struct msgb *orig_msg)
return gprs_ns_sendmsg(bssgp_nsi, msg);
}
-static void bssgp_parse_cell_id(struct gprs_ra_id *raid, uint16_t *cid,
- const uint8_t *buf)
+uint16_t bssgp_parse_cell_id(struct gprs_ra_id *raid, const uint8_t *buf)
{
/* 6 octets RAC */
gsm48_parse_ra(raid, buf);
/* 2 octets CID */
- *cid = ntohs(*(uint16_t *) (buf+6));
+ return ntohs(*(uint16_t *) (buf+6));
}
/* Chapter 8.4 BVC-Reset Procedure */
@@ -241,8 +240,8 @@ static int bssgp_rx_bvc_reset(struct msgb *msg, struct tlv_parsed *tp,
return -EINVAL;
}
/* actually extract RAC / CID */
- bssgp_parse_cell_id(&bctx->ra_id, &bctx->cell_id,
- TLVP_VAL(tp, BSSGP_IE_CELL_ID));
+ bctx->cell_id = bssgp_parse_cell_id(&bctx->ra_id,
+ TLVP_VAL(tp, BSSGP_IE_CELL_ID));
LOGP(DGPRS, LOGL_NOTICE, "Cell %u-%u-%u-%u CI %u on BVCI %u\n",
bctx->ra_id.mcc, bctx->ra_id.mnc, bctx->ra_id.lac,
bctx->ra_id.rac, bctx->cell_id, bvci);
@@ -275,7 +274,9 @@ static int bssgp_rx_ul_ud(struct msgb *msg)
/* FIXME: lookup bssgp_bts_ctx based on BVCI + NSEI */
+ /* store pointer to LLC header and CELL ID in msgb->cb */
msgb_llch(msg) = TLVP_VAL(&tp, BSSGP_IE_LLC_PDU);
+ msgb_bcid(msg) = TLVP_VAL(&tp, BSSGP_IE_CELL_ID);
return gprs_llc_rcvmsg(msg, &tp);
}