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/.
fixeria gerrit-no-reply at lists.osmocom.orgfixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/25674 ) Change subject: rsl: prevent race condition during timeslot re-configuration ...................................................................... rsl: prevent race condition during timeslot re-configuration Change-Id: Ia625c2827fca883ea712076706d5ef21ed793ba6 Fixes: OS#5245 --- M include/osmo-bts/gsm_data.h M src/common/rsl.c 2 files changed, 22 insertions(+), 19 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/74/25674/1 diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h index fe2862d..e77dc02 100644 --- a/include/osmo-bts/gsm_data.h +++ b/include/osmo-bts/gsm_data.h @@ -407,6 +407,8 @@ int s; /* Kind of the release/activation. E.g. RSL or PCU */ enum lchan_rel_act_kind rel_act_kind; + /* RSL CHANnel ACTIVation message */ + struct msgb *rsl_chan_activ; /* RTP header Marker bit to indicate beginning of speech after pause */ bool rtp_tx_marker; @@ -468,7 +470,6 @@ struct { enum gsm_phys_chan_config pchan_is; enum gsm_phys_chan_config pchan_want; - struct msgb *pending_chan_activ; } dyn; unsigned int flags; diff --git a/src/common/rsl.c b/src/common/rsl.c index 507a7cf..e88785c 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -1521,7 +1521,7 @@ * Store the CHAN_ACTIV msg, connect the L1 timeslot in the proper type and * then invoke rsl_rx_chan_activ() with msg. */ -static int dyn_ts_l1_reconnect(struct gsm_bts_trx_ts *ts, struct msgb *msg) +static int dyn_ts_l1_reconnect(struct gsm_bts_trx_ts *ts) { DEBUGP(DRSL, "%s dyn_ts_l1_reconnect\n", gsm_ts_and_pchan_name(ts)); @@ -1542,9 +1542,6 @@ return -EINVAL; } - /* We will feed this back to rsl_rx_chan_activ() later */ - ts->dyn.pending_chan_activ = msg; - /* Disconnect, continue connecting from cb_ts_disconnected(). */ DEBUGP(DRSL, "%s Disconnect\n", gsm_ts_and_pchan_name(ts)); return bts_model_ts_disconnect(ts); @@ -1643,9 +1640,12 @@ * mode than this activation needs it to be. * Re-connect, then come back to rsl_rx_chan_activ(). */ - rc = dyn_ts_l1_reconnect(ts, msg); + rc = dyn_ts_l1_reconnect(ts); if (rc) return rsl_tx_chan_act_nack(lchan, RSL_ERR_NORMAL_UNSPEC); + /* will be fed back to rsl_rx_chan_activ() later */ + OSMO_ASSERT(lchan->rsl_chan_activ == NULL); + lchan->rsl_chan_activ = msg; /* indicate that the msgb should not be freed. */ return 1; } @@ -3231,8 +3231,7 @@ static void osmo_dyn_ts_connected(struct gsm_bts_trx_ts *ts, int rc) { - struct msgb *msg = ts->dyn.pending_chan_activ; - ts->dyn.pending_chan_activ = NULL; + unsigned int ln; if (rc) { LOGP(DRSL, LOGL_NOTICE, "%s PDCH ACT OSMO operation failed (%d) in bts model\n", @@ -3241,20 +3240,23 @@ return; } - if (!msg) { - LOGP(DRSL, LOGL_ERROR, - "%s TS re-connected, but no chan activ msg pending\n", - gsm_ts_and_pchan_name(ts)); - return; - } - ts->dyn.pchan_is = ts->dyn.pchan_want; DEBUGP(DRSL, "%s Connected\n", gsm_ts_and_pchan_name(ts)); - /* continue where we left off before re-connecting the TS. */ - rc = rsl_rx_chan_activ(msg); - if (rc != 1) - msgb_free(msg); + /* Handle postponed RSL CHANnel ACTIVation messages (if any) */ + for (ln = 0; ln < ARRAY_SIZE(ts->lchan); ln++) { + struct gsm_lchan *lchan = &ts->lchan[ln]; + + if (lchan->rsl_chan_activ == NULL) + continue; + + struct msgb *msg = lchan->rsl_chan_activ; + lchan->rsl_chan_activ = NULL; + + /* Continue where we left off before re-connecting the TS */ + if (rsl_rx_chan_activ(msg) != 1) + msgb_free(msg); + } } void cb_ts_connected(struct gsm_bts_trx_ts *ts, int rc) -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/25674 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: Ia625c2827fca883ea712076706d5ef21ed793ba6 Gerrit-Change-Number: 25674 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211003/6e9d720f/attachment.htm>