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
This commit is contained in:
Pau Espin 2020-12-01 17:25:28 +01:00
parent 8c03bf3f3c
commit 64c422858d
30 changed files with 270 additions and 138 deletions

View File

@ -11,6 +11,7 @@ noinst_HEADERS = \
bsc_subscr_conn_fsm.h \
bss.h \
bts.h \
bts_sm.h \
bts_trx.h \
bts_ipaccess_nanobts_omlattr.h \
chan_alloc.h \

View File

@ -14,6 +14,7 @@
#include "osmocom/bsc/gsm_data.h"
#include "osmocom/bsc/bts_trx.h"
#include "osmocom/bsc/bts_sm.h"
enum bts_counter_id {
BTS_CTR_CHREQ_TOTAL,
@ -197,15 +198,11 @@ struct gsm_bts_model {
uint8_t _features_data[MAX_BTS_FEATURES/8];
};
/* BTS Site Manager */
struct gsm_bts_sm {
struct gsm_gprs_cell {
struct gsm_abis_mo mo;
/* nanoBTS and old versions of osmo-bts behaves this way due to
broken FSMs not following TS 12.21: they never do
Dependency->Offline transition, but they should be OPSTARTed
nevertheless during Dependnecy state to work. This field is
used by all dependent NM objects. */
bool peer_has_no_avstate_offline;
uint16_t bvci;
uint8_t timer[11];
struct gprs_rlc_cfg rlc_cfg;
};
/* One BTS */
@ -272,7 +269,7 @@ struct gsm_bts {
/* CCCH is on C0 */
struct gsm_bts_trx *c0;
struct gsm_bts_sm site_mgr;
struct gsm_bts_sm *site_mgr; /* backpointer */
/* bitmask of all SI that are present/valid in si_buf */
uint32_t si_valid;
@ -354,18 +351,7 @@ struct gsm_bts {
/* Not entirely sure how ip.access specific this is */
struct {
enum bts_gprs_mode mode;
struct {
struct gsm_abis_mo mo;
uint16_t nsei;
uint8_t timer[7];
} nse;
struct {
struct gsm_abis_mo mo;
uint16_t bvci;
uint8_t timer[11];
struct gprs_rlc_cfg rlc_cfg;
} cell;
struct gsm_bts_gprs_nsvc nsvc[2];
struct gsm_gprs_cell cell;
uint8_t rac;
uint8_t net_ctrl_ord;
bool ctrl_ack_type_use_block;
@ -574,11 +560,7 @@ static inline const struct osmo_location_area_id *bts_lai(struct gsm_bts *bts)
return &lai;
}
static inline struct gsm_bts *gsm_bts_sm_get_bts(struct gsm_bts_sm *site_mgr) {
return (struct gsm_bts *)container_of(site_mgr, struct gsm_bts, site_mgr);
}
struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, uint8_t bts_num);
struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, struct gsm_bts_sm *bts_sm, uint8_t bts_num);
char *gsm_bts_name(const struct gsm_bts *bts);

View File

@ -0,0 +1,72 @@
/* BTS Site Manager */
/* (C) 2020 by sysmocom - s.m.f.c. GmbH <info@sysmocom.de>
* Author: Pau Espin Pedrol <pespin@sysmocom.de>
*
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#include <unistd.h>
#include <stdint.h>
#include "osmocom/bsc/gsm_data.h"
struct gsm_bts;
struct gsm_gprs_nse {
struct gsm_abis_mo mo;
uint16_t nsei;
uint8_t timer[7];
};
struct gsm_gprs_nsvc {
struct gsm_bts *bts;
/* data read via VTY config file, to configure the BTS
* via OML from BSC */
int id;
uint16_t nsvci;
uint16_t local_port; /* on the BTS */
struct osmo_sockaddr remote;
struct gsm_abis_mo mo;
};
/* BTS Site Manager */
struct gsm_bts_sm {
struct gsm_bts *bts[1]; /* only one bts supported so far */
struct gsm_abis_mo mo;
/* nanoBTS and old versions of osmo-bts behaves this way due to
broken FSMs not following TS 12.21: they never do
Dependency->Offline transition, but they should be OPSTARTed
nevertheless during Dependnecy state to work. This field is
used by all dependent NM objects. */
bool peer_has_no_avstate_offline;
struct {
struct gsm_gprs_nse nse;
struct gsm_gprs_nsvc nsvc[2];
} gprs;
};
static inline struct gsm_bts *gsm_bts_sm_get_bts(struct gsm_bts_sm *site_mgr) {
return site_mgr->bts[0];
}
struct gsm_bts_sm *gsm_bts_sm_alloc(struct gsm_network *net, uint8_t bts_num);
void gsm_bts_sm_mo_reset(struct gsm_bts_sm *bts_sm);

View File

@ -767,17 +767,6 @@ struct gsm_envabtse {
struct gsm_abis_mo mo;
};
struct gsm_bts_gprs_nsvc {
struct gsm_bts *bts;
/* data read via VTY config file, to configure the BTS
* via OML from BSC */
int id;
uint16_t nsvci;
uint16_t local_port; /* on the BTS */
struct osmo_sockaddr remote;
struct gsm_abis_mo mo;
};
enum gprs_rlc_par {
RLC_T3142,
RLC_T3169,

View File

@ -47,6 +47,7 @@ ipaccess_config_SOURCES = \
# FIXME: resolve the bogus dependencies patched around here:
ipaccess_config_LDADD = \
$(top_builddir)/src/osmo-bsc/bts.o \
$(top_builddir)/src/osmo-bsc/bts_sm.o \
$(top_builddir)/src/osmo-bsc/bts_trx.o \
$(top_builddir)/src/osmo-bsc/abis_nm.o \
$(top_builddir)/src/osmo-bsc/acc.o \
@ -72,6 +73,7 @@ ipaccess_proxy_LDADD = \
$(top_builddir)/src/osmo-bsc/abis_nm.o \
$(top_builddir)/src/osmo-bsc/acc.o \
$(top_builddir)/src/osmo-bsc/bts.o \
$(top_builddir)/src/osmo-bsc/bts_sm.o \
$(top_builddir)/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.o \
$(top_builddir)/src/osmo-bsc/bts_trx.o \
$(top_builddir)/src/osmo-bsc/gsm_data.o \

View File

@ -52,6 +52,7 @@ osmo_bsc_SOURCES = \
bts_ipaccess_nanobts_omlattr.c \
bts_nokia_site.c \
bts_siemens_bs11.c \
bts_sm.c \
bts_sysmobts.c \
bts_unknown.c \
chan_alloc.c \

View File

@ -866,11 +866,11 @@ bool all_trx_rsl_connected_unlocked(const struct gsm_bts *bts)
if (bts->gprs.cell.mo.nm_state.administrative == NM_STATE_LOCKED)
return false;
if (bts->gprs.nse.mo.nm_state.administrative == NM_STATE_LOCKED)
if (bts->site_mgr->gprs.nse.mo.nm_state.administrative == NM_STATE_LOCKED)
return false;
if (bts->gprs.nsvc[0].mo.nm_state.administrative == NM_STATE_LOCKED &&
bts->gprs.nsvc[1].mo.nm_state.administrative == NM_STATE_LOCKED)
if (bts->site_mgr->gprs.nsvc[0].mo.nm_state.administrative == NM_STATE_LOCKED &&
bts->site_mgr->gprs.nsvc[1].mo.nm_state.administrative == NM_STATE_LOCKED)
return false;
}

View File

@ -463,17 +463,17 @@ static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
vty_out(vty, " NM State: ");
net_dump_nmstate(vty, &bts->mo.nm_state);
vty_out(vty, " Site Mgr NM State: ");
net_dump_nmstate(vty, &bts->site_mgr.mo.nm_state);
net_dump_nmstate(vty, &bts->site_mgr->mo.nm_state);
if (bts->gprs.mode != BTS_GPRS_NONE) {
vty_out(vty, " GPRS NSE: ");
net_dump_nmstate(vty, &bts->gprs.nse.mo.nm_state);
net_dump_nmstate(vty, &bts->site_mgr->gprs.nse.mo.nm_state);
vty_out(vty, " GPRS CELL: ");
net_dump_nmstate(vty, &bts->gprs.cell.mo.nm_state);
vty_out(vty, " GPRS NSVC0: ");
net_dump_nmstate(vty, &bts->gprs.nsvc[0].mo.nm_state);
net_dump_nmstate(vty, &bts->site_mgr->gprs.nsvc[0].mo.nm_state);
vty_out(vty, " GPRS NSVC1: ");
net_dump_nmstate(vty, &bts->gprs.nsvc[1].mo.nm_state);
net_dump_nmstate(vty, &bts->site_mgr->gprs.nsvc[1].mo.nm_state);
} else
vty_out(vty, " GPRS: not configured%s", VTY_NEWLINE);
@ -740,6 +740,7 @@ static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx)
static void config_write_bts_gprs(struct vty *vty, struct gsm_bts *bts)
{
unsigned int i;
struct gsm_bts_sm *bts_sm = bts->site_mgr;
vty_out(vty, " gprs mode %s%s", bts_gprs_mode_name(bts->gprs.mode),
VTY_NEWLINE);
if (bts->gprs.mode == BTS_GPRS_NONE)
@ -757,15 +758,15 @@ static void config_write_bts_gprs(struct vty *vty, struct gsm_bts *bts)
vty_out(vty, " gprs cell timer %s %u%s",
get_value_string(gprs_bssgp_cfg_strs, i),
bts->gprs.cell.timer[i], VTY_NEWLINE);
vty_out(vty, " gprs nsei %u%s", bts->gprs.nse.nsei,
vty_out(vty, " gprs nsei %u%s", bts_sm->gprs.nse.nsei,
VTY_NEWLINE);
for (i = 0; i < ARRAY_SIZE(bts->gprs.nse.timer); i++)
for (i = 0; i < ARRAY_SIZE(bts_sm->gprs.nse.timer); i++)
vty_out(vty, " gprs ns timer %s %u%s",
get_value_string(gprs_ns_timer_strs, i),
bts->gprs.nse.timer[i], VTY_NEWLINE);
for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
struct gsm_bts_gprs_nsvc *nsvc =
&bts->gprs.nsvc[i];
bts_sm->gprs.nse.timer[i], VTY_NEWLINE);
for (i = 0; i < ARRAY_SIZE(bts_sm->gprs.nsvc); i++) {
struct gsm_gprs_nsvc *nsvc =
&bts_sm->gprs.nsvc[i];
struct osmo_sockaddr_str remote = {};
uint16_t port;
@ -3190,7 +3191,7 @@ DEFUN_USRATTR(cfg_bts_gprs_nsei,
GPRS_CHECK_ENABLED(bts);
bts->gprs.nse.nsei = atoi(argv[0]);
bts->site_mgr->gprs.nse.nsei = atoi(argv[0]);
return CMD_SUCCESS;
}
@ -3211,7 +3212,7 @@ DEFUN_USRATTR(cfg_bts_gprs_nsvci,
GPRS_CHECK_ENABLED(bts);
bts->gprs.nsvc[idx].nsvci = atoi(argv[1]);
bts->site_mgr->gprs.nsvc[idx].nsvci = atoi(argv[1]);
return CMD_SUCCESS;
}
@ -3231,7 +3232,7 @@ DEFUN_USRATTR(cfg_bts_gprs_nsvc_lport,
GPRS_CHECK_ENABLED(bts);
bts->gprs.nsvc[idx].local_port = atoi(argv[1]);
bts->site_mgr->gprs.nsvc[idx].local_port = atoi(argv[1]);
return CMD_SUCCESS;
}
@ -3252,7 +3253,7 @@ DEFUN_USRATTR(cfg_bts_gprs_nsvc_rport,
GPRS_CHECK_ENABLED(bts);
/* sockaddr_in and sockaddr_in6 have the port at the same position */
bts->gprs.nsvc[idx].remote.u.sin.sin_port = htons(atoi(argv[1]));
bts->site_mgr->gprs.nsvc[idx].remote.u.sin.sin_port = htons(atoi(argv[1]));
return CMD_SUCCESS;
}
@ -3281,13 +3282,13 @@ DEFUN_USRATTR(cfg_bts_gprs_nsvc_rip,
}
/* Can't use osmo_sockaddr_str_to_sockaddr() because the port would be overriden */
bts->gprs.nsvc[idx].remote.u.sas.ss_family = remote.af;
bts->site_mgr->gprs.nsvc[idx].remote.u.sas.ss_family = remote.af;
switch (remote.af) {
case AF_INET:
osmo_sockaddr_str_to_in_addr(&remote, &bts->gprs.nsvc[idx].remote.u.sin.sin_addr);
osmo_sockaddr_str_to_in_addr(&remote, &bts->site_mgr->gprs.nsvc[idx].remote.u.sin.sin_addr);
break;
case AF_INET6:
osmo_sockaddr_str_to_in6_addr(&remote, &bts->gprs.nsvc[idx].remote.u.sin6.sin6_addr);
osmo_sockaddr_str_to_in6_addr(&remote, &bts->site_mgr->gprs.nsvc[idx].remote.u.sin6.sin6_addr);
break;
}
@ -3321,10 +3322,10 @@ DEFUN_USRATTR(cfg_bts_gprs_ns_timer,
GPRS_CHECK_ENABLED(bts);
if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.nse.timer))
if (idx < 0 || idx >= ARRAY_SIZE(bts->site_mgr->gprs.nse.timer))
return CMD_WARNING;
bts->gprs.nse.timer[idx] = val;
bts->site_mgr->gprs.nse.timer[idx] = val;
return CMD_SUCCESS;
}

View File

@ -121,7 +121,6 @@ int gsm_bts_model_register(struct gsm_bts_model *model)
return 0;
}
static const uint8_t bts_nse_timer_default[] = { 3, 3, 3, 3, 30, 3, 10 };
static const uint8_t bts_cell_timer_default[] =
{ 3, 3, 3, 3, 3, 10, 3, 10, 3, 10, 3 };
static const struct gprs_rlc_cfg rlc_cfg_default = {
@ -149,10 +148,7 @@ static const struct gprs_rlc_cfg rlc_cfg_default = {
static int gsm_bts_talloc_destructor(struct gsm_bts *bts)
{
if (bts->site_mgr.mo.fi) {
osmo_fsm_inst_free(bts->site_mgr.mo.fi);
bts->site_mgr.mo.fi = NULL;
}
bts->site_mgr->bts[0] = NULL;
if (bts->mo.fi) {
osmo_fsm_inst_free(bts->mo.fi);
bts->mo.fi = NULL;
@ -164,9 +160,9 @@ static int gsm_bts_talloc_destructor(struct gsm_bts *bts)
* This part is shared among the thin programs in osmo-bsc/src/utils/.
* osmo-bsc requires further initialization that pulls in more dependencies (see
* bsc_bts_alloc_register()). */
struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, uint8_t bts_num)
struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, struct gsm_bts_sm *bts_sm, uint8_t bts_num)
{
struct gsm_bts *bts = talloc_zero(net, struct gsm_bts);
struct gsm_bts *bts = talloc_zero(bts_sm, struct gsm_bts);
struct gsm48_multi_rate_conf mr_cfg;
int i;
@ -182,26 +178,13 @@ struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, uint8_t bts_num)
bts->ms_max_power = 15; /* dBm */
bts->site_mgr.mo.fi = osmo_fsm_inst_alloc(&nm_bts_sm_fsm, bts, &bts->site_mgr,
LOGL_INFO, NULL);
osmo_fsm_inst_update_id_f(bts->site_mgr.mo.fi, "bts_sm");
gsm_mo_init(&bts->site_mgr.mo, bts, NM_OC_SITE_MANAGER, 0xff, 0xff, 0xff);
bts->site_mgr = bts_sm;
bts->mo.fi = osmo_fsm_inst_alloc(&nm_bts_fsm, bts, bts,
LOGL_INFO, NULL);
osmo_fsm_inst_update_id_f(bts->mo.fi, "bts%d", bts->nr);
gsm_mo_init(&bts->mo, bts, NM_OC_BTS, bts->nr, 0xff, 0xff);
for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
bts->gprs.nsvc[i].bts = bts;
bts->gprs.nsvc[i].id = i;
gsm_mo_init(&bts->gprs.nsvc[i].mo, bts, NM_OC_GPRS_NSVC,
bts->nr, i, 0xff);
}
memcpy(&bts->gprs.nse.timer, bts_nse_timer_default,
sizeof(bts->gprs.nse.timer));
gsm_mo_init(&bts->gprs.nse.mo, bts, NM_OC_GPRS_NSE,
bts->nr, 0xff, 0xff);
memcpy(&bts->gprs.cell.timer, bts_cell_timer_default,
sizeof(bts->gprs.cell.timer));
gsm_mo_init(&bts->gprs.cell.mo, bts, NM_OC_GPRS_CELL,
@ -589,10 +572,6 @@ void gsm_bts_mo_reset(struct gsm_bts *bts)
unsigned int i;
gsm_abis_mo_reset(&bts->mo);
gsm_abis_mo_reset(&bts->site_mgr.mo);
for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++)
gsm_abis_mo_reset(&bts->gprs.nsvc[i].mo);
gsm_abis_mo_reset(&bts->gprs.nse.mo);
gsm_abis_mo_reset(&bts->gprs.cell.mo);
llist_for_each_entry(trx, &bts->trx_list, list) {

View File

@ -133,7 +133,7 @@ static int nm_statechg_event(int evt, struct nm_statechg_signal_data *nsd)
struct gsm_bts_trx *trx;
struct gsm_bts_bb_trx *bb_transc;
struct gsm_bts_trx_ts *ts;
struct gsm_bts_gprs_nsvc *nsvc;
struct gsm_gprs_nsvc *nsvc;
struct msgb *msgb;
@ -174,7 +174,8 @@ static int nm_statechg_event(int evt, struct nm_statechg_signal_data *nsd)
osmo_fsm_inst_dispatch(trx->mo.fi, NM_EV_STATE_CHG_REP, nsd);
break;
case NM_OC_GPRS_NSE:
bts = container_of(obj, struct gsm_bts, gprs.nse);
bts_sm = container_of(obj, struct gsm_bts_sm, gprs.nse);
bts = bts_sm->bts[0];
if (bts->gprs.mode == BTS_GPRS_NONE)
break;
if (new_state->availability == NM_AVSTATE_DEPENDENCY) {
@ -258,7 +259,7 @@ static int sw_activ_rep(struct msgb *mb)
switch (foh->obj_class) {
case NM_OC_SITE_MANAGER:
osmo_fsm_inst_dispatch(bts->site_mgr.mo.fi, NM_EV_SW_ACT_REP, NULL);
osmo_fsm_inst_dispatch(bts->site_mgr->mo.fi, NM_EV_SW_ACT_REP, NULL);
break;
case NM_OC_BTS:
osmo_fsm_inst_dispatch(bts->mo.fi, NM_EV_SW_ACT_REP, NULL);
@ -306,7 +307,7 @@ static void nm_rx_opstart_ack(struct msgb *oml_msg)
switch (foh->obj_class) {
case NM_OC_SITE_MANAGER:
osmo_fsm_inst_dispatch(bts->site_mgr.mo.fi, NM_EV_OPSTART_ACK, NULL);
osmo_fsm_inst_dispatch(bts->site_mgr->mo.fi, NM_EV_OPSTART_ACK, NULL);
break;
case NM_OC_BTS:
osmo_fsm_inst_dispatch(bts->mo.fi, NM_EV_OPSTART_ACK, NULL);
@ -339,7 +340,7 @@ static void nm_rx_opstart_nack(struct msgb *oml_msg)
switch (foh->obj_class) {
case NM_OC_SITE_MANAGER:
osmo_fsm_inst_dispatch(bts->site_mgr.mo.fi, NM_EV_OPSTART_NACK, NULL);
osmo_fsm_inst_dispatch(bts->site_mgr->mo.fi, NM_EV_OPSTART_NACK, NULL);
break;
case NM_OC_BTS:
osmo_fsm_inst_dispatch(bts->mo.fi, NM_EV_OPSTART_ACK, NULL);
@ -522,7 +523,7 @@ void ipaccess_drop_oml(struct gsm_bts *bts, const char *reason)
}
}
osmo_fsm_inst_dispatch(bts->site_mgr.mo.fi, NM_EV_OML_DOWN, NULL);
osmo_fsm_inst_dispatch(bts->site_mgr->mo.fi, NM_EV_OML_DOWN, NULL);
osmo_fsm_inst_dispatch(bts->mo.fi, NM_EV_OML_DOWN, NULL);
gsm_bts_all_ts_dispatch(bts, TS_EV_OML_DOWN, NULL);

View File

@ -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:

View File

@ -1452,7 +1452,7 @@ static void nokia_abis_nm_fake_1221_ok(struct gsm_bts *bts)
struct gsm_bts_trx *trx;
mo_ok(&bts->mo);
mo_ok(&bts->site_mgr.mo);
mo_ok(&bts->site_mgr->mo);
llist_for_each_entry(trx, &bts->trx_list, list) {
int i;

85
src/osmo-bsc/bts_sm.c Normal file
View File

@ -0,0 +1,85 @@
/* (C) 2008-2018 by Harald Welte <laforge@gnumonks.org>
* (C) 2020 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
*
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <osmocom/gsm/abis_nm.h>
#include <osmocom/bsc/gsm_data.h>
#include <osmocom/bsc/bts.h>
#include <osmocom/bsc/debug.h>
#include <osmocom/bsc/nm_common_fsm.h>
static const uint8_t bts_nse_timer_default[] = { 3, 3, 3, 3, 30, 3, 10 };
static int gsm_bts_sm_talloc_destructor(struct gsm_bts_sm *bts_sm)
{
if (bts_sm->mo.fi) {
osmo_fsm_inst_free(bts_sm->mo.fi);
bts_sm->mo.fi = NULL;
}
return 0;
}
struct gsm_bts_sm *gsm_bts_sm_alloc(struct gsm_network *net, uint8_t bts_num)
{
struct gsm_bts_sm *bts_sm = talloc_zero(net, struct gsm_bts_sm);
struct gsm_bts *bts;
int i;
if (!bts_sm)
return NULL;
talloc_set_destructor(bts_sm, gsm_bts_sm_talloc_destructor);
bts_sm->mo.fi = osmo_fsm_inst_alloc(&nm_bts_sm_fsm, bts_sm, bts_sm,
LOGL_INFO, NULL);
osmo_fsm_inst_update_id_f(bts_sm->mo.fi, "bts_sm");
bts = gsm_bts_alloc(net, bts_sm, bts_num);
if (!bts) {
talloc_free(bts_sm);
return NULL;
}
bts_sm->bts[0] = bts;
gsm_mo_init(&bts_sm->mo, bts, NM_OC_SITE_MANAGER, 0xff, 0xff, 0xff);
for (i = 0; i < ARRAY_SIZE(bts_sm->gprs.nsvc); i++) {
bts_sm->gprs.nsvc[i].bts = bts;
bts_sm->gprs.nsvc[i].id = i;
gsm_mo_init(&bts_sm->gprs.nsvc[i].mo, bts, NM_OC_GPRS_NSVC,
bts->nr, i, 0xff);
}
memcpy(&bts_sm->gprs.nse.timer, bts_nse_timer_default,
sizeof(bts_sm->gprs.nse.timer));
gsm_mo_init(&bts_sm->gprs.nse.mo, bts, NM_OC_GPRS_NSE,
bts->nr, 0xff, 0xff);
return bts_sm;
}
void gsm_bts_sm_mo_reset(struct gsm_bts_sm *bts_sm)
{
int i;
gsm_abis_mo_reset(&bts_sm->mo);
gsm_abis_mo_reset(&bts_sm->gprs.nse.mo);
for (i = 0; i < ARRAY_SIZE(bts_sm->gprs.nsvc); i++)
gsm_abis_mo_reset(&bts_sm->gprs.nsvc[i].mo);
gsm_bts_mo_reset(bts_sm->bts[0]);
}

View File

@ -110,14 +110,16 @@ struct gsm_bts *gsm_bts_alloc_register(struct gsm_network *net, enum gsm_bts_typ
uint8_t bsic)
{
struct gsm_bts_model *model = bts_model_find(type);
struct gsm_bts_sm *bts_sm;
struct gsm_bts *bts;
if (!model && type != GSM_BTS_TYPE_UNKNOWN)
return NULL;
bts = gsm_bts_alloc(net, net->num_bts);
if (!bts)
bts_sm = gsm_bts_sm_alloc(net, net->num_bts);
if (!bts_sm)
return NULL;
bts = bts_sm->bts[0];
net->num_bts++;
@ -378,7 +380,7 @@ gsm_objclass2mo(struct gsm_bts *bts, uint8_t obj_class,
mo = &trx->ts[obj_inst->ts_nr].mo;
break;
case NM_OC_SITE_MANAGER:
mo = &bts->site_mgr.mo;
mo = &bts->site_mgr->mo;
break;
case NM_OC_BS11:
switch (obj_inst->bts_nr) {
@ -410,15 +412,15 @@ gsm_objclass2mo(struct gsm_bts *bts, uint8_t obj_class,
mo = &bts->bs11.envabtse[obj_inst->trx_nr].mo;
break;
case NM_OC_GPRS_NSE:
mo = &bts->gprs.nse.mo;
mo = &bts->site_mgr->gprs.nse.mo;
break;
case NM_OC_GPRS_CELL:
mo = &bts->gprs.cell.mo;
break;
case NM_OC_GPRS_NSVC:
if (obj_inst->trx_nr >= ARRAY_SIZE(bts->gprs.nsvc))
if (obj_inst->trx_nr >= ARRAY_SIZE(bts->site_mgr->gprs.nsvc))
return NULL;
mo = &bts->gprs.nsvc[obj_inst->trx_nr].mo;
mo = &bts->site_mgr->gprs.nsvc[obj_inst->trx_nr].mo;
break;
}
return mo;
@ -474,18 +476,18 @@ gsm_objclass2obj(struct gsm_bts *bts, uint8_t obj_class,
obj = &trx->ts[obj_inst->ts_nr];
break;
case NM_OC_SITE_MANAGER:
obj = &bts->site_mgr;
obj = bts->site_mgr;
break;
case NM_OC_GPRS_NSE:
obj = &bts->gprs.nse;
obj = &bts->site_mgr->gprs.nse;
break;
case NM_OC_GPRS_CELL:
obj = &bts->gprs.cell;
break;
case NM_OC_GPRS_NSVC:
if (obj_inst->trx_nr >= ARRAY_SIZE(bts->gprs.nsvc))
if (obj_inst->trx_nr >= ARRAY_SIZE(bts->site_mgr->gprs.nsvc))
return NULL;
obj = &bts->gprs.nsvc[obj_inst->trx_nr];
obj = &bts->site_mgr->gprs.nsvc[obj_inst->trx_nr];
break;
}
return obj;

View File

@ -113,7 +113,7 @@ static void st_op_disabled_dependency_on_enter(struct osmo_fsm_inst *fi, uint32_
struct gsm_bts_bb_trx *bb_transc = (struct gsm_bts_bb_trx *)fi->priv;
struct gsm_bts_trx *trx = gsm_bts_bb_trx_get_trx(bb_transc);
if (trx->bts->site_mgr.peer_has_no_avstate_offline) {
if (trx->bts->site_mgr->peer_has_no_avstate_offline) {
nm_bb_transc_fsm_state_chg(fi, NM_BB_TRANSC_ST_OP_DISABLED_OFFLINE);
return;
}
@ -187,7 +187,7 @@ static void st_op_disabled_offline(struct osmo_fsm_inst *fi, uint32_t event, voi
case NM_AVSTATE_DEPENDENCY:
/* There's no point in moving back to Dependency, since it's broken
and it acts actually as if it was in Offline state */
if (!trx->bts->site_mgr.peer_has_no_avstate_offline) {
if (!trx->bts->site_mgr->peer_has_no_avstate_offline) {
nm_bb_transc_fsm_state_chg(fi, NM_BB_TRANSC_ST_OP_DISABLED_DEPENDENCY);
} else {
/* Moreover, in nanoBTS we need to check here for tx

View File

@ -119,7 +119,7 @@ static void st_op_disabled_dependency_on_enter(struct osmo_fsm_inst *fi, uint32_
/* nanoBTS is broken, doesn't follow TS 12.21. Opstart MUST be sent
during Dependency, so we simply move to OFFLINE state here to avoid
duplicating code */
if (bts->site_mgr.peer_has_no_avstate_offline) {
if (bts->site_mgr->peer_has_no_avstate_offline) {
nm_bts_fsm_state_chg(fi, NM_BTS_ST_OP_DISABLED_OFFLINE);
return;
}
@ -202,7 +202,7 @@ static void st_op_disabled_offline(struct osmo_fsm_inst *fi, uint32_t event, voi
case NM_AVSTATE_DEPENDENCY:
/* There's no point in moving back to Dependency, since it's broken
and it acts actually as if it was in Offline state */
if (!bts->site_mgr.peer_has_no_avstate_offline) {
if (!bts->site_mgr->peer_has_no_avstate_offline) {
nm_bts_fsm_state_chg(fi, NM_BTS_ST_OP_DISABLED_DEPENDENCY);
} else {
/* Moreover, in nanoBTS we need to check here for tx

View File

@ -78,7 +78,7 @@ static void st_op_disabled_notinstalled(struct osmo_fsm_inst *fi, uint32_t event
"have your .cfg with 'type nanobts'. Otherwise, you probably "
"are using an old osmo-bts; automatically adjusting OML "
"behavior to be backward-compatible.\n");
bts->site_mgr.peer_has_no_avstate_offline = true;
site_mgr->peer_has_no_avstate_offline = true;
}
nm_bts_sm_fsm_state_chg(fi, NM_BTS_SM_ST_OP_ENABLED);
return;

View File

@ -125,7 +125,7 @@ static void st_op_disabled_dependency_on_enter(struct osmo_fsm_inst *fi, uint32_
{
struct gsm_bts_trx_ts *ts = (struct gsm_bts_trx_ts *)fi->priv;
if (ts->trx->bts->site_mgr.peer_has_no_avstate_offline) {
if (ts->trx->bts->site_mgr->peer_has_no_avstate_offline) {
nm_chan_fsm_state_chg(fi, NM_CHAN_ST_OP_DISABLED_OFFLINE);
return;
}
@ -208,7 +208,7 @@ static void st_op_disabled_offline(struct osmo_fsm_inst *fi, uint32_t event, voi
case NM_AVSTATE_DEPENDENCY:
/* There's no point in moving back to Dependency, since it's broken
and it acts actually as if it was in Offline state */
if (!ts->trx->bts->site_mgr.peer_has_no_avstate_offline) {
if (!ts->trx->bts->site_mgr->peer_has_no_avstate_offline) {
nm_chan_fsm_state_chg(fi, NM_CHAN_ST_OP_DISABLED_DEPENDENCY);
} else {
/* Moreover, in nanoBTS we need to check here for tx

View File

@ -424,7 +424,7 @@ static int inp_sig_cb(unsigned int subsys, unsigned int signal,
osmo_timer_del(&trx->bts->cbch_timer);
}
gsm_bts_mo_reset(trx->bts);
gsm_bts_sm_mo_reset(trx->bts->site_mgr);
abis_nm_clear_queue(trx->bts);
break;
@ -529,7 +529,7 @@ static int bootstrap_bts(struct gsm_bts *bts)
/* ACC ramping is initialized from vty/config */
/* Initialize the BTS state */
gsm_bts_mo_reset(bts);
gsm_bts_sm_mo_reset(bts->site_mgr);
return 0;
}

View File

@ -46,6 +46,7 @@
#include <osmocom/bsc/abis_rsl.h>
#include <osmocom/bsc/gsm_04_08_rr.h>
#include <osmocom/bsc/bts.h>
#include <osmocom/bsc/bts_sm.h>
static int pcu_sock_send(struct gsm_bts *bts, struct msgb *msg);
uint32_t trx_get_hlayer1(struct gsm_bts_trx *trx);
@ -115,13 +116,17 @@ static int pcu_tx_info_ind(struct gsm_bts *bts)
struct gsm_pcu_if *pcu_prim;
struct gsm_pcu_if_info_ind *info_ind;
struct gprs_rlc_cfg *rlcc;
struct gsm_bts_gprs_nsvc *nsvc;
struct gsm_bts_sm *bts_sm;
struct gsm_gprs_nsvc *nsvc;
struct gsm_bts_trx *trx;
struct gsm_bts_trx_ts *ts;
int i, tn;
OSMO_ASSERT(bts);
OSMO_ASSERT(bts->network);
OSMO_ASSERT(bts->site_mgr);
bts_sm = bts->site_mgr;
LOGP(DPCU, LOGL_INFO, "Sending info for BTS %d\n",bts->nr);
@ -147,8 +152,8 @@ static int pcu_tx_info_ind(struct gsm_bts *bts)
info_ind->rac = bts->gprs.rac;
/* NSE */
info_ind->nsei = bts->gprs.nse.nsei;
memcpy(info_ind->nse_timer, bts->gprs.nse.timer, 7);
info_ind->nsei = bts_sm->gprs.nse.nsei;
memcpy(info_ind->nse_timer, bts_sm->gprs.nse.timer, 7);
memcpy(info_ind->cell_timer, bts->gprs.cell.timer, 11);
/* cell attributes */
@ -202,7 +207,7 @@ static int pcu_tx_info_ind(struct gsm_bts *bts)
/* NSVC */
for (i = 0; i < ARRAY_SIZE(info_ind->nsvci); i++) {
nsvc = &bts->gprs.nsvc[i];
nsvc = &bts->site_mgr->gprs.nsvc[i];
info_ind->nsvci[i] = nsvc->nsvci;
info_ind->local_port[i] = nsvc->local_port;

View File

@ -50,6 +50,7 @@ bs11_config_LDADD = \
$(top_builddir)/src/osmo-bsc/abis_nm.o \
$(top_builddir)/src/osmo-bsc/acc.o \
$(top_builddir)/src/osmo-bsc/bts.o \
$(top_builddir)/src/osmo-bsc/bts_sm.o \
$(top_builddir)/src/osmo-bsc/bts_trx.o \
$(top_builddir)/src/osmo-bsc/bts_siemens_bs11.o \
$(top_builddir)/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.o \
@ -130,6 +131,7 @@ meas_json_LDADD = \
$(top_builddir)/src/osmo-bsc/abis_nm.o \
$(top_builddir)/src/osmo-bsc/acc.o \
$(top_builddir)/src/osmo-bsc/bts.o \
$(top_builddir)/src/osmo-bsc/bts_sm.o \
$(top_builddir)/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.o \
$(top_builddir)/src/osmo-bsc/bts_trx.o \
$(top_builddir)/src/osmo-bsc/gsm_data.o \

View File

@ -29,6 +29,7 @@ abis_test_LDADD = \
$(top_builddir)/src/osmo-bsc/acc.o \
$(top_builddir)/src/osmo-bsc/bts.o \
$(top_builddir)/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.o \
$(top_builddir)/src/osmo-bsc/bts_sm.o \
$(top_builddir)/src/osmo-bsc/bts_trx.o \
$(top_builddir)/src/osmo-bsc/gsm_data.o \
$(top_builddir)/src/osmo-bsc/net_init.o \

View File

@ -28,6 +28,7 @@ acc_test_LDADD = \
$(top_builddir)/src/osmo-bsc/abis_nm.o \
$(top_builddir)/src/osmo-bsc/acc.o \
$(top_builddir)/src/osmo-bsc/bts.o \
$(top_builddir)/src/osmo-bsc/bts_sm.o \
$(top_builddir)/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.o \
$(top_builddir)/src/osmo-bsc/bts_trx.o \
$(top_builddir)/src/osmo-bsc/gsm_data.o \

View File

@ -44,7 +44,8 @@ static void clock_debug(char* str)
#define bts_init(net) _bts_init(net, __func__)
static inline struct gsm_bts *_bts_init(struct gsm_network *net, const char *msg)
{
struct gsm_bts *bts = gsm_bts_alloc(net, 0);
struct gsm_bts_sm *bts_sm = gsm_bts_sm_alloc(net, 0);
struct gsm_bts *bts = bts_sm->bts[0];
if (!bts) {
fprintf(stderr, "BTS allocation failure in %s()\n", msg);
exit(1);
@ -66,7 +67,7 @@ static inline void _bts_del(struct gsm_bts *bts, const char *msg)
if (osmo_timer_pending(&bts->acc_ramp.step_timer))
osmo_timer_del(&bts->acc_ramp.step_timer);
/* no need to llist_del(&bts->list), we never registered the bts there. */
talloc_free(bts);
talloc_free(bts->site_mgr);
fprintf(stderr, "BTS deallocated OK in %s()\n", msg);
}

View File

@ -39,6 +39,7 @@ bsc_test_LDADD = \
$(top_builddir)/src/osmo-bsc/osmo_bsc_filter.o \
$(top_builddir)/src/osmo-bsc/bsc_subscriber.o \
$(top_builddir)/src/osmo-bsc/bts.o \
$(top_builddir)/src/osmo-bsc/bts_sm.o \
$(top_builddir)/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.o \
$(top_builddir)/src/osmo-bsc/bts_trx.o \
$(top_builddir)/src/osmo-bsc/gsm_data.o \

View File

@ -29,6 +29,7 @@ gsm0408_test_LDADD = \
$(top_builddir)/src/osmo-bsc/arfcn_range_encode.o \
$(top_builddir)/src/osmo-bsc/bts.o \
$(top_builddir)/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.o \
$(top_builddir)/src/osmo-bsc/bts_sm.o \
$(top_builddir)/src/osmo-bsc/bts_trx.o \
$(top_builddir)/src/osmo-bsc/gsm_data.o \
$(top_builddir)/src/osmo-bsc/net_init.o \

View File

@ -123,7 +123,8 @@ static inline void _bts_uarfcn_add(struct gsm_bts *bts, uint16_t arfcn, uint16_t
#define bts_init(net) _bts_init(net, __func__)
static inline struct gsm_bts *_bts_init(struct gsm_network *net, const char *msg)
{
struct gsm_bts *bts = gsm_bts_alloc(net, 0);
struct gsm_bts_sm *bts_sm = gsm_bts_sm_alloc(net, 0);
struct gsm_bts *bts = bts_sm->bts[0];
if (!bts) {
printf("BTS allocation failure in %s()\n", msg);
exit(1);
@ -143,7 +144,7 @@ static inline void _bts_del(struct gsm_bts *bts, const char *msg)
if (osmo_timer_pending(&bts->acc_mgr.rotate_timer))
osmo_timer_del(&bts->acc_mgr.rotate_timer);
/* no need to llist_del(&bts->list), we never registered the bts there. */
talloc_free(bts);
talloc_free(bts->site_mgr);
printf("BTS deallocated OK in %s()\n", msg);
}

View File

@ -58,6 +58,7 @@ handover_test_LDADD = \
$(top_builddir)/src/osmo-bsc/bsc_subscriber.o \
$(top_builddir)/src/osmo-bsc/bsc_vty.o \
$(top_builddir)/src/osmo-bsc/bts.o \
$(top_builddir)/src/osmo-bsc/bts_sm.o \
$(top_builddir)/src/osmo-bsc/bts_trx.o \
$(top_builddir)/src/osmo-bsc/bts_ipaccess_nanobts.o \
$(top_builddir)/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.o \

View File

@ -27,6 +27,7 @@ nanobts_omlattr_test_LDADD = \
$(top_builddir)/src/osmo-bsc/acc.o \
$(top_builddir)/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.o \
$(top_builddir)/src/osmo-bsc/bts.o \
$(top_builddir)/src/osmo-bsc/bts_sm.o \
$(top_builddir)/src/osmo-bsc/bts_trx.o \
$(top_builddir)/src/osmo-bsc/gsm_data.o \
$(top_builddir)/src/osmo-bsc/nm_common_fsm.o \

View File

@ -243,7 +243,7 @@ int main(int argc, char **argv)
};
/* Parameters needed to test nanobts_attr_nse_get() */
bts->gprs.nse.nsei = 101;
bts->site_mgr->gprs.nse.nsei = 101;
uint8_t attr_nse_expected[] =
{ 0x9d, 0x00, 0x02, 0x00, 0x65, 0xa0, 0x00, 0x07, 0x03, 0x03, 0x03,
0x03, 0x1e, 0x03, 0x0a, 0xa1, 0x00, 0x0b, 0x03, 0x03, 0x03,
@ -266,9 +266,9 @@ int main(int argc, char **argv)
/* Parameters needed to test nanobts_attr_nscv_get() */
struct osmo_sockaddr_str addr;
osmo_sockaddr_str_from_str(&addr, "10.9.1.101", 23000);
osmo_sockaddr_str_to_sockaddr(&addr, &bts->gprs.nsvc[0].remote.u.sas);
bts->gprs.nsvc[0].nsvci = 0x65;
bts->gprs.nsvc[0].local_port = 0x5a3c;
osmo_sockaddr_str_to_sockaddr(&addr, &bts->site_mgr->gprs.nsvc[0].remote.u.sas);
bts->site_mgr->gprs.nsvc[0].nsvci = 0x65;
bts->site_mgr->gprs.nsvc[0].local_port = 0x5a3c;
uint8_t attr_nscv_expected[] =
{ 0x9f, 0x00, 0x02, 0x00, 0x65, 0xa2, 0x00, 0x08, 0x59, 0xd8, 0x0a,
0x09, 0x01, 0x65, 0x5a, 0x3c
@ -291,9 +291,9 @@ int main(int argc, char **argv)
/* NSVC IPv6 test */
struct osmo_sockaddr_str addr6;
osmo_sockaddr_str_from_str(&addr6, "fd00:5678:9012:3456:7890:1234:5678:9012", 23010);
osmo_sockaddr_str_to_sockaddr(&addr6, &bts->gprs.nsvc[0].remote.u.sas);
bts->gprs.nsvc[0].nsvci = 0x65;
bts->gprs.nsvc[0].local_port = 0x5a3c;
osmo_sockaddr_str_to_sockaddr(&addr6, &bts->site_mgr->gprs.nsvc[0].remote.u.sas);
bts->site_mgr->gprs.nsvc[0].nsvci = 0x65;
bts->site_mgr->gprs.nsvc[0].local_port = 0x5a3c;
uint8_t attr_nscv6_expected[] =
/* |- oml attr |-16bit length */
{ 0x9f, 0x00, 0x02, 0x00, 0x65, 0xfd, 0x00, 0x16,