gb_proxy_peer: Require ra_id and cid in gbproxy_cell_alloc
pass raid and cell id directly as parameter to gbproxy_cell_alloc so
that we do not need to fill tas parameter to gbproxy_cell_alloc so that
we do not need to fill the struct members later.
Change-Id: Ic7deae5ccf839b941d70557d28451d52f32cebbb
Related: SYS#5103
diff --git a/include/osmocom/sgsn/gb_proxy.h b/include/osmocom/sgsn/gb_proxy.h
index 96b2bcc..a36f305 100644
--- a/include/osmocom/sgsn/gb_proxy.h
+++ b/include/osmocom/sgsn/gb_proxy.h
@@ -268,7 +268,7 @@
void gbproxy_bvc_free(struct gbproxy_bvc *bvc);
int gbproxy_cleanup_bvcs(struct gbproxy_nse *nse, uint16_t bvci);
-struct gbproxy_cell *gbproxy_cell_alloc(struct gbproxy_config *cfg, uint16_t bvci);
+struct gbproxy_cell *gbproxy_cell_alloc(struct gbproxy_config *cfg, uint16_t bvci, const struct gprs_ra_id *raid, uint16_t cid);
struct gbproxy_cell *gbproxy_cell_by_bvci(struct gbproxy_config *cfg, uint16_t bvci);
struct gbproxy_cell *gbproxy_cell_by_cellid(struct gbproxy_config *cfg, const struct gprs_ra_id *raid, uint16_t cid);
void gbproxy_cell_free(struct gbproxy_cell *cell);
diff --git a/src/gb_proxy.c b/src/gb_proxy.c
index 12e685d..116530f 100644
--- a/src/gb_proxy.c
+++ b/src/gb_proxy.c
@@ -669,10 +669,8 @@
* for this BVC. We need to create the 'cell' data structure and the SGSN-side
* BVC counterparts */
- bvc->cell = gbproxy_cell_alloc(cfg, bvci);
+ bvc->cell = gbproxy_cell_alloc(cfg, bvci, ra_id, cell_id);
OSMO_ASSERT(bvc->cell);
- memcpy(&bvc->cell->id.raid, &bvc->raid, sizeof(bvc->cell->id.raid));
- bvc->cell->id.cid = cell_id;
/* link us to the cell and vice-versa */
bvc->cell->bss_bvc = bvc;
diff --git a/src/gb_proxy_peer.c b/src/gb_proxy_peer.c
index 753355e..9ea00a9 100644
--- a/src/gb_proxy_peer.c
+++ b/src/gb_proxy_peer.c
@@ -163,7 +163,8 @@
***********************************************************************/
/* Allocate a new 'cell' object */
-struct gbproxy_cell *gbproxy_cell_alloc(struct gbproxy_config *cfg, uint16_t bvci)
+struct gbproxy_cell *gbproxy_cell_alloc(struct gbproxy_config *cfg, uint16_t bvci,
+ const struct gprs_ra_id *raid, uint16_t cid)
{
struct gbproxy_cell *cell;
OSMO_ASSERT(cfg);
@@ -174,6 +175,8 @@
cell->cfg = cfg;
cell->bvci = bvci;
+ cell->id.cid = cid;
+ memcpy(&cell->id.raid, raid, sizeof(cell->id.raid));
hash_add(cfg->cells, &cell->list, cell->bvci);