diff options
author | Vadim Yanitskiy <axilirator@gmail.com> | 2018-08-15 07:56:42 +0700 |
---|---|---|
committer | Vadim Yanitskiy <axilirator@gmail.com> | 2018-08-15 08:20:41 +0700 |
commit | 3cbbe81b632c3ae16a070951336cb6052cb56126 (patch) | |
tree | e2c3da4e60da3a7ea569fe382c934d900f1b42e7 | |
parent | 0f2b894580e2e8d9d01aa63521c213b5a82f231b (diff) |
trxcon/scheduler: pass lchan to sched_bad_frame_ind()
Instead of passing the information about a logical channel, it
makes sense to pass the pointer to its state where everything
is stored. This approach would allow to avoid adding more
arguments every time, e.g. in case of AMR.
Change-Id: I91fe86fef43aac68776a58c9acc37ef2a9ee8042
-rw-r--r-- | src/host/trxcon/sched_lchan_common.c | 12 | ||||
-rw-r--r-- | src/host/trxcon/sched_lchan_tchf.c | 2 | ||||
-rw-r--r-- | src/host/trxcon/sched_prim.c | 8 | ||||
-rw-r--r-- | src/host/trxcon/sched_trx.h | 2 |
4 files changed, 10 insertions, 14 deletions
diff --git a/src/host/trxcon/sched_lchan_common.c b/src/host/trxcon/sched_lchan_common.c index 47b01621..03cdc67c 100644 --- a/src/host/trxcon/sched_lchan_common.c +++ b/src/host/trxcon/sched_lchan_common.c @@ -139,17 +139,17 @@ int sched_send_dt_conf(struct trx_instance *trx, struct trx_ts *ts, * Composes a bad frame indication message * according to the current tch_mode. * - * @param l2 Pointer to allocated byte array - * @param tch_mode Current TCH mode + * @param l2 Caller-allocated byte array + * @param lchan Logical channel to generate BFI for * @return How much bytes were written */ -size_t sched_bad_frame_ind(uint8_t *l2, uint8_t rsl_cmode, uint8_t tch_mode) +size_t sched_bad_frame_ind(uint8_t *l2, struct trx_lchan_state *lchan) { /* BFI is only required for speech */ - if (rsl_cmode != RSL_CMOD_SPD_SPEECH) + if (lchan->rsl_cmode != RSL_CMOD_SPD_SPEECH) return 0; - switch (tch_mode) { + switch (lchan->tch_mode) { case GSM48_CMODE_SIGN: case GSM48_CMODE_SPEECH_V1: /* Full Rate */ memset(l2, 0x00, GSM_FR_BYTES); @@ -163,7 +163,7 @@ size_t sched_bad_frame_ind(uint8_t *l2, uint8_t rsl_cmode, uint8_t tch_mode) /* FIXME: AMR is not implemented yet */ return 0; default: - LOGP(DSCH, LOGL_ERROR, "Invalid TCH mode: %u\n", tch_mode); + LOGP(DSCH, LOGL_ERROR, "Invalid TCH mode: %u\n", lchan->tch_mode); return 0; } } diff --git a/src/host/trxcon/sched_lchan_tchf.c b/src/host/trxcon/sched_lchan_tchf.c index e20b461f..86cdb12b 100644 --- a/src/host/trxcon/sched_lchan_tchf.c +++ b/src/host/trxcon/sched_lchan_tchf.c @@ -166,7 +166,7 @@ int rx_tchf_fn(struct trx_instance *trx, struct trx_ts *ts, bfi: /* Bad frame indication */ - l2_len = sched_bad_frame_ind(l2, rsl_cmode, tch_mode); + l2_len = sched_bad_frame_ind(l2, lchan); /* Didn't try to decode */ if (n_errors < 0) diff --git a/src/host/trxcon/sched_prim.c b/src/host/trxcon/sched_prim.c index acd08bf1..2aeaa5de 100644 --- a/src/host/trxcon/sched_prim.c +++ b/src/host/trxcon/sched_prim.c @@ -373,12 +373,8 @@ int sched_prim_dummy(struct trx_lchan_state *lchan) * other channels: LAPDm fill frame. */ if (CHAN_IS_TCH(chan) && TCH_MODE_IS_SPEECH(tch_mode)) { - /** - * Silence frame indication - * HACK: use actual rsl_cmode! - */ - prim_len = sched_bad_frame_ind(prim_buffer, - RSL_CMOD_SPD_SPEECH, tch_mode); + /* Bad frame indication */ + prim_len = sched_bad_frame_ind(prim_buffer, lchan); } else if (CHAN_IS_TCH(chan) && TCH_MODE_IS_DATA(tch_mode)) { /* FIXME: should we do anything for CSD? */ return 0; diff --git a/src/host/trxcon/sched_trx.h b/src/host/trxcon/sched_trx.h index f3fa9df0..2aafbf06 100644 --- a/src/host/trxcon/sched_trx.h +++ b/src/host/trxcon/sched_trx.h @@ -317,7 +317,7 @@ int sched_trx_handle_tx_burst(struct trx_instance *trx, /* Shared declarations for lchan handlers */ 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); +size_t sched_bad_frame_ind(uint8_t *l2, struct trx_lchan_state *lchan); int sched_send_dt_ind(struct trx_instance *trx, struct trx_ts *ts, struct trx_lchan_state *lchan, uint8_t *l2, size_t l2_len, int bit_error_count, bool dec_failed, bool traffic); |