diff options
Diffstat (limited to 'src/tbf_fsm.h')
-rw-r--r-- | src/tbf_fsm.h | 66 |
1 files changed, 36 insertions, 30 deletions
diff --git a/src/tbf_fsm.h b/src/tbf_fsm.h index 614c319d..fd6ffa6f 100644 --- a/src/tbf_fsm.h +++ b/src/tbf_fsm.h @@ -12,10 +12,6 @@ * 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 General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #pragma once @@ -27,45 +23,55 @@ struct gprs_rlcmac_tbf; enum tbf_fsm_event { - TBF_EV_ASSIGN_ADD_CCCH, /* An assignment is sent over CCCH and confirmation from MS is pending */ + /* For both UL/DL TBF: */ + TBF_EV_ASSIGN_ADD_CCCH, /* An assignment is sent over CCCH and confirmation from MS is pending */ TBF_EV_ASSIGN_ADD_PACCH, /* An assignment is sent over PACCH and confirmation from MS is pending */ - TBF_EV_ASSIGN_ACK_PACCH, /* We received a CTRL ACK confirming assignment started on PACCH */ + TBF_EV_ASSIGN_ACK_PACCH, /* We received a CTRL ACK confirming assignment started on PACCH */ + TBF_EV_MAX_N3105, /* MAX N3105 (max poll timeout) reached */ + + /* Only for DL TBF: */ TBF_EV_ASSIGN_READY_CCCH, /* TBF Start Time timer triggered */ - TBF_EV_ASSIGN_PCUIF_CNF, /* Transmission of IMM.ASS for DL TBF to the MS confirmed by BTS over PCUIF */ - TBF_EV_DL_ACKNACK_MISS, /* DL TBF: We polled for DL ACK/NACK but we received none (POLL timeout) */ - TBF_EV_LAST_DL_DATA_SENT, /* DL TBF sends RLCMAC block containing last DL avilable data buffered */ - TBF_EV_LAST_UL_DATA_RECVD, /* UL TBF sends RLCMAC block containing last UL data (cv=0) */ + TBF_EV_ASSIGN_PCUIF_CNF, /* Transmission of IMM.ASS for to the MS confirmed by BTS over PCUIF */ + TBF_EV_DL_ACKNACK_MISS, /* We polled for DL ACK/NACK but we received none (POLL timeout) */ + TBF_EV_LAST_DL_DATA_SENT, /* Network sends RLCMAC block containing last DL avilable data buffered */ TBF_EV_FINAL_ACK_RECVD, /* DL ACK/NACK with FINAL_ACK=1 received from MS */ - TBF_EV_FINAL_UL_ACK_CONFIRMED, /* UL TBF: MS ACKs (CtrlAck or PktResReq) our UL ACK/NACK w/ FinalAckInd=1 */ - TBF_EV_MAX_N3101, /* MAX N3101 (max usf timeout) reached (UL TBF) */ - TBF_EV_MAX_N3103, /* MAX N3103 (max Pkt Ctrl Ack for last UL ACK/NACK timeout) reached (UL TBF) */ - TBF_EV_MAX_N3105, /* MAX N3105 (max poll timeout) reached (UL/DL TBF) */ + + /* Only for UL TBF: */ + TBF_EV_FIRST_UL_DATA_RECVD, /* Received first UL data from MS. Equals to Contention Resolution completed on the network side */ + TBF_EV_CONTENTION_RESOLUTION_MS_SUCCESS, /* Contention resolution success at the mobile station side (first UL_ACK_NACK confirming TLLI is received at the MS) */ + TBF_EV_LAST_UL_DATA_RECVD, /* MS ends RLCMAC block containing last UL data (cv=0) */ + TBF_EV_FINAL_UL_ACK_CONFIRMED, /* MS ACKs (CtrlAck or PktResReq) our UL ACK/NACK w/ FinalAckInd=1. data = (bool) MS requests establishment of a new UL-TBF. */ + TBF_EV_MAX_N3101, /* MAX N3101 (max usf timeout) reached */ + TBF_EV_MAX_N3103, /* MAX N3103 (max Pkt Ctrl Ack for last UL ACK/NACK timeout) reached */ }; +extern const struct value_string tbf_fsm_event_names[]; + enum tbf_fsm_states { TBF_ST_NEW = 0, /* new created TBF */ TBF_ST_ASSIGN, /* wait for downlink assignment */ TBF_ST_FLOW, /* RLC/MAC flow, resource needed */ TBF_ST_FINISHED, /* flow finished, wait for release */ - TBF_ST_WAIT_RELEASE,/* wait for release or restart of DL TBF */ - TBF_ST_RELEASING, /* releasing, wait to free TBI/USF */ + TBF_ST_WAIT_RELEASE, /* DL TBF: wait for release or restart */ + TBF_ST_WAIT_REUSE_TFI, /* DL TBF: wait to reuse TFI after last PKT ACK/NACK */ + TBF_ST_RELEASING, /* releasing, wait to free TFI/USF */ }; -struct tbf_fsm_ctx { - struct osmo_fsm_inst *fi; - struct gprs_rlcmac_tbf* tbf; /* back pointer */ +struct tbf_dl_fsm_ctx { + union { /* back pointer. union used to easily access superclass from ctx */ + struct gprs_rlcmac_tbf *tbf; + struct gprs_rlcmac_dl_tbf *dl_tbf; + }; uint32_t state_flags; - unsigned int T_release; /* Timer to be used to end release: T3169 or T3195 */ }; -extern const struct osmo_tdef_state_timeout tbf_fsm_timeouts[32]; -/* Transition to a state, using the T timer defined in tbf_fsm_timeouts. - * The actual timeout value is in turn obtained from conn->T_defs. - * Assumes local variable fi exists. */ -#define tbf_fsm_state_chg(fi, NEXT_STATE) \ - osmo_tdef_fsm_inst_state_chg(fi, NEXT_STATE, \ - tbf_fsm_timeouts, \ - the_pcu->T_defs, \ - -1) +struct tbf_ul_fsm_ctx { + union { /* back pointer. union used to easily access superclass from ctx */ + struct gprs_rlcmac_tbf *tbf; + struct gprs_rlcmac_ul_tbf *ul_tbf; + }; + uint32_t state_flags; +}; -extern struct osmo_fsm tbf_fsm; +extern struct osmo_fsm tbf_dl_fsm; +extern struct osmo_fsm tbf_ul_fsm; |