From e17d5e5383928d2aaaade575ce0f2a93bb921f64 Mon Sep 17 00:00:00 2001 From: Cyril Jourdan Date: Wed, 5 Jun 2013 09:14:17 +0200 Subject: cesar/mac/pbproc: make sta context more visible in some functions, refs #4018 --- cesar/mac/pbproc/src/fsm_rx_data.c | 5 +++-- cesar/mac/pbproc/src/fsm_rx_sound.c | 13 +++++-------- cesar/mac/pbproc/test/pbproc/src/rx_data.c | 10 +++++++--- 3 files changed, 15 insertions(+), 13 deletions(-) (limited to 'cesar') diff --git a/cesar/mac/pbproc/src/fsm_rx_data.c b/cesar/mac/pbproc/src/fsm_rx_data.c index 5d380d42d0..65a4491cdb 100644 --- a/cesar/mac/pbproc/src/fsm_rx_data.c +++ b/cesar/mac/pbproc/src/fsm_rx_data.c @@ -112,6 +112,9 @@ pbproc_frda__handle (pbproc_t *ctx, u32 rx_date) PBPROC_FC_SACKI_UNIFORM_ALL_ERROR); return; } + sta_t *sta = NULL; + if (!(rx_params->bcast || unassociated)) + sta = mac_store_sta_get_noref (ctx->store, rx_params->tei); /* Get tonemap. */ uint tmi = rx_params->tmi_av; tonemap_t *tm; @@ -131,7 +134,6 @@ pbproc_frda__handle (pbproc_t *ctx, u32 rx_date) { dbg_claim (wack); dbg_claim (tmi < TONEMAP_INDEX_NB); - sta_t *sta = mac_store_sta_get_noref (ctx->store, rx_params->tei); if (sta) { tm = sta->rx_tonemaps->tm[tmi]; @@ -197,7 +199,6 @@ pbproc_frda__handle (pbproc_t *ctx, u32 rx_date) { if (unassociated) break; - sta_t *sta = mac_store_sta_get_noref (ctx->store, rx_params->tei); mac_nek_t *(*nek)[2]; if (sta) { diff --git a/cesar/mac/pbproc/src/fsm_rx_sound.c b/cesar/mac/pbproc/src/fsm_rx_sound.c index 756d61dde8..eb3fb5ddba 100644 --- a/cesar/mac/pbproc/src/fsm_rx_sound.c +++ b/cesar/mac/pbproc/src/fsm_rx_sound.c @@ -35,19 +35,16 @@ pbproc_frso_init (pbproc_t *ctx) /** * Decrement sound counter and check if sound transmission is completed. - * \param ctx pbproc context - * \param tei source tei + * \param sta station context * \param src received sound reason code * \param offset_tck offset since the start of beacon period * \param flp_tck frame length, with preamble and IFS * \return true if sound is completed */ static bool -pbproc_frso_sound_complete (pbproc_t *ctx, uint tei, uint src, - uint offset_tck, uint flp_tck) +pbproc_frso_sound_complete (sta_t *sta, uint src, uint offset_tck, + uint flp_tck) { - dbg_claim (ctx); - sta_t *sta = mac_store_sta_get_noref (ctx->store, tei); if (sta) { u8 zero_counter = 0; @@ -131,9 +128,9 @@ pbproc_frso__handle (pbproc_t *ctx, u32 rx_date, /* Unblock hardware. */ phy_rx_prepare_sound (ctx->phy, 1, tm->phy_combo_params[pb_size], tm->gil, symb_nb); + sta_t *sta = mac_store_sta_get_noref (ctx->store, sound->stei); /* Is sound completed? */ - sound_complete = pbproc_frso_sound_complete ( - ctx, sound->stei, sound->src, + sound_complete = pbproc_frso_sound_complete (sta, sound->src, rx_date - ctx->alloc.beacon_period_start_date, ctx->times.pre_fcs_tck + fl_tck); /* Update stats. */ diff --git a/cesar/mac/pbproc/test/pbproc/src/rx_data.c b/cesar/mac/pbproc/test/pbproc/src/rx_data.c index 226d71438c..07c478bfcf 100644 --- a/cesar/mac/pbproc/test/pbproc/src/rx_data.c +++ b/cesar/mac/pbproc/test/pbproc/src/rx_data.c @@ -124,11 +124,15 @@ rx_data_burst_test_mpdu (test_t t, test_pbproc_t *tp, /* Prepare tone map. */ tonemap_t *tm = &tp->config.tonemask_info.tonemap_robo[PHY_MOD_ROBO]; uint dx = MAC_DX417_TCK; + if (!(burst->unassociated || burst->bcast)) + { + mac_store_sta_add (tp->store, ctx->stei); + ctx->sta_added = true; + } if (m->tmi != PHY_MOD_ROBO || m->encrypted) { tm = utils_sta_prepare_default_tonemap (tp, false, ctx->stei, m->tmi, m->tm_mod, 0, &dx); - ctx->sta_added = true; } uint rifs_tck = m->symb_nb == 0 || m->tmi < PHY_MOD_ROBO_NB ? MAC_RIFS_DEFAULT_TCK : MAC_RIFS_SPC_ANY_TCK; @@ -476,14 +480,14 @@ rx_data_burst_test_f (test_t t, test_pbproc_t *tp, &tp->pbproc->rx_pool_tail->blk); slist_init (tp->pbproc->rx_pool_, paste_size); } - if (ctx.sta_added) - dbg_check (mac_store_sta_remove (tp->store, ctx.stei)); tp->config.authenticated = false; if (mfs) { mac_store_mfs_remove (tp->store, PARENT_OF (mfs_t, rx, mfs)); blk_release (mfs); } + if (ctx.sta_added) + dbg_check (mac_store_sta_remove (tp->store, ctx.stei)); if (burst->chandata_nb) pbproc_set_chandata_conf (tp->pbproc, NULL, 0, false); } -- cgit v1.2.3