aboutsummaryrefslogtreecommitdiffstats
path: root/src/nacc_fsm.h
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2021-01-21 18:46:13 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2021-01-29 12:59:30 +0100
commitc0a250d17d79e08763f77cdf58e970dc2e65e7d3 (patch)
treefd17974c91dd13c5cd2f601c5937dcd025c52e04 /src/nacc_fsm.h
parent1e77ca88af8f07290cd1a11f11f3db916c9c3c79 (diff)
Introduce NACC support
A new nacc_fsm is introduced per MS object, with its partner priv structure struct nacc_fsm_ctx, which exists and is available in the MS object only during the duration of the NACC procedure. The NACC context is created on an MS whenever a Pkt Cell Change Notification is received on Uplink RLCMAC, which asks for neighbor information of a given ARFCN+BSIC. First, the target ARFCN+BSIC needs to be translated into a CGI-PS (RAC+CI) address. That's done by asking the BSC through the Neighbour Resolution Service available in osmo-bsc using the CTRL interface. Once the CGI-PS of the target cell is known, PCU starts a RIM RAN-INFO request against the SGSN (which will route the request as needed), and wait for a response containing the SI bits from the target cell. After the SI are received, the scheduler is instructed to eventually poll a TBF for the MS originating the CCN, so that we can send the SI encapsulated into multiple Packet Neighbor Cell Data messages on the downlink. One all the SI bits are sent, the scheduler is instructed to send a Packet Cell Change Continue message. Once the message above has been sent, the FSM autodestroys itself. Caches are also introduced in this patch which allows for re-using recently known translations ARFCN+BSIC -> CGI-PS and CGI-PS -> SI_INFO respectively. Change-Id: Id35f40d05f3e081f32fddbf1fa34cb338db452ca
Diffstat (limited to 'src/nacc_fsm.h')
-rw-r--r--src/nacc_fsm.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/nacc_fsm.h b/src/nacc_fsm.h
new file mode 100644
index 00000000..9107dafd
--- /dev/null
+++ b/src/nacc_fsm.h
@@ -0,0 +1,64 @@
+/* nacc_fsm.h
+ *
+ * Copyright (C) 2021 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
+ * Author: Pau Espin Pedrol <pespin@sysmocom.de>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * 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 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
+
+#include <osmocom/core/fsm.h>
+#include <osmocom/gsm/gsm23003.h>
+
+#include <neigh_cache.h>
+
+struct GprsMs;
+struct gprs_rlcmac_tbf;
+
+enum nacc_fsm_event {
+ NACC_EV_RX_CELL_CHG_NOTIFICATION, /* data: Packet_Cell_Change_Notification_t* */
+ NACC_EV_RX_RAC_CI, /* no data passed, RAC_CI became available in neigh_cache */
+ NACC_EV_RX_SI, /* data: struct si_cache_entry* */
+ NACC_EV_CREATE_RLCMAC_MSG, /* data: struct nacc_ev_create_rlcmac_msg_ctx* */
+};
+
+enum nacc_fsm_states {
+ NACC_ST_INITIAL,
+ NACC_ST_WAIT_RESOLVE_RAC_CI,
+ NACC_ST_WAIT_REQUEST_SI,
+ NACC_ST_TX_NEIGHBOUR_DATA,
+ NACC_ST_TX_CELL_CHG_CONTINUE,
+ NACC_ST_DONE,
+};
+
+struct nacc_fsm_ctx {
+ struct osmo_fsm_inst *fi;
+ struct GprsMs* ms; /* back pointer */
+ struct ctrl_handle *neigh_ctrl;
+ struct ctrl_connection *neigh_ctrl_conn;
+ struct neigh_cache_entry_key neigh_key; /* target cell info from MS */
+ struct osmo_cell_global_id_ps cgi_ps; /* target cell info resolved from req_{arfcn+bsic} */
+ struct si_cache_value si_info; /* SI info resolved from SGSN, to be sent to MS */
+ size_t si_info_bytes_sent; /* How many bytes out of si_info->si_len were already sent to MS */
+ size_t container_idx; /* Next container_idx to assign when sending Packet Neighbor Data message */
+};
+
+/* passed as data in NACC_EV_CREATE_RLCMAC_MSG */
+struct nacc_ev_create_rlcmac_msg_ctx {
+ struct gprs_rlcmac_tbf *tbf; /* target tbf to create messages for */
+ struct msgb *msg; /* to be filled by FSM during event processing */
+};
+
+struct nacc_fsm_ctx *nacc_fsm_alloc(struct GprsMs* ms);