cosmetic: rename gsm_subscriber_connection->conn_fsm to ->fi

Match osmo-bsc's naming of the subscriber connection's FSM instance; 'conn->fi'
makes more sense anyway than 'conn->conn_fsm'.

BTW, an upcoming commit will do away with the legacy from libbsc/libmsc duality
and firmly glue the conn allocation to the fi.

Related: OS#3122
Change-Id: If442f2ba78d9722b1065ec30c9a13f372b6a8caa
This commit is contained in:
Neels Hofmeyr 2018-03-31 18:45:59 +02:00
parent ae73d2b16f
commit 4d3a66b3f8
15 changed files with 54 additions and 53 deletions

View File

@ -75,6 +75,9 @@ struct gsm_subscriber_connection {
/* global linked list of subscriber_connections */
struct llist_head entry;
/* FSM instance to control the subscriber connection's permissions and lifetime. */
struct osmo_fsm_inst *fi;
/* usage count. If this drops to zero, we start the release
* towards A/Iu */
uint32_t use_count;
@ -92,8 +95,6 @@ struct gsm_subscriber_connection {
/* SMS helpers for libmsc */
uint8_t next_rp_ref;
struct osmo_fsm_inst *conn_fsm;
/* Are we part of a special "silent" call */
int silent_call;

View File

@ -393,7 +393,7 @@ int mm_rx_loc_upd_req(struct gsm_subscriber_connection *conn, struct msgb *msg)
DEBUGP(DMM, "LU/new-LAC: %u/%u\n", old_lai.lac, new_lai.lac);
is_utran = (conn->via_ran == RAN_UTRAN_IU);
lu_fsm = vlr_loc_update(conn->conn_fsm,
lu_fsm = vlr_loc_update(conn->fi,
SUBSCR_CONN_E_ACCEPTED,
SUBSCR_CONN_E_CN_CLOSE,
(void*)&conn_from_lu,
@ -759,7 +759,7 @@ int gsm48_rx_mm_serv_req(struct gsm_subscriber_connection *conn, struct msgb *ms
memcpy(conn->classmark.classmark2, classmark2, classmark2_len);
conn->classmark.classmark2_len = classmark2_len;
if (conn->conn_fsm) {
if (conn->fi) {
if (msc_subscr_conn_is_accepted(conn))
return cm_serv_reuse_conn(conn, mi-1);
LOGP(DMM, LOGL_ERROR, "%s: connection already in use\n",
@ -776,7 +776,7 @@ int gsm48_rx_mm_serv_req(struct gsm_subscriber_connection *conn, struct msgb *ms
}
is_utran = (conn->via_ran == RAN_UTRAN_IU);
vlr_proc_acc_req(conn->conn_fsm,
vlr_proc_acc_req(conn->fi,
SUBSCR_CONN_E_ACCEPTED,
SUBSCR_CONN_E_CN_CLOSE,
(void*)&conn_from_cm_service_req,
@ -1181,7 +1181,7 @@ static int gsm48_rx_rr_pag_resp(struct gsm_subscriber_connection *conn, struct m
conn->classmark.classmark2_len = *classmark2_lv;
is_utran = (conn->via_ran == RAN_UTRAN_IU);
vlr_proc_acc_req(conn->conn_fsm,
vlr_proc_acc_req(conn->fi,
SUBSCR_CONN_E_ACCEPTED,
SUBSCR_CONN_E_CN_CLOSE,
(void*)&conn_from_paging_resp,

View File

@ -481,7 +481,7 @@ static void vty_dump_one_conn(struct vty *vty, const struct gsm_subscriber_conne
conn->use_tokens,
conn->received_cm_service_request ? 'C' : '-',
conn->encr.alg_id,
conn->conn_fsm ? osmo_fsm_inst_state_name(conn->conn_fsm) : "-",
conn->fi ? osmo_fsm_inst_state_name(conn->fi) : "-",
VTY_NEWLINE);
}

View File

@ -88,16 +88,16 @@ void subscr_conn_release_when_unused(struct gsm_subscriber_connection *conn)
{
if (!conn)
return;
if (!conn->conn_fsm)
if (!conn->fi)
return;
if (!(conn->conn_fsm->state == SUBSCR_CONN_S_ACCEPTED
|| conn->conn_fsm->state == SUBSCR_CONN_S_COMMUNICATING)) {
if (!(conn->fi->state == SUBSCR_CONN_S_ACCEPTED
|| conn->fi->state == SUBSCR_CONN_S_COMMUNICATING)) {
DEBUGP(DMM, "%s: %s: conn still being established (%s)\n",
vlr_subscr_name(conn->vsub), __func__,
osmo_fsm_inst_state_name(conn->conn_fsm));
osmo_fsm_inst_state_name(conn->fi));
return;
}
osmo_fsm_inst_dispatch(conn->conn_fsm, SUBSCR_CONN_E_RELEASE_WHEN_UNUSED, NULL);
osmo_fsm_inst_dispatch(conn->fi, SUBSCR_CONN_E_RELEASE_WHEN_UNUSED, NULL);
}
/* receive a Level 3 Complete message and return MSC_CONN_ACCEPT or
@ -110,7 +110,7 @@ int msc_compl_l3(struct gsm_subscriber_connection *conn,
subscr_conn_release_when_unused(conn);
/* If this should be kept, the conn->conn_fsm has placed a use_count */
/* If this should be kept, the conn->fi has placed a use_count */
msc_subscr_conn_put(conn, MSC_CONN_USE_COMPL_L3);
/* Always return acceptance, because even if the conn was not accepted,
@ -268,11 +268,11 @@ void msc_subscr_con_cleanup(struct gsm_subscriber_connection *conn)
DEBUGP(DRLL, "Freeing subscriber connection"
" with NULL subscriber\n");
if (!conn->conn_fsm)
if (!conn->fi)
return;
osmo_fsm_inst_term(conn->conn_fsm,
(conn->conn_fsm->state == SUBSCR_CONN_S_RELEASED)
osmo_fsm_inst_term(conn->fi,
(conn->fi->state == SUBSCR_CONN_S_RELEASED)
? OSMO_FSM_TERM_REGULAR
: OSMO_FSM_TERM_ERROR,
NULL);
@ -322,8 +322,8 @@ static void msc_subscr_conn_release_all(struct gsm_subscriber_connection *conn,
}
}
/* If the conn->conn_fsm is still present, dispatch SUBSCR_CONN_E_CN_CLOSE
* event to gracefully terminate the connection. If the conn_fsm is already
/* If the conn->fi is still present, dispatch SUBSCR_CONN_E_CN_CLOSE
* event to gracefully terminate the connection. If the fi is already
* cleared, call msc_subscr_conn_release_all() to take release actions.
* \param cause a GSM_CAUSE_* constant, e.g. GSM_CAUSE_AUTH_FAILED.
*/
@ -338,22 +338,22 @@ void msc_subscr_conn_close(struct gsm_subscriber_connection *conn,
vlr_subscr_name(conn->vsub), cause);
return;
}
if (!conn->conn_fsm) {
if (!conn->fi) {
DEBUGP(DMM, "msc_subscr_conn_close(vsub=%s, cause=%u): no conn fsm,"
" releasing directly without release event.\n",
vlr_subscr_name(conn->vsub), cause);
/* In case of an IMSI Detach, we don't have conn_fsm. Release
/* In case of an IMSI Detach, we don't have fi. Release
* anyway to ensure a timely Iu Release / BSSMAP Clear. */
msc_subscr_conn_release_all(conn, cause);
return;
}
if (conn->conn_fsm->state == SUBSCR_CONN_S_RELEASED) {
if (conn->fi->state == SUBSCR_CONN_S_RELEASED) {
DEBUGP(DMM, "msc_subscr_conn_close(vsub=%s, cause=%u):"
" conn fsm already releasing, ignore.\n",
vlr_subscr_name(conn->vsub), cause);
return;
}
osmo_fsm_inst_dispatch(conn->conn_fsm, SUBSCR_CONN_E_CN_CLOSE, &cause);
osmo_fsm_inst_dispatch(conn->fi, SUBSCR_CONN_E_CN_CLOSE, &cause);
}
/* increment the ref-count. Needs to be called by every user */

View File

@ -225,7 +225,7 @@ static void subscr_conn_fsm_cleanup(struct osmo_fsm_inst *fi,
if (!conn)
return;
conn->conn_fsm = NULL;
conn->fi = NULL;
msc_subscr_conn_close(conn, cause);
msc_subscr_conn_put(conn, MSC_CONN_USE_FSM);
}
@ -329,7 +329,7 @@ int msc_create_conn_fsm(struct gsm_subscriber_connection *conn, const char *id)
struct osmo_fsm_inst *fi;
OSMO_ASSERT(conn);
if (conn->conn_fsm) {
if (conn->fi) {
LOGP(DMM, LOGL_ERROR,
"%s: Error: connection already in use\n", id);
return -EINVAL;
@ -349,8 +349,8 @@ int msc_create_conn_fsm(struct gsm_subscriber_connection *conn, const char *id)
"%s: Failed to allocate subscr conn master FSM\n", id);
return -ENOMEM;
}
conn->conn_fsm = fi;
osmo_fsm_inst_dispatch(conn->conn_fsm, SUBSCR_CONN_E_START, NULL);
conn->fi = fi;
osmo_fsm_inst_dispatch(conn->fi, SUBSCR_CONN_E_START, NULL);
return 0;
}
@ -360,10 +360,10 @@ bool msc_subscr_conn_is_accepted(const struct gsm_subscriber_connection *conn)
return false;
if (!conn->vsub)
return false;
if (!conn->conn_fsm)
if (!conn->fi)
return false;
if (!(conn->conn_fsm->state == SUBSCR_CONN_S_ACCEPTED
|| conn->conn_fsm->state == SUBSCR_CONN_S_COMMUNICATING))
if (!(conn->fi->state == SUBSCR_CONN_S_ACCEPTED
|| conn->fi->state == SUBSCR_CONN_S_COMMUNICATING))
return false;
return true;
}
@ -374,8 +374,8 @@ void msc_subscr_conn_communicating(struct gsm_subscriber_connection *conn)
/* This function is called to indicate that *some* communication is happening with the phone.
* Late in the process, that may be a Release Confirm and the FSM and conn are already in
* teardown. No need to signal SUBSCR_CONN_E_COMMUNICATING then. */
if (conn->conn_fsm)
osmo_fsm_inst_dispatch(conn->conn_fsm, SUBSCR_CONN_E_COMMUNICATING, NULL);
if (conn->fi)
osmo_fsm_inst_dispatch(conn->fi, SUBSCR_CONN_E_COMMUNICATING, NULL);
}
void msc_subscr_conn_init(void)

View File

@ -158,8 +158,8 @@ void trans_free(struct gsm_trans *trans)
trans->conn = NULL;
talloc_free(trans);
/* trans_free() should always happen while the conn_fsm is still around. */
OSMO_ASSERT(conn->conn_fsm);
/* trans_free() should always happen while the fi is still around. */
OSMO_ASSERT(conn->fi);
/* Possibly this was the last transaction used by this conn. */
subscr_conn_release_when_unused(conn);

View File

@ -166,7 +166,7 @@ static void _test_auth_reuse(enum ran_type via_ran,
"03575886" /* classmark 2 */
"089910070000106005" /* IMSI */);
OSMO_ASSERT(g_conn);
OSMO_ASSERT(g_conn->conn_fsm);
OSMO_ASSERT(g_conn->fi);
OSMO_ASSERT(g_conn->vsub);
VERBOSE_ASSERT(cm_service_result_sent, == RES_NONE, "%d");
VERBOSE_ASSERT(auth_request_sent, == true, "%d");
@ -217,7 +217,7 @@ static void _test_auth_reuse(enum ran_type via_ran,
"03575886" /* classmark 2 */
"089910070000106005" /* IMSI */);
OSMO_ASSERT(g_conn);
OSMO_ASSERT(g_conn->conn_fsm);
OSMO_ASSERT(g_conn->fi);
OSMO_ASSERT(g_conn->vsub);
VERBOSE_ASSERT(cm_service_result_sent, == RES_NONE, "%d");
VERBOSE_ASSERT(auth_request_sent, == false, "%d");

View File

@ -172,7 +172,7 @@ static void test_call_mo()
"03575886" /* classmark 2 */
"089910070000106005" /* IMSI */);
OSMO_ASSERT(g_conn);
OSMO_ASSERT(g_conn->conn_fsm);
OSMO_ASSERT(g_conn->fi);
OSMO_ASSERT(g_conn->vsub);
VERBOSE_ASSERT(cm_service_result_sent, == RES_NONE, "%d");
VERBOSE_ASSERT(auth_request_sent, == true, "%d");
@ -355,7 +355,7 @@ static void test_call_mo_to_unknown()
"03575886" /* classmark 2 */
"089910070000106005" /* IMSI */);
OSMO_ASSERT(g_conn);
OSMO_ASSERT(g_conn->conn_fsm);
OSMO_ASSERT(g_conn->fi);
OSMO_ASSERT(g_conn->vsub);
VERBOSE_ASSERT(cm_service_result_sent, == RES_NONE, "%d");
VERBOSE_ASSERT(auth_request_sent, == true, "%d");
@ -434,7 +434,7 @@ static void test_call_mo_to_unknown_timeout()
"03575886" /* classmark 2 */
"089910070000106005" /* IMSI */);
OSMO_ASSERT(g_conn);
OSMO_ASSERT(g_conn->conn_fsm);
OSMO_ASSERT(g_conn->fi);
OSMO_ASSERT(g_conn->vsub);
VERBOSE_ASSERT(cm_service_result_sent, == RES_NONE, "%d");
VERBOSE_ASSERT(auth_request_sent, == true, "%d");

View File

@ -99,7 +99,7 @@ static void test_gsm_authen()
cm_service_result_sent = RES_NONE;
ms_sends_msg("05247803305886089910070000006402");
OSMO_ASSERT(g_conn);
OSMO_ASSERT(g_conn->conn_fsm);
OSMO_ASSERT(g_conn->fi);
OSMO_ASSERT(g_conn->vsub);
VERBOSE_ASSERT(cm_service_result_sent, == RES_NONE, "%d");
VERBOSE_ASSERT(auth_request_sent, == true, "%d");
@ -316,7 +316,7 @@ static void test_gsm_authen_tmsi()
cm_service_result_sent = RES_NONE;
ms_sends_msg("05247803305886" "05f4" "03020100");
OSMO_ASSERT(g_conn);
OSMO_ASSERT(g_conn->conn_fsm);
OSMO_ASSERT(g_conn->fi);
OSMO_ASSERT(g_conn->vsub);
VERBOSE_ASSERT(cm_service_result_sent, == RES_NONE, "%d");
VERBOSE_ASSERT(auth_request_sent, == true, "%d");
@ -804,7 +804,7 @@ static void test_gsm_milenage_authen()
"03305886" /* classmark 2: GSM phase 2 */
"089910070000106005" /* IMSI */);
OSMO_ASSERT(g_conn);
OSMO_ASSERT(g_conn->conn_fsm);
OSMO_ASSERT(g_conn->fi);
OSMO_ASSERT(g_conn->vsub);
VERBOSE_ASSERT(cm_service_result_sent, == RES_NONE, "%d");
VERBOSE_ASSERT(auth_request_sent, == true, "%d");

View File

@ -101,7 +101,7 @@ static void test_ciph()
auth_request_expect_rand = "12aca96fb4ffdea5c985cbafa9b6e18b";
ms_sends_msg("05247803305886089910070000006402");
OSMO_ASSERT(g_conn);
OSMO_ASSERT(g_conn->conn_fsm);
OSMO_ASSERT(g_conn->fi);
OSMO_ASSERT(g_conn->vsub);
VERBOSE_ASSERT(auth_request_sent, == true, "%d");
VERBOSE_ASSERT(cm_service_result_sent, == RES_NONE, "%d");
@ -340,7 +340,7 @@ static void test_ciph_tmsi()
auth_request_expect_autn = NULL;
ms_sends_msg("05247803305886" "05f4" "03020100");
OSMO_ASSERT(g_conn);
OSMO_ASSERT(g_conn->conn_fsm);
OSMO_ASSERT(g_conn->fi);
OSMO_ASSERT(g_conn->vsub);
VERBOSE_ASSERT(auth_request_sent, == true, "%d");
VERBOSE_ASSERT(cm_service_result_sent, == RES_NONE, "%d");
@ -934,7 +934,7 @@ static void test_gsm_ciph_in_umts_env()
"03575886" /* classmark 2 */
"089910070000106005" /* IMSI */);
OSMO_ASSERT(g_conn);
OSMO_ASSERT(g_conn->conn_fsm);
OSMO_ASSERT(g_conn->fi);
OSMO_ASSERT(g_conn->vsub);
VERBOSE_ASSERT(cm_service_result_sent, == RES_NONE, "%d");
VERBOSE_ASSERT(auth_request_sent, == true, "%d");

View File

@ -148,7 +148,7 @@ static void test_ms_timeout_cm_auth_resp()
cm_service_result_sent = RES_NONE;
ms_sends_msg("05247803305886089910070000006402");
OSMO_ASSERT(g_conn);
OSMO_ASSERT(g_conn->conn_fsm);
OSMO_ASSERT(g_conn->fi);
OSMO_ASSERT(g_conn->vsub);
VERBOSE_ASSERT(cm_service_result_sent, == RES_NONE, "%d");
VERBOSE_ASSERT(auth_request_sent, == true, "%d");

View File

@ -65,7 +65,7 @@ static void test_no_authen()
cm_service_result_sent = RES_NONE;
ms_sends_msg("05247803305886089910070000006402");
OSMO_ASSERT(g_conn);
OSMO_ASSERT(g_conn->conn_fsm);
OSMO_ASSERT(g_conn->fi);
OSMO_ASSERT(g_conn->vsub);
VERBOSE_ASSERT(cm_service_result_sent, == RES_ACCEPT, "%d");
EXPECT_ACCEPTED(true);
@ -227,7 +227,7 @@ static void test_no_authen_tmsi()
cm_service_result_sent = RES_NONE;
ms_sends_msg("05247803305886" "05f4" "03020100");
OSMO_ASSERT(g_conn);
OSMO_ASSERT(g_conn->conn_fsm);
OSMO_ASSERT(g_conn->fi);
OSMO_ASSERT(g_conn->vsub);
VERBOSE_ASSERT(cm_service_result_sent, == RES_ACCEPT, "%d");
EXPECT_ACCEPTED(true);

View File

@ -109,7 +109,7 @@ static void _normal_cm_service_req()
cm_service_result_sent = RES_NONE;
ms_sends_msg("05247803305886089910070000006402");
OSMO_ASSERT(g_conn);
OSMO_ASSERT(g_conn->conn_fsm);
OSMO_ASSERT(g_conn->fi);
OSMO_ASSERT(g_conn->vsub);
VERBOSE_ASSERT(cm_service_result_sent, == RES_ACCEPT, "%d");
EXPECT_ACCEPTED(true);

View File

@ -36,8 +36,8 @@ static void test_early_stage()
btw("conn_fsm present, in state NEW");
OSMO_ASSERT(msc_create_conn_fsm(g_conn, "test") == 0);
OSMO_ASSERT(g_conn->conn_fsm);
OSMO_ASSERT(g_conn->conn_fsm->state == SUBSCR_CONN_S_NEW);
OSMO_ASSERT(g_conn->fi);
OSMO_ASSERT(g_conn->fi->state == SUBSCR_CONN_S_NEW);
EXPECT_ACCEPTED(false);
thwart_rx_non_initial_requests();
@ -48,13 +48,13 @@ static void test_early_stage()
OSMO_ASSERT(g_conn->vsub);
/* mark as silent call so it sticks around */
g_conn->silent_call = 1;
osmo_fsm_inst_state_chg(g_conn->conn_fsm, SUBSCR_CONN_S_ACCEPTED, 0, 0);
osmo_fsm_inst_state_chg(g_conn->fi, SUBSCR_CONN_S_ACCEPTED, 0, 0);
EXPECT_CONN_COUNT(1);
EXPECT_ACCEPTED(true);
btw("CLOSE event marks conn_fsm as released and frees the conn");
expect_bssap_clear();
osmo_fsm_inst_dispatch(g_conn->conn_fsm, SUBSCR_CONN_E_CN_CLOSE, NULL);
osmo_fsm_inst_dispatch(g_conn->fi, SUBSCR_CONN_E_CN_CLOSE, NULL);
VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
EXPECT_CONN_COUNT(0);

View File

@ -196,7 +196,7 @@ static void _test_umts_authen(enum ran_type via_ran)
"03575886" /* classmark 2 */
"089910070000106005" /* IMSI */);
OSMO_ASSERT(g_conn);
OSMO_ASSERT(g_conn->conn_fsm);
OSMO_ASSERT(g_conn->fi);
OSMO_ASSERT(g_conn->vsub);
VERBOSE_ASSERT(cm_service_result_sent, == RES_NONE, "%d");
VERBOSE_ASSERT(auth_request_sent, == true, "%d");