diff options
Diffstat (limited to 'openbsc/src/libbsc/bsc_api.c')
-rw-r--r-- | openbsc/src/libbsc/bsc_api.c | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/openbsc/src/libbsc/bsc_api.c b/openbsc/src/libbsc/bsc_api.c index b8b596782..a72f15121 100644 --- a/openbsc/src/libbsc/bsc_api.c +++ b/openbsc/src/libbsc/bsc_api.c @@ -39,7 +39,7 @@ #define GSM0808_T10_VALUE 6, 0 -static LLIST_HEAD(sub_connections); +static LLIST_HEAD(sub_connections); /* FIXME move to libmsc */ static void rll_ind_cb(struct gsm_lchan *, uint8_t, void *, enum bsc_rllr_ind); static void send_sapi_reject(struct gsm_subscriber_connection *conn, int link_id); @@ -147,7 +147,7 @@ static void assignment_t10_timeout(void *_conn) conn->secondary_lchan = NULL; /* inform them about the failure */ - api = conn->bts->network->bsc_api; + api = conn->network->bsc_api; api->assign_fail(conn, GSM0808_CAUSE_NO_RADIO_RESOURCE_AVAILABLE, NULL); } @@ -158,7 +158,7 @@ static void handle_mr_config(struct gsm_subscriber_connection *conn, struct gsm_lchan *lchan, int full_rate) { struct bsc_api *api; - api = conn->bts->network->bsc_api; + api = conn->network->bsc_api; struct amr_multirate_conf *mr; struct gsm48_multi_rate_conf *mr_conf; @@ -204,7 +204,8 @@ static int handle_new_assignment(struct gsm_subscriber_connection *conn, int cha chan_type = full_rate ? GSM_LCHAN_TCH_F : GSM_LCHAN_TCH_H; - new_lchan = lchan_alloc(conn->bts, chan_type, 0); + struct gsm_bts *bts = conn->lchan->ts->trx->bts; // MSCPLIT ?? + new_lchan = lchan_alloc(bts, chan_type, 0); if (!new_lchan) { LOGP(DMSC, LOGL_NOTICE, "No free channel.\n"); @@ -239,24 +240,25 @@ static int handle_new_assignment(struct gsm_subscriber_connection *conn, int cha return 0; } -struct gsm_subscriber_connection *subscr_con_allocate(struct gsm_lchan *lchan) +struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_lchan *lchan) { struct gsm_subscriber_connection *conn; + struct gsm_network *network = lchan->ts->trx->bts->network; - conn = talloc_zero(lchan->ts->trx->bts->network, struct gsm_subscriber_connection); + conn = talloc_zero(network, struct gsm_subscriber_connection); if (!conn) return NULL; /* Configure the time and start it so it will be closed */ + /* FIXME: above comment is weird in at least two ways */ + conn->network = network; conn->lchan = lchan; - conn->bts = lchan->ts->trx->bts; lchan->conn = conn; - llist_add_tail(&conn->entry, &sub_connections); + llist_add_tail(&conn->entry, &network->subscr_conns); return conn; } -/* TODO: move subscriber put here... */ -void subscr_con_free(struct gsm_subscriber_connection *conn) +void bsc_subscr_con_free(struct gsm_subscriber_connection *conn) { if (!conn) return; @@ -387,7 +389,7 @@ static int chan_compat_with_mode(struct gsm_lchan *lchan, int chan_mode, int ful int gsm0808_assign_req(struct gsm_subscriber_connection *conn, int chan_mode, int full_rate) { struct bsc_api *api; - api = conn->bts->network->bsc_api; + api = conn->network->bsc_api; if (!chan_compat_with_mode(conn->lchan, chan_mode, full_rate)) { if (handle_new_assignment(conn, chan_mode, full_rate) != 0) @@ -424,7 +426,7 @@ static void handle_ass_compl(struct gsm_subscriber_connection *conn, struct msgb *msg) { struct gsm48_hdr *gh; - struct bsc_api *api = conn->bts->network->bsc_api; + struct bsc_api *api = conn->network->bsc_api; if (conn->secondary_lchan != msg->lchan) { LOGP(DMSC, LOGL_ERROR, "Assignment Compl should occur on second lchan.\n"); @@ -439,8 +441,13 @@ static void handle_ass_compl(struct gsm_subscriber_connection *conn, } /* switch TRAU muxer for E1 based BTS from one channel to another */ +#if BEFORE_MSCSPLIT if (is_e1_bts(conn->bts)) switch_trau_mux(conn->lchan, conn->secondary_lchan); +#else + if (is_e1_bts(conn->lchan->ts->trx->bts)) + switch_trau_mux(conn->lchan, conn->secondary_lchan); +#endif /* swap channels */ osmo_timer_del(&conn->T10); @@ -449,7 +456,7 @@ static void handle_ass_compl(struct gsm_subscriber_connection *conn, conn->lchan = conn->secondary_lchan; conn->secondary_lchan = NULL; - if (is_ipaccess_bts(conn->bts) && conn->lchan->tch_mode != GSM48_CMODE_SIGN) + if (is_ipaccess_bts(conn->lchan->ts->trx->bts) && conn->lchan->tch_mode != GSM48_CMODE_SIGN) rsl_ipacc_crcx(conn->lchan); api->assign_compl(conn, gh->data[0], @@ -461,7 +468,7 @@ static void handle_ass_compl(struct gsm_subscriber_connection *conn, static void handle_ass_fail(struct gsm_subscriber_connection *conn, struct msgb *msg) { - struct bsc_api *api = conn->bts->network->bsc_api; + struct bsc_api *api = conn->network->bsc_api; uint8_t *rr_failure; struct gsm48_hdr *gh; @@ -656,7 +663,8 @@ static void dispatch_dtap(struct gsm_subscriber_connection *conn, } } -/*! \brief RSL has received a DATA INDICATION with L3 from MS */ +/*! \brief RSL has received a DATA INDICATION with L3 from MS. + * (for Iu-CS see gsm0408_rcvmsg_iucs()) */ int gsm0408_rcvmsg(struct msgb *msg, uint8_t link_id) { int rc; @@ -678,7 +686,7 @@ int gsm0408_rcvmsg(struct msgb *msg, uint8_t link_id) } else { /* allocate a new connection */ rc = BSC_API_CONN_POL_REJECT; - lchan->conn = subscr_con_allocate(msg->lchan); + lchan->conn = bsc_subscr_con_allocate(msg->lchan); if (!lchan->conn) { lchan_release(lchan, 1, RSL_REL_NORMAL); return -1; @@ -689,7 +697,7 @@ int gsm0408_rcvmsg(struct msgb *msg, uint8_t link_id) if (rc != BSC_API_CONN_POL_ACCEPT) { lchan->conn->lchan = NULL; - subscr_con_free(lchan->conn); + bsc_subscr_con_free(lchan->conn); lchan_release(lchan, 1, RSL_REL_NORMAL); } } @@ -737,7 +745,6 @@ int gsm0808_clear(struct gsm_subscriber_connection *conn) conn->lchan = NULL; conn->secondary_lchan = NULL; conn->ho_lchan = NULL; - conn->bts = NULL; osmo_timer_del(&conn->T10); @@ -751,7 +758,7 @@ static void send_sapi_reject(struct gsm_subscriber_connection *conn, int link_id if (!conn) return; - api = conn->bts->network->bsc_api; + api = conn->network->bsc_api; if (!api || !api->sapi_n_reject) return; @@ -848,7 +855,7 @@ static void handle_release(struct gsm_subscriber_connection *conn, gsm0808_clear(conn); if (destruct) - subscr_con_free(conn); + bsc_subscr_con_free(conn); } static void handle_chan_ack(struct gsm_subscriber_connection *conn, @@ -877,7 +884,3 @@ static __attribute__((constructor)) void on_dso_load_bsc(void) osmo_signal_register_handler(SS_LCHAN, bsc_handle_lchan_signal, NULL); } -struct llist_head *bsc_api_sub_connections(struct gsm_network *net) -{ - return &sub_connections; -} |