summaryrefslogtreecommitdiff
path: root/cesar/mac/common/src/mfs.c
diff options
context:
space:
mode:
authorCyril Jourdan2011-05-10 11:29:03 +0200
committerCyril Jourdan2011-07-27 09:28:47 +0200
commit995546db79268510d50d2d8baab78c462e42691f (patch)
tree18b7afd838f869240129a9c6a54b8135b62644d1 /cesar/mac/common/src/mfs.c
parentf9d2fa175bfd7783ce60312204024a0a7eb31511 (diff)
cesar/mac/common: change window size value management, closes #2499
The RX window size is changed from 200 to 256 to be compliant with the HPAV specification. The function mfs_rx_window_size_encode is replaced by a global conversion table between indexes used in RxWSz field of the FCs and actual values of window size. This makes the access to the values easier and prevent from using non-standard values.
Diffstat (limited to 'cesar/mac/common/src/mfs.c')
-rw-r--r--cesar/mac/common/src/mfs.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/cesar/mac/common/src/mfs.c b/cesar/mac/common/src/mfs.c
index 2a4fbfe4bd..d61c1b5e3d 100644
--- a/cesar/mac/common/src/mfs.c
+++ b/cesar/mac/common/src/mfs.c
@@ -16,11 +16,19 @@
#include "mac/common/defs.h"
#include "mac/common/timings.h"
-/** MFS MME window size. */
-#define MFS_WINDOW_SIZE_MME 8
+/** MFS MME window size (fixed). */
+#define MFS_WINDOW_SIZE_MME MFS_WINDOW_SIZE_8
-/** MFS DATA window size. */
-#define MFS_WINDOW_SIZE_DATA 200
+/** RX MFS DATA window size (fixed). */
+#define MFS_WINDOW_SIZE_DATA_RX MFS_WINDOW_SIZE_256
+
+/** Default TX MFS DATA window size (actual value is fixed by the receiver). */
+#define MFS_DEFAULT_WINDOW_SIZE_DATA_TX MFS_WINDOW_SIZE_16
+
+/** Window size values table (values of the RxWSz field of the FCs in which
+ * it is included). */
+const u16 mfs_window_size[MFS_WINDOW_SIZE_NB] = { 4, 8, 16, 24, 32, 48, 64, 80,
+ 96, 112, 128, 144, 160, 192, 224, 256 };
static void
mfs_common_init (mfs_common_t *mfs_common, bool tx, bool bcast, bool mme, uint
@@ -54,8 +62,8 @@ mfs_rx_init (mfs_rx_t *mfs, bool bcast, bool mme, uint lid, uint tei)
mfs_common_init (&mfs->common, false, bcast, mme, lid, tei);
mfs->head = NULL;
mfs->ssn_min = 0;
- mfs->window_size = mme ? MFS_WINDOW_SIZE_MME : MFS_WINDOW_SIZE_DATA;
- mfs->window_size_encoded = mfs_rx_window_size_encode (mfs->window_size);
+ mfs->window_size_encoded = mme ? MFS_WINDOW_SIZE_MME : MFS_WINDOW_SIZE_DATA_RX;
+ mfs->window_size = mfs_window_size[mfs->window_size_encoded];
mfs->release = false;
link_stats_rx_reset (&mfs->stats);
}
@@ -87,8 +95,8 @@ mfs_tx_init (mfs_tx_t *mfs, bool bcast, bool mme, uint lid, uint tei)
mfs->pending_seg_nb = 0;
mfs->fsm_state = bcast ? MFS_FSM_CMD_NOP : MFS_FSM_CMD_INIT;
mfs->min_ssn = 0;
- mfs->window_size = mme ? MFS_WINDOW_SIZE_MME : MFS_WINDOW_SIZE_DATA;
- mfs->window_holes_seg_nb = 0;
+ mfs->window_size = mme ? mfs_window_size[MFS_WINDOW_SIZE_MME]
+ : mfs_window_size[MFS_DEFAULT_WINDOW_SIZE_DATA_TX];
if (mme)
mfs->cap = 2;
else
@@ -112,15 +120,3 @@ mfs_tx_init_unassociated (mfs_tx_t *mfs, bool bcast, bool mme, uint lid,
mfs->fsm_state = MFS_FSM_CMD_NOP;
}
-u8
-mfs_rx_window_size_encode (u16 window_size)
-{
- uint i;
- static u16 encode_table[] = { 4, 8, 16, 24, 32, 48, 64, 80, 96, 112, 128,
- 144, 160, 192, 224, 256 };
- dbg_assert (window_size >= 4 && window_size <= 256);
- DICHOTOMY_SEARCH (0, COUNT (encode_table), i,
- window_size < encode_table[i]);
- return i - 1;
-}
-