host/trxcon/scheduler: inform L2&3 about decoding errors

Previously, we used to drop a frame if decoding wasn't successful.
This way, the higher layers didn't even know about that, so the
local counters and Measurement Reports were incomplete.

This change makes scheduler to forward L2 frames in any case,
setting the num_biterr for each of them. In case of decoding
error, a dummy (payload filled by 0x00) L2 frame will be sent.

Change-Id: I31011d8f3ca8b9a12474cd0bc653faed18391033
This commit is contained in:
Vadim Yanitskiy 2017-12-16 16:21:05 +07:00
parent 9b511668a4
commit a9c2ef2638
4 changed files with 21 additions and 10 deletions

View File

@ -26,6 +26,7 @@
#include <string.h>
#include <talloc.h>
#include <stdint.h>
#include <stdbool.h>
#include <arpa/inet.h>
@ -80,7 +81,8 @@ const uint8_t sched_nb_training_bits[8][26] = {
};
int sched_send_data_ind(struct trx_instance *trx, struct trx_ts *ts,
struct trx_lchan_state *lchan, uint8_t *l2, size_t l2_len)
struct trx_lchan_state *lchan, uint8_t *l2, size_t l2_len,
bool dec_failed, int bit_error_count)
{
const struct trx_lchan_desc *lchan_desc;
struct l1ctl_info_dl *data;
@ -99,14 +101,18 @@ int sched_send_data_ind(struct trx_instance *trx, struct trx_ts *ts,
data->band_arfcn = htons(trx->band_arfcn);
data->frame_nr = htonl(lchan->rx_first_fn);
data->rx_level = -(lchan->meas.rssi_sum / lchan->meas.rssi_num);
data->num_biterr = bit_error_count;
/* FIXME: set proper values */
data->num_biterr = 0;
data->fire_crc = 0;
data->snr = 0;
/* Fill in the payload */
memcpy(data->payload, l2, l2_len);
if (dec_failed) {
/* Mark frame as broken */
data->fire_crc = 2;
} else {
/* Fill in the payload */
memcpy(data->payload, l2, l2_len);
}
/* Put a packet to higher layers */
l1ctl_tx_data_ind(trx->l1l, data, l2_len == GSM_MACBLOCK_LEN ?

View File

@ -149,7 +149,9 @@ int rx_tchf_fn(struct trx_instance *trx, struct trx_ts *ts,
l2_len = sched_bad_frame_ind(l2, rsl_cmode, tch_mode);
} else if (rc == GSM_MACBLOCK_LEN) {
/* FACCH received, forward it to the higher layers */
sched_send_data_ind(trx, ts, lchan, l2, GSM_MACBLOCK_LEN);
sched_send_data_ind(trx, ts, lchan,
l2, GSM_MACBLOCK_LEN, false, n_errors);
/* Send BFI instead of stolen TCH frame */
l2_len = sched_bad_frame_ind(l2, rsl_cmode, tch_mode);
} else {
@ -159,7 +161,8 @@ int rx_tchf_fn(struct trx_instance *trx, struct trx_ts *ts,
/* Send a traffic frame to the higher layers */
if (l2_len > 0)
sched_send_data_ind(trx, ts, lchan, l2, l2_len);
sched_send_data_ind(trx, ts, lchan,
l2, l2_len, false, n_errors);
return 0;
}

View File

@ -108,11 +108,11 @@ int rx_data_fn(struct trx_instance *trx, struct trx_ts *ts,
(*first_fn) % ts->mf_layout->period,
ts->mf_layout->period,
lchan_desc->name);
return rc;
}
/* Send a L2 frame to the higher layers */
sched_send_data_ind(trx, ts, lchan, l2, GSM_MACBLOCK_LEN);
sched_send_data_ind(trx, ts, lchan,
l2, GSM_MACBLOCK_LEN, rc != 0, n_errors);
/* TODO: AGC, TA loops */
return 0;

View File

@ -1,6 +1,7 @@
#pragma once
#include <stdint.h>
#include <stdbool.h>
#include <osmocom/core/bits.h>
#include <osmocom/core/utils.h>
@ -277,6 +278,7 @@ extern const uint8_t sched_nb_training_bits[8][26];
size_t sched_bad_frame_ind(uint8_t *l2, uint8_t rsl_cmode, uint8_t tch_mode);
int sched_send_data_ind(struct trx_instance *trx, struct trx_ts *ts,
struct trx_lchan_state *lchan, uint8_t *l2, size_t l2_len);
struct trx_lchan_state *lchan, uint8_t *l2, size_t l2_len,
bool dec_failed, int bit_error_count);
int sched_send_data_conf(struct trx_instance *trx, struct trx_ts *ts,
struct trx_lchan_state *lchan, uint32_t fn, size_t l2_len);