From 495afa0d6bcc89cf359e44d7eae76f31dd88fbaf Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Tue, 9 Oct 2012 09:18:24 +0200 Subject: cesar/mac/pbproc/test/pbproc: replace end of alloc literal --- cesar/mac/pbproc/test/pbproc/inc/test_pbproc.h | 3 +++ cesar/mac/pbproc/test/pbproc/src/ca.c | 8 ++++---- cesar/mac/pbproc/test/pbproc/src/rx_data.c | 4 ++-- cesar/mac/pbproc/test/pbproc/src/rx_sound.c | 2 +- cesar/mac/pbproc/test/pbproc/src/test_pbproc.c | 4 ++-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/cesar/mac/pbproc/test/pbproc/inc/test_pbproc.h b/cesar/mac/pbproc/test/pbproc/inc/test_pbproc.h index ee8ebafc1a..db29992dbb 100644 --- a/cesar/mac/pbproc/test/pbproc/inc/test_pbproc.h +++ b/cesar/mac/pbproc/test/pbproc/inc/test_pbproc.h @@ -27,6 +27,9 @@ /** Date offset for expiration tests. */ #define TEST_PBPROC_EXPIRATION_DATE_OFFSET 1000000000 +/** End date of default allocation. */ +#define TEST_PBPROC_ALLOC_END_DATE 0x80000000 + /** Test pbproc context. */ struct test_pbproc_t { diff --git a/cesar/mac/pbproc/test/pbproc/src/ca.c b/cesar/mac/pbproc/test/pbproc/src/ca.c index 3f2cf4b032..08c3852107 100644 --- a/cesar/mac/pbproc/test/pbproc/src/ca.c +++ b/cesar/mac/pbproc/test/pbproc/src/ca.c @@ -50,8 +50,8 @@ ca_access_activate (ca_t *ctx, u32 date) ctx->current_allocation_param.hybrid = params->hybrid; ctx->current_allocation_param.merge = params->merge; ctx->current_allocation_param.nek_switch = params->nek_switch; - ctx->current_allocation_param.end_date = 0x80000000; - ctx->current_allocation_param.aifs_date = 0x80000000; + ctx->current_allocation_param.end_date = TEST_PBPROC_ALLOC_END_DATE; + ctx->current_allocation_param.aifs_date = TEST_PBPROC_ALLOC_END_DATE; return &ctx->current_allocation_param; } @@ -104,8 +104,8 @@ ca_access_aifs (ca_t *ctx) ctx->current_allocation_param.hybrid = params->hybrid; ctx->current_allocation_param.merge = params->merge; ctx->current_allocation_param.nek_switch = params->nek_switch; - ctx->current_allocation_param.end_date = 0x80000000; - ctx->current_allocation_param.aifs_date = 0x80000000; + ctx->current_allocation_param.end_date = TEST_PBPROC_ALLOC_END_DATE; + ctx->current_allocation_param.aifs_date = TEST_PBPROC_ALLOC_END_DATE; return &ctx->current_allocation_param; } diff --git a/cesar/mac/pbproc/test/pbproc/src/rx_data.c b/cesar/mac/pbproc/test/pbproc/src/rx_data.c index 7233e07419..b8fee52d99 100644 --- a/cesar/mac/pbproc/test/pbproc/src/rx_data.c +++ b/cesar/mac/pbproc/test/pbproc/src/rx_data.c @@ -993,7 +993,7 @@ rx_data_nfu_test (test_t t, test_pbproc_t *tp, u32 date, rx_data_nfu_t nfu) } if (nfu == NFU_OUT_OF_ALLOC) { - date += 0x80000000; + date += TEST_PBPROC_ALLOC_END_DATE; restart_date = date + length_tck - MAC_PREAMBLE_TCK - MAC_FC_AV_TCK - MAC_CIFS_TCK; length_tck = MAC_PREAMBLE_TCK + MAC_FC_AV_TCK + MAC_CIFS_TCK; @@ -1061,7 +1061,7 @@ rx_beacon_nfu_test (test_t t, test_pbproc_t *tp, rx_data_nfu_t nfu) u32 date = 12345; if (nfu == NFU_OUT_OF_ALLOC) /* Date to overshoot allocation. */ - date = 0x80000000 - MAC_PREAMBLE_HYBRID_TCK / 2; + date = TEST_PBPROC_ALLOC_END_DATE - MAC_PREAMBLE_HYBRID_TCK / 2; const uint pre_fc_fl_tck = MAC_PREAMBLE_HYBRID_TCK + MAC_FC_10_TCK + MAC_FC_AV_TCK + MAC_PAYLOAD_TCK (6, MAC_DX567_TCK) + MAC_B2BIFS_TCK; diff --git a/cesar/mac/pbproc/test/pbproc/src/rx_sound.c b/cesar/mac/pbproc/test/pbproc/src/rx_sound.c index 323b8db0eb..a029baea1b 100644 --- a/cesar/mac/pbproc/test/pbproc/src/rx_sound.c +++ b/cesar/mac/pbproc/test/pbproc/src/rx_sound.c @@ -278,7 +278,7 @@ rx_sound_nfu_test (test_t t, test_pbproc_t *tp, u32 date, rx_sound_nfu_t nfu) .fccs_av = 0, }; if (nfu == NFU_OUT_OF_ALLOC) - date += 0x80000000; + date += TEST_PBPROC_ALLOC_END_DATE; length_tck = MAC_PREAMBLE_TCK + MAC_FC_AV_TCK + MAC_FL_TO_TCK (MAC_TCK_TO_FL (fl_tck)) + MAC_PREAMBLE_TCK + MAC_FC_AV_TCK + MAC_CIFS_TCK; diff --git a/cesar/mac/pbproc/test/pbproc/src/test_pbproc.c b/cesar/mac/pbproc/test/pbproc/src/test_pbproc.c index f531bbb1df..e08a77cf79 100644 --- a/cesar/mac/pbproc/test/pbproc/src/test_pbproc.c +++ b/cesar/mac/pbproc/test/pbproc/src/test_pbproc.c @@ -128,8 +128,8 @@ test_pbproc_alloc (test_pbproc_t *ctx, bool hybrid, ctx->pbproc->alloc.merge = false; ctx->pbproc->times = ctx->pbproc->times_array[PBPROC_TIMES_ARRAY_INDEX ( hybrid, ctx->pbproc->alloc.coexistence_mode)]; - ctx->pbproc->alloc.end_date = 0x80000000; - ctx->pbproc->alloc.aifs_date = 0x80000000; + ctx->pbproc->alloc.end_date = TEST_PBPROC_ALLOC_END_DATE; + ctx->pbproc->alloc.aifs_date = TEST_PBPROC_ALLOC_END_DATE; ctx->pbproc->alloc.beacon_period_start_date = beacon_period_start_date; } -- cgit v1.2.3 From 8c9b814f60eb2ea609b45da04ccd721684eb7fc4 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Wed, 3 Oct 2012 11:33:17 +0200 Subject: cesar/mac/pbproc: fix out of alloc timing, closes #3406 CIFS or B2BIFS are not needed at the end of allocation as there is an AIFS anyway, see HPAV 5.6 Interframe Spacing. --- cesar/mac/pbproc/src/fsm_rx_beacon.c | 3 ++- cesar/mac/pbproc/src/fsm_rx_data.c | 3 +-- cesar/mac/pbproc/src/fsm_rx_sound.c | 3 +-- cesar/mac/pbproc/test/pbproc/src/rx_data.c | 8 ++++---- cesar/mac/pbproc/test/pbproc/src/rx_sound.c | 4 ++-- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/cesar/mac/pbproc/src/fsm_rx_beacon.c b/cesar/mac/pbproc/src/fsm_rx_beacon.c index 2b1fde55c1..a79256a2e7 100644 --- a/cesar/mac/pbproc/src/fsm_rx_beacon.c +++ b/cesar/mac/pbproc/src/fsm_rx_beacon.c @@ -47,7 +47,8 @@ pbproc_frbe__handle (pbproc_t *ctx, u32 rx_date, ctx->recv_mpdu.ack_date = rx_date + flp_tck; /* Ignore frames ending after the allocation, handle pool exhaustion. */ if ((!ctx->alloc.merge - && less_mod2p32 (ctx->alloc.end_date, ctx->recv_mpdu.ack_date)) + && less_mod2p32 (ctx->alloc.end_date, ctx->recv_mpdu.ack_date + - MAC_B2BIFS_TCK)) || ctx->rx_pool_size < 1) { /* Ignore. */ diff --git a/cesar/mac/pbproc/src/fsm_rx_data.c b/cesar/mac/pbproc/src/fsm_rx_data.c index d0fbc6f700..138a8e2414 100644 --- a/cesar/mac/pbproc/src/fsm_rx_data.c +++ b/cesar/mac/pbproc/src/fsm_rx_data.c @@ -105,8 +105,7 @@ pbproc_frda__handle (pbproc_t *ctx, u32 rx_date) uint fl_tck = rx_params->fl_tck; if (!ctx->alloc.merge && less_mod2p32 (ctx->alloc.end_date, - rx_date + 2 * ctx->times.pre_fcs_tck + fl_tck - + MAC_CIFS_TCK)) + rx_date + 2 * ctx->times.pre_fcs_tck + fl_tck)) { ctx->stats.rx_out_of_alloc++; pbproc_frda_error (ctx, rx_date, false, diff --git a/cesar/mac/pbproc/src/fsm_rx_sound.c b/cesar/mac/pbproc/src/fsm_rx_sound.c index a24cdbd91c..ff12e93441 100644 --- a/cesar/mac/pbproc/src/fsm_rx_sound.c +++ b/cesar/mac/pbproc/src/fsm_rx_sound.c @@ -59,8 +59,7 @@ pbproc_frso__handle (pbproc_t *ctx, u32 rx_date, if (pool_shortage || (!ctx->alloc.merge && less_mod2p32 (ctx->alloc.end_date, - rx_date + 2 * ctx->times.pre_fcs_tck + fl_tck - + MAC_CIFS_TCK))) + rx_date + 2 * ctx->times.pre_fcs_tck + fl_tck))) { if (pool_shortage) ctx->stats.rx_pool_shortage++; diff --git a/cesar/mac/pbproc/test/pbproc/src/rx_data.c b/cesar/mac/pbproc/test/pbproc/src/rx_data.c index b8fee52d99..dffee89e41 100644 --- a/cesar/mac/pbproc/test/pbproc/src/rx_data.c +++ b/cesar/mac/pbproc/test/pbproc/src/rx_data.c @@ -993,7 +993,7 @@ rx_data_nfu_test (test_t t, test_pbproc_t *tp, u32 date, rx_data_nfu_t nfu) } if (nfu == NFU_OUT_OF_ALLOC) { - date += TEST_PBPROC_ALLOC_END_DATE; + date = TEST_PBPROC_ALLOC_END_DATE - length_tck + MAC_CIFS_TCK + 1; restart_date = date + length_tck - MAC_PREAMBLE_TCK - MAC_FC_AV_TCK - MAC_CIFS_TCK; length_tck = MAC_PREAMBLE_TCK + MAC_FC_AV_TCK + MAC_CIFS_TCK; @@ -1059,12 +1059,12 @@ rx_beacon_nfu_test (test_t t, test_pbproc_t *tp, rx_data_nfu_t nfu) .fccs_av = 0, }; u32 date = 12345; - if (nfu == NFU_OUT_OF_ALLOC) - /* Date to overshoot allocation. */ - date = TEST_PBPROC_ALLOC_END_DATE - MAC_PREAMBLE_HYBRID_TCK / 2; const uint pre_fc_fl_tck = MAC_PREAMBLE_HYBRID_TCK + MAC_FC_10_TCK + MAC_FC_AV_TCK + MAC_PAYLOAD_TCK (6, MAC_DX567_TCK) + MAC_B2BIFS_TCK; + if (nfu == NFU_OUT_OF_ALLOC) + /* Date to overshoot allocation. */ + date = TEST_PBPROC_ALLOC_END_DATE - pre_fc_fl_tck + MAC_B2BIFS_TCK + 1; if (nfu != NFU_POOL_SHORTAGE) tp->pbproc->rx_pool_size = 1; /* Use another state to test return to IDLE. */ diff --git a/cesar/mac/pbproc/test/pbproc/src/rx_sound.c b/cesar/mac/pbproc/test/pbproc/src/rx_sound.c index a029baea1b..274174af26 100644 --- a/cesar/mac/pbproc/test/pbproc/src/rx_sound.c +++ b/cesar/mac/pbproc/test/pbproc/src/rx_sound.c @@ -277,11 +277,11 @@ rx_sound_nfu_test (test_t t, test_pbproc_t *tp, u32 date, rx_sound_nfu_t nfu) .reserved2 = 0, .fccs_av = 0, }; - if (nfu == NFU_OUT_OF_ALLOC) - date += TEST_PBPROC_ALLOC_END_DATE; length_tck = MAC_PREAMBLE_TCK + MAC_FC_AV_TCK + MAC_FL_TO_TCK (MAC_TCK_TO_FL (fl_tck)) + MAC_PREAMBLE_TCK + MAC_FC_AV_TCK + MAC_CIFS_TCK; + if (nfu == NFU_OUT_OF_ALLOC) + date = TEST_PBPROC_ALLOC_END_DATE - length_tck + MAC_CIFS_TCK + 1; restart_date = date + length_tck - MAC_PREAMBLE_TCK - MAC_FC_AV_TCK - MAC_CIFS_TCK; length_tck = MAC_PREAMBLE_TCK + MAC_FC_AV_TCK + MAC_CIFS_TCK; -- cgit v1.2.3