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

March 2023

  • 1 participants
  • 3642 discussions
[M] Change in osmo-pcu[master]: doc: Add details regarding BSC co-location
by dexter 24 Mar '23

24 Mar '23
Attention is currently required from: pespin. dexter has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/32049 ) Change subject: doc: Add details regarding BSC co-location ...................................................................... Patch Set 3: (1 comment) File doc/manuals/chapters/overview.adoc: https://gerrit.osmocom.org/c/osmo-pcu/+/32049/comment/c1888d5f_99eb50ab PS2, Line 12: In small base stations, the PCU is usually co-located inside the BTS. In this > It think it's not a matter of "small vs big", it's a matter of ip. […] Hmm. I am also not sure about this. I wonder how it is with large IP based BTS. Presumably latency is also an argument for putting the PCU as close as possible to the BSS. I don't know I only saw the BTS co-located PCU scheme in femto-BTSs so far, but I also never saw a large IP based BTS... -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/32049 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: Ib2a3b60849fd312b21073a3511b8ca36b4536343 Gerrit-Change-Number: 32049 Gerrit-PatchSet: 3 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-CC: pespin <pespin(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Fri, 24 Mar 2023 15:33:36 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmo-bts[2023q1]: Avoid tx RF Resource Ind for disabled TRX
by pespin 24 Mar '23

24 Mar '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/32053 ) Change subject: Avoid tx RF Resource Ind for disabled TRX ...................................................................... Avoid tx RF Resource Ind for disabled TRX Related: SYS#6370 Change-Id: I887e0cb03b2a5654accccf7a55fac51319981bfb (cherry picked from commit 767f690f058b6888109dd8b49e9116a20f2744c1) --- M src/common/bts_trx.c M src/common/l1sap.c 2 files changed, 21 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/53/32053/1 diff --git a/src/common/bts_trx.c b/src/common/bts_trx.c index fce1d02..280880f 100644 --- a/src/common/bts_trx.c +++ b/src/common/bts_trx.c @@ -227,10 +227,13 @@ osmo_fsm_inst_dispatch(trx->mo.fi, NM_EV_RSL_UP, NULL); osmo_fsm_inst_dispatch(trx->bb_transc.mo.fi, NM_EV_RSL_UP, NULL); - if ((rc = rsl_tx_rf_res(trx)) < 0) - oml_tx_failure_event_rep(&trx->bb_transc.mo, NM_SEVER_MAJOR, OSMO_EVT_MAJ_RSL_FAIL, - "Failed to establish RSL link (%d)", rc); - + if (trx->mo.nm_state.operational == NM_OPSTATE_ENABLED || + trx->bb_transc.mo.nm_state.operational == NM_OPSTATE_ENABLED) { + rc = rsl_tx_rf_res(trx); + if (rc < 0) + oml_tx_failure_event_rep(&trx->bb_transc.mo, NM_SEVER_MAJOR, OSMO_EVT_MAJ_RSL_FAIL, + "Failed to establish RSL link (%d)", rc); + } if (trx == trx->bts->c0) load_timer_start(trx->bts); diff --git a/src/common/l1sap.c b/src/common/l1sap.c index 22b5e8c..efde406 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -615,6 +615,9 @@ return; llist_for_each_entry(trx, &bts->trx_list, list) { + if (trx->mo.nm_state.operational != NM_OPSTATE_ENABLED || + trx->bb_transc.mo.nm_state.operational != NM_OPSTATE_ENABLED) + continue; /* Calculate the average of all received samples */ l1sap_interf_meas_calc_avg(trx); /* Report to the BSC over the A-bis/RSL */ -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/32053 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: 2023q1 Gerrit-Change-Id: I887e0cb03b2a5654accccf7a55fac51319981bfb Gerrit-Change-Number: 32053 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmo-bts[2023q1]: bts-trx: Avoid pushing interf_meas for disabled TRX
by pespin 24 Mar '23

24 Mar '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/32054 ) Change subject: bts-trx: Avoid pushing interf_meas for disabled TRX ...................................................................... bts-trx: Avoid pushing interf_meas for disabled TRX It makes no sense to push interference meas results for those TRX since they are disabled, unused and hence won't be reported in RSL RF Res Ind. Related: SYS#6370 Change-Id: Ie3fd80970585cb30808b0644568dbc8936a57721 (cherry picked from commit 8fe6479358d485203c0d5e4e4f437aaf7236d102) --- M src/osmo-bts-trx/scheduler_trx.c 1 file changed, 19 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/54/32054/1 diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c index 382ddae..e7ed5ea 100644 --- a/src/osmo-bts-trx/scheduler_trx.c +++ b/src/osmo-bts-trx/scheduler_trx.c @@ -124,6 +124,11 @@ unsigned int tn, ln; llist_for_each_entry(trx, &bts->trx_list, list) { + /* Skip pushing interf_meas for disabled TRX */ + if (trx->mo.nm_state.operational != NM_OPSTATE_ENABLED || + trx->bb_transc.mo.nm_state.operational != NM_OPSTATE_ENABLED) + continue; + for (tn = 0; tn < ARRAY_SIZE(trx->ts); tn++) { const struct gsm_bts_trx_ts *ts = &trx->ts[tn]; for (ln = 0; ln < ARRAY_SIZE(ts->lchan); ln++) -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/32054 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: 2023q1 Gerrit-Change-Id: Ie3fd80970585cb30808b0644568dbc8936a57721 Gerrit-Change-Number: 32054 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmo-bts[2023q1]: bts-trx: Fix no NM Radio{Carrier,Channel} switching to Enabled if one...
by pespin 24 Mar '23

24 Mar '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/32052 ) Change subject: bts-trx: Fix no NM Radio{Carrier,Channel} switching to Enabled if one TRX is rf_locked ...................................................................... bts-trx: Fix no NM Radio{Carrier,Channel} switching to Enabled if one TRX is rf_locked Differentiate in each TRX between being provisioned (configuration available) and being provisioned *plus enabled*. TRX0 waits for all other TRX to be ready before sending POWERON, since all TRX need to have been minimally configured over TRXC before POWERON is called. This "ready" state though, doesn't necessarily mean the TRX!=0 are enabled (aka NM Enabled and rf_locked=0). With them being configured it es enough to start the whole PHY. With the old logic, given any TRX was rf_locked=1 at startup, the PHY would not become UP because it the TRX_PROV FSM was waiting for OPSTART to arrive on all TRX, which wouldn't happen on TRX that had rf_locked=1. So in summary, the desired requirements to start the PHY are (in any order): 1- Wait all TRX are configured 2- Wait for TRX0 OPSTART Related: SYS#6370 Change-Id: Ie4836f5721ce8227a63c267730aeb17228994214 (cherry picked from commit 72f991f541b17bcb8305d36ee28637aa0be34a0e) --- M src/osmo-bts-trx/trx_provision_fsm.c 1 file changed, 50 insertions(+), 17 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/52/32052/1 diff --git a/src/osmo-bts-trx/trx_provision_fsm.c b/src/osmo-bts-trx/trx_provision_fsm.c index 5deecd7..8b20b10 100644 --- a/src/osmo-bts-trx/trx_provision_fsm.c +++ b/src/osmo-bts-trx/trx_provision_fsm.c @@ -253,11 +253,11 @@ l1h->config.setslot_sent[data->tn] = false; } -/* Whether a given TRX is fully configured and can be powered on */ +/* Whether a given TRX is fully configured */ static bool trx_is_provisioned(struct trx_l1h *l1h) { struct phy_instance *pinst = l1h->phy_inst; - if (l1h->config.enabled && l1h->config.rxtune_acked && l1h->config.txtune_acked && + if (l1h->config.rxtune_acked && l1h->config.txtune_acked && (l1h->config.bsic_acked || !pinst->phy_link->u.osmotrx.use_legacy_setbsic) && (l1h->config.tsc_acked || pinst->phy_link->u.osmotrx.use_legacy_setbsic) && (l1h->config.nomtxpower_acked || l1h->config.nominal_power_set_by_vty) && @@ -267,6 +267,11 @@ return false; } +/* Whether a given TRX is fully configured and can be powered on */ +static bool trx_is_provisioned_and_enabled(struct trx_l1h *l1h) +{ + return l1h->config.enabled && trx_is_provisioned(l1h); +} static void trx_signal_ready_trx0(struct trx_l1h *l1h) { @@ -282,7 +287,7 @@ } } -/* Called from TRX0 to check if other TRX are already configured and powered so POWERON can be sent */ +/* Called from TRX0 to check if other TRX are already configured so POWERON can be sent */ static bool trx_other_trx0_ready(struct trx_l1h *l1h) { struct phy_instance *pinst = l1h->phy_inst; @@ -293,7 +298,7 @@ struct trx_l1h *l1h_it = pinst_it->u.osmotrx.hdl; if (l1h_it->phy_inst->num == 0) continue; - if (l1h_it->provision_fi->state != TRX_PROV_ST_OPEN_POWERON) + if (!trx_is_provisioned(l1h_it)) return false; } return true; @@ -389,7 +394,8 @@ uint16_t arfcn; int nominal_power; int status; - bool others_ready; + bool waiting_other_trx; + bool was_ready = trx_is_provisioned(l1h); switch (event) { case TRX_PROV_EV_CLOSE: @@ -485,22 +491,22 @@ l1if_provision_transceiver_trx(l1h); - if (l1h->phy_inst->num == 0) - others_ready = trx_other_trx0_ready(l1h); - else - others_ready = true; /* we don't care about others in TRX!=0 */ + if (l1h->phy_inst->num == 0) { + waiting_other_trx = !trx_other_trx0_ready(l1h); + } else { + waiting_other_trx = false; /* we don't care about others in TRX!=0 */ + /* If we just became ready for TRX0 POWERON (aka this TRX becomes provisioned), signal it to TRX0: */ + if (l1h->phy_inst->num != 0 && (!was_ready && trx_is_provisioned(l1h))) + trx_signal_ready_trx0(l1h); + } /* if we gathered all data and could go forward. For TRX0, only after * all other TRX are prepared, since it will send POWERON commad */ - if (trx_is_provisioned(l1h) && - (l1h->phy_inst->num != 0 || others_ready)) { - if (l1h->phy_inst->num != 0) { + if (trx_is_provisioned_and_enabled(l1h) && !waiting_other_trx) { + if (l1h->phy_inst->num != 0) trx_prov_fsm_state_chg(fi, TRX_PROV_ST_OPEN_POWERON); - /* Once we are powered on, signal TRX0 in case it was waiting for us */ - trx_signal_ready_trx0(l1h); - } else { + else trx_prov_fsm_state_chg(fi, TRX_PROV_ST_OPEN_WAIT_POWERON_CNF); - } } else { LOGPFSML(fi, LOGL_INFO, "Delay poweron, wait for:%s%s%s%s%s%s%s%s\n", l1h->config.enabled ? "" :" enable", @@ -512,7 +518,7 @@ l1h->config.txtune_acked ? "" : " txtune-ack", l1h->config.nominal_power_set_by_vty ? "" : (l1h->config.nomtxpower_acked ? "" : " nomtxpower-ack"), l1h->config.setformat_acked ? "" : " setformat-ack", - (l1h->phy_inst->num != 0 || others_ready) ? "" : " other-trx" + waiting_other_trx ? "" : " other-trx" ); } } -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/32052 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: 2023q1 Gerrit-Change-Id: Ie4836f5721ce8227a63c267730aeb17228994214 Gerrit-Change-Number: 32052 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmocom-bb[master]: layer23: rlcmac: Support GMM detaching from VTY
by pespin 24 Mar '23

24 Mar '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/32051 ) Change subject: layer23: rlcmac: Support GMM detaching from VTY ...................................................................... layer23: rlcmac: Support GMM detaching from VTY Related: OS#5501 Depends: libosmo-gprs.git Change-Id If6cbb1d425b3a9f713348f1dea4747e2b6be0a44 Change-Id: Idca0bff6fc3e6a16b5e8379eae3315e3af012d78 --- M src/host/layer23/src/modem/vty.c 1 file changed, 39 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/51/32051/1 diff --git a/src/host/layer23/src/modem/vty.c b/src/host/layer23/src/modem/vty.c index 0d13c93..69848df 100644 --- a/src/host/layer23/src/modem/vty.c +++ b/src/host/layer23/src/modem/vty.c @@ -172,7 +172,33 @@ gmm_prim->gmmreg.attach_req.attach_type = OSMO_GPRS_GMM_ATTACH_TYPE_GPRS; if (osmo_gprs_gmm_prim_upper_down(gmm_prim) != 0) { - vty_out(vty, "Failed to enqueue an GMM PDU%s", VTY_NEWLINE); + vty_out(vty, "Failed to enqueue a GMM PDU%s", VTY_NEWLINE); + return CMD_WARNING; + } + + return CMD_SUCCESS; +} + +DEFUN_HIDDEN(test_gmm_reg_detach, + test_gmm_reg_detach_cmd, + "test MS_NAME gmm detach", + TEST_CMD_DESC MS_NAME_DESC GMM_CMDG_DESC + "Enqueue a GMM GMMREG-DETACH.req for transmission\n") +{ + struct osmo_gprs_gmm_prim *gmm_prim; + const uint32_t tlli = 0xe1c5d364; + struct osmocom_ms *ms; + + if ((ms = l23_vty_get_ms(argv[0], vty)) == NULL) + return CMD_WARNING; + + gmm_prim = osmo_gprs_gmm_prim_alloc_gmmreg_detach_req(); + gmm_prim->gmmreg.detach_req.ptmsi = tlli; + gmm_prim->gmmreg.detach_req.detach_type = OSMO_GPRS_GMM_DETACH_MS_TYPE_GPRS; + gmm_prim->gmmreg.detach_req.poweroff_type = OSMO_GPRS_GMM_DETACH_POWEROFF_TYPE_NORMAL; + + if (osmo_gprs_gmm_prim_upper_down(gmm_prim) != 0) { + vty_out(vty, "Failed to enqueue a GMM PDU%s", VTY_NEWLINE); return CMD_WARNING; } @@ -363,6 +389,7 @@ install_element_ve(&test_llc_unitdata_req_hexpdu_cmd); install_element_ve(&test_llc_unitdata_req_gmm_attch_cmd); install_element_ve(&test_gmm_reg_attach_cmd); + install_element_ve(&test_gmm_reg_detach_cmd); install_element(CONFIG_NODE, &l23_cfg_ms_cmd); install_element(MS_NODE, &cfg_ms_apn_cmd); -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/32051 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Idca0bff6fc3e6a16b5e8379eae3315e3af012d78 Gerrit-Change-Number: 32051 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[L] Change in libosmo-gprs[master]: gmm: Initial implementation of GPRS Detach
by pespin 24 Mar '23

24 Mar '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/32050 ) Change subject: gmm: Initial implementation of GPRS Detach ...................................................................... gmm: Initial implementation of GPRS Detach This patch contains further work on several areas for the GMM layer, like fixes and improvements in existing primitives, initial FSM implementation, initial Tx and Rx of some GMM messages, etc. Related: OS#5501 Change-Id: If6cbb1d425b3a9f713348f1dea4747e2b6be0a44 --- M include/osmocom/gprs/gmm/gmm_ms_fsm.h M include/osmocom/gprs/gmm/gmm_pdu.h M include/osmocom/gprs/gmm/gmm_prim.h M include/osmocom/gprs/gmm/gmm_private.h M src/gmm/gmm.c M src/gmm/gmm_ms_fsm.c M src/gmm/gmm_pdu.c M src/gmm/gmm_prim.c M tests/gmm/gmm_prim_test.c M tests/gmm/gmm_prim_test.err M tests/gmm/gmm_prim_test.ok 11 files changed, 300 insertions(+), 34 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/50/32050/1 diff --git a/include/osmocom/gprs/gmm/gmm_ms_fsm.h b/include/osmocom/gprs/gmm/gmm_ms_fsm.h index 9639a9b..7aff7ab 100644 --- a/include/osmocom/gprs/gmm/gmm_ms_fsm.h +++ b/include/osmocom/gprs/gmm/gmm_ms_fsm.h @@ -1,6 +1,7 @@ #pragma once #include <osmocom/core/fsm.h> +#include <osmocom/gprs/gmm/gmm_prim.h> struct gprs_gmm_entity; @@ -29,7 +30,8 @@ GPRS_GMM_MS_EV_ATTACH_REQUESTED, GPRS_GMM_MS_EV_ATTACH_REJECTED, GPRS_GMM_MS_EV_ATTACH_ACCEPTED, - GPRS_GMM_MS_EV_DETACH_REQUESTED, /* poweroff or network initiated */ + GPRS_GMM_MS_EV_DETACH_REQUESTED, /* also network initiated. data: ptr to enum osmo_gprs_gmm_detach_ms_type */ + GPRS_GMM_MS_EV_DETACH_REQUESTED_POWEROFF, GPRS_GMM_MS_EV_DETACH_ACCEPTED, GPRS_GMM_MS_EV_SR_REQUESTED, /* (Iu only) */ GPRS_GMM_MS_EV_SR_REJECTED, /* (Iu only) */ @@ -43,6 +45,8 @@ struct gprs_gmm_ms_fsm_ctx { struct osmo_fsm_inst *fi; struct gprs_gmm_entity *gmme; + /* Type of last initiated detach: */ + enum osmo_gprs_gmm_detach_ms_type detach_type; }; int gprs_gmm_ms_fsm_init(void); diff --git a/include/osmocom/gprs/gmm/gmm_pdu.h b/include/osmocom/gprs/gmm/gmm_pdu.h index 5a9faa1..d005c0d 100644 --- a/include/osmocom/gprs/gmm/gmm_pdu.h +++ b/include/osmocom/gprs/gmm/gmm_pdu.h @@ -31,3 +31,8 @@ int gprs_gmm_build_ciph_auth_resp(struct gprs_gmm_entity *gmme, bool imeisv_requested, uint8_t ac_ref_nr, const uint8_t sres[4], struct msgb *msg); + +int gprs_gmm_build_detach_req(struct gprs_gmm_entity *gmme, + enum osmo_gprs_gmm_detach_ms_type detach_type, + enum osmo_gprs_gmm_detach_poweroff_type poweroff_type, + struct msgb *msg); diff --git a/include/osmocom/gprs/gmm/gmm_prim.h b/include/osmocom/gprs/gmm/gmm_prim.h index 6537075..a345651 100644 --- a/include/osmocom/gprs/gmm/gmm_prim.h +++ b/include/osmocom/gprs/gmm/gmm_prim.h @@ -56,6 +56,43 @@ OSMO_GPRS_GMM_ATTACH_TYPE_EMERGENCY = 4, /* others: reserved, interpreted as OSMO_GPRS_GMM_ATTACH_TYPE_GPRS */ }; +extern const struct value_string osmo_gprs_gmm_attach_type_names[]; +static inline const char *osmo_gprs_gmm_attach_ms_type_name(enum osmo_gprs_gmm_attach_type val) +{ + return get_value_string(osmo_gprs_gmm_attach_type_names, val); +} + +/* Detach type 10.5.5.5 */ +enum osmo_gprs_gmm_detach_poweroff_type { + /* 0 is reserved */ + OSMO_GPRS_GMM_DETACH_POWEROFF_TYPE_NORMAL = 0, + OSMO_GPRS_GMM_DETACH_POWEROFF_TYPE_POWEROFF = 1, +}; +enum osmo_gprs_gmm_detach_ms_type { + /* 0 is reserved */ + OSMO_GPRS_GMM_DETACH_MS_TYPE_GPRS = 1, + OSMO_GPRS_GMM_DETACH_MS_TYPE_IMSI = 2, + OSMO_GPRS_GMM_DETACH_MS_TYPE_COMBINED = 3, + /* others: reserved, interpreted as OSMO_GPRS_GMM_DETACH_TYPE_COMBINED */ +}; +extern const struct value_string osmo_gprs_gmm_detach_ms_type_names[]; +static inline const char *osmo_gprs_gmm_detach_ms_type_name(enum osmo_gprs_gmm_detach_ms_type val) +{ + return get_value_string(osmo_gprs_gmm_detach_ms_type_names, val); +} + +enum osmo_gprs_gmm_detach_network_type { + /* 0 is reserved */ + OSMO_GPRS_GMM_DETACH_NETWORK_TYPE_REATTACH_REQUIRED = 1, + OSMO_GPRS_GMM_DETACH_NETWORK_TYPE_REATTACH_NOT_REQUIRED = 2, + OSMO_GPRS_GMM_DETACH_NETWORK_TYPE_IMSI = 3, + /* others: reserved, interpreted as OSMO_GPRS_GMM_DETACH_TYPE_REATTACH_NOT_REQUIRED */ +}; +extern const struct value_string osmo_gprs_gmm_detach_network_type_names[]; +static inline const char *osmo_gprs_gmm_detach_network_type_name(enum osmo_gprs_gmm_detach_network_type val) +{ + return get_value_string(osmo_gprs_gmm_detach_network_type_names, val); +} /* Parameters for OSMO_GPRS_GMM_GMMREG_* prims */ struct osmo_gprs_gmm_gmmreg_prim { @@ -86,15 +123,17 @@ } attach_cnf; /* OSMO_GPRS_GMM_GMMREG_DETACH | Req, 6.6.1.4 */ struct { - /* detach-type, power-off/normal-detach */ + uint32_t ptmsi; + enum osmo_gprs_gmm_detach_ms_type detach_type; + enum osmo_gprs_gmm_detach_poweroff_type poweroff_type; } detach_req; /* OSMO_GPRS_GMM_GMMREG_DETACH | Cnf, 6.6.1.5 */ struct { - /* detach-type */ + enum osmo_gprs_gmm_detach_ms_type detach_type; } detach_cnf; /* OSMO_GPRS_GMM_GMMREG_DETACH | Ind, , 6.6.1.6 */ struct { - /* detach-type */ + enum osmo_gprs_gmm_detach_ms_type detach_type; } detach_ind; }; }; @@ -197,6 +236,7 @@ /* Alloc primitive for GMMREG SAP: */ struct osmo_gprs_gmm_prim *osmo_gprs_gmm_prim_alloc_gmmreg_attach_req(void); +struct osmo_gprs_gmm_prim *osmo_gprs_gmm_prim_alloc_gmmreg_detach_req(void); /* Alloc primitive for GMMRR SAP: */ struct osmo_gprs_gmm_prim *osmo_gprs_gmm_prim_alloc_gmmrr_page_ind(uint32_t tlli); diff --git a/include/osmocom/gprs/gmm/gmm_private.h b/include/osmocom/gprs/gmm/gmm_private.h index 87b9843..0f05dff 100644 --- a/include/osmocom/gprs/gmm/gmm_private.h +++ b/include/osmocom/gprs/gmm/gmm_private.h @@ -17,6 +17,9 @@ #include <osmocom/gprs/gmm/gmm_prim.h> #include <osmocom/gprs/gmm/gmm_ms_fsm.h> +/* 3GPP TS 44.064 § 8.3 TLLI assignment procedures */ +#define GPRS_GMM_TLLI_UNASSIGNED (0xffffffff) + extern int g_gmm_log_cat[_OSMO_GPRS_GMM_LOGC_MAX]; #define LOGGMM(lvl, fmt, args...) LOGP(g_gmm_log_cat[OSMO_GPRS_GMM_LOGC_GMM], lvl, fmt, ## args) @@ -86,6 +89,9 @@ int gprs_gmm_tx_att_req(struct gprs_gmm_entity *gmme, enum osmo_gprs_gmm_attach_type attach_type, bool attach_with_imsi); +int gprs_gmm_tx_detach_req(struct gprs_gmm_entity *gmme, + enum osmo_gprs_gmm_detach_ms_type detach_type, + enum osmo_gprs_gmm_detach_poweroff_type poweroff_type); #define LOGGMME(snme, level, fmt, args...) \ LOGGMM(level, "GMME(PTMSI-%08x) " fmt, \ diff --git a/src/gmm/gmm.c b/src/gmm/gmm.c index 4abf3a7..e304050 100644 --- a/src/gmm/gmm.c +++ b/src/gmm/gmm.c @@ -179,6 +179,18 @@ return rc; } +static int gprs_gmm_submit_gmmreg_detach_cnf(struct gprs_gmm_entity *gmme) +{ + struct osmo_gprs_gmm_prim *gmm_prim_tx; + int rc; + + gmm_prim_tx = gprs_gmm_prim_alloc_gmmreg_detach_cnf(); + gmm_prim_tx->gmmreg.detach_cnf.detach_type = gmme->ms_fsm.detach_type; + + rc = gprs_gmm_prim_call_up_cb(gmm_prim_tx); + return rc; +} + static int gprs_gmm_submit_gmmrr_assing_req(struct gprs_gmm_entity *gmme) { struct osmo_gprs_gmm_prim *gmm_prim_tx; @@ -340,6 +352,39 @@ return rc; } +/* Tx GMM Detach Request (mobile originating detach), 9.4.5.2 */ +int gprs_gmm_tx_detach_req(struct gprs_gmm_entity *gmme, + enum osmo_gprs_gmm_detach_ms_type detach_type, + enum osmo_gprs_gmm_detach_poweroff_type poweroff_type) +{ + struct osmo_gprs_llc_prim *llc_prim; + int rc; + struct msgb *msg; + + LOGGMME(gmme, LOGL_INFO, "Tx GMM DETACH REQUEST (MO)\n"); + llc_prim = osmo_gprs_llc_prim_alloc_ll_unitdata_req( + gmme->ptmsi, OSMO_GPRS_LLC_SAPI_GMM, NULL, GPRS_GMM_ALLOC_SIZE); + msg = llc_prim->oph.msg; + msg->l3h = msg->tail; + rc = gprs_gmm_build_detach_req(gmme, detach_type, poweroff_type, msg); + if (rc < 0) { + msgb_free(msg); + return -EBADMSG; + } + llc_prim->ll.l3_pdu = msg->l3h; + llc_prim->ll.l3_pdu_len = msgb_l3len(msg); + /* TODO: + llc_prim->ll.qos_params[3]; + llc_prim->ll.radio_prio; + llc_prim->ll.apply_gea; + llc_prim->ll.apply_gia; + */ + + rc = gprs_gmm_prim_call_llc_down_cb(llc_prim); + + return rc; +} + static int gprs_gmm_rx_att_ack(struct gprs_gmm_entity *gmme, struct gsm48_hdr *gh, unsigned int len) { struct gsm48_attach_ack *aa; @@ -413,6 +458,41 @@ return 0; /* TODO */ } +/* Rx GMM Detach Accept (mobile originating detach), 9.4.6.2 */ +static int gprs_gmm_rx_detach_accept(struct gprs_gmm_entity *gmme, struct gsm48_hdr *gh, unsigned int len) +{ + int rc; + + if (len < sizeof(*gh) + 1) { + LOGGMME(gmme, LOGL_ERROR, "Rx GMM DETACH ACCEPT (MO) with wrong size %u\n", len); + goto rejected; + } + + bool force_stanbdy_indicated = (gh->data[0] >> 4) == 0x01; + + LOGGMME(gmme, LOGL_DEBUG, "Rx GMM DETACH ACCEPT (MO) force_standby_indicated=%s\n", + force_stanbdy_indicated ? "true" : "false"); + + /* TODO: submit GMMSM-RELEASE-IND */ + + /* Submit LLGMM-ASSIGN-REQ as per TS 24.007 Annex C.3 */ + gmme->ptmsi = GPRS_GMM_TLLI_UNASSIGNED; + rc = gprs_gmm_submit_llgmm_assing_req(gmme); + if (rc < 0) + goto rejected; + + /* Submit GMMREG-DETACH-CNF as per TS 24.007 Annex C.3 */ + rc = gprs_gmm_submit_gmmreg_detach_cnf(gmme); + if (rc < 0) + goto rejected; + + rc = osmo_fsm_inst_dispatch(gmme->ms_fsm.fi, GPRS_GMM_MS_EV_DETACH_ACCEPTED, NULL); + return rc; + +rejected: + return -EINVAL; /* TODO: what to do on error? */ +} + /* Rx GMM Identity Request, 9.2.10 */ static int gprs_gmm_rx_id_req(struct gprs_gmm_entity *gmme, struct gsm48_hdr *gh, unsigned int len) { @@ -488,6 +568,9 @@ case GSM48_MT_GMM_ATTACH_REJ: rc = gprs_gmm_rx_att_rej(gmme, gh, len); break; + case GSM48_MT_GMM_DETACH_ACK: + rc = gprs_gmm_rx_detach_accept(gmme, gh, len); + break; case GSM48_MT_GMM_ID_REQ: rc = gprs_gmm_rx_id_req(gmme, gh, len); break; diff --git a/src/gmm/gmm_ms_fsm.c b/src/gmm/gmm_ms_fsm.c index adb73a1..72c6d15 100644 --- a/src/gmm/gmm_ms_fsm.c +++ b/src/gmm/gmm_ms_fsm.c @@ -39,9 +39,6 @@ case GPRS_GMM_MS_EV_ENABLE_GPRS_MODE: gmm_ms_fsm_state_chg(fi, GPRS_GMM_MS_ST_DEREGISTERED); break; - case GPRS_GMM_MS_EV_DETACH_REQUESTED: - gmm_ms_fsm_state_chg(fi, GPRS_GMM_MS_ST_DEREGISTERED); - break; default: OSMO_ASSERT(0); } @@ -56,9 +53,6 @@ case GPRS_GMM_MS_EV_ATTACH_REQUESTED: gmm_ms_fsm_state_chg(fi, GPRS_GMM_MS_ST_REGISTERED_INITIATED); break; - case GPRS_GMM_MS_EV_DETACH_REQUESTED: - gmm_ms_fsm_state_chg(fi, GPRS_GMM_MS_ST_DEREGISTERED); - break; default: OSMO_ASSERT(0); } @@ -84,6 +78,7 @@ static void st_gmm_ms_registered(struct osmo_fsm_inst *fi, uint32_t event, void *data) { + struct gprs_gmm_ms_fsm_ctx *ctx = (struct gprs_gmm_ms_fsm_ctx *)fi->priv; switch (event) { case GPRS_GMM_MS_EV_SR_REQUESTED: gmm_ms_fsm_state_chg(fi, GPRS_GMM_MS_ST_REGISTERED); @@ -92,6 +87,7 @@ gmm_ms_fsm_state_chg(fi, GPRS_GMM_MS_ST_RAU_INITIATED); break; case GPRS_GMM_MS_EV_DETACH_REQUESTED: + ctx->detach_type = *((enum osmo_gprs_gmm_detach_ms_type *)data); gmm_ms_fsm_state_chg(fi, GPRS_GMM_MS_ST_DEREGISTERED_INITIATED); break; default: @@ -109,9 +105,6 @@ case GPRS_GMM_MS_EV_RAU_ACCEPTED: gmm_ms_fsm_state_chg(fi, GPRS_GMM_MS_ST_REGISTERED); break; - case GPRS_GMM_MS_EV_DETACH_REQUESTED: - gmm_ms_fsm_state_chg(fi, GPRS_GMM_MS_ST_DEREGISTERED); - break; default: OSMO_ASSERT(0); } @@ -129,9 +122,6 @@ case GPRS_GMM_MS_EV_RAU_ACCEPTED: gmm_ms_fsm_state_chg(fi, GPRS_GMM_MS_ST_REGISTERED); break; - case GPRS_GMM_MS_EV_DETACH_REQUESTED: - gmm_ms_fsm_state_chg(fi, GPRS_GMM_MS_ST_DEREGISTERED); - break; default: OSMO_ASSERT(0); } @@ -146,7 +136,15 @@ case GPRS_GMM_MS_EV_SR_ACCEPTED: gmm_ms_fsm_state_chg(fi, GPRS_GMM_MS_ST_REGISTERED); break; - case GPRS_GMM_MS_EV_DETACH_REQUESTED: + default: + OSMO_ASSERT(0); + } +} + +void gmm_ms_fsm_allstate_action(struct osmo_fsm_inst *fi, uint32_t event, void *data) +{ + switch (event) { + case GPRS_GMM_MS_EV_DETACH_REQUESTED_POWEROFF: gmm_ms_fsm_state_chg(fi, GPRS_GMM_MS_ST_DEREGISTERED); break; default: @@ -157,8 +155,7 @@ static struct osmo_fsm_state gmm_ms_fsm_states[] = { [GPRS_GMM_MS_ST_NULL] = { .in_event_mask = - X(GPRS_GMM_MS_EV_ENABLE_GPRS_MODE)| - X(GPRS_GMM_MS_EV_DETACH_REQUESTED), + X(GPRS_GMM_MS_EV_ENABLE_GPRS_MODE), .out_state_mask = X(GPRS_GMM_MS_ST_DEREGISTERED), .name = "Null", @@ -167,8 +164,7 @@ [GPRS_GMM_MS_ST_DEREGISTERED] = { .in_event_mask = X(GPRS_GMM_MS_EV_DISABLE_GPRS_MODE) | - X(GPRS_GMM_MS_EV_ATTACH_REQUESTED) | - X(GPRS_GMM_MS_EV_DETACH_REQUESTED), + X(GPRS_GMM_MS_EV_ATTACH_REQUESTED), .out_state_mask = X(GPRS_GMM_MS_ST_NULL) | X(GPRS_GMM_MS_ST_REGISTERED_INITIATED)| @@ -192,7 +188,6 @@ .in_event_mask = X(GPRS_GMM_MS_EV_SR_REQUESTED) | X(GPRS_GMM_MS_EV_RAU_REQUESTED) | - X(GPRS_GMM_MS_EV_DETACH_REQUESTED) | X(GPRS_GMM_MS_EV_DETACH_REQUESTED), .out_state_mask = X(GPRS_GMM_MS_ST_REGISTERED) | @@ -206,19 +201,17 @@ .in_event_mask = X(GPRS_GMM_MS_EV_DETACH_ACCEPTED) | X(GPRS_GMM_MS_EV_LOW_LVL_FAIL) | - X(GPRS_GMM_MS_EV_RAU_ACCEPTED) | - X(GPRS_GMM_MS_EV_DETACH_REQUESTED), + X(GPRS_GMM_MS_EV_RAU_ACCEPTED), .out_state_mask = X(GPRS_GMM_MS_ST_REGISTERED) | X(GPRS_GMM_MS_ST_DEREGISTERED), .name = "DeregisteredInitiated", - .action = st_gmm_ms_sr_initiated, + .action = st_gmm_ms_deregistered_initiated, }, [GPRS_GMM_MS_ST_RAU_INITIATED] = { .in_event_mask = X(GPRS_GMM_MS_EV_RAU_REJECTED) | - X(GPRS_GMM_MS_EV_RAU_ACCEPTED) | - X(GPRS_GMM_MS_EV_DETACH_REQUESTED), + X(GPRS_GMM_MS_EV_RAU_ACCEPTED), .out_state_mask = X(GPRS_GMM_MS_ST_REGISTERED) | X(GPRS_GMM_MS_ST_DEREGISTERED_INITIATED) | @@ -229,13 +222,12 @@ [GPRS_GMM_MS_ST_SR_INITIATED] = { .in_event_mask = X(GPRS_GMM_MS_EV_SR_REJECTED) | - X(GPRS_GMM_MS_EV_SR_ACCEPTED) | - X(GPRS_GMM_MS_EV_DETACH_REQUESTED), + X(GPRS_GMM_MS_EV_SR_ACCEPTED), .out_state_mask = X(GPRS_GMM_MS_ST_REGISTERED) | X(GPRS_GMM_MS_ST_DEREGISTERED), - .name = "DeregisteredInitiated", - .action = st_gmm_ms_deregistered_initiated, + .name = "SRInitiated", + .action = st_gmm_ms_sr_initiated, }, }; @@ -246,6 +238,7 @@ { GPRS_GMM_MS_EV_ATTACH_REJECTED, "ATTACH_REJECTED" }, { GPRS_GMM_MS_EV_ATTACH_ACCEPTED, "ATTACH_ACCEPTED" }, { GPRS_GMM_MS_EV_DETACH_REQUESTED, "DETACH_REQUESTED" }, + { GPRS_GMM_MS_EV_DETACH_REQUESTED_POWEROFF, "DETACH_REQUESTED_POWEROFF" }, { GPRS_GMM_MS_EV_DETACH_ACCEPTED, "DETACH_ACCEPTED" }, { GPRS_GMM_MS_EV_SR_REQUESTED, "SR_REQUESTED" }, { GPRS_GMM_MS_EV_SR_REJECTED, "SR_REJECTED" }, @@ -267,6 +260,8 @@ .states = gmm_ms_fsm_states, .num_states = ARRAY_SIZE(gmm_ms_fsm_states), .event_names = gmm_ms_fsm_event_names, + .allstate_event_mask = X(GPRS_GMM_MS_EV_DETACH_REQUESTED_POWEROFF), + .allstate_action = gmm_ms_fsm_allstate_action, .log_subsys = DLGLOBAL, /* updated dynamically through gprs_gmm_ms_fsm_set_log_cat() */ .timer_cb = gmm_ms_fsm_timer_cb, }; diff --git a/src/gmm/gmm_pdu.c b/src/gmm/gmm_pdu.c index 141e4a5..b8bea9d 100644 --- a/src/gmm/gmm_pdu.c +++ b/src/gmm/gmm_pdu.c @@ -328,3 +328,42 @@ /* TODO: Optional IEs, eg Authentication parameter */ return rc; } + +int gprs_gmm_build_detach_req(struct gprs_gmm_entity *gmme, + enum osmo_gprs_gmm_detach_ms_type detach_type, + enum osmo_gprs_gmm_detach_poweroff_type poweroff_type, + struct msgb *msg) +{ + struct gsm48_hdr *gh; + uint8_t byte; + struct osmo_mobile_identity mi; + uint8_t *l; + int rc; + + gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh)); + gh->proto_discr = GSM48_PDISC_MM_GPRS; + gh->msg_type = GSM48_MT_GMM_DETACH_REQ; + + /* Detach type 10.5.5.5 + Spare half octet 10.5.1.8 */ + byte = ((detach_type & 0x07) << 5) | (poweroff_type & 0x01) << 4; + msgb_put_u8(msg, byte); + + /* DRX parameter 10.5.5.6 */ + memcpy(msgb_put(msg, sizeof(drx_param_def)), + &drx_param_def, + sizeof(drx_param_def)); + + /* P-TMSI, Mobile identity 10.5.1.4 */ + mi = (struct osmo_mobile_identity){ + .type = GSM_MI_TYPE_TMSI, + .tmsi = gmme->ptmsi, + }; + l = msgb_put(msg, 1); /* len */ + rc = osmo_mobile_identity_encode_msgb(msg, &mi, false); + if (rc < 0) + return -EINVAL; + *l = rc; + + /* TODO: optional fields: P-TMSI signature 10.5.5.8a */ + return 0; +} diff --git a/src/gmm/gmm_prim.c b/src/gmm/gmm_prim.c index c18d9d5..059c22a 100644 --- a/src/gmm/gmm_prim.c +++ b/src/gmm/gmm_prim.c @@ -65,6 +65,28 @@ { 0, NULL } }; +const struct value_string osmo_gprs_gmm_attach_type_names[] = { + { OSMO_GPRS_GMM_ATTACH_TYPE_GPRS, "GPRS attach" }, + { OSMO_GPRS_GMM_ATTACH_TYPE_COMBINED_OLD, "Combined GPRS/IMSI attach (old protocol version)" }, + { OSMO_GPRS_GMM_ATTACH_TYPE_COMBINED, "Combined GPRS/IMSI attach" }, + { OSMO_GPRS_GMM_ATTACH_TYPE_EMERGENCY, "Emergency attach" }, + { 0, NULL } +}; + +const struct value_string osmo_gprs_gmm_detach_ms_type_names[] = { + { OSMO_GPRS_GMM_DETACH_MS_TYPE_GPRS, "GPRS detach" }, + { OSMO_GPRS_GMM_DETACH_MS_TYPE_IMSI, "IMSI detach" }, + { OSMO_GPRS_GMM_DETACH_MS_TYPE_COMBINED, "Combined GPRS/IMSI detach" }, + { 0, NULL } +}; + +const struct value_string osmo_gprs_gmm_detach_network_type_names[] = { + { OSMO_GPRS_GMM_DETACH_NETWORK_TYPE_REATTACH_REQUIRED, "Re-attach required" }, + { OSMO_GPRS_GMM_DETACH_NETWORK_TYPE_REATTACH_NOT_REQUIRED, "Re-attach not required" }, + { OSMO_GPRS_GMM_DETACH_NETWORK_TYPE_IMSI, "IMSI detach (after VLR failure)" }, + { 0, NULL } +}; + const char *osmo_gprs_gmm_prim_name(const struct osmo_gprs_gmm_prim *gmm_prim) { static char name_buf[256]; @@ -357,9 +379,31 @@ static int gprs_gmm_prim_handle_gmmreg_detach_req(struct osmo_gprs_gmm_prim *gmm_prim) { int rc; + struct gprs_gmm_entity *gmme = gprs_gmm_find_gmme_by_tlli(gmm_prim->gmmreg.detach_req.ptmsi); - rc = gprs_gmm_prim_handle_unsupported(gmm_prim); + if (!gmme) { + LOGGMM(LOGL_ERROR, "Rx GMMREG-DETACH.req for unknown PTMSI=0x%08x\n", + gmm_prim->gmmreg.detach_req.ptmsi); + return -EINVAL; + } + switch (gmm_prim->gmmreg.detach_req.poweroff_type) { + case OSMO_GPRS_GMM_DETACH_POWEROFF_TYPE_NORMAL: + /* C.3 MS initiated DETACH, GPRS only */ + rc = osmo_fsm_inst_dispatch(gmme->ms_fsm.fi, GPRS_GMM_MS_EV_DETACH_REQUESTED, + &gmm_prim->gmmreg.detach_req.detach_type); + break; + case OSMO_GPRS_GMM_DETACH_POWEROFF_TYPE_POWEROFF: + /* C.4 POWER-OFF DETACH, GPRS only */ + rc = osmo_fsm_inst_dispatch(gmme->ms_fsm.fi, GPRS_GMM_MS_EV_DETACH_REQUESTED_POWEROFF, NULL); + break; + default: + OSMO_ASSERT(0); + } + + rc = gprs_gmm_tx_detach_req(gmme, + gmm_prim->gmmreg.detach_req.detach_type, + gmm_prim->gmmreg.detach_req.poweroff_type); return rc; } diff --git a/tests/gmm/gmm_prim_test.c b/tests/gmm/gmm_prim_test.c index fdc50b7..70f8377 100644 --- a/tests/gmm/gmm_prim_test.c +++ b/tests/gmm/gmm_prim_test.c @@ -133,6 +133,10 @@ 0xea, 0x71, 0x1b, 0x41 }; +static uint8_t pdu_gmm_detach_acc[] = { +0x08, 0x06, 0x00 +}; + int test_gmm_prim_up_cb(struct osmo_gprs_gmm_prim *gmm_prim, void *user_data) { const char *pdu_name = osmo_gprs_gmm_prim_name(gmm_prim); @@ -145,6 +149,10 @@ gmm_prim->gmmreg.attach_cnf.accepted, gmm_prim->gmmreg.attach_cnf.rej.cause); break; + case OSMO_PRIM(OSMO_GPRS_GMM_GMMREG_DETACH, PRIM_OP_CONFIRM): + printf("%s(): Rx %s detach_type='%s'\n", __func__, pdu_name, + osmo_gprs_gmm_detach_ms_type_name(gmm_prim->gmmreg.detach_cnf.detach_type)); + break; default: printf("%s(): Unexpected Rx %s\n", __func__, pdu_name); OSMO_ASSERT(0) @@ -217,13 +225,12 @@ /* MS sends GMM Attach Req */ gmm_prim = osmo_gprs_gmm_prim_alloc_gmmreg_attach_req(); + OSMO_ASSERT(gmm_prim); gmm_prim->gmmreg.attach_req.attach_type = OSMO_GPRS_GMM_ATTACH_TYPE_GPRS; gmm_prim->gmmreg.attach_req.ptmsi = ptmsi; OSMO_STRLCPY_ARRAY(gmm_prim->gmmreg.attach_req.imsi, imsi); OSMO_STRLCPY_ARRAY(gmm_prim->gmmreg.attach_req.imei, imei); OSMO_STRLCPY_ARRAY(gmm_prim->gmmreg.attach_req.imeisv, imeisv); - - OSMO_ASSERT(gmm_prim); rc = osmo_gprs_gmm_prim_upper_down(gmm_prim); OSMO_ASSERT(rc == 0); @@ -248,6 +255,24 @@ OSMO_ASSERT(rc == 0); /* As a result, MS answers GMM Attach Complete */ + /* ... */ + + /* DETACH */ + gmm_prim = osmo_gprs_gmm_prim_alloc_gmmreg_detach_req(); + OSMO_ASSERT(gmm_prim); + gmm_prim->gmmreg.detach_req.detach_type = OSMO_GPRS_GMM_DETACH_MS_TYPE_GPRS; + gmm_prim->gmmreg.detach_req.poweroff_type = OSMO_GPRS_GMM_DETACH_POWEROFF_TYPE_NORMAL; + gmm_prim->gmmreg.detach_req.ptmsi = ptmsi; + rc = osmo_gprs_gmm_prim_upper_down(gmm_prim); + OSMO_ASSERT(rc == 0); + + /* Network sends GMM Detach Accept */ + llc_prim = gprs_llc_prim_alloc_ll_unitdata_ind(tlli, OSMO_GPRS_LLC_SAPI_GMM, (uint8_t *)pdu_gmm_detach_acc, sizeof(pdu_gmm_detach_acc)); + OSMO_ASSERT(llc_prim); + rc = osmo_gprs_gmm_prim_llc_lower_up(llc_prim); + OSMO_ASSERT(rc == 0); + /* As a result, MS answers GMM Attach Complete */ + printf("==== %s() [end] ====\n", __func__); } diff --git a/tests/gmm/gmm_prim_test.err b/tests/gmm/gmm_prim_test.err index 0256edf..8e50caa 100644 --- a/tests/gmm/gmm_prim_test.err +++ b/tests/gmm/gmm_prim_test.err @@ -16,3 +16,11 @@ DLGLOBAL INFO GMME(PTMSI-ea711b41) Tx GMM ATTACH COMPL DLGLOBAL INFO GMM_MS{RegisteredInitiated}: Received Event ATTACH_ACCEPTED DLGLOBAL INFO GMM_MS{RegisteredInitiated}: state_chg to Registered +DLGLOBAL INFO Rx from upper layers: GMMREG-DETACH.request +DLGLOBAL INFO GMM_MS{Registered}: Received Event DETACH_REQUESTED +DLGLOBAL INFO GMM_MS{Registered}: state_chg to DeregisteredInitiated +DLGLOBAL INFO GMME(PTMSI-ea711b41) Tx GMM DETACH REQUEST (MO) +DLGLOBAL INFO Rx from lower layers: LL-UNITDATA.indication +DLGLOBAL DEBUG GMME(PTMSI-ea711b41) Rx GMM DETACH ACCEPT (MO) force_standby_indicated=false +DLGLOBAL INFO GMM_MS{DeregisteredInitiated}: Received Event DETACH_ACCEPTED +DLGLOBAL INFO GMM_MS{DeregisteredInitiated}: state_chg to Deregistered diff --git a/tests/gmm/gmm_prim_test.ok b/tests/gmm/gmm_prim_test.ok index 91bcaeb..ed4f7e1 100644 --- a/tests/gmm/gmm_prim_test.ok +++ b/tests/gmm/gmm_prim_test.ok @@ -7,4 +7,7 @@ test_gmm_prim_llc_down_cb(): Rx LLGM-ASSIGN.request TLLI=0x00000000 test_gmm_prim_down_cb(): Rx GMRR-ASSIGN.request new_tlli=0xea711b41 test_gmm_prim_llc_down_cb(): Rx LL-UNITDATA.request TLLI=0xea711b41 SAPI=GMM l3=[08 03 ] +test_gmm_prim_llc_down_cb(): Rx LL-UNITDATA.request TLLI=0xea711b41 SAPI=GMM l3=[08 05 20 0a 00 05 f4 ea 71 1b 41 ] +test_gmm_prim_llc_down_cb(): Rx LLGM-ASSIGN.request TLLI=0x00000000 +test_gmm_prim_up_cb(): Rx GMMREG-DETACH.confirm detach_type='GPRS detach' ==== test_gmm_prim_ms() [end] ==== -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/32050 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: If6cbb1d425b3a9f713348f1dea4747e2b6be0a44 Gerrit-Change-Number: 32050 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmocom-bb[master]: layer23: modem: Test GMM layer through VTY
by pespin 24 Mar '23

24 Mar '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/32022 ) Change subject: layer23: modem: Test GMM layer through VTY ...................................................................... layer23: modem: Test GMM layer through VTY Recent work on libosmo-gprs-gmm already allows triggering GPRS Attach procedure. Let's add some code to use it so we can already test the entire stack GMM->LLC->RLCMAC (SM layer still missing). Depends: libosmo-gprs.git Change-Id I212053b3a3f27ef7d63503c3d5ef08453b2d2056 Related: OS#5501 Change-Id: Iba0663075468670a29aceafe5196cae3cab050eb --- M src/host/layer23/src/modem/gmm.c M src/host/layer23/src/modem/llc.c M src/host/layer23/src/modem/vty.c 3 files changed, 63 insertions(+), 10 deletions(-) Approvals: Jenkins Builder: Verified fixeria: Looks good to me, approved diff --git a/src/host/layer23/src/modem/gmm.c b/src/host/layer23/src/modem/gmm.c index 3488162..f88226e 100644 --- a/src/host/layer23/src/modem/gmm.c +++ b/src/host/layer23/src/modem/gmm.c @@ -82,6 +82,17 @@ return rc; } +static int modem_gmm_prim_llc_down_cb(struct osmo_gprs_llc_prim *llc_prim, void *user_data) +{ + int rc; + + rc = osmo_gprs_llc_prim_upper_down(llc_prim); + + /* LLC took ownership of the message, tell GMM layer to not free it: */ + rc = 1; + return rc; +} + int modem_gmm_init(struct osmocom_ms *ms) { int rc; @@ -93,5 +104,8 @@ osmo_gprs_gmm_prim_set_up_cb(modem_gmm_prim_up_cb, ms); osmo_gprs_gmm_prim_set_down_cb(modem_gmm_prim_down_cb, ms); + osmo_gprs_gmm_prim_set_llc_down_cb(modem_gmm_prim_llc_down_cb, ms); + + osmo_gprs_gmm_enable_gprs(true); return rc; } diff --git a/src/host/layer23/src/modem/llc.c b/src/host/layer23/src/modem/llc.c index 8d9d5bd..5352e0f 100644 --- a/src/host/layer23/src/modem/llc.c +++ b/src/host/layer23/src/modem/llc.c @@ -32,6 +32,7 @@ #include <osmocom/gprs/gprs_msgb.h> #include <osmocom/gprs/llc/llc_prim.h> #include <osmocom/gprs/llc/llc.h> +#include <osmocom/gprs/gmm/gmm_prim.h> #include <osmocom/gprs/rlcmac/rlcmac_prim.h> #include <osmocom/gprs/sndcp/sndcp_prim.h> @@ -41,7 +42,7 @@ static int modem_llc_handle_ll_gmm(struct osmo_gprs_llc_prim *llc_prim) { - struct msgb *msg; + int rc; switch (llc_prim->oph.primitive) { case OSMO_GPRS_LLC_LL_UNITDATA: @@ -57,15 +58,10 @@ return -EINVAL; } - msg = msgb_alloc(4096, "gsm0408_rx"); - msgb_tlli(msg) = llc_prim->ll.tlli; - msgb_gmmh(msg) = msgb_put(msg, llc_prim->ll.l3_pdu_len); - if (llc_prim->ll.l3_pdu_len > 0) - memcpy(msgb_gmmh(msg), llc_prim->ll.l3_pdu, llc_prim->ll.l3_pdu_len); - - //TODO: submit to GMM? - //TODO: free msg? - return 0; + /* GMM took ownership of the message, tell LLC layer to not free it: */ + rc = osmo_gprs_gmm_prim_llc_lower_up(llc_prim); + rc = 1; + return rc; } static int modem_llc_handle_ll_sndcp(struct osmo_gprs_llc_prim *llc_prim) diff --git a/src/host/layer23/src/modem/vty.c b/src/host/layer23/src/modem/vty.c index 4fa8e1d..0d13c93 100644 --- a/src/host/layer23/src/modem/vty.c +++ b/src/host/layer23/src/modem/vty.c @@ -25,6 +25,7 @@ #include <osmocom/gprs/llc/llc.h> #include <osmocom/gprs/llc/llc_prim.h> +#include <osmocom/gprs/gmm/gmm_prim.h> #include <osmocom/vty/vty.h> #include <osmocom/vty/command.h> @@ -60,6 +61,7 @@ #define TEST_CMD_DESC "Testing commands for developers\n" #define GRR_CMDG_DESC "GPRS RR specific commands\n" #define LLC_CMDG_DESC "GPRS LLC specific commands\n" +#define GMM_CMDG_DESC "GPRS GMM specific commands\n" /* testing commands */ DEFUN_HIDDEN(test_grr_tx_chan_req, @@ -152,6 +154,31 @@ return CMD_SUCCESS; } +DEFUN_HIDDEN(test_gmm_reg_attach, + test_gmm_reg_attach_cmd, + "test MS_NAME gmm attach", + TEST_CMD_DESC MS_NAME_DESC GMM_CMDG_DESC + "Enqueue a GMM GMMREG-ATTACH.req for transmission\n") +{ + struct osmo_gprs_gmm_prim *gmm_prim; + const uint32_t tlli = 0xe1c5d364; + struct osmocom_ms *ms; + + if ((ms = l23_vty_get_ms(argv[0], vty)) == NULL) + return CMD_WARNING; + + gmm_prim = osmo_gprs_gmm_prim_alloc_gmmreg_attach_req(); + gmm_prim->gmmreg.attach_req.ptmsi = tlli; + gmm_prim->gmmreg.attach_req.attach_type = OSMO_GPRS_GMM_ATTACH_TYPE_GPRS; + + if (osmo_gprs_gmm_prim_upper_down(gmm_prim) != 0) { + vty_out(vty, "Failed to enqueue an GMM PDU%s", VTY_NEWLINE); + return CMD_WARNING; + } + + return CMD_SUCCESS; +} + /* per APN config */ DEFUN(cfg_ms_apn, cfg_ms_apn_cmd, "apn APN_NAME", "Configure an APN\n" @@ -335,6 +362,7 @@ install_element_ve(&test_grr_tx_chan_req_cmd); install_element_ve(&test_llc_unitdata_req_hexpdu_cmd); install_element_ve(&test_llc_unitdata_req_gmm_attch_cmd); + install_element_ve(&test_gmm_reg_attach_cmd); install_element(CONFIG_NODE, &l23_cfg_ms_cmd); install_element(MS_NODE, &cfg_ms_apn_cmd); -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/32022 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Iba0663075468670a29aceafe5196cae3cab050eb Gerrit-Change-Number: 32022 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Hoernchen <ewild(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in osmo-pcu[master]: doc: Add details regarding BSC co-location
by pespin 24 Mar '23

24 Mar '23
Attention is currently required from: dexter. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/32049 ) Change subject: doc: Add details regarding BSC co-location ...................................................................... Patch Set 2: (1 comment) File doc/manuals/chapters/overview.adoc: https://gerrit.osmocom.org/c/osmo-pcu/+/32049/comment/df70ea2d_bf765afb PS2, Line 12: In small base stations, the PCU is usually co-located inside the BTS. In this It think it's not a matter of "small vs big", it's a matter of ip.access based BTS expecting it to be co-located with the BTS. -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/32049 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: Ib2a3b60849fd312b21073a3511b8ca36b4536343 Gerrit-Change-Number: 32049 Gerrit-PatchSet: 2 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-CC: pespin <pespin(a)sysmocom.de> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Fri, 24 Mar 2023 15:19:36 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmo-pcu[master]: doc: overview: put BTS and PCU on the same rank
by fixeria 24 Mar '23

24 Mar '23
Attention is currently required from: dexter. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/32047 ) Change subject: doc: overview: put BTS and PCU on the same rank ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/32047 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: Ifa170f3956b4629765a88ed62e877a204541d9ea Gerrit-Change-Number: 32047 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Fri, 24 Mar 2023 15:18:38 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[M] Change in osmocom-bb[master]: layer23: modem: Test GMM layer through VTY
by fixeria 24 Mar '23

24 Mar '23
Attention is currently required from: Hoernchen, pespin. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/32022 ) Change subject: layer23: modem: Test GMM layer through VTY ...................................................................... Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/32022 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Iba0663075468670a29aceafe5196cae3cab050eb Gerrit-Change-Number: 32022 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Hoernchen <ewild(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: Hoernchen <ewild(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Fri, 24 Mar 2023 15:15:05 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • ...
  • 365
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.