lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

May 2023

  • 1 participants
  • 2583 discussions
[S] Change in osmocom-bb[master]: layer23: Store and use SAPI & NSAPI in apn->pdp
by pespin 03 May '23

03 May '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/32597 ) Change subject: layer23: Store and use SAPI & NSAPI in apn->pdp ...................................................................... layer23: Store and use SAPI & NSAPI in apn->pdp Change-Id: If82c94ca9c84a94e63a9a5d642a27a7b4e3ff089 --- M src/host/layer23/include/osmocom/bb/common/apn.h M src/host/layer23/src/common/apn.c M src/host/layer23/src/modem/sm.c M src/host/layer23/src/modem/sndcp.c 4 files changed, 24 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/97/32597/1 diff --git a/src/host/layer23/include/osmocom/bb/common/apn.h b/src/host/layer23/include/osmocom/bb/common/apn.h index 538b31d..c449530 100644 --- a/src/host/layer23/include/osmocom/bb/common/apn.h +++ b/src/host/layer23/include/osmocom/bb/common/apn.h @@ -28,6 +28,11 @@ #define APN_TYPE_IPv6 0x02 /* v6-only */ #define APN_TYPE_IPv4v6 0x04 /* v4v6 dual-stack */ +struct osmobb_pdp_ctx { + uint8_t nsapi; + uint8_t llc_sapi; +}; + struct osmobb_apn { /* list of APNs inside MS */ struct llist_head list; @@ -52,6 +57,7 @@ } cfg; struct osmo_tundev *tun; struct apn_fsm_ctx fsm; + struct osmobb_pdp_ctx pdp; }; struct osmobb_apn *apn_alloc(struct osmocom_ms *ms, const char *name); diff --git a/src/host/layer23/src/common/apn.c b/src/host/layer23/src/common/apn.c index b9b032c..4ea5d3a 100644 --- a/src/host/layer23/src/common/apn.c +++ b/src/host/layer23/src/common/apn.c @@ -23,6 +23,8 @@ #include <talloc.h> +#include <osmocom/gprs/sm/sm.h> + #include <osmocom/bb/common/logging.h> #include <osmocom/bb/common/apn.h> #include <osmocom/bb/common/ms.h> @@ -49,6 +51,9 @@ osmo_tundev_set_priv_data(apn->tun, apn); apn->ms = ms; + /* FIXME: may want to configure or pick free one in the future: */ + apn->pdp.nsapi = 6; + apn->pdp.llc_sapi = OSMO_GPRS_SM_LLC_SAPI_SAPI3; llist_add_tail(&apn->list, &ms->gprs.apn_list); return apn; diff --git a/src/host/layer23/src/modem/sm.c b/src/host/layer23/src/modem/sm.c index aac2b52..03982c6 100644 --- a/src/host/layer23/src/modem/sm.c +++ b/src/host/layer23/src/modem/sm.c @@ -229,8 +229,6 @@ struct osmo_gprs_sm_prim *sm_prim; const struct gsm_subscriber *subscr = &ms->subscr; enum osmo_gprs_sm_pdp_addr_ietf_type pdp_addr_ietf_type; - uint8_t nsapi = 6; - enum osmo_gprs_sm_llc_sapi llc_sapi = OSMO_GPRS_SM_LLC_SAPI_SAPI3; struct osmo_sockaddr pdp_addr_any = {0}; uint8_t qos[OSMO_GPRS_SM_QOS_MAXLEN] = {0}; uint8_t pco[OSMO_GPRS_SM_QOS_MAXLEN] = {0}; @@ -248,8 +246,8 @@ } sm_prim = osmo_gprs_sm_prim_alloc_smreg_pdp_act_req(); - sm_prim->smreg.pdp_act_req.nsapi = nsapi; - sm_prim->smreg.pdp_act_req.llc_sapi = llc_sapi; + sm_prim->smreg.pdp_act_req.nsapi = apn->pdp.nsapi; + sm_prim->smreg.pdp_act_req.llc_sapi = apn->pdp.llc_sapi; sm_prim->smreg.pdp_act_req.pdp_addr_ietf_type = pdp_addr_ietf_type; sm_prim->smreg.pdp_act_req.pdp_addr_v4 = pdp_addr_any; sm_prim->smreg.pdp_act_req.pdp_addr_v6 = pdp_addr_any; diff --git a/src/host/layer23/src/modem/sndcp.c b/src/host/layer23/src/modem/sndcp.c index b4b7761..7814e50 100644 --- a/src/host/layer23/src/modem/sndcp.c +++ b/src/host/layer23/src/modem/sndcp.c @@ -181,10 +181,8 @@ /* TODO: look up PDP context IDs from ms once we have GMM layer. */ uint32_t tlli = 0xe1c5d364; - uint8_t sapi = OSMO_GPRS_LLC_SAPI_SNDCP3; - uint8_t nsapi = 1; - sndcp_prim = osmo_gprs_sndcp_prim_alloc_sn_xid_req(tlli, sapi, nsapi); + sndcp_prim = osmo_gprs_sndcp_prim_alloc_sn_xid_req(tlli, apn->pdp.llc_sapi, apn->pdp.nsapi); OSMO_ASSERT(sndcp_prim); sndcp_prim->sn.xid_req.pcomp_rfc1144.active = set->pcomp_rfc1144.active; sndcp_prim->sn.xid_req.pcomp_rfc1144.s01 = set->pcomp_rfc1144.s01; @@ -203,10 +201,8 @@ /* TODO: look up PDP context IDs from apn->ms once we have GMM layer. */ uint32_t tlli = 0xe1c5d364; - uint8_t sapi = OSMO_GPRS_LLC_SAPI_SNDCP3; - uint8_t nsapi = 1; - sndcp_prim = osmo_gprs_sndcp_prim_alloc_sn_unitdata_req(tlli, sapi, nsapi, npdu, npdu_len); + sndcp_prim = osmo_gprs_sndcp_prim_alloc_sn_unitdata_req(tlli, apn->pdp.llc_sapi, apn->pdp.nsapi, npdu, npdu_len); OSMO_ASSERT(sndcp_prim); rc = osmo_gprs_sndcp_prim_upper_down(sndcp_prim); return rc; -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/32597 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: If82c94ca9c84a94e63a9a5d642a27a7b4e3ff089 Gerrit-Change-Number: 32597 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[L] Change in osmocom-bb[master]: layer23: Introduce apn_fsm
by pespin 03 May '23

03 May '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/32596 ) Change subject: layer23: Introduce apn_fsm ...................................................................... layer23: Introduce apn_fsm This allows further control on the state of the APNs, as well as a step further towards administering them through VTY. Change-Id: I2cc732dfb020d31ab89025e7e22276b819dcb24a --- M src/host/layer23/include/osmocom/bb/common/Makefile.am M src/host/layer23/include/osmocom/bb/common/apn.h A src/host/layer23/include/osmocom/bb/common/apn_fsm.h M src/host/layer23/include/osmocom/bb/common/settings.h M src/host/layer23/src/common/Makefile.am M src/host/layer23/src/common/apn.c A src/host/layer23/src/common/apn_fsm.c M src/host/layer23/src/common/settings.c M src/host/layer23/src/modem/gmm.c M src/host/layer23/src/modem/sm.c M src/host/layer23/src/modem/vty.c 11 files changed, 346 insertions(+), 15 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/96/32596/1 diff --git a/src/host/layer23/include/osmocom/bb/common/Makefile.am b/src/host/layer23/include/osmocom/bb/common/Makefile.am index 28caf78..7c0fa97 100644 --- a/src/host/layer23/include/osmocom/bb/common/Makefile.am +++ b/src/host/layer23/include/osmocom/bb/common/Makefile.am @@ -1,5 +1,6 @@ noinst_HEADERS = \ apn.h \ + apn_fsm.h \ l1ctl.h \ l1l2_interface.h \ l23_app.h \ diff --git a/src/host/layer23/include/osmocom/bb/common/apn.h b/src/host/layer23/include/osmocom/bb/common/apn.h index 94784ef..538b31d 100644 --- a/src/host/layer23/include/osmocom/bb/common/apn.h +++ b/src/host/layer23/include/osmocom/bb/common/apn.h @@ -20,6 +20,7 @@ #include <osmocom/core/linuxlist.h> #include <osmocom/core/select.h> #include <osmocom/core/tun.h> +#include <osmocom/bb/common/apn_fsm.h> struct osmocom_ms; @@ -50,6 +51,7 @@ bool tx_gpdu_seq; } cfg; struct osmo_tundev *tun; + struct apn_fsm_ctx fsm; }; struct osmobb_apn *apn_alloc(struct osmocom_ms *ms, const char *name); diff --git a/src/host/layer23/include/osmocom/bb/common/apn_fsm.h b/src/host/layer23/include/osmocom/bb/common/apn_fsm.h new file mode 100644 index 0000000..890267c --- /dev/null +++ b/src/host/layer23/include/osmocom/bb/common/apn_fsm.h @@ -0,0 +1,29 @@ +#pragma once + +#include <osmocom/core/fsm.h> + +struct osmobb_apn; + +enum apn_fsm_states { + APN_ST_DISABLED, + APN_ST_INACTIVE, + APN_ST_ACTIVATING, + APN_ST_ACTIVE, +}; + +enum apn_fsm_events { + APN_EV_GPRS_ALLOWED, /* data: bool *allowed */ + APN_EV_GMM_ATTACHED, + APN_EV_GMM_DETACHED, + APN_EV_RX_SM_ACT_PDP_CTX_REJ, /* data: enum gsm48_gsm_cause *cause */ + APN_EV_RX_SM_ACT_PDP_CTX_ACC, + APN_EV_RX_SM_DEACT_PDP_CTX_ACC, +}; + +struct apn_fsm_ctx { + struct osmo_fsm_inst *fi; + struct osmobb_apn *apn; +}; + +int apn_fsm_ctx_init(struct apn_fsm_ctx *ctx, struct osmobb_apn *apn); +void apn_fsm_ctx_release(struct apn_fsm_ctx *ctx); diff --git a/src/host/layer23/include/osmocom/bb/common/settings.h b/src/host/layer23/include/osmocom/bb/common/settings.h index 88ce280..38faa4b 100644 --- a/src/host/layer23/include/osmocom/bb/common/settings.h +++ b/src/host/layer23/include/osmocom/bb/common/settings.h @@ -205,6 +205,7 @@ int gprs_settings_init(struct osmocom_ms *ms); int gprs_settings_fi(struct osmocom_ms *ms); struct osmobb_apn *ms_find_apn_by_name(struct osmocom_ms *ms, const char *apn_name); +int ms_dispatch_all_apn(struct osmocom_ms *ms, uint32_t event, void *data); extern char *layer2_socket_path; diff --git a/src/host/layer23/src/common/Makefile.am b/src/host/layer23/src/common/Makefile.am index 60af3b8..8f5aeba 100644 --- a/src/host/layer23/src/common/Makefile.am +++ b/src/host/layer23/src/common/Makefile.am @@ -16,6 +16,7 @@ noinst_LIBRARIES = liblayer23.a liblayer23_a_SOURCES = \ apn.c \ + apn_fsm.c \ gps.c \ l1ctl.c \ l1l2_interface.c \ diff --git a/src/host/layer23/src/common/apn.c b/src/host/layer23/src/common/apn.c index 636246a..b9b032c 100644 --- a/src/host/layer23/src/common/apn.c +++ b/src/host/layer23/src/common/apn.c @@ -35,25 +35,33 @@ if (!apn) return NULL; + if (apn_fsm_ctx_init(&apn->fsm, apn) != 0) + goto ret_free; + talloc_set_name(apn, "apn_%s", name); apn->cfg.name = talloc_strdup(apn, name); apn->cfg.shutdown = true; apn->cfg.tx_gpdu_seq = true; apn->tun = osmo_tundev_alloc(apn, name); - if (!apn->tun) { - talloc_free(apn); - return NULL; - } + if (!apn->tun) + goto ret_free_fsm; osmo_tundev_set_priv_data(apn->tun, apn); apn->ms = ms; llist_add_tail(&apn->list, &ms->gprs.apn_list); return apn; + +ret_free_fsm: + apn_fsm_ctx_release(&apn->fsm); +ret_free: + talloc_free(apn); + return NULL; } void apn_free(struct osmobb_apn *apn) { + apn_fsm_ctx_release(&apn->fsm); llist_del(&apn->list); osmo_tundev_free(apn->tun); talloc_free(apn); diff --git a/src/host/layer23/src/common/apn_fsm.c b/src/host/layer23/src/common/apn_fsm.c new file mode 100644 index 0000000..edaac48 --- /dev/null +++ b/src/host/layer23/src/common/apn_fsm.c @@ -0,0 +1,245 @@ +/* Lifecycle of an APN */ +/* + * (C) 2023 by sysmocom - s.m.f.c. GmbH <info(a)sysmocom.de> + * All Rights Reserved + * + * SPDX-License-Identifier: AGPL-3.0+ + * + * Author: Pau Espin Pedrol <pespin(a)sysmocom.de> + * + * 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 <errno.h> +#include <osmocom/core/tdef.h> +#include <osmocom/core/utils.h> + +#include <osmocom/bb/common/logging.h> +#include <osmocom/bb/common/apn_fsm.h> +#include <osmocom/bb/common/apn.h> +#define X(s) (1 << (s)) + +static struct osmo_tdef T_defs_apn[] = { + { .T=1, .default_val=30, .desc = "Activating timeout (s)" }, + { 0 } /* empty item at the end */ +}; + +static const struct osmo_tdef_state_timeout apn_fsm_timeouts[32] = { + [APN_ST_DISABLED] = {}, + [APN_ST_INACTIVE] = {}, + [APN_ST_ACTIVATING] = { .T=1 }, + [APN_ST_ACTIVE] = {}, +}; + +#define apn_fsm_state_chg(fi, NEXT_STATE) \ + osmo_tdef_fsm_inst_state_chg(fi, NEXT_STATE, apn_fsm_timeouts, T_defs_apn, -1) + +static void st_apn_disabled_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state) +{ + struct apn_fsm_ctx *ctx = (struct apn_fsm_ctx *)fi->priv; + + apn_stop(ctx->apn); +} + +static void st_apn_disabled(struct osmo_fsm_inst *fi, uint32_t event, void *data) +{ + switch (event) { + case APN_EV_GPRS_ALLOWED: + if (*((bool *)data) == true) + apn_fsm_state_chg(fi, APN_ST_INACTIVE); + break; + default: + OSMO_ASSERT(0); + } +} + +static void st_apn_inactive_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state) +{ + struct apn_fsm_ctx *ctx = (struct apn_fsm_ctx *)fi->priv; + + int rc = apn_start(ctx->apn); + if (rc < 0) + apn_fsm_state_chg(fi, APN_ST_DISABLED); + + /* FIXME: Here once we find a way to store whether the ms object is GMM + attached, we can transition directly to ACTIVATING. */ +} + +static void st_apn_inactive(struct osmo_fsm_inst *fi, uint32_t event, void *data) +{ + switch (event) { + case APN_EV_GPRS_ALLOWED: + if (*((bool *)data) == false) + apn_fsm_state_chg(fi, APN_ST_DISABLED); + break; + case APN_EV_GMM_ATTACHED: + apn_fsm_state_chg(fi, APN_ST_ACTIVATING); + break; + default: + OSMO_ASSERT(0); + } +} + +static void st_apn_activating_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state) +{ + /* FIXME: We could send SMREG-PDP_ACT.req from here. Right now that's done by the app. */ +} + +static void st_apn_activating(struct osmo_fsm_inst *fi, uint32_t event, void *data) +{ + switch (event) { + case APN_EV_GPRS_ALLOWED: + /* TODO: Tx PDP DEACT ACC */ + apn_fsm_state_chg(fi, APN_ST_DISABLED); + break; + case APN_EV_GMM_DETACHED: + apn_fsm_state_chg(fi, APN_ST_INACTIVE); + break; + case APN_EV_RX_SM_ACT_PDP_CTX_REJ: + apn_fsm_state_chg(fi, APN_ST_INACTIVE); + break; + case APN_EV_RX_SM_ACT_PDP_CTX_ACC: + apn_fsm_state_chg(fi, APN_ST_ACTIVE); + break; + default: + OSMO_ASSERT(0); + } +} + +static void st_apn_active_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state) +{ + struct apn_fsm_ctx *ctx = (struct apn_fsm_ctx *)fi->priv; + struct osmo_netdev *netdev; + + netdev = osmo_tundev_get_netdev(ctx->apn->tun); + osmo_netdev_ifupdown(netdev, true); +} + +static void st_apn_active(struct osmo_fsm_inst *fi, uint32_t event, void *data) +{ + switch (event) { + case APN_EV_GPRS_ALLOWED: + /* TODO: Tx PDP DEACT ACC */ + apn_fsm_state_chg(fi, APN_ST_DISABLED); + break; + case APN_EV_GMM_DETACHED: + apn_fsm_state_chg(fi, APN_ST_INACTIVE); + break; + case APN_EV_RX_SM_DEACT_PDP_CTX_ACC: + apn_fsm_state_chg(fi, APN_ST_INACTIVE); + break; + default: + OSMO_ASSERT(0); + } +} + +static int apn_fsm_timer_cb(struct osmo_fsm_inst *fi) +{ + switch (fi->T) { + case 1: + apn_fsm_state_chg(fi, APN_ST_INACTIVE); + break; + default: + OSMO_ASSERT(0); + } + return 0; +} + +static struct osmo_fsm_state apn_fsm_states[] = { + [APN_ST_DISABLED] = { + .in_event_mask = + X(APN_EV_GPRS_ALLOWED), + .out_state_mask = + X(APN_ST_INACTIVE), + .name = "DISABLED", + .onenter = st_apn_disabled_on_enter, + .action = st_apn_disabled, + }, + [APN_ST_INACTIVE] = { + .in_event_mask = + X(APN_EV_GPRS_ALLOWED) | + X(APN_EV_GMM_ATTACHED), + .out_state_mask = + X(APN_ST_ACTIVATING), + .name = "INACTIVE", + .onenter = st_apn_inactive_on_enter, + .action = st_apn_inactive, + }, + [APN_ST_ACTIVATING] = { + .in_event_mask = + X(APN_EV_GPRS_ALLOWED) | + X(APN_EV_GMM_DETACHED) | + X(APN_EV_RX_SM_ACT_PDP_CTX_REJ) | + X(APN_EV_RX_SM_ACT_PDP_CTX_ACC), + .out_state_mask = + X(APN_ST_DISABLED) | + X(APN_ST_INACTIVE) | + X(APN_ST_ACTIVE), + .name = "ACTIVATING", + .onenter = st_apn_activating_on_enter, + .action = st_apn_activating, + }, + [APN_ST_ACTIVE] = { + .in_event_mask = + X(APN_EV_GPRS_ALLOWED) | + X(APN_EV_GMM_DETACHED)| + X(APN_EV_RX_SM_DEACT_PDP_CTX_ACC), + .out_state_mask = + X(APN_ST_DISABLED) | + X(APN_ST_INACTIVE), + .name = "ACTIVE", + .onenter = st_apn_active_on_enter, + .action = st_apn_active, + }, +}; + +const struct value_string apn_fsm_event_names[] = { + { APN_EV_GPRS_ALLOWED, "GPRS_ALLOWED" }, + { APN_EV_GMM_ATTACHED, "GMM_ATTACHED" }, + { APN_EV_GMM_DETACHED, "GMM_DETACHED" }, + { APN_EV_RX_SM_ACT_PDP_CTX_REJ, "ACT_PDP_CTX_REJ" }, + { APN_EV_RX_SM_ACT_PDP_CTX_ACC, "ACT_PDP_CTX_ACC" }, + { APN_EV_RX_SM_DEACT_PDP_CTX_ACC, "DEACT_PDP_CTX_ACC" }, + { 0, NULL } +}; + +struct osmo_fsm apn_fsm = { + .name = "APN", + .states = apn_fsm_states, + .num_states = ARRAY_SIZE(apn_fsm_states), + .timer_cb = apn_fsm_timer_cb, + .event_names = apn_fsm_event_names, + .log_subsys = DTUN, + .timer_cb = apn_fsm_timer_cb, +}; + +int apn_fsm_ctx_init(struct apn_fsm_ctx *ctx, struct osmobb_apn *apn) +{ + ctx->apn = apn; + ctx->fi = osmo_fsm_inst_alloc(&apn_fsm, apn, ctx, LOGL_INFO, NULL); + if (!ctx->fi) + return -ENODATA; + + return 0; +} + +void apn_fsm_ctx_release(struct apn_fsm_ctx *ctx) +{ + osmo_fsm_inst_free(ctx->fi); +} + +static __attribute__((constructor)) void apn_fsm_init(void) +{ + OSMO_ASSERT(osmo_fsm_register(&apn_fsm) == 0); + osmo_tdefs_reset(T_defs_apn); +} diff --git a/src/host/layer23/src/common/settings.c b/src/host/layer23/src/common/settings.c index 565da96..986d551 100644 --- a/src/host/layer23/src/common/settings.c +++ b/src/host/layer23/src/common/settings.c @@ -252,3 +252,14 @@ } return NULL; } + +int ms_dispatch_all_apn(struct osmocom_ms *ms, uint32_t event, void *data) +{ + struct gprs_settings *set = &ms->gprs; + int rc = 0; + struct osmobb_apn *apn; + + llist_for_each_entry(apn, &set->apn_list, list) + rc |= osmo_fsm_inst_dispatch(apn->fsm.fi, event, data); + return rc; +} diff --git a/src/host/layer23/src/modem/gmm.c b/src/host/layer23/src/modem/gmm.c index f3a936a..b95f15a 100644 --- a/src/host/layer23/src/modem/gmm.c +++ b/src/host/layer23/src/modem/gmm.c @@ -64,10 +64,12 @@ ms->subscr.ptmsi = gmm_prim->gmmreg.attach_cnf.acc.allocated_ptmsi; app_data.modem_state = MODEM_ST_ATTACHED; /* Activate APN if not yet already: */ - apn = llist_first_entry_or_null(&ms->gprs.apn_list, struct osmobb_apn, list); - if (!apn || apn->cfg.shutdown) - break; - modem_sm_smreg_pdp_act_req(ms, apn); + llist_for_each_entry(apn, &ms->gprs.apn_list, list) { + if (apn->fsm.fi->state != APN_ST_INACTIVE) + continue; + osmo_fsm_inst_dispatch(apn->fsm.fi, APN_EV_GMM_ATTACHED, NULL); + modem_sm_smreg_pdp_act_req(ms, apn); + } } else { uint8_t cause = gmm_prim->gmmreg.attach_cnf.rej.cause; LOGP(DGMM, LOGL_ERROR, "%s(): Rx %s: Attach rejected, cause=%u (%s)\n", @@ -94,6 +96,9 @@ break; case OSMO_PRIM(OSMO_GPRS_GMM_GMMREG_DETACH, PRIM_OP_CONFIRM): case OSMO_PRIM(OSMO_GPRS_GMM_GMMREG_DETACH, PRIM_OP_INDICATION): + LOGP(DGMM, LOGL_NOTICE, "%s(): Rx %s\n", __func__, pdu_name); + ms_dispatch_all_apn(ms, APN_EV_GMM_DETACHED, NULL); + break; default: LOGP(DGMM, LOGL_ERROR, "%s(): Rx %s UNIMPLEMENTED\n", __func__, pdu_name); break; diff --git a/src/host/layer23/src/modem/sm.c b/src/host/layer23/src/modem/sm.c index 56b223f..aac2b52 100644 --- a/src/host/layer23/src/modem/sm.c +++ b/src/host/layer23/src/modem/sm.c @@ -50,24 +50,28 @@ static int modem_sm_handle_pdp_act_cnf(struct osmocom_ms *ms, struct osmo_gprs_sm_prim *sm_prim) { const char *pdu_name = osmo_gprs_sm_prim_name(sm_prim); - struct osmobb_apn *apn = llist_first_entry_or_null(&ms->gprs.apn_list, struct osmobb_apn, list); + struct osmobb_apn *apn = NULL, *apn_it; struct osmo_netdev *netdev; char buf_addr[INET6_ADDRSTRLEN]; char buf_addr2[INET6_ADDRSTRLEN]; int rc; + llist_for_each_entry(apn_it, &ms->gprs.apn_list, list) { + if (apn_it->fsm.fi->state == APN_ST_ACTIVATING) { + apn = apn_it; + break; + } + } + if (!apn) { LOGP(DSM, LOGL_ERROR, "Rx %s but have no APN!\n", pdu_name); return -ENOENT; } - if (apn->cfg.shutdown) { - LOGPAPN(LOGL_ERROR, apn, "Rx %s but APN is administratively shutdown!\n", pdu_name); - return -ENOENT; - } if (!sm_prim->smreg.pdp_act_cnf.accepted) { LOGPAPN(LOGL_ERROR, apn, "Rx %s: Activate PDP failed! cause '%s'\n", pdu_name, get_value_string(gsm48_gsm_cause_names, sm_prim->smreg.pdp_act_cnf.rej.cause)); + osmo_fsm_inst_dispatch(apn->fsm.fi, APN_EV_RX_SM_ACT_PDP_CTX_REJ, NULL); /* TODO: maybe retry ? */ return 0; } @@ -117,6 +121,8 @@ /* TODO: Handle PCO */ /* TODO: Handle QoS */ + + osmo_fsm_inst_dispatch(apn->fsm.fi, APN_EV_RX_SM_ACT_PDP_CTX_ACC, NULL); return rc; } diff --git a/src/host/layer23/src/modem/vty.c b/src/host/layer23/src/modem/vty.c index 33891d4..77f0885 100644 --- a/src/host/layer23/src/modem/vty.c +++ b/src/host/layer23/src/modem/vty.c @@ -257,6 +257,7 @@ { struct osmocom_ms *ms = vty->index; struct osmobb_apn *apn; + bool on = false; apn = ms_find_apn_by_name(ms, argv[0]); if (!apn) { @@ -264,6 +265,9 @@ return CMD_WARNING; } + /* Disable APN before getting rid of it. */ + osmo_fsm_inst_dispatch(apn->fsm.fi, APN_EV_GPRS_ALLOWED, &on); + apn_free(apn); return CMD_SUCCESS; @@ -326,9 +330,12 @@ "Put the APN in administrative shut-down\n") { struct osmobb_apn *apn = (struct osmobb_apn *) vty->index; + bool on = false; + int rc; if (!apn->cfg.shutdown) { - if (apn_stop(apn)) { + rc = osmo_fsm_inst_dispatch(apn->fsm.fi, APN_EV_GPRS_ALLOWED, &on); + if (rc < 0) { vty_out(vty, "%% Failed to Stop APN%s", VTY_NEWLINE); return CMD_WARNING; } @@ -343,13 +350,16 @@ NO_STR "Remove the APN from administrative shut-down\n") { struct osmobb_apn *apn = (struct osmobb_apn *) vty->index; + bool on = true; + int rc; if (apn->cfg.shutdown) { if (!apn->cfg.dev_name) { vty_out(vty, "%% Failed to start APN, tun-device is not configured%s", VTY_NEWLINE); return CMD_WARNING; } - if (apn_start(apn) < 0) { + rc = osmo_fsm_inst_dispatch(apn->fsm.fi, APN_EV_GPRS_ALLOWED, &on); + if (rc < 0) { vty_out(vty, "%% Failed to start APN, check log for details%s", VTY_NEWLINE); return CMD_WARNING; } -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/32596 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I2cc732dfb020d31ab89025e7e22276b819dcb24a Gerrit-Change-Number: 32596 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmocom-bb[master]: layer23: modem: sndcp: Properly inform SNDCP layer of ownership transfer
by fixeria 03 May '23

03 May '23
Attention is currently required from: pespin. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/32593 ) Change subject: layer23: modem: sndcp: Properly inform SNDCP layer of ownership transfer ...................................................................... Patch Set 3: Code-Review+2 (1 comment) File src/host/layer23/src/modem/sndcp.c: https://gerrit.osmocom.org/c/osmocom-bb/+/32593/comment/fc8078f9_f30b97e8 PS2, Line 149: ownsership > typo, like in previous patch Done -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/32593 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Icc3351f360e41d4a95e056b4fd797c7d133e8a83 Gerrit-Change-Number: 32593 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Wed, 03 May 2023 16:41:34 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmocom-bb[master]: layer23: modem: sndcp: Properly inform SNDCP layer of ownership transfer
by pespin 03 May '23

03 May '23
Attention is currently required from: pespin. Hello osmith, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmocom-bb/+/32593 to look at the new patch set (#3). Change subject: layer23: modem: sndcp: Properly inform SNDCP layer of ownership transfer ...................................................................... layer23: modem: sndcp: Properly inform SNDCP layer of ownership transfer Change-Id: Icc3351f360e41d4a95e056b4fd797c7d133e8a83 --- M src/host/layer23/src/modem/sndcp.c 1 file changed, 10 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/93/32593/3 -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/32593 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Icc3351f360e41d4a95e056b4fd797c7d133e8a83 Gerrit-Change-Number: 32593 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
[S] Change in osmocom-bb[master]: layer23: modem: grr: Log ignored CCCH ImmAss
by pespin 03 May '23

03 May '23
Attention is currently required from: fixeria. Hello osmith, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmocom-bb/+/32589 to look at the new patch set (#4). Change subject: layer23: modem: grr: Log ignored CCCH ImmAss ...................................................................... layer23: modem: grr: Log ignored CCCH ImmAss There seems to be some bug when using virtphy where sometimes the received T2 and/or T3 in the ImmASs is not matching what we sent. This helps in showing the problem and not failing silently. Change-Id: Iaecd2616733d84f35a825916fe888142800b426b --- M src/host/layer23/src/modem/grr.c 1 file changed, 30 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/89/32589/4 -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/32589 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Iaecd2616733d84f35a825916fe888142800b426b Gerrit-Change-Number: 32589 Gerrit-PatchSet: 4 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
[S] Change in osmocom-bb[master]: layer23: modem: sndcp: Forward LL-XID.req SNDCP->LLC
by pespin 03 May '23

03 May '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/32587 ) Change subject: layer23: modem: sndcp: Forward LL-XID.req SNDCP->LLC ...................................................................... layer23: modem: sndcp: Forward LL-XID.req SNDCP->LLC Change-Id: Icbc033cd0659bba75bb280a3d46e76edd2e20226 --- M src/host/layer23/src/modem/sndcp.c 1 file changed, 10 insertions(+), 0 deletions(-) Approvals: osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified fixeria: Looks good to me, approved diff --git a/src/host/layer23/src/modem/sndcp.c b/src/host/layer23/src/modem/sndcp.c index 00c21bc..fd6aada 100644 --- a/src/host/layer23/src/modem/sndcp.c +++ b/src/host/layer23/src/modem/sndcp.c @@ -117,6 +117,7 @@ switch (OSMO_PRIM_HDR(&llc_prim->oph)) { case OSMO_PRIM(OSMO_GPRS_LLC_LL_UNITDATA, PRIM_OP_REQUEST): + case OSMO_PRIM(OSMO_GPRS_LLC_LL_XID, PRIM_OP_REQUEST): LOGP(DSNDCP, LOGL_DEBUG, "%s(): Rx %s TLLI=0x%08x SAPI=%s L3=[%s]\n", __func__, pdu_name, llc_prim->ll.tlli, osmo_gprs_llc_sapi_name(llc_prim->ll.sapi), -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/32587 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Icbc033cd0659bba75bb280a3d46e76edd2e20226 Gerrit-Change-Number: 32587 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[S] Change in osmocom-bb[master]: layer23: modem: sm: Properly inform SM layer of ownership transfer
by pespin 03 May '23

03 May '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/32588 ) Change subject: layer23: modem: sm: Properly inform SM layer of ownership transfer ...................................................................... layer23: modem: sm: Properly inform SM layer of ownership transfer Change-Id: I95ed63fe6442369ab3afb75cbd9908b87addbb3e --- M src/host/layer23/src/modem/sm.c 1 file changed, 10 insertions(+), 0 deletions(-) Approvals: osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified fixeria: Looks good to me, approved diff --git a/src/host/layer23/src/modem/sm.c b/src/host/layer23/src/modem/sm.c index 2a404d4..56b223f 100644 --- a/src/host/layer23/src/modem/sm.c +++ b/src/host/layer23/src/modem/sm.c @@ -162,6 +162,7 @@ case OSMO_PRIM(OSMO_GPRS_SNDCP_SNSM_ACTIVATE, PRIM_OP_INDICATION): LOGP(DSM, LOGL_INFO, "%s(): Rx %s\n", __func__, pdu_name); rc = osmo_gprs_sndcp_prim_dispatch_snsm(sndcp_prim); + rc = 1; /* Tell SM that we take ownership of the prim. */ break; default: LOGP(DSM, LOGL_ERROR, "%s(): Unexpected Rx %s\n", __func__, pdu_name); -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/32588 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I95ed63fe6442369ab3afb75cbd9908b87addbb3e Gerrit-Change-Number: 32588 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[S] Change in osmocom-bb[master]: layer23: modem: grr: Log ignored CCCH ImmAss
by pespin 03 May '23

03 May '23
Attention is currently required from: fixeria. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/32589 ) Change subject: layer23: modem: grr: Log ignored CCCH ImmAss ...................................................................... Patch Set 3: (3 comments) File src/host/layer23/src/modem/grr.c: https://gerrit.osmocom.org/c/osmocom-bb/+/32589/comment/0ad4c14b_ff6819d0 PS3, Line 242: LOGL_INFO > Maybe LOGL_DEBUG instead? You gonna see lots of these messages when running modem against a busy com […] Yes I know, but at the current stage I think it makes sense to have it as INFO rather than DEBUG. DEBUG means too much stuff needs to be logged. https://gerrit.osmocom.org/c/osmocom-bb/+/32589/comment/b8fe1a79_75cf6b80 PS3, Line 256: no req_ref match > `req_ref mismatch`? Ack https://gerrit.osmocom.org/c/osmocom-bb/+/32589/comment/93265166_085c3cad PS3, Line 257: ia->req_ref.ra, ia->req_ref.t1, > alignment issues Ack -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/32589 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Iaecd2616733d84f35a825916fe888142800b426b Gerrit-Change-Number: 32589 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Wed, 03 May 2023 16:36:08 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmocom-bb[master]: layer23: modem: sndcp: Properly inform SNDCP layer of ownership transfer
by fixeria 03 May '23

03 May '23
Attention is currently required from: pespin. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/32593 ) Change subject: layer23: modem: sndcp: Properly inform SNDCP layer of ownership transfer ...................................................................... Patch Set 2: (1 comment) File src/host/layer23/src/modem/sndcp.c: https://gerrit.osmocom.org/c/osmocom-bb/+/32593/comment/fdab35fc_047dc410 PS2, Line 149: ownsership typo, like in previous patch -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/32593 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Icc3351f360e41d4a95e056b4fd797c7d133e8a83 Gerrit-Change-Number: 32593 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Wed, 03 May 2023 16:34:21 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmocom-bb[master]: layer23: modem: sm: Properly inform SM layer of ownership transfer
by fixeria 03 May '23

03 May '23
Attention is currently required from: osmith, pespin. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/32588 ) Change subject: layer23: modem: sm: Properly inform SM layer of ownership transfer ...................................................................... Patch Set 2: Code-Review+2 (1 comment) Commit Message: https://gerrit.osmocom.org/c/osmocom-bb/+/32588/comment/988eb157_d8ed74cd PS1, Line 7: ownsership > ownership Done -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/32588 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I95ed63fe6442369ab3afb75cbd9908b87addbb3e Gerrit-Change-Number: 32588 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Wed, 03 May 2023 16:33:17 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Comment-In-Reply-To: osmith <osmith(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 236
  • 237
  • 238
  • 239
  • 240
  • 241
  • 242
  • ...
  • 259
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.