summaryrefslogtreecommitdiff
path: root/cesar/mac/pbproc
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/mac/pbproc')
-rw-r--r--cesar/mac/pbproc/src/fsm_rx_beacon.c3
-rw-r--r--cesar/mac/pbproc/src/fsm_rx_data.c3
-rw-r--r--cesar/mac/pbproc/src/fsm_rx_sound.c3
-rw-r--r--cesar/mac/pbproc/test/pbproc/inc/test_pbproc.h3
-rw-r--r--cesar/mac/pbproc/test/pbproc/src/ca.c8
-rw-r--r--cesar/mac/pbproc/test/pbproc/src/rx_data.c8
-rw-r--r--cesar/mac/pbproc/test/pbproc/src/rx_sound.c4
-rw-r--r--cesar/mac/pbproc/test/pbproc/src/test_pbproc.c4
-rw-r--r--cesar/mac/pbproc/test/pbproc_eoc/inc/test_pbproc.h3
-rw-r--r--cesar/mac/pbproc/test/pbproc_eoc/src/ca.c8
-rw-r--r--cesar/mac/pbproc/test/pbproc_eoc/src/rx_data.c8
-rw-r--r--cesar/mac/pbproc/test/pbproc_eoc/src/rx_sound.c4
-rw-r--r--cesar/mac/pbproc/test/pbproc_eoc/src/test_pbproc.c4
13 files changed, 34 insertions, 29 deletions
diff --git a/cesar/mac/pbproc/src/fsm_rx_beacon.c b/cesar/mac/pbproc/src/fsm_rx_beacon.c
index ddf4e30b85..47b780ea50 100644
--- a/cesar/mac/pbproc/src/fsm_rx_beacon.c
+++ b/cesar/mac/pbproc/src/fsm_rx_beacon.c
@@ -48,7 +48,8 @@ pbproc_frbe__handle (pbproc_t *ctx, u32 rx_date,
/* Ignore frames ending after the allocation, handle pool exhaustion. */
#if !CONFIG_MAC_PBPROC_EOC_FC
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)
#else
if (ctx->rx_pool_size < 1)
diff --git a/cesar/mac/pbproc/src/fsm_rx_data.c b/cesar/mac/pbproc/src/fsm_rx_data.c
index a56ce06e1b..86c27842d5 100644
--- a/cesar/mac/pbproc/src/fsm_rx_data.c
+++ b/cesar/mac/pbproc/src/fsm_rx_data.c
@@ -153,8 +153,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 0c3e35429a..5998ed4e46 100644
--- a/cesar/mac/pbproc/src/fsm_rx_sound.c
+++ b/cesar/mac/pbproc/src/fsm_rx_sound.c
@@ -77,8 +77,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/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..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 += 0x80000000;
+ 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 = 0x80000000 - 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 323b8db0eb..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 += 0x80000000;
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;
diff --git a/cesar/mac/pbproc/test/pbproc/src/test_pbproc.c b/cesar/mac/pbproc/test/pbproc/src/test_pbproc.c
index af6a03753c..569e3d0aef 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;
}
diff --git a/cesar/mac/pbproc/test/pbproc_eoc/inc/test_pbproc.h b/cesar/mac/pbproc/test/pbproc_eoc/inc/test_pbproc.h
index ee8ebafc1a..db29992dbb 100644
--- a/cesar/mac/pbproc/test/pbproc_eoc/inc/test_pbproc.h
+++ b/cesar/mac/pbproc/test/pbproc_eoc/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_eoc/src/ca.c b/cesar/mac/pbproc/test/pbproc_eoc/src/ca.c
index e5fce901a2..9633f23d3a 100644
--- a/cesar/mac/pbproc/test/pbproc_eoc/src/ca.c
+++ b/cesar/mac/pbproc/test/pbproc_eoc/src/ca.c
@@ -51,8 +51,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;
}
@@ -121,8 +121,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_eoc/src/rx_data.c b/cesar/mac/pbproc/test/pbproc_eoc/src/rx_data.c
index bebccb702d..e3786ed2af 100644
--- a/cesar/mac/pbproc/test/pbproc_eoc/src/rx_data.c
+++ b/cesar/mac/pbproc/test/pbproc_eoc/src/rx_data.c
@@ -1164,7 +1164,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 - 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;
@@ -1420,12 +1420,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 = 0x80000000 - 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_eoc/src/rx_sound.c b/cesar/mac/pbproc/test/pbproc_eoc/src/rx_sound.c
index 13ce1814e3..78bdeacccd 100644
--- a/cesar/mac/pbproc/test/pbproc_eoc/src/rx_sound.c
+++ b/cesar/mac/pbproc/test/pbproc_eoc/src/rx_sound.c
@@ -273,13 +273,13 @@ rx_sound_nfu_test (test_t t, test_pbproc_t *tp, u32 date, rx_sound_nfu_t nfu)
.src = TONEMAP_SRC_INITIAL,
.fccs_av = 0,
};
- if (nfu == NFU_OUT_OF_ALLOC)
- date += 0x80000000;
/* Late set of date. */
prep->tx_date = 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;
diff --git a/cesar/mac/pbproc/test/pbproc_eoc/src/test_pbproc.c b/cesar/mac/pbproc/test/pbproc_eoc/src/test_pbproc.c
index e784452ae7..1bebb19d9a 100644
--- a/cesar/mac/pbproc/test/pbproc_eoc/src/test_pbproc.c
+++ b/cesar/mac/pbproc/test/pbproc_eoc/src/test_pbproc.c
@@ -131,8 +131,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;
}