summaryrefslogtreecommitdiff
path: root/cesar
diff options
context:
space:
mode:
authorNicolas Schodet2012-12-21 17:13:29 +0100
committerNicolas Schodet2013-01-07 09:34:39 +0100
commit81b85603a55beeb65e46e1d3ea9056d1c25b793f (patch)
treec8c2346f1cb0bb72a25ea04ec5888e4ca2d7da9a /cesar
parent1199b58563b44123a89dae9283f2e8df1893a070 (diff)
cesar/mac/pbproc/test/pbproc: code factorization
Diffstat (limited to 'cesar')
-rw-r--r--cesar/mac/pbproc/test/pbproc/src/tx_data.c504
1 files changed, 155 insertions, 349 deletions
diff --git a/cesar/mac/pbproc/test/pbproc/src/tx_data.c b/cesar/mac/pbproc/test/pbproc/src/tx_data.c
index 31a2aac841..958e7877dc 100644
--- a/cesar/mac/pbproc/test/pbproc/src/tx_data.c
+++ b/cesar/mac/pbproc/test/pbproc/src/tx_data.c
@@ -19,26 +19,61 @@
#include "mac/common/timings.h"
+/** TX common test parameters. */
+struct tx_data_test_common_param_t
+{
+ /** Duration of the access, measured as a number of symbol, default to
+ * symb_nb if 0. */
+ uint duration_symb_nb;
+ /** Number of symbols. */
+ uint symb_nb;
+ /** Expected total number of segments. */
+ uint seg_nb_total;
+ /** Tonemap index. */
+ uint tmi;
+ /** Tonemap uniform modulation, or 0 to reuse previous one. */
+ uint tm_mod;
+ /** Whether spoc_update_step is valid. */
+ bool spoc;
+ /** SPOC update step. */
+ phy_prepare_type_t spoc_update_step;
+ /** MFS FSM response in SACK, default to ACK. */
+ mfs_fsm_rsp_t sack_mfs_fsm_rsp;
+ /** MFS window size in SACK. */
+ mfs_window_size_idx_t sack_window_size;
+ /** TX while in RE_SYNC, seen on stats. */
+ bool re_sync;
+};
+typedef struct tx_data_test_common_param_t tx_data_test_common_param_t;
+
+#define tx_data_test_common(t, tp, date, mfs, params...) \
+ tx_data_test_common_f ((t), (tp), (date), (mfs), \
+ &(struct tx_data_test_common_param_t) { params })
+
void
-tx_data_test (test_t t, test_pbproc_t *tp, u32 date, uint mfs_seg_nb,
- uint duration_tck, uint symb_nb, uint data_seg_nb_total,
- bool unassociated, uint tmi, phy_prepare_type_t spoc_update_step)
+tx_data_test_common_f (test_t t, test_pbproc_t *tp, u32 date, mfs_tx_t *mfs,
+ const tx_data_test_common_param_t *p)
{
test_within (t);
- const uint lid = 1;
- const uint stei = unassociated ? 0 : tp->config.tei;
- const uint dtei = 2;
+ dbg_assert (mfs);
+ const uint stei = mfs->common.unassociated ? 0 : tp->config.tei;
+ const uint dtei = mfs->common.tei;
const uint beacon_tck = MAC_MS_TO_TCK (1000) / 50;
tonemap_t *tm = &tp->config.tonemask_info.tonemap_robo[PHY_MOD_ROBO];
uint dx = MAC_DX417_TCK;
+ uint tmi = p->tmi;
if (tmi != PHY_MOD_ROBO)
- tm = utils_sta_prepare_default_tonemap (tp, true, dtei, tmi, 10, 0,
- &dx);
+ tm = utils_sta_prepare_default_tonemap (tp, true, dtei, tmi,
+ p->tm_mod, 0, &dx);
uint rifs_tck = tmi < PHY_MOD_ROBO_NB ? MAC_RIFS_DEFAULT_TCK
: MAC_RIFS_SPC_ANY_TCK;
- mfs_tx_t *mfs = utils_mfs_tx_prepare (false, false, lid, dtei,
- mfs_seg_nb);
- mfs->common.unassociated = unassociated;
+ uint duration_symb_nb = p->duration_symb_nb
+ ? p->duration_symb_nb : p->symb_nb;
+ uint duration_tck = MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
+ + MAC_PAYLOAD_TCK (duration_symb_nb, dx) + MAC_RIFS_DEFAULT_TCK
+ + MAC_PREAMBLE_TCK + MAC_FC_AV_TCK;
+ bool spoc_preamble = p->spoc
+ && p->spoc_update_step == PHY_PREPARE_TYPE_PREAMBLE;
test_pbproc_alloc (tp, false, date / beacon_tck * beacon_tck);
ca_access_param_t access = {
.access_date = date,
@@ -46,6 +81,7 @@ tx_data_test (test_t t, test_pbproc_t *tp, u32 date, uint mfs_seg_nb,
.prp = true,
.cfp = false,
};
+ dbg_assert (MFS_FSM_RSP_ACK == 0); /* Check default is fine. */
pbproc_fc_sack_t sack_fc = {
.dt_av = PBPROC_FC_DT_SACK,
.access = false,
@@ -55,30 +91,31 @@ tx_data_test (test_t t, test_pbproc_t *tp, u32 date, uint mfs_seg_nb,
.bdf = true,
.svn = 0,
.rrtf = false,
- .mfs_rsp_data = MFS_FSM_RSP_ACK,
+ .mfs_rsp_data = p->sack_mfs_fsm_rsp,
.mfs_rsp_mgmt = MFS_FSM_RSP_ACK,
.sackt3 = 0,
.sackt2 = 0,
.sackt1 = 0,
.sackt0 = 0,
.sacki = { 0, 0 },
- .sacki_last = 0,
+ .sacki_last = p->sack_window_size << 4,
.fccs_av = 0,
};
const uint pre_fc_fl_tck = MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
- + MAC_PAYLOAD_TCK (symb_nb, MAC_DX417_TCK) + rifs_tck;
+ + MAC_PAYLOAD_TCK (p->symb_nb, dx) + rifs_tck;
scenario_entry_t entries[] = {
SCENARIO_ACTION (phy_access, .mfs = mfs, .access_param = &access,
.prp_won = true, .slot_count = 2),
SCENARIO_EVENT (ca_access_hold),
SCENARIO_EVENT (ca_access_get_mfs),
SCENARIO_EVENT (phy_pbdma_start, .bypass_aes = true,
- .nb_total = data_seg_nb_total,
+ .nb_total = p->seg_nb_total,
.nb_pb_it = 0, .chandata = false, .now = false),
+ SCENARIO_EVENT_COND (tmi >= PHY_MOD_ROBO_NB, phy_set_tonemap),
SCENARIO_EVENT (phy_tx_param, .fc_mode = PHY_FC_MODE_AV_1,
.mod = tmi < PHY_MOD_ROBO_NB ? tmi : PHY_MOD_TM,
.fecrate = tm->fecrate, .pb_size = PHY_PB_SIZE_520,
- .gil = PHY_GIL_417, .symbol_nb = symb_nb),
+ .gil = PHY_GIL_417, .symbol_nb = p->symb_nb),
SCENARIO_EVENT (phy_tx_frame, .date = date, .want_conf = true,
.stop_tx_on_prp_lost = true),
SCENARIO_EVENT (ca_access_vcs_restart_eifs, .start_date = date),
@@ -90,20 +127,15 @@ tx_data_test (test_t t, test_pbproc_t *tp, u32 date, uint mfs_seg_nb,
SCENARIO_EVENT (phy_rx_activate, .now = false,
.date = date + pre_fc_fl_tck,
.pre_detection = true),
- SCENARIO_EVENT_COND (spoc_update_step < PHY_PREPARE_TYPE_NB,
- phy_extra_timer_program,
+ SCENARIO_EVENT_COND (p->spoc, phy_extra_timer_program,
.date = date + pre_fc_fl_tck - rifs_tck),
- SCENARIO_ACTION_COND (spoc_update_step < PHY_PREPARE_TYPE_NB,
- phy_extra_timer),
- SCENARIO_EVENT_COND (spoc_update_step == PHY_PREPARE_TYPE_PREAMBLE,
- phy_spoc_tx_set),
- SCENARIO_EVENT_COND (spoc_update_step < PHY_PREPARE_TYPE_NB,
- phy_prepare, .type = spoc_update_step,
- .wait = false),
- SCENARIO_EVENT_COND (spoc_update_step == PHY_PREPARE_TYPE_PREAMBLE,
- phy_spoc_rx_set),
- SCENARIO_EVENT_COND (spoc_update_step == PHY_PREPARE_TYPE_PREAMBLE,
- phy_freq_error_set, .sync = true, .rho_q30 = 42),
+ SCENARIO_ACTION_COND (p->spoc, phy_extra_timer),
+ SCENARIO_EVENT_COND (spoc_preamble, phy_spoc_tx_set),
+ SCENARIO_EVENT_COND (p->spoc, phy_prepare,
+ .type = p->spoc_update_step, .wait = false),
+ SCENARIO_EVENT_COND (spoc_preamble, phy_spoc_rx_set),
+ SCENARIO_EVENT_COND (spoc_preamble, phy_freq_error_set, .sync = true,
+ .rho_q30 = 42),
SCENARIO_ACTION (phy_rx_fc, .rx_date = date + pre_fc_fl_tck,
.fc_av = (u32 *) &sack_fc),
SCENARIO_EVENT (phy_rx_prepare_short),
@@ -120,26 +152,48 @@ tx_data_test (test_t t, test_pbproc_t *tp, u32 date, uint mfs_seg_nb,
test_pbproc_check_stats_reset (tp);
scenario_run (t, entries, &globals);
test_pbproc_check_stats (t, tp, .tx_data = 1, .tx_data_wack = 1,
- .tx_data_wack_ack = 1);
+ .tx_data_wack_ack = 1,
+ .tx_data_re_sync = p->re_sync ? 1 : 0);
+ test_fail_unless (tp->pbproc->fsm.current_state == PBPROC_FSM_STATE_IDLE);
+}
+
+void
+tx_data_test (test_t t, test_pbproc_t *tp, u32 date, uint mfs_seg_nb,
+ uint duration_symb_nb, uint symb_nb, uint seg_nb_total,
+ bool unassociated, uint tmi)
+{
+ test_within (t);
+ const uint lid = 1;
+ const uint dtei = 2;
+ mfs_tx_t *mfs = utils_mfs_tx_prepare (false, false, lid, dtei,
+ mfs_seg_nb);
+ mfs->common.unassociated = unassociated;
+ tx_data_test_common (t, tp, date, mfs,
+ .duration_symb_nb = duration_symb_nb,
+ .symb_nb = symb_nb, .seg_nb_total = seg_nb_total,
+ .tmi = tmi);
test_fail_unless (mfs->fsm_state == MFS_FSM_CMD_IN_SYNC);
test_fail_unless (mfs->stats.num_mpdus == 1);
test_fail_unless (mfs->stats.num_bursts == 1);
- test_fail_unless (mfs->stats.num_pbs == data_seg_nb_total);
- test_fail_unless (mfs->stats.num_segs_suc == data_seg_nb_total);
+ test_fail_unless (mfs->stats.num_pbs == seg_nb_total);
+ test_fail_unless (mfs->stats.num_segs_suc == seg_nb_total);
utils_mfs_tx_cleanup (mfs);
if (tmi != PHY_MOD_ROBO)
dbg_check (mac_store_sta_remove (tp->store, dtei));
- test_fail_unless (tp->pbproc->fsm.current_state == PBPROC_FSM_STATE_IDLE);
}
void
tx_data_woack_test (test_t t, test_pbproc_t *tp, u32 date, uint mfs_seg_nb,
- uint duration_tck, uint symb_nb, uint data_seg_nb_total)
+ uint duration_symb_nb, uint symb_nb,
+ uint data_seg_nb_total)
{
test_within (t);
const uint lid = 1;
const uint dtei = 0xff;
const uint beacon_tck = MAC_MS_TO_TCK (1000) / 50;
+ uint duration_tck = MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
+ + MAC_PAYLOAD_TCK (duration_symb_nb, MAC_DX417_TCK)
+ + MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK + MAC_FC_AV_TCK;
mfs_tx_t *mfs = utils_mfs_tx_prepare (true, false, lid, dtei, mfs_seg_nb);
test_pbproc_alloc (tp, false, date / beacon_tck * beacon_tck);
ca_access_param_t access = {
@@ -197,162 +251,24 @@ tx_data_rx_window_change_test (test_t t, test_pbproc_t *tp)
{
test_within (t);
const uint lid = 1;
- const uint stei = tp->config.tei;
const uint dtei = 2;
- const uint beacon_tck = MAC_MS_TO_TCK (1000) / 50;
- tonemap_t *tm = &tp->config.tonemask_info.tonemap_robo[PHY_MOD_ROBO];
- uint dx = MAC_DX417_TCK;
- tm = utils_sta_prepare_default_tonemap (tp, true, dtei, 5, 10, 0,
- &dx);
- uint rifs_tck = MAC_RIFS_SPC_ANY_TCK;
mfs_tx_t *mfs = utils_mfs_tx_prepare (false, false, lid, dtei,
100);
- mfs->common.unassociated = false;
- test_pbproc_alloc (tp, false, 100000 / beacon_tck * beacon_tck);
/* First transmission with default RX window size. */
- ca_access_param_t access_1 = {
- .access_date = 100000,
- .duration_tck = MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
- + MAC_PAYLOAD_TCK (25, MAC_DX417_TCK)
- + MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
- + MAC_FC_AV_TCK,
- .prp = true,
- .cfp = false,
- };
- pbproc_fc_sack_t sack_fc_1 = {
- .dt_av = PBPROC_FC_DT_SACK,
- .access = false,
- .snid = tp->snid,
- .dtei = stei,
- .cfs = false,
- .bdf = true,
- .svn = 0,
- .rrtf = false,
- .mfs_rsp_data = MFS_FSM_RSP_ACK,
- .mfs_rsp_mgmt = MFS_FSM_RSP_ACK,
- .sackt3 = 0,
- .sackt2 = 0,
- .sackt1 = 0,
- .sackt0 = 0,
- .sacki = { 0, 0 },
- .sacki_last = MFS_WINDOW_SIZE_256 << 4,
- .fccs_av = 0,
- };
- const uint pre_fc_fl_tck = MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
- + MAC_PAYLOAD_TCK (25, MAC_DX417_TCK) + rifs_tck;
- scenario_entry_t entries_1[] = {
- SCENARIO_ACTION (phy_access, .mfs = mfs, .access_param = &access_1,
- .prp_won = true, .slot_count = 2),
- SCENARIO_EVENT (ca_access_hold),
- SCENARIO_EVENT (ca_access_get_mfs),
- SCENARIO_EVENT (phy_pbdma_start, .bypass_aes = true,
- .nb_total = 41,
- .nb_pb_it = 0, .chandata = false, .now = false),
- SCENARIO_EVENT (phy_set_tonemap),
- SCENARIO_EVENT (phy_tx_param, .fc_mode = PHY_FC_MODE_AV_1,
- .mod = PHY_MOD_TM, .fecrate = tm->fecrate,
- .pb_size = PHY_PB_SIZE_520, .gil = PHY_GIL_417,
- .symbol_nb = 25),
- SCENARIO_EVENT (phy_tx_frame, .date = 100000, .want_conf = true,
- .stop_tx_on_prp_lost = true),
- SCENARIO_EVENT (ca_access_vcs_restart_eifs, .start_date = 100000),
- SCENARIO_ACTION (phy_access_conf),
- SCENARIO_EVENT (phy_tx_prepare),
- SCENARIO_EVENT (ca_backoff_deferred, .slot_count = 0),
- SCENARIO_EVENT (ca_access_vcs_restart_eifs,
- .start_date = 100000 + pre_fc_fl_tck),
- SCENARIO_EVENT (phy_rx_activate, .now = false,
- .date = 100000 + pre_fc_fl_tck,
- .pre_detection = true),
- SCENARIO_ACTION (phy_rx_fc, .rx_date = 100000 + pre_fc_fl_tck,
- .fc_av = (u32 *) &sack_fc_1),
- SCENARIO_EVENT (phy_rx_prepare_short),
- SCENARIO_EVENT (ca_access_done),
- SCENARIO_EVENT (ca_backoff_success),
- SCENARIO_EVENT (ca_access_vcs_restart,
- .end_date = 100000 + pre_fc_fl_tck + MAC_PREAMBLE_TCK
- + MAC_FC_AV_TCK + MAC_CIFS_TCK),
- SCENARIO_END
- };
- scenario_globals_t globals = {
- .tp = tp,
- };
- test_pbproc_check_stats_reset (tp);
- scenario_run (t, entries_1, &globals);
- test_pbproc_check_stats (t, tp, .tx_data = 1, .tx_data_wack = 1,
- .tx_data_wack_ack = 1);
+ tx_data_test_common (t, tp, 100000, mfs, .duration_symb_nb = 25,
+ .symb_nb = 25, .seg_nb_total = 41,
+ .tmi = 5, .tm_mod = 10,
+ .sack_window_size = MFS_WINDOW_SIZE_256);
test_fail_unless (mfs->fsm_state == MFS_FSM_CMD_IN_SYNC);
test_fail_unless (mfs->stats.num_mpdus == 1);
test_fail_unless (mfs->stats.num_bursts == 1);
test_fail_unless (mfs->stats.num_pbs == 41);
test_fail_unless (mfs->stats.num_segs_suc == 41);
/* Second transmission: RX window will change. */
- ca_access_param_t access_2 = {
- .access_date = 300000,
- .duration_tck = MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
- + MAC_PAYLOAD_TCK (25, MAC_DX417_TCK)
- + MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
- + MAC_FC_AV_TCK,
- .prp = true,
- .cfp = false,
- };
- pbproc_fc_sack_t sack_fc_2 = {
- .dt_av = PBPROC_FC_DT_SACK,
- .access = false,
- .snid = tp->snid,
- .dtei = stei,
- .cfs = false,
- .bdf = true,
- .svn = 0,
- .rrtf = false,
- .mfs_rsp_data = MFS_FSM_RSP_NACK,
- .mfs_rsp_mgmt = MFS_FSM_RSP_ACK,
- .sackt3 = 0,
- .sackt2 = 0,
- .sackt1 = 0,
- .sackt0 = 0,
- .sacki = { 0, 0 },
- .sacki_last = MFS_WINDOW_SIZE_24 << 4,
- .fccs_av = 0,
- };
- scenario_entry_t entries_2[] = {
- SCENARIO_ACTION (phy_access, .mfs = mfs, .access_param = &access_2,
- .prp_won = true, .slot_count = 2),
- SCENARIO_EVENT (ca_access_hold),
- SCENARIO_EVENT (ca_access_get_mfs),
- SCENARIO_EVENT (phy_pbdma_start, .bypass_aes = true,
- .nb_total = 41,
- .nb_pb_it = 0, .chandata = false, .now = false),
- SCENARIO_EVENT (phy_set_tonemap),
- SCENARIO_EVENT (phy_tx_param, .fc_mode = PHY_FC_MODE_AV_1,
- .mod = PHY_MOD_TM, .fecrate = tm->fecrate,
- .pb_size = PHY_PB_SIZE_520, .gil = PHY_GIL_417,
- .symbol_nb = 25),
- SCENARIO_EVENT (phy_tx_frame, .date = 300000, .want_conf = true,
- .stop_tx_on_prp_lost = true),
- SCENARIO_EVENT (ca_access_vcs_restart_eifs, .start_date = 300000),
- SCENARIO_ACTION (phy_access_conf),
- SCENARIO_EVENT (phy_tx_prepare),
- SCENARIO_EVENT (ca_backoff_deferred, .slot_count = 0),
- SCENARIO_EVENT (ca_access_vcs_restart_eifs,
- .start_date = 300000 + pre_fc_fl_tck),
- SCENARIO_EVENT (phy_rx_activate, .now = false,
- .date = 300000 + pre_fc_fl_tck,
- .pre_detection = true),
- SCENARIO_ACTION (phy_rx_fc, .rx_date = 300000 + pre_fc_fl_tck,
- .fc_av = (u32 *) &sack_fc_2),
- SCENARIO_EVENT (phy_rx_prepare_short),
- SCENARIO_EVENT (ca_access_done),
- SCENARIO_EVENT (ca_backoff_success),
- SCENARIO_EVENT (ca_access_vcs_restart,
- .end_date = 300000 + pre_fc_fl_tck + MAC_PREAMBLE_TCK
- + MAC_FC_AV_TCK + MAC_CIFS_TCK),
- SCENARIO_END
- };
- test_pbproc_check_stats_reset (tp);
- scenario_run (t, entries_2, &globals);
- test_pbproc_check_stats (t, tp, .tx_data = 1, .tx_data_wack = 1,
- .tx_data_wack_ack = 1);
+ tx_data_test_common (t, tp, 300000, mfs, .duration_symb_nb = 25,
+ .symb_nb = 25, .seg_nb_total = 41, .tmi = 5,
+ .sack_window_size = MFS_WINDOW_SIZE_24,
+ .sack_mfs_fsm_rsp = MFS_FSM_RSP_NACK);
test_fail_unless (mfs->fsm_state == MFS_FSM_CMD_RE_SYNC);
test_fail_unless (mfs->stats.num_mpdus == 2);
test_fail_unless (mfs->stats.num_bursts == 2);
@@ -360,74 +276,10 @@ tx_data_rx_window_change_test (test_t t, test_pbproc_t *tp)
test_fail_unless (mfs->stats.num_segs_suc == 41);
/* Third transmission: check that we only send 1 PB and that we switch to
* IN_SYNC after ACK. */
- ca_access_param_t access_3 = {
- .access_date = 500000,
- .duration_tck = MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
- + MAC_PAYLOAD_TCK (25, MAC_DX417_TCK)
- + MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
- + MAC_FC_AV_TCK,
- .prp = true,
- .cfp = false,
- };
- pbproc_fc_sack_t sack_fc_3 = {
- .dt_av = PBPROC_FC_DT_SACK,
- .access = false,
- .snid = tp->snid,
- .dtei = stei,
- .cfs = false,
- .bdf = true,
- .svn = 0,
- .rrtf = false,
- .mfs_rsp_data = MFS_FSM_RSP_ACK,
- .mfs_rsp_mgmt = MFS_FSM_RSP_ACK,
- .sackt3 = 0,
- .sackt2 = 0,
- .sackt1 = 0,
- .sackt0 = 0,
- .sacki = { 0, 0 },
- .sacki_last = MFS_WINDOW_SIZE_24 << 4,
- .fccs_av = 0,
- };
- const uint pre_fc_fl_tck_2 = MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
- + MAC_PAYLOAD_TCK (1, MAC_DX417_TCK) + rifs_tck;
- scenario_entry_t entries_3[] = {
- SCENARIO_ACTION (phy_access, .mfs = mfs, .access_param = &access_3,
- .prp_won = true, .slot_count = 2),
- SCENARIO_EVENT (ca_access_hold),
- SCENARIO_EVENT (ca_access_get_mfs),
- SCENARIO_EVENT (phy_pbdma_start, .bypass_aes = true,
- .nb_total = 1,
- .nb_pb_it = 0, .chandata = false, .now = false),
- SCENARIO_EVENT (phy_set_tonemap),
- SCENARIO_EVENT (phy_tx_param, .fc_mode = PHY_FC_MODE_AV_1,
- .mod = PHY_MOD_TM, .fecrate = tm->fecrate,
- .pb_size = PHY_PB_SIZE_520, .gil = PHY_GIL_417,
- .symbol_nb = 1),
- SCENARIO_EVENT (phy_tx_frame, .date = 500000, .want_conf = true,
- .stop_tx_on_prp_lost = true),
- SCENARIO_EVENT (ca_access_vcs_restart_eifs, .start_date = 500000),
- SCENARIO_ACTION (phy_access_conf),
- SCENARIO_EVENT (phy_tx_prepare),
- SCENARIO_EVENT (ca_backoff_deferred, .slot_count = 0),
- SCENARIO_EVENT (ca_access_vcs_restart_eifs,
- .start_date = 500000 + pre_fc_fl_tck_2),
- SCENARIO_EVENT (phy_rx_activate, .now = false,
- .date = 500000 + pre_fc_fl_tck_2,
- .pre_detection = true),
- SCENARIO_ACTION (phy_rx_fc, .rx_date = 500000 + pre_fc_fl_tck_2,
- .fc_av = (u32 *) &sack_fc_3),
- SCENARIO_EVENT (phy_rx_prepare_short),
- SCENARIO_EVENT (ca_access_done),
- SCENARIO_EVENT (ca_backoff_success),
- SCENARIO_EVENT (ca_access_vcs_restart,
- .end_date = 500000 + pre_fc_fl_tck_2 + MAC_PREAMBLE_TCK
- + MAC_FC_AV_TCK + MAC_CIFS_TCK),
- SCENARIO_END
- };
- test_pbproc_check_stats_reset (tp);
- scenario_run (t, entries_3, &globals);
- test_pbproc_check_stats (t, tp, .tx_data = 1, .tx_data_wack = 1,
- .tx_data_wack_ack = 1, .tx_data_re_sync = 1);
+ tx_data_test_common (t, tp, 500000, mfs, .duration_symb_nb = 25,
+ .symb_nb = 1, .seg_nb_total = 1, .tmi = 5,
+ .sack_window_size = MFS_WINDOW_SIZE_24,
+ .re_sync = true);
test_fail_unless (mfs->fsm_state == MFS_FSM_CMD_IN_SYNC);
test_fail_unless (mfs->stats.num_mpdus == 3);
test_fail_unless (mfs->stats.num_bursts == 3);
@@ -436,12 +288,11 @@ tx_data_rx_window_change_test (test_t t, test_pbproc_t *tp)
/* End of the test. */
utils_mfs_tx_cleanup (mfs);
dbg_check (mac_store_sta_remove (tp->store, dtei));
- test_fail_unless (tp->pbproc->fsm.current_state == PBPROC_FSM_STATE_IDLE);
}
void
tx_data_burst_test (test_t t, test_pbproc_t *tp, u32 date, uint mfs_seg_nb,
- uint duration_tck,
+ uint duration_symb_nb,
uint symb_nb_1, uint data_seg_nb_total_1,
uint symb_nb_0, uint data_seg_nb_total_0,
uint tmi_1, uint tmi_0, utils_interval_t *intervals,
@@ -455,6 +306,9 @@ tx_data_burst_test (test_t t, test_pbproc_t *tp, u32 date, uint mfs_seg_nb,
tonemap_t *tm_1 = &tp->config.tonemask_info.tonemap_robo[PHY_MOD_ROBO];
tonemap_t *tm_0 = &tp->config.tonemask_info.tonemap_robo[PHY_MOD_ROBO];
uint dx_1 = MAC_DX417_TCK, dx_0 = MAC_DX417_TCK;
+ uint duration_tck = MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
+ + MAC_PAYLOAD_TCK (duration_symb_nb, dx_1) + MAC_RIFS_DEFAULT_TCK
+ + MAC_PREAMBLE_TCK + MAC_FC_AV_TCK;
/* Prepare tone maps. */
if (tmi_1 != PHY_MOD_ROBO || intervals)
tm_1 = utils_sta_prepare_default_tonemap (tp, true, dtei, tmi_1, 10,
@@ -605,13 +459,17 @@ tx_data_burst_test (test_t t, test_pbproc_t *tp, u32 date, uint mfs_seg_nb,
}
void
-tx_data_noseg_test (test_t t, test_pbproc_t *tp, u32 date, uint duration_tck,
- bool prp_won, bool got_mfs, bool late)
+tx_data_noseg_test (test_t t, test_pbproc_t *tp, u32 date,
+ uint duration_symb_nb, bool prp_won, bool got_mfs,
+ bool late)
{
test_within (t);
const uint lid = 1;
const uint dtei = 2;
const uint beacon_tck = MAC_MS_TO_TCK (1000) / 50;
+ uint duration_tck = MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
+ + MAC_PAYLOAD_TCK (duration_symb_nb, MAC_DX417_TCK)
+ + MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK + MAC_FC_AV_TCK;
mfs_tx_t *mfs = got_mfs
? utils_mfs_tx_prepare (false, false, lid, dtei, late ? 1 : 0)
: NULL;
@@ -666,11 +524,13 @@ tx_data_noseg_test (test_t t, test_pbproc_t *tp, u32 date, uint duration_tck,
}
void
-tx_data_beacon_test (test_t t, test_pbproc_t *tp, u32 date, uint duration_tck,
- uint symb_nb)
+tx_data_beacon_test (test_t t, test_pbproc_t *tp, u32 date,
+ uint duration_symb_nb, uint symb_nb)
{
test_within (t);
const uint beacon_tck = MAC_MS_TO_TCK (1000) / 50;
+ uint duration_tck = MAC_PREAMBLE_HYBRID_TCK + MAC_FC_10_TCK
+ + MAC_FC_AV_TCK + MAC_PAYLOAD_TCK (6, MAC_DX567_TCK) + MAC_B2BIFS_TCK;
mfs_tx_t *mfs = utils_mfs_tx_prepare (true, false, MAC_LID_SPC_CENTRAL,
MAC_TEI_BCAST, 0);
mfs->cfp = true;
@@ -730,6 +590,29 @@ tx_data_beacon_test (test_t t, test_pbproc_t *tp, u32 date, uint duration_tck,
}
void
+tx_data_spoc_test (test_t t, test_pbproc_t *tp,
+ phy_prepare_type_t spoc_update_step)
+{
+ test_within (t);
+ const uint lid = 1;
+ const uint dtei = 2;
+ mfs_tx_t *mfs = utils_mfs_tx_prepare (false, false, lid, dtei, 5);
+ tx_data_test_common (t, tp, 5462132, mfs, .symb_nb = 50,
+ .duration_symb_nb = 50,
+ .seg_nb_total = 5,
+ .tmi = PHY_MOD_HS_ROBO,
+ .spoc = spoc_update_step != PHY_PREPARE_TYPE_NB,
+ .spoc_update_step = spoc_update_step);
+ test_fail_unless (mfs->fsm_state == MFS_FSM_CMD_IN_SYNC);
+ test_fail_unless (mfs->stats.num_mpdus == 1);
+ test_fail_unless (mfs->stats.num_bursts == 1);
+ test_fail_unless (mfs->stats.num_pbs == 5);
+ test_fail_unless (mfs->stats.num_segs_suc == 5);
+ utils_mfs_tx_cleanup (mfs);
+ dbg_check (mac_store_sta_remove (tp->store, dtei));
+}
+
+void
tx_data_basic_test_case (test_t t)
{
test_pbproc_t tp;
@@ -737,66 +620,32 @@ tx_data_basic_test_case (test_t t)
test_pbproc_init (&tp);
test_begin (t, "unicast")
{
- tx_data_test (t, &tp, 5462132, 30,
- MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
- + MAC_PAYLOAD_TCK (50, MAC_DX417_TCK)
- + MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
- + MAC_FC_AV_TCK,
- 50, 5, false, PHY_MOD_HS_ROBO, PHY_PREPARE_TYPE_NB);
- tx_data_test (t, &tp, 5462132, 30,
- MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
- + MAC_PAYLOAD_TCK (50, MAC_DX417_TCK)
- + MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
- + MAC_FC_AV_TCK,
- 38, 2, true, PHY_MOD_ROBO, PHY_PREPARE_TYPE_NB);
+ tx_data_test (t, &tp, 5462132, 30, 50, 50, 5, false, PHY_MOD_HS_ROBO);
+ tx_data_test (t, &tp, 5462132, 30, 50, 38, 2, true, PHY_MOD_ROBO);
} test_end;
test_begin (t, "no seg prp won")
{
- tx_data_noseg_test (t, &tp, 5462132,
- MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
- + MAC_PAYLOAD_TCK (95, MAC_DX417_TCK)
- + MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
- + MAC_FC_AV_TCK, true, true, false);
+ tx_data_noseg_test (t, &tp, 5462132, 95, true, true, false);
} test_end;
test_begin (t, "no seg prp lost")
{
- tx_data_noseg_test (t, &tp, 5462132,
- MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
- + MAC_PAYLOAD_TCK (95, MAC_DX417_TCK)
- + MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
- + MAC_FC_AV_TCK, false, true, false);
+ tx_data_noseg_test (t, &tp, 5462132, 95, false, true, false);
} test_end;
test_begin (t, "no mfs prp won")
{
- tx_data_noseg_test (t, &tp, 5462132,
- MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
- + MAC_PAYLOAD_TCK (95, MAC_DX417_TCK)
- + MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
- + MAC_FC_AV_TCK, true, false, false);
+ tx_data_noseg_test (t, &tp, 5462132, 95, true, false, false);
} test_end;
test_begin (t, "no mfs prp lost")
{
- tx_data_noseg_test (t, &tp, 5462132,
- MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
- + MAC_PAYLOAD_TCK (95, MAC_DX417_TCK)
- + MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
- + MAC_FC_AV_TCK, false, false, false);
+ tx_data_noseg_test (t, &tp, 5462132, 95, false, false, false);
} test_end;
test_begin (t, "multicast")
{
- tx_data_woack_test (t, &tp, 5462132, 30,
- MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
- + MAC_PAYLOAD_TCK (95, MAC_DX417_TCK)
- + MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
- + MAC_FC_AV_TCK,
- 38, 2);
+ tx_data_woack_test (t, &tp, 5462132, 30, 95, 38, 2);
} test_end;
test_begin (t, "beacon")
{
- tx_data_beacon_test (t, &tp, 123, MAC_PREAMBLE_HYBRID_TCK
- + MAC_FC_10_TCK + MAC_FC_AV_TCK
- + MAC_PAYLOAD_TCK (6, MAC_DX567_TCK)
- + MAC_B2BIFS_TCK, 6);
+ tx_data_beacon_test (t, &tp, 123, 6, 6);
} test_end;
test_pbproc_uninit (&tp);
}
@@ -829,13 +678,8 @@ tx_data_bursts_test_case (test_t t)
};
test_begin (t, "max fl")
{
- tx_data_burst_test (t, &tp, 5162132, 83 + 26,
- MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
- + MAC_PAYLOAD_TCK (95, MAC_DX417_TCK)
- + MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
- + MAC_FC_AV_TCK,
- 50, 83, 16, 26,
- 6, 6, NULL, false, false);
+ tx_data_burst_test (t, &tp, 5162132, 83 + 26, 95,
+ 50, 83, 16, 26, 6, 6, NULL, false, false);
} test_end;
test_begin (t, "interval max fl, seg limit")
{
@@ -843,11 +687,7 @@ tx_data_bursts_test_case (test_t t)
100000 - (MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
+ MAC_PAYLOAD_TCK (50, MAC_DX417_TCK)
+ MAC_BIFS_TCK),
- 83 + 26,
- MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
- + MAC_PAYLOAD_TCK (95, MAC_DX417_TCK)
- + MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
- + MAC_FC_AV_TCK,
+ 83 + 26, 95,
50, 83, 16, 26,
5, 6, intervals, false, false);
} test_end;
@@ -857,21 +697,13 @@ tx_data_bursts_test_case (test_t t)
200000 - (MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
+ MAC_PAYLOAD_TCK (50, MAC_DX417_TCK)
+ MAC_BIFS_TCK),
- 90,
- MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
- + MAC_PAYLOAD_TCK (95, MAC_DX417_TCK)
- + MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
- + MAC_FC_AV_TCK,
+ 90, 95,
50, 83, 0, 0,
6, 0, intervals, false, false);
} test_end;
test_begin (t, "interval max fl, interrupt on no pb")
{
- tx_data_burst_test (t, &tp, 5162132, 100,
- MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
- + MAC_PAYLOAD_TCK (95, MAC_DX417_TCK)
- + MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
- + MAC_FC_AV_TCK,
+ tx_data_burst_test (t, &tp, 5162132, 100, 95,
50, 83, 0, 0,
6, 0, NULL, true, false);
} test_end;
@@ -881,11 +713,7 @@ tx_data_bursts_test_case (test_t t)
100000 - (MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
+ MAC_PAYLOAD_TCK (50, MAC_DX417_TCK)
+ MAC_BIFS_TCK),
- 100,
- MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
- + MAC_PAYLOAD_TCK (95, MAC_DX417_TCK)
- + MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
- + MAC_FC_AV_TCK,
+ 100, 95,
50, 83, 0, 0,
5, 6, intervals, false, true);
} test_end;
@@ -904,38 +732,20 @@ tx_data_spoc_test_case (test_t t)
pbproc_spoc_coeff_set (tp.pbproc, true, coeff);
test_begin (t, "preamble")
{
- tx_data_test (t, &tp, 5462132, 30,
- MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
- + MAC_PAYLOAD_TCK (50, MAC_DX417_TCK)
- + MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
- + MAC_FC_AV_TCK,
- 50, 5, false, PHY_MOD_HS_ROBO,
- PHY_PREPARE_TYPE_PREAMBLE);
+ tx_data_spoc_test (t, &tp, PHY_PREPARE_TYPE_PREAMBLE);
test_fail_unless (tp.pbproc->spoc_update.step
== PHY_PREPARE_TYPE_PRS);
test_fail_unless (tp.pbproc->spoc_update.coeff == NULL);
} test_end;
test_begin (t, "prs")
{
- tx_data_test (t, &tp, 5462132, 30,
- MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
- + MAC_PAYLOAD_TCK (50, MAC_DX417_TCK)
- + MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
- + MAC_FC_AV_TCK,
- 50, 5, false, PHY_MOD_HS_ROBO,
- PHY_PREPARE_TYPE_PRS);
+ tx_data_spoc_test (t, &tp, PHY_PREPARE_TYPE_PRS);
test_fail_unless (tp.pbproc->spoc_update.step
== PHY_PREPARE_TYPE_NB);
} test_end;
test_begin (t, "done")
{
- tx_data_test (t, &tp, 5462132, 30,
- MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
- + MAC_PAYLOAD_TCK (50, MAC_DX417_TCK)
- + MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
- + MAC_FC_AV_TCK,
- 50, 5, false, PHY_MOD_HS_ROBO,
- PHY_PREPARE_TYPE_NB);
+ tx_data_spoc_test (t, &tp, PHY_PREPARE_TYPE_NB);
} test_end;
test_pbproc_uninit (&tp);
}
@@ -1100,11 +910,7 @@ tx_data_error_test_case (test_t t)
} test_end;
test_begin (t, "tx late")
{
- tx_data_noseg_test (t, &tp, 5462132,
- MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
- + MAC_PAYLOAD_TCK (95, MAC_DX417_TCK)
- + MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
- + MAC_FC_AV_TCK, true, true, true);
+ tx_data_noseg_test (t, &tp, 5462132, 95, true, true, true);
} test_end;
test_pbproc_uninit (&tp);
}