summaryrefslogtreecommitdiff
path: root/cesar/cl/src/cl.c
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/cl/src/cl.c')
-rw-r--r--cesar/cl/src/cl.c72
1 files changed, 40 insertions, 32 deletions
diff --git a/cesar/cl/src/cl.c b/cesar/cl/src/cl.c
index f3aa688592..ba8d4d958a 100644
--- a/cesar/cl/src/cl.c
+++ b/cesar/cl/src/cl.c
@@ -15,6 +15,7 @@
#include "common/std.h"
#include "lib/seq_check.h"
+#include "lib/stats.h"
#include "hal/arch/arch.h"
#include "hal/gpio/gpio.h"
@@ -27,10 +28,39 @@
#include "cl/inc/trace.h"
#include "cl/inc/send.h"
#include "cl/inc/receive.h"
+
#include "config/cl.h"
+#include "config/cl/eoc.h"
+#include "config/mac/common.h"
+#include "config.h"
+
+#include <string.h>
static struct cl_t cl_global;
+/**
+ * Initialise CL stats.
+ * \param ctx cl context
+ */
+#if CONFIG_STATS
+static void
+cl_stats_init (cl_t *ctx)
+{
+ # define CL_STAT(s) \
+ lib_stats_set_stat_value_notype ("cl_" #s, &ctx->stats.s, \
+ LIB_STATS_ACCESS_READ_ONLY, \
+ LIB_STATS_DEBUG)
+ CL_STAT (rx_data);
+ CL_STAT (rx_data_multicast);
+ CL_STAT (rx_mme);
+ CL_STAT (tx_data);
+ CL_STAT (tx_data_drop_auth);
+ CL_STAT (tx_data_drop_mfs);
+ CL_STAT (tx_data_multicast);
+ CL_STAT (tx_mme);
+}
+#endif
+
cl_t *
cl_init (mac_store_t *mac_store, sar_t *sar, mac_config_t *mac_config,
ipmbox_t *ipmbox, bufmgr_t *bufmgr)
@@ -40,6 +70,7 @@ cl_init (mac_store_t *mac_store, sar_t *sar, mac_config_t *mac_config,
/* Check parameters. */
dbg_assert (mac_config);
+ memset (&cl_global, 0, sizeof (cl_t));
ctx = &cl_global;
/* Initialize MAC store. */
@@ -76,6 +107,11 @@ cl_init (mac_store_t *mac_store, sar_t *sar, mac_config_t *mac_config,
bridge_table_init (ctx);
ctx->brg_rx = NULL;
+#if CONFIG_CL_EOC_ROUTE
+ cl_eoc_mactotei_init (ctx);
+ ctx->groups.nb = 0;
+#endif
+
/* Initialize the data link. */
ctx->data_send_link.mfs = NULL;
@@ -87,6 +123,10 @@ cl_init (mac_store_t *mac_store, sar_t *sar, mac_config_t *mac_config,
lib_seq_check_init (
&ctx->seq_check_tx_ctx, CALLBACK (cl_lib_seq_check_tx_cb), ctx);
+#if CONFIG_STATS
+ /* Register statistics. */
+ cl_stats_init (ctx);
+#endif
/* Debug LEDs. */
GPIO_SETUP (LED_CL_RX, GPIO_DIRECTION_OUT);
GPIO_SET (LED_CL_RX, 0);
@@ -131,38 +171,6 @@ cl_data_send_link_clear (cl_t *ctx)
arch_dsr_unlock ();
}
-igmp_groups_t*
-cl_get_igmp_groups (cl_t *ctx)
-{
- dbg_assert (ctx);
-
- return &ctx->groups;
-}
-
-void
-cl_update_igmp_groups (cl_t *ctx)
-{
- dbg_assert (ctx);
- uint g;
- uint m;
- for (g = 0; g < ctx->groups.nb; g++)
- {
- uint tei = MAC_TEI_UNASSOCIATED;
- ctx->groups.nb_actual_members[g] = 0;
-
- for (m = 0; m < ctx->groups.nb_total_members[g]; m++)
- {
- tei = cl_mactotei_table_find_tei_from_mac (
- ctx, ctx->groups.member_mac[g][m]);
- if (MAC_TEI_IS_STA(tei))
- ctx->groups.member_tei[g][ctx->groups.nb_actual_members[g]++] =
- tei;
- }
- if (ctx->groups.nb_actual_members[g] == 0)
- ctx->groups.member_tei[g][0] = MAC_TEI_BCAST;
- }
-}
-
#if CONFIG_CL_DATA_RATE
void
cl_compute_datarate_on_sta_ (cl_t *ctx, mfs_t *mfs, uint length)