summaryrefslogtreecommitdiff
path: root/cesar
diff options
context:
space:
mode:
authorNélio Laranjeiro2012-03-30 10:56:16 +0200
committerNélio Laranjeiro2012-07-18 17:36:36 +0200
commite377852d4cd982105a99204239451de9e302c028 (patch)
tree18daa13142c0e69bf1076c1abd96042f6c8207d4 /cesar
parentde6dcdccd3a9b75c9db4c55fcacd4ae3504166d3 (diff)
cesar/{bsu,mac}: add an expiration ntb to pb_beacon_t, closes #3057
A frame reception on PBProc can cancel an emission. To avoid to not transmit the frame the PBProc reschedule it, but before sending the frame it will check the expiration ntb date of the PBs it should send in the frame. This is correct for any PB but for Beacon PB it is not, those special PB did not have an expiration ntb date in their descriptor. So at the end some beacons were dropped because the PBProc was comparing an expiration ntb date to something which was not. This commit fix it by adding an expiration ntb date in the Beacon PB corresponding to the end of the beacon period within the one it is valid.
Diffstat (limited to 'cesar')
-rw-r--r--cesar/bsu/aclf/aclf.h8
-rw-r--r--cesar/bsu/aclf/src/aclf.c7
-rw-r--r--cesar/bsu/src/interface.c2
-rw-r--r--cesar/mac/common/pb.h2
4 files changed, 19 insertions, 0 deletions
diff --git a/cesar/bsu/aclf/aclf.h b/cesar/bsu/aclf/aclf.h
index beb6e1146a..e6ea17693c 100644
--- a/cesar/bsu/aclf/aclf.h
+++ b/cesar/bsu/aclf/aclf.h
@@ -257,6 +257,14 @@ bsu_aclf_track_powerline (bsu_aclf_t *ctx);
void
bsu_aclf_clear_sync (bsu_aclf_t *ctx);
+/**
+ * Get the date at the one the beacon should be considered as invalid.
+ * \param ctx the module context.
+ * \return the expiration date.
+ */
+u32
+bsu_aclf_beacon_expiration_date (bsu_aclf_t *ctx);
+
END_DECLS
#endif /* bsu_aclf_aclf_h */
diff --git a/cesar/bsu/aclf/src/aclf.c b/cesar/bsu/aclf/src/aclf.c
index 6f531167cc..a43e6618c8 100644
--- a/cesar/bsu/aclf/src/aclf.c
+++ b/cesar/bsu/aclf/src/aclf.c
@@ -381,3 +381,10 @@ bsu_aclf_clear_sync (bsu_aclf_t *ctx)
for (i = 2; i < BSU_ACLF_BPSD_NB; i++)
ctx->bpsd[i] = ctx->bpsd[i - 1] + ctx->beacon_period_theo_tck;
}
+
+u32
+bsu_aclf_beacon_expiration_date (bsu_aclf_t *ctx)
+{
+ dbg_claim (ctx);
+ return ctx->bpsd[2];
+}
diff --git a/cesar/bsu/src/interface.c b/cesar/bsu/src/interface.c
index d4f0c82c5b..74ffc03b85 100644
--- a/cesar/bsu/src/interface.c
+++ b/cesar/bsu/src/interface.c
@@ -90,6 +90,8 @@ bsu_beacon_send (bsu_t *ctx, bsu_beacon_type_t beacon_type,
if (beacon_type == BSU_BEACON_TYPE_CENTRAL)
ca_mfs_hold (ctx->ca, mfs);
mfs->cfp = ctx->sta_avln->beacon.vf.hm == MAC_COEXISTENCE_AV_ONLY_MODE;
+ beacon->expiration_ntb = bsu_aclf_beacon_expiration_date (ctx->aclf)
+ + ctx->mac_config->ntb_offset_tck;
/* Provide the beacon to the SAR. */
sar_beacon_send (ctx->sar, beacon, mfs, bto_bpsto);
BSU_TRACE (BEACON_SEND, phy_date (), beacon_type);
diff --git a/cesar/mac/common/pb.h b/cesar/mac/common/pb.h
index af337ed8dc..34372db3fd 100644
--- a/cesar/mac/common/pb.h
+++ b/cesar/mac/common/pb.h
@@ -80,6 +80,8 @@ union pb_beacon_t
u8 *data;
/** First four bytes of the beacon payload. */
u32 first_data_word;
+ /** Expiration NTB date.*/
+ u32 expiration_ntb;
};
};
typedef union pb_beacon_t pb_beacon_t;