summaryrefslogtreecommitdiff
path: root/cesar
diff options
context:
space:
mode:
authorMilenko Jelisavcic2011-08-18 18:00:30 +0200
committerMilenko Jelisavcic2011-08-18 18:00:30 +0200
commit1e5f0ca925682257841145fc4373f8c49ad0a315 (patch)
tree843e1aa55e5f4a07d12133443dbceea18d37efc3 /cesar
parentcf5bd437d90bc197d2db0327d20fb420bcf14352 (diff)
parentbe85e1d442cc9aba62a864a9c573656f4042e4d4 (diff)
Merge branch 'master' of pessac:/git/cesar into eoc
Conflicts: cesar/cl/src/cl.c cleopatre/application/libmme/Makefile cleopatre/application/libmme/src/mme.c cleopatre/application/libspid/Makefile
Diffstat (limited to 'cesar')
-rw-r--r--cesar/ce/rx/bitloading/bitloading.h33
-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/cp/test/src/test_mbox.c2
-rw-r--r--cesar/ce/rx/src/rx.c4
-rw-r--r--cesar/cl/src/cl.c20
-rw-r--r--cesar/cp/sta/action/src/sc.c2
8 files changed, 70 insertions, 45 deletions
diff --git a/cesar/ce/rx/bitloading/bitloading.h b/cesar/ce/rx/bitloading/bitloading.h
index 0c41de5b88..ae362549d1 100644
--- a/cesar/ce/rx/bitloading/bitloading.h
+++ b/cesar/ce/rx/bitloading/bitloading.h
@@ -21,6 +21,12 @@
#include "lib/blk.h"
#include "lib/blk_table.h"
+
+#include "common/module.h"
+
+/**
+ * Maximum value of the PB error rate sliding mean.
+ */
#define CE_RX_BL_UPDATE_PBER_SLIDING_MEAN_QUANTIFICATION (1 << 16)
typedef enum ce_rx_bitloading_ber_sliding_mean_t
@@ -146,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;
/**
@@ -173,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
/**
@@ -190,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
@@ -234,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);
}
/**
@@ -276,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 f37e91f499..223d24fab9 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_ = 9;
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/cp/test/src/test_mbox.c b/cesar/ce/rx/cp/test/src/test_mbox.c
index 0e7efb12dc..ee51677871 100644
--- a/cesar/ce/rx/cp/test/src/test_mbox.c
+++ b/cesar/ce/rx/cp/test/src/test_mbox.c
@@ -256,7 +256,7 @@ test_suite_mbox (test_t t)
INVALID_PTR);
/* Create a station. */
- sta_t peer;
+ sta_t peer = { .tei = 0x42 };
peer.rx_tonemaps = tonemaps_alloc ();
test_begin (t, "request to send a ce restart")
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. */
diff --git a/cesar/cl/src/cl.c b/cesar/cl/src/cl.c
index 4a75204f25..fc6b7d22bb 100644
--- a/cesar/cl/src/cl.c
+++ b/cesar/cl/src/cl.c
@@ -986,30 +986,22 @@ void cl_data_recv (cl_t *ctx, u8 *buffer, uint length, mfs_rx_t *mfs)
dbg_assert (mfs);
dbg_assert (ctx->data_rx.cb);
- /* Get source MAC address. */
- mac_t src = bitstream_direct_read_mac (buffer + 6);
-
- if (CONFIG_TRACE)
- {
- mac_t dest = bitstream_direct_read_large (buffer, 0, 48);
- mac_t src = bitstream_direct_read_large (buffer, 48, 48);
- CL_TRACE (DATA_RECV, phy_date (), buffer, TRACE_U64(dest),
- TRACE_U64(src), length);
- }
- (*ctx->data_rx.cb) (ctx->data_rx.user, buffer, length);
-#if !CONFIG_CL_EOC_ROUTE
mac_t smac, dmac;
bitstream_direct_read_macs (buffer, &dmac, &smac);
+ CL_TRACE (DATA_RECV, phy_date (), buffer, TRACE_U64 (dmac),
+ TRACE_U64 (smac), length);
+ (*ctx->data_rx.cb) (ctx->data_rx.user, buffer, length);
+
+#if !CONFIG_CL_EOC_ROUTE
cl_brg_rx_add (ctx, smac, mfs->common.tei);
#endif
/* update data rate informations associated to the RX
* from the associated sta to the local sta */
tei = mfs->common.tei;
-
#if CONFIG_CL_EOC_ROUTE
bool ok = true;
if (MAC_TEI_IS_EOC_CCO(ctx->mac_config->tei))
- ok = cl_eoc_mactotei_entry_insert (ctx, src, tei);
+ ok = cl_eoc_mactotei_entry_insert (ctx, smac, tei);
dbg_assert (ok);
#endif
diff --git a/cesar/cp/sta/action/src/sc.c b/cesar/cp/sta/action/src/sc.c
index f3b980b622..d838810972 100644
--- a/cesar/cp/sta/action/src/sc.c
+++ b/cesar/cp/sta/action/src/sc.c
@@ -350,7 +350,7 @@ cp_sta_action_sc__sc_join__cm_sc_join_req (cp_t *ctx, cp_mme_rx_t *mme)
* which one is going to SC_ADD. */
/* To prevent a warning. */
const uint my_cco_cap = CP_CCO_LEVEL;
- if ((my_cco_cap > cco_cap)
+ if (((int) my_cco_cap > (int) cco_cap)
|| ((my_cco_cap == cco_cap)
&& (MAC_REVERSE (cp_sta_own_data_get_mac_address (ctx))
> MAC_REVERSE (mme->peer.mac))))