ASCI: Get timing advance and TX power only when included

Instead of assuming that there are TX power and timing advance IEs
included in RSL message, check for existence.

gsm48_rr_rx_acch() may receive frames from FACCH that do not have these
IEs included in the message. These frames are UI frames on DCCH and Bter
frames. E.g. these frames are used on voice group channel to control
uplink.

Related: OS#5364
Change-Id: I87fcd44bba221ab4c5fbd2c79557db2444a10b88
This commit is contained in:
Andreas Eversberg 2023-08-23 11:23:49 +02:00 committed by jolly
parent 975351e250
commit 245b4b9238
1 changed files with 21 additions and 25 deletions

View File

@ -4875,32 +4875,7 @@ static int gsm48_rr_rx_pch_agch(struct osmocom_ms *ms, struct msgb *msg)
/* receive ACCH at RR layer */
static int gsm48_rr_rx_acch(struct osmocom_ms *ms, struct msgb *msg)
{
struct gsm48_rrlayer *rr = &ms->rrlayer;
struct gsm_settings *set = &ms->settings;
struct abis_rsl_rll_hdr *rllh = msgb_l2(msg);
struct gsm48_system_information_type_header *sih = msgb_l3(msg);
uint8_t ind_ta, ind_tx_power;
if (msgb_l2len(msg) < sizeof(*rllh) + 2 + 2) {
LOGP(DRR, LOGL_ERROR, "Missing TA and TX_POWER IEs\n");
return -EINVAL;
}
ind_ta = rllh->data[1];
ind_tx_power = rllh->data[3];
LOGP(DRR, LOGL_INFO, "DL SACCH indicates ta %d (actual ta %d)\n",
ind_ta, ind_ta - set->alter_delay);
LOGP(DRR, LOGL_INFO, "DL SACCH indicates tx_power %d\n",
ind_tx_power);
if (ind_ta != rr->cd_now.ind_ta
|| ind_tx_power != rr->cd_now.ind_tx_power) {
LOGP(DRR, LOGL_INFO, "Applying new ta and tx_power\n");
l1ctl_tx_param_req(ms, ind_ta - set->alter_delay,
(set->alter_tx_power) ? set->alter_tx_power_value
: ind_tx_power);
rr->cd_now.ind_ta = ind_ta;
rr->cd_now.ind_tx_power = ind_tx_power;
}
switch (sih->system_information) {
case GSM48_MT_RR_SYSINFO_5:
@ -4921,9 +4896,12 @@ static int gsm48_rr_rx_acch(struct osmocom_ms *ms, struct msgb *msg)
/* unit data from layer 2 to RR layer */
static int gsm48_rr_unit_data_ind(struct osmocom_ms *ms, struct msgb *msg)
{
struct gsm48_rrlayer *rr = &ms->rrlayer;
struct gsm322_cellsel *cs = &ms->cellsel;
struct gsm_settings *set = &ms->settings;
struct abis_rsl_rll_hdr *rllh = msgb_l2(msg);
struct tlv_parsed tv;
int ind_ta = -1, ind_tx_power = -1;
uint8_t ch_type, ch_subch, ch_ts;
DEBUGP(DRSL, "RSLms UNIT DATA IND chan_nr=0x%02x link_id=0x%02x\n",
@ -4934,6 +4912,24 @@ static int gsm48_rr_unit_data_ind(struct osmocom_ms *ms, struct msgb *msg)
return -EINVAL;
}
/* Update TX power and timing advance, if included in message. */
if (TLVP_PRES_LEN(&tv, RSL_IE_TIMING_ADVANCE, 1)) {
ind_ta = *TLVP_VAL(&tv, RSL_IE_TIMING_ADVANCE);
LOGP(DRR, LOGL_INFO, "DL SACCH indicates ta %d (actual ta %d)\n", ind_ta, ind_ta - set->alter_delay);
}
if (TLVP_PRES_LEN(&tv, RSL_IE_MS_POWER, 1)) {
ind_tx_power = *TLVP_VAL(&tv, RSL_IE_MS_POWER);
LOGP(DRR, LOGL_INFO, "DL SACCH indicates tx_power %d\n", ind_tx_power);
}
if ((ind_ta >= 0 && ind_ta != rr->cd_now.ind_ta) ||
(ind_tx_power >= 0 && ind_tx_power != rr->cd_now.ind_tx_power)) {
LOGP(DRR, LOGL_INFO, "Applying new ta and tx_power\n");
l1ctl_tx_param_req(ms, ind_ta - set->alter_delay,
(set->alter_tx_power) ? set->alter_tx_power_value : ind_tx_power);
rr->cd_now.ind_ta = ind_ta;
rr->cd_now.ind_tx_power = ind_tx_power;
}
if (!TLVP_PRESENT(&tv, RSL_IE_L3_INFO)) {
DEBUGP(DRSL, "UNIT_DATA_IND without L3 INFO ?!?\n");
return -EIO;