Change in osmo-pcu[master]: nacc_fsm: Move code filling struct to helper function

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Wed Feb 10 18:21:12 UTC 2021


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/22826 )


Change subject: nacc_fsm: Move code filling struct to helper function
......................................................................

nacc_fsm: Move code filling struct to helper function

Same filler will be needed in different places since that message can
arrive at different points of time (different states).
It also helps supporting newer key types in the future.

Change-Id: Idfd4db8408f767b1847b04c88047a1c4996e543e
---
M src/nacc_fsm.c
1 file changed, 19 insertions(+), 10 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/26/22826/1

diff --git a/src/nacc_fsm.c b/src/nacc_fsm.c
index 6a92f83..f9dea98 100644
--- a/src/nacc_fsm.c
+++ b/src/nacc_fsm.c
@@ -268,6 +268,22 @@
 	return 0;
 }
 
+static int fill_neigh_key_from_bts_pkt_cell_chg_not(struct neigh_cache_entry_key *neigh_key,
+						    const struct gprs_rlcmac_bts *bts,
+						    const Packet_Cell_Change_Notification_t *notif)
+{
+	switch (notif->Target_Cell.UnionType) {
+	case 0: /* GSM */
+		neigh_key->local_lac = bts->cgi_ps.rai.lac.lac;
+		neigh_key->local_ci = bts->cgi_ps.cell_identity;
+		neigh_key->tgt_arfcn = notif->Target_Cell.u.Target_Cell_GSM_Notif.ARFCN;
+		neigh_key->tgt_bsic = notif->Target_Cell.u.Target_Cell_GSM_Notif.BSIC;
+		return 0;
+	default:
+		return -ENOTSUP;
+	}
+}
+
 #define SI_HDR_LEN 2
 static void bts_fill_si_cache_value(const struct gprs_rlcmac_bts *bts, struct si_cache_value *val)
 {
@@ -303,19 +319,12 @@
 	switch (event) {
 	case NACC_EV_RX_CELL_CHG_NOTIFICATION:
 		notif = (Packet_Cell_Change_Notification_t *)data;
-		switch (notif->Target_Cell.UnionType) {
-		case 0: /* GSM */
-			ctx->neigh_key.local_lac = bts->cgi_ps.rai.lac.lac;
-			ctx->neigh_key.local_ci = bts->cgi_ps.cell_identity;
-			ctx->neigh_key.tgt_arfcn = notif->Target_Cell.u.Target_Cell_GSM_Notif.ARFCN;
-			ctx->neigh_key.tgt_bsic = notif->Target_Cell.u.Target_Cell_GSM_Notif.BSIC;
-			nacc_fsm_state_chg(fi, NACC_ST_WAIT_RESOLVE_RAC_CI);
-			break;
-		default:
+		if (fill_neigh_key_from_bts_pkt_cell_chg_not(&ctx->neigh_key, bts, notif) < 0) {
 			LOGPFSML(fi, LOGL_NOTICE, "TargetCell type=0x%x not supported\n",
 				 notif->Target_Cell.UnionType);
 			osmo_fsm_inst_term(fi, OSMO_FSM_TERM_ERROR, NULL);
-			return;
+		} else {
+			nacc_fsm_state_chg(fi, NACC_ST_WAIT_RESOLVE_RAC_CI);
 		}
 		break;
 	default:

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/22826
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Idfd4db8408f767b1847b04c88047a1c4996e543e
Gerrit-Change-Number: 22826
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210210/da56418f/attachment.htm>


More information about the gerrit-log mailing list