summaryrefslogtreecommitdiff
path: root/cesar/ce/rx/bitloading
diff options
context:
space:
mode:
authorYacine Belkadi2011-12-21 10:30:51 +0100
committerYacine Belkadi2012-01-12 10:22:31 +0100
commitd2617fdde159644deda9fb9c7be6517251114112 (patch)
tree0d03bad6782050fc2d3869fe06671c57d461785e /cesar/ce/rx/bitloading
parent7ed7f5d2760322b8b33d75760b396d951c953690 (diff)
cesar/ce/rx/bl: BER means: ignore (1 good PB && PB < 1 symbol), closes #2755
If we have: - A channel with low SNR on the last carriers, which results in a tonemap where the last carriers have less good modulations than the previous carriers. - A traffic of small packets, which results in frames of only one PB where the PB doesn't occupy the whole symbol. then the BER means decrease and cause a CE restart. With this commit, the BER means are not updated for frames with only one good PB that occupied less than a symbol.
Diffstat (limited to 'cesar/ce/rx/bitloading')
-rw-r--r--cesar/ce/rx/bitloading/src/transition.c24
-rw-r--r--cesar/ce/rx/bitloading/test/src/test_fsm.c45
2 files changed, 62 insertions, 7 deletions
diff --git a/cesar/ce/rx/bitloading/src/transition.c b/cesar/ce/rx/bitloading/src/transition.c
index 1a2edb3ba5..0f08301454 100644
--- a/cesar/ce/rx/bitloading/src/transition.c
+++ b/cesar/ce/rx/bitloading/src/transition.c
@@ -302,6 +302,12 @@ ce_rx_bl_fsm__TRACKING__data (ce_rx_t *ce_rx,
{
tm = sta->rx_tonemaps->tm[measure->rx_params.tmi_av];
}
+ else
+ {
+ dbg_assert (measure->rx_params.tmi_av < PHY_MOD_ROBO_NB);
+ tm = &ce_rx->mac_config->tonemask_info.tonemap_robo[measure->
+ rx_params.tmi_av];
+ }
/* Increase CE statistics. */
/* If measure is a negotiated tone map. */
@@ -317,14 +323,20 @@ ce_rx_bl_fsm__TRACKING__data (ce_rx_t *ce_rx,
* FIXME: this will not work with intervals. */
if (sta->rx_tonemaps->default_tmi == measure->rx_params.tmi_av)
{
+ /* Because default_tmi == tmi_av, we necessarily have the
+ * corresponding tonemap. */
+ dbg_assert (tm);
+
ce_rx_bitloading_t *bl = &sta->ce_rx_bt;
dbg_assert (bl);
u8 good_pb_count = measure->total_pb_count - measure->false_pb_count;
u16 pb_size =
(measure->rx_params.pb_size == PHY_PB_SIZE_136 ? 136 : 520) * 8;
- /* Update BER sliding means. */
- if (good_pb_count)
+ /* Update BER sliding means. Except if the frame contained only one
+ * good PB, and it took less than one symbol. */
+ if (good_pb_count
+ && !(good_pb_count == 1 && pb_size < tm->bits_per_symbol))
ce_rx_bl_ber_sliding_mean_update
(bl, ce_rx_bl_ber_quantify
(measure->ber_sum, good_pb_count, pb_size));
@@ -385,11 +397,9 @@ ce_rx_bl_fsm__TRACKING__data (ce_rx_t *ce_rx,
or the tone map is not at the maximum
and not too soon. */
if ((!tm_is_negotiated
- ||
- ((tm)
- && (tm->bits_per_symbol
- < (ce_rx->mac_config->tonemask_info.carrier_nb
- * CE_BIT_PER_MOD[CE_MOD_COUNT - 1]))))
+ || (tm->bits_per_symbol <
+ (ce_rx->mac_config->tonemask_info.carrier_nb
+ * CE_BIT_PER_MOD[CE_MOD_COUNT - 1])))
&& lesseq_mod2p32
(bl->next_date_min_for_restart_rtc_date[1],
cyg_current_time ()))
diff --git a/cesar/ce/rx/bitloading/test/src/test_fsm.c b/cesar/ce/rx/bitloading/test/src/test_fsm.c
index 5b6504c56e..03c2a211d8 100644
--- a/cesar/ce/rx/bitloading/test/src/test_fsm.c
+++ b/cesar/ce/rx/bitloading/test/src/test_fsm.c
@@ -906,6 +906,51 @@ test_ce_rx_bl_fsm_base (test_t t)
ce_rx_bitloading_uninit (&sta.ce_rx_bt);
} test_end;
+ test_begin (t, "TRACKING, frame with only one good PB and size of "
+ "PB < tm.bits_per_symbol, no update of BER sliding means")
+ {
+ ce_rx_bitloading_init (&sta.ce_rx_bt);
+ test_ce_rx_bl_reset (&sta.ce_rx_bt);
+ test_ce_rx_bl_measure_empty (&measure);
+ measure.false_pb_count = 1;
+ measure.total_pb_count = 2;
+ tm.bits_per_symbol = PHY_CARRIER_NB
+ * CE_BIT_PER_MOD[CE_MOD_COUNT - 1];
+
+ s64 prev_ber_sliding_mean_fast =
+ sta.ce_rx_bt.ber_sliding_mean[CE_RX_BL_BER_SLIDING_MEAN_FAST] = 0x1;
+ s64 prev_ber_sliding_mean_slow =
+ sta.ce_rx_bt.ber_sliding_mean[CE_RX_BL_BER_SLIDING_MEAN_SLOW] = 0x2;
+
+ uint pos = 0;
+ scenario_test[pos++] = (scenario_entry_t)
+ SCENARIO_ACTION (TRACKING__data,
+ .sta = &sta,
+ .measure = measure,
+ .branch = ce_rx_bl_fsm_next_branch
+ (TRACKING, data, no_channel_change));
+
+ /* No SCENARIO_EVENT (ce_rx_bl_ber_sliding_mean_update) */
+
+ scenario_test[pos++] = (scenario_entry_t)
+ SCENARIO_EVENT (ce_rx_bl_pber_sliding_mean_update);
+ scenario_test[pos++] = (scenario_entry_t)
+ SCENARIO_END;
+
+ scenario_run (t, scenario_test, &globals);
+
+ /* Check that the BER sliding means have not been updated. */
+ test_fail_if (
+ sta.ce_rx_bt.ber_sliding_mean[CE_RX_BL_BER_SLIDING_MEAN_FAST]
+ != prev_ber_sliding_mean_fast);
+ test_fail_if (
+ sta.ce_rx_bt.ber_sliding_mean[CE_RX_BL_BER_SLIDING_MEAN_SLOW]
+ != prev_ber_sliding_mean_slow);
+
+ /* Clean. */
+ ce_rx_bitloading_uninit (&sta.ce_rx_bt);
+ }test_end;
+
}
int