blob: 3f34f31ac763eef2a141fd9969ab8c9d9bd87895 [file] [log] [blame]
Pau Espin Pedrolea8dbdd2021-07-29 18:39:16 +02001/* tbf_ul_ack_fsm.h
2 *
3 * Copyright (C) 2021 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
4 * 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 Pedrolea8dbdd2021-07-29 18:39:16 +020015 */
16#pragma once
17
18#include <osmocom/core/fsm.h>
19#include <osmocom/core/tdef.h>
20
21#include <gprs_pcu.h>
22
23struct gprs_rlcmac_tbf;
24struct gprs_rlcmac_ul_tbf;
Pau Espin Pedrol106f2a02022-12-12 17:29:10 +010025struct gprs_rlcmac_pdch;
Pau Espin Pedrolea8dbdd2021-07-29 18:39:16 +020026
27enum tbf_ul_ack_fsm_event {
28 TBF_UL_ACK_EV_SCHED_ACK, /* Tx UL ACK/NACK is pending */
29 TBF_UL_ACK_EV_CREATE_RLCMAC_MSG, /* Scheduler wants to gen+Tx the Ass (rej): data=tbf_ul_ack_ev_create_rlcmac_msg_ctx */
30 TBF_UL_ACK_EV_RX_CTRL_ACK, /* Received CTRL ACK answering poll set on UL ACK/NACK */
31 TBF_UL_ACK_EV_POLL_TIMEOUT, /* Pdch Ul Controller signals timeout for poll set on UL ACK/NACK */
32};
33
34enum tbf_ul_ack_fsm_states {
35 TBF_UL_ACK_ST_NONE = 0,
36 TBF_UL_ACK_ST_SCHED_UL_ACK, /* send UL ACK/NACK on next RTS */
37 TBF_UL_ACK_ST_WAIT_ACK, /* wait for PACKET CONTROL ACK */
38};
39
40struct tbf_ul_ack_fsm_ctx {
41 struct osmo_fsm_inst *fi;
42 struct gprs_rlcmac_ul_tbf *tbf; /* back pointer */
43};
44
Pau Espin Pedrolea8dbdd2021-07-29 18:39:16 +020045extern struct osmo_fsm tbf_ul_ack_fsm;
46
47
48/* passed as data in TBF_UL_ACK_EV_CREATE_RLCMAC_MSG */
49struct tbf_ul_ack_ev_create_rlcmac_msg_ctx {
Pau Espin Pedrol5ba3ef92022-12-12 18:02:25 +010050 const struct gprs_rlcmac_pdch *pdch; /* TS where the created DL ctrl block is to be sent */
Pau Espin Pedrolea8dbdd2021-07-29 18:39:16 +020051 uint32_t fn; /* FN where the created DL ctrl block is to be sent */
Pau Espin Pedrolea8dbdd2021-07-29 18:39:16 +020052 struct msgb *msg; /* to be filled by FSM during event processing */
53};
54
55
Pau Espin Pedrol5ba3ef92022-12-12 18:02:25 +010056struct msgb *tbf_ul_ack_create_rlcmac_msg(const struct gprs_rlcmac_ul_tbf *ul_tbf,
57 const struct gprs_rlcmac_pdch *pdch,
58 uint32_t fn);
Pau Espin Pedrol106f2a02022-12-12 17:29:10 +010059bool tbf_ul_ack_rts(const struct gprs_rlcmac_ul_tbf *ul_tbf, const struct gprs_rlcmac_pdch *pdch);
Pau Espin Pedrolbf2842e2022-10-26 20:14:58 +020060bool tbf_ul_ack_waiting_cnf_final_ack(const struct gprs_rlcmac_ul_tbf *ul_tbf);
61bool tbf_ul_ack_exp_ctrl_ack(const struct gprs_rlcmac_ul_tbf *ul_tbf, uint32_t fn, uint8_t ts);