diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-12-01 17:25:28 +0100 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-12-03 16:31:36 +0100 |
commit | 64c422858db9388e210875dc681f2d1952e0d0bb (patch) | |
tree | 85d8baa6526562e89c9912d3da76507e0ce4fba3 /src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c | |
parent | 8c03bf3f3c58afa582ed000ba05e886b593256f9 (diff) |
Store GPRS MOs directly under BTS SiteMgr object
The only real 1-1 relationship between BTS NM objects is the one between
GPRS Cell and BTS (which is actually a BTS cell).
In our current osmo-bts implementation we don't care much since we only
handle 1-cell BTSses, but let's make the data structure organization
more generic.
Implementation notes:
The gsm_bts_sm is moved to its own file, APIs to allocate are added and
the new public object is hooked correctly in the allocation process of
osmo-bsc.
Change-Id: I06461b7784fa2a78de37383406e35beae85fbad8
Diffstat (limited to 'src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c')
-rw-r--r-- | src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c b/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c index 6d64a4bb4..5ad0f47bc 100644 --- a/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c +++ b/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c @@ -105,18 +105,19 @@ struct msgb *nanobts_attr_nse_get(struct gsm_bts *bts) { struct msgb *msgb; uint8_t buf[256]; + struct gsm_bts_sm *bts_sm = bts->site_mgr; msgb = msgb_alloc(1024, "nanobts_attr_bts"); if (!msgb) return NULL; /* NSEI 925 */ - buf[0] = bts->gprs.nse.nsei >> 8; - buf[1] = bts->gprs.nse.nsei & 0xff; + buf[0] = bts_sm->gprs.nse.nsei >> 8; + buf[1] = bts_sm->gprs.nse.nsei & 0xff; msgb_tl16v_put(msgb, NM_ATT_IPACC_NSEI, 2, buf); /* all timers in seconds */ - OSMO_ASSERT(ARRAY_SIZE(bts->gprs.nse.timer) < sizeof(buf)); - memcpy(buf, bts->gprs.nse.timer, ARRAY_SIZE(bts->gprs.nse.timer)); + OSMO_ASSERT(ARRAY_SIZE(bts_sm->gprs.nse.timer) < sizeof(buf)); + memcpy(buf, bts_sm->gprs.nse.timer, ARRAY_SIZE(bts_sm->gprs.nse.timer)); msgb_tl16v_put(msgb, NM_ATT_IPACC_NS_CFG, 7, buf); /* all timers in seconds */ @@ -202,16 +203,17 @@ struct msgb *nanobts_attr_nscv_get(struct gsm_bts *bts) { struct msgb *msgb; uint8_t buf[256]; + struct gsm_bts_sm *bts_sm = bts->site_mgr; msgb = msgb_alloc(1024, "nanobts_attr_bts"); if (!msgb) return NULL; /* 925 */ - buf[0] = bts->gprs.nsvc[0].nsvci >> 8; - buf[1] = bts->gprs.nsvc[0].nsvci & 0xff; + buf[0] = bts_sm->gprs.nsvc[0].nsvci >> 8; + buf[1] = bts_sm->gprs.nsvc[0].nsvci & 0xff; msgb_tl16v_put(msgb, NM_ATT_IPACC_NSVCI, 2, buf); - switch (bts->gprs.nsvc->remote.u.sa.sa_family) { + switch (bts_sm->gprs.nsvc->remote.u.sa.sa_family) { case AF_INET6: /* all fields are encoded in network byte order */ /* protocol family */ @@ -219,20 +221,20 @@ struct msgb *nanobts_attr_nscv_get(struct gsm_bts *bts) /* padding */ buf[1] = 0x00; /* local udp port */ - osmo_store16be(bts->gprs.nsvc[0].local_port, &buf[2]); + osmo_store16be(bts_sm->gprs.nsvc[0].local_port, &buf[2]); /* remote udp port */ - memcpy(&buf[4], &bts->gprs.nsvc[0].remote.u.sin6.sin6_port, sizeof(uint16_t)); + memcpy(&buf[4], &bts_sm->gprs.nsvc[0].remote.u.sin6.sin6_port, sizeof(uint16_t)); /* remote ip address */ - memcpy(&buf[6], &bts->gprs.nsvc[0].remote.u.sin6.sin6_addr, sizeof(struct in6_addr)); + memcpy(&buf[6], &bts_sm->gprs.nsvc[0].remote.u.sin6.sin6_addr, sizeof(struct in6_addr)); msgb_tl16v_put(msgb, NM_ATT_OSMO_NS_LINK_CFG, 6 + sizeof(struct in6_addr), buf); break; case AF_INET: /* remote udp port */ - memcpy(&buf[0], &bts->gprs.nsvc[0].remote.u.sin.sin_port, sizeof(uint16_t)); + memcpy(&buf[0], &bts_sm->gprs.nsvc[0].remote.u.sin.sin_port, sizeof(uint16_t)); /* remote ip address */ - memcpy(&buf[2], &bts->gprs.nsvc[0].remote.u.sin.sin_addr, sizeof(struct in_addr)); + memcpy(&buf[2], &bts_sm->gprs.nsvc[0].remote.u.sin.sin_addr, sizeof(struct in_addr)); /* local udp port */ - osmo_store16be(bts->gprs.nsvc[0].local_port, &buf[6]); + osmo_store16be(bts_sm->gprs.nsvc[0].local_port, &buf[6]); msgb_tl16v_put(msgb, NM_ATT_IPACC_NS_LINK_CFG, 8, buf); break; default: |