summaryrefslogtreecommitdiff
path: root/cesar/ce/rx/cp
diff options
context:
space:
mode:
authorMilenko Jelisavcic2011-03-03 12:25:08 +0100
committerMilenko Jelisavcic2011-03-03 12:41:57 +0100
commitc2f9aaebc0c0fac178035c584b692c7e0f6d9627 (patch)
tree92ab2c7c17509e0cf70c88a11b63e668ba6acfff /cesar/ce/rx/cp
parentf046b5af5d2e24f999f0c03fc894a31b8181afe7 (diff)
parent36782c42c342a6567aca7d0008fb631e6da10c57 (diff)
Merge branch 'master' of jelisavcic@pessac:/git/cesar into eoc
Conflicts: cesar/bsu/aclf/aclf.h cesar/bsu/aclf/src/aclf.c cesar/bsu/src/bsu.c cesar/ce/rx/bitloading/fsm/src/fsm.c cesar/ce/rx/bitloading/src/transition.c cesar/ce/rx/inc/trace.h cesar/ce/rx/src/trace.c cesar/cp/beacon/src/beacon.c cesar/cp/inc/trace.h cesar/cp/src/trace.c cesar/mac/pbproc/src/fsm_tx_data.c cesar/mac/sar/Config cesar/mac/sar/src/sar.c cesar/tools/sniffer_phy/src/lowlevel.c cleopatre/devkit/plcdrv/arm/src/linux_drv.c cleopatre/devkit/plcdrv/arm/src/mailbox.c
Diffstat (limited to 'cesar/ce/rx/cp')
-rw-r--r--cesar/ce/rx/cp/inc/cp.h8
-rw-r--r--cesar/ce/rx/cp/mbox.h9
-rw-r--r--cesar/ce/rx/cp/mme.h9
-rw-r--r--cesar/ce/rx/cp/src/cp.c24
-rw-r--r--cesar/ce/rx/cp/src/mbox.c11
-rw-r--r--cesar/ce/rx/cp/src/mme.c9
-rw-r--r--cesar/ce/rx/cp/stub/src/cp.c4
-rw-r--r--cesar/ce/rx/cp/test/src/test_mbox.c34
-rw-r--r--cesar/ce/rx/cp/test/src/test_mme.c13
9 files changed, 88 insertions, 33 deletions
diff --git a/cesar/ce/rx/cp/inc/cp.h b/cesar/ce/rx/cp/inc/cp.h
index 9a0aeee7ca..267f05fafa 100644
--- a/cesar/ce/rx/cp/inc/cp.h
+++ b/cesar/ce/rx/cp/inc/cp.h
@@ -125,6 +125,14 @@ ce_rx_cp_send_mme_new_tone_map (ce_rx_t *ce_rx, sta_t *peer, u8 new_tmi,
void
ce_rx_cp_send_mme_refresh_tmi_list (ce_rx_t *ce_rx, sta_t *peer);
+/**
+ * Send a MME to restart initial CE.
+ * \param ce_rx the CE RX context.
+ * \param peer the destination of the MME.
+ */
+void
+ce_rx_cp_send_mme_restart_initial_ce (ce_rx_t *ce_rx, sta_t *peer);
+
END_DECLS
#endif /* ce_rx_cp_inc_cp_h */
diff --git a/cesar/ce/rx/cp/mbox.h b/cesar/ce/rx/cp/mbox.h
index 18a8ddbf57..bb949efd0f 100644
--- a/cesar/ce/rx/cp/mbox.h
+++ b/cesar/ce/rx/cp/mbox.h
@@ -46,4 +46,13 @@ ce_rx_cp_mbox_t *
ce_rx_cp_mbox_node_refresh_tmi (ce_rx_t *ce_rx, cp_tei_t tei,
tonemaps_t *tms);
+/**
+ * Allocate a message to send CE restart.
+ * \param ce_rx the context of the CE in RX.
+ * \param tei the TEI of the peer STA.
+ * \param tms the RX tome maps.
+ */
+ce_rx_cp_mbox_t *
+ce_rx_cp_mbox_node_restart_ce (ce_rx_t *ce_rx, cp_tei_t tei, tonemaps_t *tms);
+
#endif /* ce_rx_cp_mbox_h */
diff --git a/cesar/ce/rx/cp/mme.h b/cesar/ce/rx/cp/mme.h
index bf244679b3..ec581b70db 100644
--- a/cesar/ce/rx/cp/mme.h
+++ b/cesar/ce/rx/cp/mme.h
@@ -70,15 +70,6 @@ ce_rx_mme_refresh_tone_map_list (cp_t *ctx, cp_sta_t *sta, u32 tmi_list, u8
default_tmi, tonemap_intervals_t *int_list,
tonemaps_t *tms);
-/**
- * Send a CM_TM_UPDATE.IND to restart initial CE.
- * \param ctx the Control Plane context.
- * \param sta the destination of the MME.
- * \param tms the tone maps structure (in RX).
- */
-void
-ce_rx_mme_restart_initial_ce (cp_t *ctx, cp_sta_t *sta, tonemaps_t *tms);
-
END_DECLS
#endif /* ce_rx_cp_mme_h */
diff --git a/cesar/ce/rx/cp/src/cp.c b/cesar/ce/rx/cp/src/cp.c
index 0adabdadcf..bdf09718ce 100644
--- a/cesar/ce/rx/cp/src/cp.c
+++ b/cesar/ce/rx/cp/src/cp.c
@@ -112,6 +112,30 @@ ce_rx_cp_send_mme_refresh_tmi_list (ce_rx_t *ce_rx, sta_t *peer)
}
void
+ce_rx_cp_send_mme_restart_initial_ce (ce_rx_t *ce_rx, sta_t *peer)
+{
+ /* Check parameters. */
+ dbg_assert (peer);
+ dbg_assert (ce_rx);
+ dbg_assert (ce_rx->cp_cb);
+ /* Sanity check: there should be no tone map enabled. */
+ dbg_assert (tonemaps_allocated_count (peer->rx_tonemaps) == 0);
+
+ CE_RX_TRACE (SEND_RESTART_CE, peer->tei);
+
+ /* Create a new work. */
+ ce_rx_cp_mbox_t *work =
+ ce_rx_cp_mbox_node_restart_ce (ce_rx, peer->tei, peer->rx_tonemaps);
+ /* Add it to the list. */
+ mbox_put (&ce_rx->cp_mbox, &work->mbox_node);
+ /* Post a flag for the CP. */
+ ce_rx->cp_cb (ce_rx->cp_ctx);
+
+ /* Disable expiration timer. */
+ peer->rx_tonemaps->refresh_counter_s = 0;
+}
+
+void
ce_rx_cp_run_work (cp_t *ctx)
{
/* Check parameter. */
diff --git a/cesar/ce/rx/cp/src/mbox.c b/cesar/ce/rx/cp/src/mbox.c
index 225e9f6905..15ef3b00a9 100644
--- a/cesar/ce/rx/cp/src/mbox.c
+++ b/cesar/ce/rx/cp/src/mbox.c
@@ -77,3 +77,14 @@ ce_rx_cp_mbox_node_refresh_tmi (ce_rx_t *ce_rx, cp_tei_t tei, tonemaps_t *tms)
return ce_rx_cp_mbox_new_node (ce_rx, tei, tms->default_tmi, tmi_list,
tms->intervals, 0, 0, false);
}
+
+ce_rx_cp_mbox_t *
+ce_rx_cp_mbox_node_restart_ce (ce_rx_t *ce_rx, cp_tei_t tei, tonemaps_t *tms)
+{
+ /* Check parameters. */
+ dbg_assert (tms);
+
+ /* Return allocated node. */
+ return ce_rx_cp_mbox_new_node (ce_rx, tei, 0, 0, tms->intervals, 0, 0,
+ false);
+}
diff --git a/cesar/ce/rx/cp/src/mme.c b/cesar/ce/rx/cp/src/mme.c
index 98157a9d69..6395eef34b 100644
--- a/cesar/ce/rx/cp/src/mme.c
+++ b/cesar/ce/rx/cp/src/mme.c
@@ -523,12 +523,3 @@ ce_rx_mme_refresh_tone_map_list (cp_t *ctx, cp_sta_t *sta, u32 tmi_list, u8
else
tms->refresh_counter_s = 0;
}
-
-void
-ce_rx_mme_restart_initial_ce (cp_t *ctx, cp_sta_t *sta, tonemaps_t *tms)
-{
- ce_rx_mme_send_cm_tm_update_ind (ctx, sta, tms, 0, 0, 0, 0,
- tms->intervals);
- /* Disable expiration timer. */
- tms->refresh_counter_s = 0;
-}
diff --git a/cesar/ce/rx/cp/stub/src/cp.c b/cesar/ce/rx/cp/stub/src/cp.c
index 8ef1ea4100..d621e40725 100644
--- a/cesar/ce/rx/cp/stub/src/cp.c
+++ b/cesar/ce/rx/cp/stub/src/cp.c
@@ -46,10 +46,10 @@ ce_rx_cp_send_mme_new_tone_map (ce_rx_t *ce_rx, sta_t *peer, u8 new_tmi,
}
void
-ce_rx_mme_restart_initial_ce (cp_t *ctx, cp_sta_t *sta, tonemaps_t *tms)
+ce_rx_cp_send_mme_restart_initial_ce (ce_rx_t *ctx, sta_t *sta)
__attribute__ ((weak));
void
-ce_rx_mme_restart_initial_ce (cp_t *ctx, cp_sta_t *sta, tonemaps_t *tms)
+ce_rx_cp_send_mme_restart_initial_ce (ce_rx_t *ctx, sta_t *sta)
{
}
diff --git a/cesar/ce/rx/cp/test/src/test_mbox.c b/cesar/ce/rx/cp/test/src/test_mbox.c
index 1b57117838..0e7efb12dc 100644
--- a/cesar/ce/rx/cp/test/src/test_mbox.c
+++ b/cesar/ce/rx/cp/test/src/test_mbox.c
@@ -19,6 +19,11 @@
#include "lib/test.h"
+static void
+stub_cp_signal_work_cb (cp_t *ctx)
+{
+}
+
/**
* Test mailbox node allocation.
*/
@@ -237,6 +242,33 @@ test_suite_mbox_node (test_t t)
ce_rx_cp_uninit (&ce_rx);
}
+/**
+ * Test mailbox.
+ */
+static void
+test_suite_mbox (test_t t)
+{
+ test_suite_begin (t, "mailbox");
+
+ ce_rx_t ce_rx;
+ ce_rx_cp_init (&ce_rx);
+ ce_rx_cp_set_cp_signal_work_callback (&ce_rx, stub_cp_signal_work_cb,
+ INVALID_PTR);
+
+ /* Create a station. */
+ sta_t peer;
+ peer.rx_tonemaps = tonemaps_alloc ();
+
+ test_begin (t, "request to send a ce restart")
+ {
+ ce_rx_cp_send_mme_restart_initial_ce (&ce_rx, &peer);
+ } test_end;
+
+ /* Clean. */
+ tonemaps_release (peer.rx_tonemaps);
+ ce_rx_cp_uninit (&ce_rx);
+}
+
int
main (int argc, char **argv)
{
@@ -245,6 +277,8 @@ main (int argc, char **argv)
test_suite_mbox_node (t);
+ test_suite_mbox (t);
+
test_begin (t, "memory")
{
test_fail_unless (blk_check_memory ());
diff --git a/cesar/ce/rx/cp/test/src/test_mme.c b/cesar/ce/rx/cp/test/src/test_mme.c
index 11cba0a688..de09b17eea 100644
--- a/cesar/ce/rx/cp/test/src/test_mme.c
+++ b/cesar/ce/rx/cp/test/src/test_mme.c
@@ -492,19 +492,6 @@ mme_test_suite (test_t t)
/* Clean. */
tms->tm[default_tmi] = 0;
} test_end;
- test_begin (t, "CM_TM_UPDATE.IND: restart initial CE")
- {
- tms->refresh_counter_s = CE_RX_REFRESH_TONE_MAP_S;
- cp.vect_size = mme_test_generate_cm_tm_update_ind (&cp, tms, 0, 0,
- NULL, 0);
- mme_test_generate_end_cm_chan_est_ind (&cp);
- /* No interval. */
- tonemap_intervals_t int_list;
- int_list.intervals_nb = 0;
- ce_rx_mme_restart_initial_ce (&cp, &sta, tms);
- /* No need to refresh when there is an empty TMI list. */
- test_fail_if (tms->refresh_counter_s != 0);
- } test_end;
/* Clean. */
tonemap_free (tm);