pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/30971 )
Change subject: layer23: Initialize osmocom_ms further in common code ......................................................................
layer23: Initialize osmocom_ms further in common code
Change-Id: Ic629cf229167ddd4c533a2abf1b82ad78d1144a9 --- M src/host/layer23/include/osmocom/bb/common/ms.h M src/host/layer23/src/common/main.c M src/host/layer23/src/common/ms.c M src/host/layer23/src/mobile/app_mobile.c 4 files changed, 14 insertions(+), 14 deletions(-)
Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve osmith: Looks good to me, but someone else must approve pespin: Looks good to me, approved
diff --git a/src/host/layer23/include/osmocom/bb/common/ms.h b/src/host/layer23/include/osmocom/bb/common/ms.h index b9c9276..bbb5491 100644 --- a/src/host/layer23/include/osmocom/bb/common/ms.h +++ b/src/host/layer23/include/osmocom/bb/common/ms.h @@ -99,4 +99,4 @@ char *lua_script; };
-struct osmocom_ms *osmocom_ms_alloc(void *ctx); +struct osmocom_ms *osmocom_ms_alloc(void *ctx, const char *name); diff --git a/src/host/layer23/src/common/main.c b/src/host/layer23/src/common/main.c index 61a8604..8017898 100644 --- a/src/host/layer23/src/common/main.c +++ b/src/host/layer23/src/common/main.c @@ -268,9 +268,8 @@
print_copyright();
- ms = osmocom_ms_alloc(l23_ctx); + ms = osmocom_ms_alloc(l23_ctx, "1"); OSMO_ASSERT(ms); - llist_add_tail(&ms->entity, &ms_list);
rc = l23_app_init(ms); if (rc < 0) { diff --git a/src/host/layer23/src/common/ms.c b/src/host/layer23/src/common/ms.c index 0b1ccb8..74dabc2 100644 --- a/src/host/layer23/src/common/ms.c +++ b/src/host/layer23/src/common/ms.c @@ -19,15 +19,18 @@
#include <osmocom/bb/common/ms.h>
-struct osmocom_ms *osmocom_ms_alloc(void *ctx) +extern struct llist_head ms_list; + +struct osmocom_ms *osmocom_ms_alloc(void *ctx, const char *name) { struct osmocom_ms *ms;
ms = talloc_zero(ctx, struct osmocom_ms); if (!ms) return NULL; + talloc_set_name(ms, "ms_%s", name);
- ms->name = talloc_strdup(ms, "1"); + ms->name = talloc_strdup(ms, name); ms->test_arfcn = 871; ms->lapdm_channel.lapdm_dcch.l1_ctx = ms; ms->lapdm_channel.lapdm_dcch.l3_ctx = ms; @@ -36,5 +39,11 @@ lapdm_channel_init(&ms->lapdm_channel, LAPDM_MODE_MS); lapdm_channel_set_l1(&ms->lapdm_channel, l1ctl_ph_prim_cb, ms);
+ ms->l2_wq.bfd.fd = -1; + ms->sap_wq.bfd.fd = -1; + + /* Register a new MS */ + llist_add_tail(&ms->entity, &ms_list); + return ms; } diff --git a/src/host/layer23/src/mobile/app_mobile.c b/src/host/layer23/src/mobile/app_mobile.c index 5bf765a..b2133f7 100644 --- a/src/host/layer23/src/mobile/app_mobile.c +++ b/src/host/layer23/src/mobile/app_mobile.c @@ -335,20 +335,12 @@ { static struct osmocom_ms *ms;
- ms = talloc_zero(l23_ctx, struct osmocom_ms); + ms = osmocom_ms_alloc(l23_ctx, name); if (!ms) { LOGP(DMOB, LOGL_ERROR, "Failed to allocate MS: %s\n", name); return NULL; }
- talloc_set_name(ms, "ms_%s", name); - ms->name = talloc_strdup(ms, name); - ms->l2_wq.bfd.fd = -1; - ms->sap_wq.bfd.fd = -1; - - /* Register a new MS */ - llist_add_tail(&ms->entity, &ms_list); - gsm_support_init(ms); gsm_settings_init(ms);