compl l3: populate conn's bsc subscr from MI

Set conn->bsub as indicated by the Mobile Identity. Now the
'log_set_context(LOG_CTX_BSC_SUBSCR, conn->bsub);' becomes useful.

Upcoming patch to support Perform Location Request will use the subscriber to
retrieve an already established conn via the bsub.

Drop fixme in gscon_fsm_init(), MI now extracted and id updated.

Change-Id: I00d4c7e8284b745368a432a7ec176aa99f79db47
diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c
index 6bfada3..95bbb12 100644
--- a/src/osmo-bsc/bsc_subscr_conn_fsm.c
+++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c
@@ -283,11 +283,6 @@
 	case GSCON_EV_A_CONN_REQ:
 		/* RLL ESTABLISH IND with initial L3 Message */
 		msg = data;
-		/* FIXME: Extract Mobile ID and update FSM using osmo_fsm_inst_set_id()
-		 * i.e. we will probably extract the mobile identity earlier, where the
-		 * imsi filter code is. Then we could just use it here.
-		 * related: OS#2969 */
-
 		rc = osmo_bsc_sigtran_open_conn(conn, msg);
 		if (rc < 0) {
 			osmo_fsm_inst_term(fi, OSMO_FSM_TERM_ERROR, NULL);
diff --git a/src/osmo-bsc/gsm_08_08.c b/src/osmo-bsc/gsm_08_08.c
index f290a48..4c53918 100644
--- a/src/osmo-bsc/gsm_08_08.c
+++ b/src/osmo-bsc/gsm_08_08.c
@@ -432,6 +432,7 @@
 int bsc_compl_l3(struct gsm_lchan *lchan, struct msgb *msg, uint16_t chosen_channel)
 {
 	struct gsm_subscriber_connection *conn;
+	struct bsc_subscr *bsub = NULL;
 	struct bsc_msc_data *msc;
 	struct msgb *create_l3;
 	struct gsm0808_speech_codec_list scl;
@@ -462,6 +463,8 @@
 		 * all, should happen in a separate patch.
 		 * See e.g.  BSC_Tests.TC_chan_rel_rll_rel_ind: "dt := * f_est_dchan('23'O, 23, '00010203040506'O);"
 		 */
+	} else {
+		bsub = bsc_subscr_find_or_create_by_mi(bsc_gsmnet->bsc_subscribers, &mi);
 	}
 
 	/* allocate a new connection */
@@ -470,6 +473,10 @@
 		LOG_COMPL_L3(pdisc, mtype, LOGL_ERROR, "Failed to allocate conn\n");
 		goto early_fail;
 	}
+	if (bsub) {
+		/* pass bsub use count to conn */
+		conn->bsub = bsub;
+	}
 	gscon_change_primary_lchan(conn, lchan);
 	gscon_update_id(conn);