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/.
daniel gerrit-no-reply at lists.osmocom.orgdaniel has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-gbproxy/+/22653 )
Change subject: Simplify raid data storage
......................................................................
Simplify raid data storage
Instead of storing the raw ra_id in gbproxy_bvc and gbproxy_cell store
the decoded ra_id plus cell id in gbproxy cell and use it from there.
Related: OS#4894
Change-Id: Ib58b9188e3ce4bd3fdadb03f158d56b29778387c
---
M include/osmocom/sgsn/gb_proxy.h
M src/gb_proxy.c
M src/gb_proxy_ctrl.c
M src/gb_proxy_vty.c
4 files changed, 17 insertions(+), 30 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-gbproxy refs/changes/53/22653/1
diff --git a/include/osmocom/sgsn/gb_proxy.h b/include/osmocom/sgsn/gb_proxy.h
index f69cb56..871ba68 100644
--- a/include/osmocom/sgsn/gb_proxy.h
+++ b/include/osmocom/sgsn/gb_proxy.h
@@ -111,8 +111,11 @@
/* BVCI of PTP BVCs associated to this cell */
uint16_t bvci;
- /* Routing Area that this BVC is part of (raw 04.08 encoding) */
- uint8_t ra[6];
+ /* Routing Area that this BVC is part of */
+ struct {
+ struct gprs_ra_id raid;
+ uint16_t cid;
+ } id;
/* pointer to the BSS-side BVC */
struct gbproxy_bvc *bss_bvc;
@@ -132,9 +135,6 @@
/* PTP BVCI of this BVC */
uint16_t bvci;
- /* Routing Area that this BVC is part of (raw 04.08 encoding) */
- uint8_t ra[6];
-
/* Counter */
struct rate_ctr_group *ctrg;
diff --git a/src/gb_proxy.c b/src/gb_proxy.c
index e8a78f2..04ebaf6 100644
--- a/src/gb_proxy.c
+++ b/src/gb_proxy.c
@@ -671,7 +671,7 @@
bvc->cell = gbproxy_cell_alloc(cfg, bvci);
OSMO_ASSERT(bvc->cell);
- memcpy(bvc->cell->ra, bvc->ra, sizeof(bvc->cell->ra));
+ memcpy(&bvc->cell->id.raid, ra_id, sizeof(*ra_id));
/* link us to the cell and vice-versa */
bvc->cell->bss_bvc = bvc;
@@ -688,7 +688,6 @@
OSMO_ASSERT(sgsn_bvc);
sgsn_bvc->cell = bvc->cell;
- memcpy(sgsn_bvc->ra, bvc->cell->ra, sizeof(sgsn_bvc->ra));
sgsn_bvc->fi = bssgp_bvc_fsm_alloc_ptp_bss(sgsn_bvc, cfg->nsi, sgsn_nse->nsei,
bvci, ra_id, cell_id);
OSMO_ASSERT(sgsn_bvc->fi);
@@ -871,17 +870,6 @@
gbproxy_bvc_move(from_bvc, nse_new);
}
#endif
- /* FIXME: do we need this, if it happens within FSM? */
- if (TLVP_PRES_LEN(tp, BSSGP_IE_CELL_ID, 8)) {
- struct gprs_ra_id raid;
- /* We have a Cell Identifier present in this
- * PDU, this means we can extend our local
- * state information about this particular cell
- * */
- memcpy(from_bvc->ra, TLVP_VAL(tp, BSSGP_IE_CELL_ID), sizeof(from_bvc->ra));
- gsm48_parse_ra(&raid, from_bvc->ra);
- LOGPBVC(from_bvc, LOGL_INFO, "Cell ID %s\n", osmo_rai_name(&raid));
- }
}
/* hand into FSM for further processing */
osmo_fsm_inst_dispatch(from_bvc->fi, BSSGP_BVCFSM_E_RX_RESET, msg);
@@ -1053,11 +1041,13 @@
LOGPBVC(sgsn_bvc, LOGL_INFO, "Rx %s: routing by BVCI\n", pdut_name);
return gbprox_relay2peer(msg, sgsn_bvc->cell->bss_bvc, ns_bvci);
} else if (TLVP_PRES_LEN(tp, BSSGP_IE_ROUTEING_AREA, 6)) {
+ struct gprs_ra_id raid;
errctr = GBPROX_GLOB_CTR_INV_RAI;
+ gsm48_parse_ra(&raid, TLVP_VAL(tp, BSSGP_IE_ROUTEING_AREA));
/* iterate over all bvcs and dispatch the paging to each matching one */
hash_for_each(cfg->bss_nses, i, nse, list) {
hash_for_each(nse->bvcs, j, bss_bvc, list) {
- if (!memcmp(bss_bvc->ra, TLVP_VAL(tp, BSSGP_IE_ROUTEING_AREA), 6)) {
+ if (!memcmp(&bss_bvc->cell->id.raid, &raid, sizeof(raid))) {
LOGPNSE(nse, LOGL_INFO, "Rx %s: routing to NSE (RAI match)\n",
pdut_name);
gbprox_relay2peer(msg, bss_bvc, ns_bvci);
@@ -1068,11 +1058,13 @@
}
}
} else if (TLVP_PRES_LEN(tp, BSSGP_IE_LOCATION_AREA, 5)) {
+ struct gsm48_ra_id lac;
errctr = GBPROX_GLOB_CTR_INV_LAI;
/* iterate over all bvcs and dispatch the paging to each matching one */
hash_for_each(cfg->bss_nses, i, nse, list) {
hash_for_each(nse->bvcs, j, bss_bvc, list) {
- if (!memcmp(bss_bvc->ra, TLVP_VAL(tp, BSSGP_IE_LOCATION_AREA), 5)) {
+ gsm48_encode_ra(&lac, &bss_bvc->cell->id.raid);
+ if (!memcmp(&lac, TLVP_VAL(tp, BSSGP_IE_LOCATION_AREA), 5)) {
LOGPNSE(nse, LOGL_INFO, "Rx %s: routing to NSE (LAI match)\n",
pdut_name);
gbprox_relay2peer(msg, bss_bvc, ns_bvci);
diff --git a/src/gb_proxy_ctrl.c b/src/gb_proxy_ctrl.c
index 794afd7..c43082d 100644
--- a/src/gb_proxy_ctrl.c
+++ b/src/gb_proxy_ctrl.c
@@ -91,13 +91,12 @@
hash_for_each(cfg->bss_nses, i, nse_peer, list) {
struct gbproxy_bvc *bvc;
hash_for_each(nse_peer->bvcs, j, bvc, list) {
- struct gprs_ra_id raid;
- gsm48_parse_ra(&raid, bvc->ra);
+ struct gprs_ra_id *raid = &bvc->cell->id.raid;
cmd->reply = talloc_asprintf_append(cmd->reply, "%u,%u,%u,%u,%u,%u,%s\n",
nse_peer->nsei, bvc->bvci,
- raid.mcc, raid.mnc,
- raid.lac, raid.rac,
+ raid->mcc, raid->mnc,
+ raid->lac, raid->rac,
osmo_fsm_inst_state_name(bvc->fi));
}
}
diff --git a/src/gb_proxy_vty.c b/src/gb_proxy_vty.c
index fd4692d..9dbde58 100644
--- a/src/gb_proxy_vty.c
+++ b/src/gb_proxy_vty.c
@@ -78,10 +78,8 @@
vty_out(vty, "NSEI %5u, SIG-BVCI %5u [%s]%s", bvc->nse->nsei, bvc->bvci,
osmo_fsm_inst_state_name(bvc->fi), VTY_NEWLINE);
} else {
- struct gprs_ra_id raid;
- gsm48_parse_ra(&raid, bvc->ra);
vty_out(vty, "NSEI %5u, PTP-BVCI %5u, RAI %s [%s]%s", bvc->nse->nsei, bvc->bvci,
- osmo_rai_name(&raid), osmo_fsm_inst_state_name(bvc->fi), VTY_NEWLINE);
+ osmo_rai_name(&bvc->cell->id.raid), osmo_fsm_inst_state_name(bvc->fi), VTY_NEWLINE);
}
}
@@ -100,12 +98,10 @@
static void gbproxy_vty_print_cell(struct vty *vty, struct gbproxy_cell *cell, bool show_stats)
{
- struct gprs_ra_id raid;
- gsm48_parse_ra(&raid, cell->ra);
unsigned int num_sgsn_bvc = 0;
unsigned int i;
- vty_out(vty, "BVCI %5u RAI %s: ", cell->bvci, osmo_rai_name(&raid));
+ vty_out(vty, "BVCI %5u RAI %s CID %05u: ", cell->bvci, osmo_rai_name(&cell->id.raid), cell->id.cid);
if (cell->bss_bvc)
vty_out(vty, "BSS NSEI %5u, SGSN NSEI ", cell->bss_bvc->nse->nsei);
else
--
To view, visit https://gerrit.osmocom.org/c/osmo-gbproxy/+/22653
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-gbproxy
Gerrit-Branch: master
Gerrit-Change-Id: Ib58b9188e3ce4bd3fdadb03f158d56b29778387c
Gerrit-Change-Number: 22653
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <dwillmann at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210203/96e61e8b/attachment.htm>