summaryrefslogtreecommitdiff
path: root/cesar
diff options
context:
space:
mode:
authorNicolas Schodet2010-12-22 11:19:58 +0100
committerNicolas Schodet2010-12-22 11:21:12 +0100
commit428fdb2eb6d8e59ca188daa6b21f23f8dbeb2d2b (patch)
tree079adbceda54b0c08b45351bdd1b8953df38f025 /cesar
parentff917f7b4d698bb4b0649e68b57b58482c235b48 (diff)
cesar/mac/pbproc: fix TX cancel when prepared SOUND frame, closes #2134
Diffstat (limited to 'cesar')
-rw-r--r--cesar/mac/pbproc/src/fsm_top.c5
-rw-r--r--cesar/mac/pbproc/test/pbproc/src/tx_sound.c50
2 files changed, 39 insertions, 16 deletions
diff --git a/cesar/mac/pbproc/src/fsm_top.c b/cesar/mac/pbproc/src/fsm_top.c
index dae6cd2143..32dda23bc8 100644
--- a/cesar/mac/pbproc/src/fsm_top.c
+++ b/cesar/mac/pbproc/src/fsm_top.c
@@ -125,7 +125,10 @@ pbproc_ftop__idle__access (pbproc_t *ctx)
&& !lesseq_mod2p32 (phy_date (), ctx->access.access_date
- PBPROC_TX_ANTICIP_TCK))
{
- pbproc_prep_mpdu_cancel (ctx);
+ if (ctx->prep_mpdu.sound_reason_code != TONEMAP_SRC_NULL)
+ pbproc_prep_mpdu_sound_ack (ctx, false);
+ else
+ pbproc_prep_mpdu_cancel (ctx);
ctx->stats.tx_late++;
}
/* Test if TX can be done. */
diff --git a/cesar/mac/pbproc/test/pbproc/src/tx_sound.c b/cesar/mac/pbproc/test/pbproc/src/tx_sound.c
index e3c1b774a1..6213c478e3 100644
--- a/cesar/mac/pbproc/test/pbproc/src/tx_sound.c
+++ b/cesar/mac/pbproc/test/pbproc/src/tx_sound.c
@@ -125,7 +125,8 @@ tx_sound_basic_test_case (test_t t)
}
void
-tx_sound_cancel_test (test_t t, test_pbproc_t *tp, bool prp_won, bool rx_fc)
+tx_sound_cancel_test (test_t t, test_pbproc_t *tp, bool prp_won, bool rx_fc,
+ bool late)
{
test_within (t);
const uint lid = 1;
@@ -255,21 +256,36 @@ tx_sound_cancel_test (test_t t, test_pbproc_t *tp, bool prp_won, bool rx_fc)
.end_date = date2 - MAC_SLOT_TCK + sack_length_tck),
SCENARIO_END
};
- scenario_entry_t *entries = rx_fc ? sack_entries : access_entries;
+ scenario_entry_t late_entries[] = {
+ SCENARIO_ACTION (phy_access, .mfs = mfs, .access_param = &access,
+ .prp_won = true, .slot_count = 6,
+ .delay_tck = late ? PBPROC_ANTICIP_TCK : 0),
+ SCENARIO_EVENT (ca_access_hold),
+ SCENARIO_EVENT (ca_access_get_mfs),
+ SCENARIO_EVENT (ca_access_done),
+ SCENARIO_EVENT (ca_access_done),
+ SCENARIO_EVENT (ca_access_defer, .date = date),
+ SCENARIO_END
+ };
+ scenario_entry_t *entries =
+ late ? late_entries : (rx_fc ? sack_entries : access_entries);
scenario_globals_t globals = {
.tp = tp,
};
test_pbproc_check_stats_reset (tp);
scenario_run (t, entries, &globals);
- test_pbproc_check_stats (
- t, tp,
- .prp_lost = prp_won ? 0 : 1,
- .cw_lost = rx_fc ? (prp_won ? 1 : 0) : (prp_won ? 2 : 1),
- .rx_handle_fc = 1,
- .rx_nfu = 1,
- .tx_sound = rx_fc ? 1 : 2,
- .tx_sound_noack = rx_fc ? 1 : 2,
- );
+ if (!late)
+ test_pbproc_check_stats (
+ t, tp,
+ .prp_lost = prp_won ? 0 : 1,
+ .cw_lost = rx_fc ? (prp_won ? 1 : 0) : (prp_won ? 2 : 1),
+ .rx_handle_fc = 1,
+ .rx_nfu = 1,
+ .tx_sound = rx_fc ? 1 : 2,
+ .tx_sound_noack = rx_fc ? 1 : 2,
+ );
+ else
+ test_pbproc_check_stats (t, tp, .tx_invalid = 1, .tx_late = 1);
test_fail_unless (mfs->stats.num_mpdus == 0);
test_fail_unless (mfs->stats.num_bursts == 0);
test_fail_unless (mfs->stats.num_pbs == 0);
@@ -288,19 +304,23 @@ tx_sound_error_test_case (test_t t)
test_pbproc_init (&tp);
test_begin (t, "no ack")
{
- tx_sound_cancel_test (t, &tp, true, false);
+ tx_sound_cancel_test (t, &tp, true, false, false);
} test_end;
test_begin (t, "cw lost")
{
- tx_sound_cancel_test (t, &tp, true, true);
+ tx_sound_cancel_test (t, &tp, true, true, false);
} test_end;
test_begin (t, "prp lost")
{
- tx_sound_cancel_test (t, &tp, false, true);
+ tx_sound_cancel_test (t, &tp, false, true, false);
} test_end;
test_begin (t, "prp lost and no frame")
{
- tx_sound_cancel_test (t, &tp, false, false);
+ tx_sound_cancel_test (t, &tp, false, false, false);
+ } test_end;
+ test_begin (t, "tx late")
+ {
+ tx_sound_cancel_test (t, &tp, true, false, true);
} test_end;
test_pbproc_uninit (&tp);
}