summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cesar/ce/rx/bitloading/bitloading.h29
-rw-r--r--cesar/ce/rx/bitloading/src/bitloading.c24
-rw-r--r--cesar/ce/rx/bitloading/test/src/test_bl.c6
-rw-r--r--cesar/ce/rx/bitloading/test/src/test_fsm.c24
-rw-r--r--cesar/ce/rx/src/rx.c4
5 files changed, 58 insertions, 29 deletions
diff --git a/cesar/ce/rx/bitloading/bitloading.h b/cesar/ce/rx/bitloading/bitloading.h
index 375a38a2a8..ae362549d1 100644
--- a/cesar/ce/rx/bitloading/bitloading.h
+++ b/cesar/ce/rx/bitloading/bitloading.h
@@ -22,6 +22,8 @@
#include "lib/blk.h"
#include "lib/blk_table.h"
+#include "common/module.h"
+
/**
* Maximum value of the PB error rate sliding mean.
*/
@@ -150,7 +152,7 @@ typedef struct ce_rx_bitloading_t
/** Statistics of the bit-loading. */
ce_rx_bitloading_stats_t stats;
/** PB Error Rate sliding mean. */
- int pber_sliding_mean;
+ uint pber_sliding_mean;
} ce_rx_bitloading_t;
/**
@@ -177,6 +179,11 @@ extern uint ce_rx_bl_min_frame_with_high_pb_err_rate_;
extern uint ce_rx_bl_ber_lower_bound_;
#define CE_RX_BL_BER_LOWER_BOUND_UNIT (128)
+/**
+ * Initial value of PB error rate sliding mean.
+ */
+extern uint ce_rx_bl_pberr_mean_init_;
+
BEGIN_DECLS
/**
@@ -194,6 +201,22 @@ ce_rx_bl_ber_sliding_mean_reset (ce_rx_bitloading_t *bl)
}
/**
+ * Initialise PB error rate sliding means.
+ * \param bl the bit loading structure of the station
+ */
+extern inline void
+ce_rx_bl_pb_err_sliding_mean_reset (ce_rx_bitloading_t *bl)
+{
+ /* Check parameter. */
+ dbg_assert (bl);
+#if MODULE_INCLUDED (ce_rx_bitloading)
+ bl->pber_sliding_mean = ce_rx_bl_pberr_mean_init_;
+#else
+ bl->pber_sliding_mean = CE_RX_BL_UPDATE_PBER_SLIDING_MEAN_QUANTIFICATION;
+#endif
+}
+
+/**
* Initialize bit-loading statistics.
*/
extern inline void
@@ -238,7 +261,7 @@ ce_rx_bitloading_init (ce_rx_bitloading_t *bt)
ce_rx_bl_ber_sliding_mean_reset (bt);
ce_rx_bl_stats_init (bt);
bt->opti_table = NULL;
- bt->pber_sliding_mean = -1;
+ ce_rx_bl_pb_err_sliding_mean_reset (bt);
}
/**
@@ -280,7 +303,7 @@ ce_rx_bitloading_uninit (ce_rx_bitloading_t *bt)
if (bt->opti_table != NULL)
blk_table_free (bt->opti_table);
/* Clean PB Error Rate sliding mean. */
- bt->pber_sliding_mean = -1;
+ ce_rx_bl_pb_err_sliding_mean_reset (bt);
}
/**
diff --git a/cesar/ce/rx/bitloading/src/bitloading.c b/cesar/ce/rx/bitloading/src/bitloading.c
index 649fcb09c2..d09061fac6 100644
--- a/cesar/ce/rx/bitloading/src/bitloading.c
+++ b/cesar/ce/rx/bitloading/src/bitloading.c
@@ -30,6 +30,11 @@ uint ce_rx_bl_min_pb_per_frame_ = 2;
uint ce_rx_bl_min_frame_with_high_pb_err_rate_ = 4;
uint ce_rx_bl_ber_lower_bound_ = 70;
+/**
+ * According to TNS specification (revision r15409).
+ */
+uint ce_rx_bl_pberr_mean_init_ = 655;
+
blk_t *
ce_rx_bl_get_nsr (ce_rx_bitloading_t *bl)
{
@@ -552,6 +557,8 @@ ce_rx_bl_pber_sliding_mean_update (ce_rx_bitloading_t *bt,
dbg_assert (bt);
dbg_assert (pb_count > 0);
dbg_assert (false_pb_count <= pb_count);
+
+ /* Compute actual PB error rate quantified. */
/* The maximum pb_count value given by hardware can't be over
* MAC_MAX_PB_PER_MPDU. */
dbg_assert (pb_count <= MAC_MAX_PB_PER_MPDU);
@@ -559,15 +566,10 @@ ce_rx_bl_pber_sliding_mean_update (ce_rx_bitloading_t *bt,
* CE_RX_BL_UPDATE_PBER_SLIDING_MEAN_QUANTIFICATION / pb_count;
dbg_assert (pber_quantified
<= CE_RX_BL_UPDATE_PBER_SLIDING_MEAN_QUANTIFICATION);
- /* Init PB Error Rate sliding mean. */
- if (bt->pber_sliding_mean < 0)
- bt->pber_sliding_mean = pber_quantified;
- /* Add current measure. */
- else
- {
- dbg_assert (bt->pber_sliding_mean
- <= CE_RX_BL_UPDATE_PBER_SLIDING_MEAN_QUANTIFICATION);
- bt->pber_sliding_mean = (255 * bt->pber_sliding_mean
- + 1 * pber_quantified) / 256;
- }
+
+ /* Update PB error rate sliding mean. */
+ dbg_assert (bt->pber_sliding_mean
+ <= CE_RX_BL_UPDATE_PBER_SLIDING_MEAN_QUANTIFICATION);
+ bt->pber_sliding_mean = (255 * bt->pber_sliding_mean
+ + 1 * pber_quantified) / 256;
}
diff --git a/cesar/ce/rx/bitloading/test/src/test_bl.c b/cesar/ce/rx/bitloading/test/src/test_bl.c
index 8765953515..5a1e410d5d 100644
--- a/cesar/ce/rx/bitloading/test/src/test_bl.c
+++ b/cesar/ce/rx/bitloading/test/src/test_bl.c
@@ -1891,7 +1891,7 @@ int
test_suite_ce_rx_bl_pber_sliding_mean_update_function (int pber_sliding_mean,
uint pb_count,
uint false_pb_count,
- int supposed_new_pber)
+ uint supposed_new_pber)
{
/* Return 0 if test is ok and other value if the test fail.*/
ce_rx_bitloading_t bt;
@@ -1909,16 +1909,12 @@ test_suite_ce_rx_bl_pber_sliding_mean_update (test_t t)
test_begin (t, "test pber sliding mean.")
{
test_fail_if (test_suite_ce_rx_bl_pber_sliding_mean_update_function (
- -1, MAC_MAX_PB_PER_MPDU, 42, 11663));
- test_fail_if (test_suite_ce_rx_bl_pber_sliding_mean_update_function (
100, 1, 1, 355));
test_fail_if (test_suite_ce_rx_bl_pber_sliding_mean_update_function (
10000, 1, 0, 9960));
test_fail_if (test_suite_ce_rx_bl_pber_sliding_mean_update_function (
0, 100, 10, 25));
test_fail_if (test_suite_ce_rx_bl_pber_sliding_mean_update_function (
- -1, 1, 0, 0));
- test_fail_if (test_suite_ce_rx_bl_pber_sliding_mean_update_function (
65536, MAC_MAX_PB_PER_MPDU, MAC_MAX_PB_PER_MPDU, 65536));
test_fail_if (test_suite_ce_rx_bl_pber_sliding_mean_update_function (
65536, MAC_MAX_PB_PER_MPDU, 0, 65280));
diff --git a/cesar/ce/rx/bitloading/test/src/test_fsm.c b/cesar/ce/rx/bitloading/test/src/test_fsm.c
index 25b078fcdd..5b6504c56e 100644
--- a/cesar/ce/rx/bitloading/test/src/test_fsm.c
+++ b/cesar/ce/rx/bitloading/test/src/test_fsm.c
@@ -30,6 +30,9 @@
/* Generic ber value for not putting zero. */
#define CE_RX_BL_TEST_GENERIC_BER 0x4242
+/* Value of the PB error rate sliding mean. */
+#define CE_RX_BL_PBERR_MEAN 655
+
/* Update one field for both variables. */
#define CE_RX_BL_TEST_STATS_UPDATE_ONE_TEST(arg) stats.arg;
#define CE_RX_BL_TEST_STATS_UPDATE_ONE_ORI(arg) sta.ce_rx_bt.stats.arg;
@@ -47,6 +50,7 @@ uint ce_rx_bl_pb_total_factor_;
uint ce_rx_bl_min_pb_per_frame_;
uint ce_rx_bl_min_frame_with_high_pb_err_rate_;
uint ce_rx_bl_ber_lower_bound_ = 38;
+uint ce_rx_bl_pberr_mean_init_ = CE_RX_BL_PBERR_MEAN;
static uint const tmi_av = 24;
@@ -391,7 +395,7 @@ test_ce_rx_bl_fsm_base (test_t t)
= sta.ce_rx_bt.ber_sliding_mean[CE_RX_BL_BER_SLIDING_MEAN_SLOW],
curr_ber_mean[CE_RX_BL_BER_SLIDING_MEAN_FAST]
= sta.ce_rx_bt.ber_sliding_mean[CE_RX_BL_BER_SLIDING_MEAN_FAST],
- curr_pberr_rate_mean = -1);
+ curr_pberr_rate_mean = CE_RX_BL_PBERR_MEAN);
test_ce_rx_bl_stats (t, &stats, &sta.ce_rx_bt.stats);
/* Clean. */
ce_rx_bitloading_uninit (&sta.ce_rx_bt);
@@ -442,7 +446,7 @@ test_ce_rx_bl_fsm_base (test_t t)
= sta.ce_rx_bt.ber_sliding_mean[CE_RX_BL_BER_SLIDING_MEAN_SLOW],
curr_ber_mean[CE_RX_BL_BER_SLIDING_MEAN_FAST]
= sta.ce_rx_bt.ber_sliding_mean[CE_RX_BL_BER_SLIDING_MEAN_FAST],
- curr_pberr_rate_mean = -1);
+ curr_pberr_rate_mean = CE_RX_BL_PBERR_MEAN);
test_ce_rx_bl_stats (t, &stats, &sta.ce_rx_bt.stats);
/* Clean. */
ce_rx_bitloading_uninit (&sta.ce_rx_bt);
@@ -487,7 +491,7 @@ test_ce_rx_bl_fsm_base (test_t t)
= sta.ce_rx_bt.ber_sliding_mean[CE_RX_BL_BER_SLIDING_MEAN_SLOW],
curr_ber_mean[CE_RX_BL_BER_SLIDING_MEAN_FAST]
= sta.ce_rx_bt.ber_sliding_mean[CE_RX_BL_BER_SLIDING_MEAN_FAST],
- curr_pberr_rate_mean = -1);
+ curr_pberr_rate_mean = CE_RX_BL_PBERR_MEAN);
test_ce_rx_bl_stats (t, &stats, &sta.ce_rx_bt.stats);
/* Clean. */
ce_rx_bitloading_uninit (&sta.ce_rx_bt);
@@ -585,7 +589,7 @@ test_ce_rx_bl_fsm_base (test_t t)
= CE_RX_BL_TEST_GENERIC_BER,
curr_ber_mean[CE_RX_BL_BER_SLIDING_MEAN_FAST]
= CE_RX_BL_TEST_GENERIC_BER,
- curr_pberr_rate_mean = -1,
+ curr_pberr_rate_mean = CE_RX_BL_PBERR_MEAN,
last_restart_reason = CE_RX_BL_RESTART_REASON_PBERR_HIGH,
restart_reason[CE_RX_BL_RESTART_REASON_PBERR_HIGH]++,
prev_ber_mean[CE_RX_BL_BER_SLIDING_MEAN_SLOW]
@@ -640,7 +644,7 @@ test_ce_rx_bl_fsm_base (test_t t)
= sta.ce_rx_bt.ber_sliding_mean[CE_RX_BL_BER_SLIDING_MEAN_SLOW],
curr_ber_mean[CE_RX_BL_BER_SLIDING_MEAN_FAST]
= sta.ce_rx_bt.ber_sliding_mean[CE_RX_BL_BER_SLIDING_MEAN_FAST],
- curr_pberr_rate_mean = -1);
+ curr_pberr_rate_mean = CE_RX_BL_PBERR_MEAN);
test_ce_rx_bl_stats (t, &stats, &sta.ce_rx_bt.stats);
/* Clean. */
ce_rx_bitloading_uninit (&sta.ce_rx_bt);
@@ -691,7 +695,7 @@ test_ce_rx_bl_fsm_base (test_t t)
curr_nb_pb_crc_false = measure.false_pb_count,
curr_ber_mean[CE_RX_BL_BER_SLIDING_MEAN_SLOW] = 1,
curr_ber_mean[CE_RX_BL_BER_SLIDING_MEAN_FAST] = 1,
- curr_pberr_rate_mean = -1,
+ curr_pberr_rate_mean = CE_RX_BL_PBERR_MEAN,
last_restart_reason = CE_RX_BL_RESTART_REASON_BER_LOW,
restart_reason[CE_RX_BL_RESTART_REASON_BER_LOW]++,
prev_ber_mean[CE_RX_BL_BER_SLIDING_MEAN_SLOW]
@@ -745,7 +749,7 @@ test_ce_rx_bl_fsm_base (test_t t)
= sta.ce_rx_bt.ber_sliding_mean[CE_RX_BL_BER_SLIDING_MEAN_SLOW],
curr_ber_mean[CE_RX_BL_BER_SLIDING_MEAN_FAST]
= sta.ce_rx_bt.ber_sliding_mean[CE_RX_BL_BER_SLIDING_MEAN_FAST],
- curr_pberr_rate_mean = -1);
+ curr_pberr_rate_mean = CE_RX_BL_PBERR_MEAN);
test_ce_rx_bl_stats (t, &stats, &sta.ce_rx_bt.stats);
/* Clean. */
ce_rx_bitloading_uninit (&sta.ce_rx_bt);
@@ -795,7 +799,7 @@ test_ce_rx_bl_fsm_base (test_t t)
curr_nb_pb_crc_false = measure.false_pb_count,
curr_ber_mean[CE_RX_BL_BER_SLIDING_MEAN_SLOW] = 1,
curr_ber_mean[CE_RX_BL_BER_SLIDING_MEAN_FAST] = 1,
- curr_pberr_rate_mean = -1,
+ curr_pberr_rate_mean = CE_RX_BL_PBERR_MEAN,
last_restart_reason = CE_RX_BL_RESTART_REASON_BER_LOW,
restart_reason[CE_RX_BL_RESTART_REASON_BER_LOW]++,
prev_ber_mean[CE_RX_BL_BER_SLIDING_MEAN_SLOW]
@@ -849,7 +853,7 @@ test_ce_rx_bl_fsm_base (test_t t)
= sta.ce_rx_bt.ber_sliding_mean[CE_RX_BL_BER_SLIDING_MEAN_SLOW],
curr_ber_mean[CE_RX_BL_BER_SLIDING_MEAN_FAST]
= sta.ce_rx_bt.ber_sliding_mean[CE_RX_BL_BER_SLIDING_MEAN_FAST],
- curr_pberr_rate_mean = -1);
+ curr_pberr_rate_mean = CE_RX_BL_PBERR_MEAN);
test_ce_rx_bl_stats (t, &stats, &sta.ce_rx_bt.stats);
/* Clean. */
ce_rx_bitloading_uninit (&sta.ce_rx_bt);
@@ -896,7 +900,7 @@ test_ce_rx_bl_fsm_base (test_t t)
= sta.ce_rx_bt.ber_sliding_mean[CE_RX_BL_BER_SLIDING_MEAN_SLOW],
curr_ber_mean[CE_RX_BL_BER_SLIDING_MEAN_FAST]
= sta.ce_rx_bt.ber_sliding_mean[CE_RX_BL_BER_SLIDING_MEAN_FAST],
- curr_pberr_rate_mean = -1);
+ curr_pberr_rate_mean = CE_RX_BL_PBERR_MEAN);
test_ce_rx_bl_stats (t, &stats, &sta.ce_rx_bt.stats);
/* Clean. */
ce_rx_bitloading_uninit (&sta.ce_rx_bt);
diff --git a/cesar/ce/rx/src/rx.c b/cesar/ce/rx/src/rx.c
index ab7d57ddad..770f5207d0 100644
--- a/cesar/ce/rx/src/rx.c
+++ b/cesar/ce/rx/src/rx.c
@@ -108,6 +108,10 @@ ce_rx_init (mac_store_t *mac_store, sar_t *sar, pbproc_t *pbproc,
&ce_rx_bl_min_time_between_ce_restart_ms[1],
LIB_STATS_ACCESS_READ_WRITE,
LIB_STATS_DEBUG);
+ lib_stats_set_stat_value_notype ("CE_RX_BL_PBERR_MEAN_INIT",
+ &ce_rx_bl_pberr_mean_init_,
+ LIB_STATS_ACCESS_READ_WRITE,
+ LIB_STATS_DEBUG);
/* ECos. */
/* No work to do. */