blob: 28c04a32e2ff18f9afbd50109b6d3ffad5e4009d [file] [log] [blame]
Pau Espin Pedroldc2aaac2021-05-14 12:50:46 +02001/* tbf_fsm.c
2 *
Pau Espin Pedrol343c0ee2022-11-17 19:55:08 +01003 * Copyright (C) 2021-2022 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
Pau Espin Pedroldc2aaac2021-05-14 12:50:46 +02004 * Author: Pau Espin Pedrol <pespin@sysmocom.de>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
Pau Espin Pedroldc2aaac2021-05-14 12:50:46 +020015 */
16
Pau Espin Pedrol343c0ee2022-11-17 19:55:08 +010017#include <osmocom/core/utils.h>
Pau Espin Pedroldc2aaac2021-05-14 12:50:46 +020018
19#include <tbf_fsm.h>
Pau Espin Pedroldc2aaac2021-05-14 12:50:46 +020020
Pau Espin Pedrol343c0ee2022-11-17 19:55:08 +010021/* Note: This file contains shared code for UL/DL TBF FSM. See tbf_dl_fsm.c and
22 * tbf_ul_fsm.c for the actual implementations of the FSM */
Pau Espin Pedroldc2aaac2021-05-14 12:50:46 +020023
Pau Espin Pedrol06abd3e2022-11-17 20:25:40 +010024/* Transition to a state, using the T timer defined in tbf_fsm_timeouts.
25 * The actual timeout value is in turn obtained from conn->T_defs.
26 * Assumes local variable fi exists. */
27#define tbf_fsm_state_chg(fi, NEXT_STATE) \
28 osmo_tdef_fsm_inst_state_chg(fi, NEXT_STATE, \
29 tbf_fsm_timeouts, \
30 the_pcu->T_defs, \
31 -1)
32
Pau Espin Pedroldc2aaac2021-05-14 12:50:46 +020033const struct value_string tbf_fsm_event_names[] = {
Pau Espin Pedrol33e80072021-07-22 19:20:50 +020034 { TBF_EV_ASSIGN_ADD_CCCH, "ASSIGN_ADD_CCCH" },
35 { TBF_EV_ASSIGN_ADD_PACCH, "ASSIGN_ADD_PACCH" },
Pau Espin Pedrol720e19e2021-07-22 19:56:37 +020036 { TBF_EV_ASSIGN_ACK_PACCH, "ASSIGN_ACK_PACCH" },
37 { TBF_EV_ASSIGN_READY_CCCH, "ASSIGN_READY_CCCH" },
Pau Espin Pedrol32252902021-07-29 16:44:11 +020038 { TBF_EV_ASSIGN_PCUIF_CNF, "ASSIGN_PCUIF_CNF" },
Pau Espin Pedrol338a5ae2022-10-28 18:47:44 +020039 { TBF_EV_FIRST_UL_DATA_RECVD, "FIRST_UL_DATA_RECVD" },
Pau Espin Pedrolf38a47e2022-10-28 19:06:45 +020040 { TBF_EV_CONTENTION_RESOLUTION_MS_SUCCESS, "CONTENTION_RESOLUTION_MS_SUCCESS" },
Pau Espin Pedrol32252902021-07-29 16:44:11 +020041 { TBF_EV_DL_ACKNACK_MISS, "DL_ACKNACK_MISS" },
Pau Espin Pedrolc32c4a32021-07-23 18:27:57 +020042 { TBF_EV_LAST_DL_DATA_SENT, "LAST_DL_DATA_SENT" },
43 { TBF_EV_LAST_UL_DATA_RECVD, "LAST_UL_DATA_RECVD" },
Pau Espin Pedrolefcb0462021-07-26 12:33:39 +020044 { TBF_EV_FINAL_ACK_RECVD, "FINAL_ACK_RECVD" },
Pau Espin Pedrol7a2b65e2021-10-11 19:18:13 +020045 { TBF_EV_FINAL_UL_ACK_CONFIRMED, "FINAL_UL_ACK_CONFIRMED" },
Pau Espin Pedrol55f600b2021-07-26 15:54:39 +020046 { TBF_EV_MAX_N3101 , "MAX_N3101" },
47 { TBF_EV_MAX_N3103 , "MAX_N3103" },
48 { TBF_EV_MAX_N3105 , "MAX_N3105" },
Pau Espin Pedroldc2aaac2021-05-14 12:50:46 +020049 { 0, NULL }
50};