summaryrefslogtreecommitdiff
path: root/cesar/cp/sta
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/cp/sta')
-rw-r--r--cesar/cp/sta/action/Config1
-rw-r--r--cesar/cp/sta/action/Module7
-rw-r--r--cesar/cp/sta/action/inc/context.h4
-rw-r--r--cesar/cp/sta/action/src/bridge.c2
-rw-r--r--cesar/cp/sta/action/src/drv.c8
-rw-r--r--cesar/cp/sta/action/src/misc.c5
-rw-r--r--cesar/cp/sta/action/src/vs.c27
-rw-r--r--cesar/cp/sta/core/core.h10
-rw-r--r--cesar/cp/sta/core/inc/core.h4
-rw-r--r--cesar/cp/sta/core/src/core.c42
-rw-r--r--cesar/cp/sta/core/test/Makefile.mk7
-rw-r--r--cesar/cp/sta/mgr/Config2
-rw-r--r--cesar/cp/sta/mgr/inc/sta.h5
-rw-r--r--cesar/cp/sta/mgr/inc/sta_mgr.h1
-rw-r--r--cesar/cp/sta/mgr/inc/sta_own_data.h10
-rw-r--r--cesar/cp/sta/mgr/net.h20
-rw-r--r--cesar/cp/sta/mgr/src/net.c30
-rw-r--r--cesar/cp/sta/mgr/src/sta.c23
-rw-r--r--cesar/cp/sta/mgr/src/sta_mgr.c11
-rw-r--r--cesar/cp/sta/mgr/src/sta_own_data.c30
-rw-r--r--cesar/cp/sta/mgr/sta.h60
-rw-r--r--cesar/cp/sta/mgr/sta_mgr.h1
-rw-r--r--cesar/cp/sta/mgr/sta_own_data.h47
-rw-r--r--cesar/cp/sta/mgr/stub/src/net.c8
-rw-r--r--cesar/cp/sta/mgr/stub/src/sta.c8
-rw-r--r--cesar/cp/sta/mgr/stub/src/sta_mgr.c1
26 files changed, 359 insertions, 15 deletions
diff --git a/cesar/cp/sta/action/Config b/cesar/cp/sta/action/Config
new file mode 100644
index 0000000000..c8185f667b
--- /dev/null
+++ b/cesar/cp/sta/action/Config
@@ -0,0 +1 @@
+CONFIG_CP_STA_ACTION_MISC_EOC = n
diff --git a/cesar/cp/sta/action/Module b/cesar/cp/sta/action/Module
index f1b9a87c9e..4e70aba504 100644
--- a/cesar/cp/sta/action/Module
+++ b/cesar/cp/sta/action/Module
@@ -1,2 +1,7 @@
-SOURCES := assoc.c drv.c misc.c poweron.c bridge.c vs.c
+SOURCES := drv.c misc.c poweron.c bridge.c vs.c
+
+ifneq ($(VARIANT),master)
+ SOURCES += assoc.c
+endif
+
MODULES := common/defs/mmtypes
diff --git a/cesar/cp/sta/action/inc/context.h b/cesar/cp/sta/action/inc/context.h
index fba7e34d5d..0d7e0ba2de 100644
--- a/cesar/cp/sta/action/inc/context.h
+++ b/cesar/cp/sta/action/inc/context.h
@@ -34,6 +34,10 @@ struct cp_sta_action_assoc_t
cp_sta_core_timed_event_def_t lease_timer;
/** Number of lost central beacons since the last beacon reception. */
uint beacon_loss;
+ /** Init count for randomization of first REQ . */
+ uint init_count;
+ /** Fast assoc retry, while no wl on cco side. */
+ bool fast_retry;
/** Retry TEI lease timeout, only used to program an event timer to resent
* the renew request in case the first request has not been confirmed. */
uint tei_renew_retry_timeout_ms;
diff --git a/cesar/cp/sta/action/src/bridge.c b/cesar/cp/sta/action/src/bridge.c
index 2d27454ee3..bef8ad5a1c 100644
--- a/cesar/cp/sta/action/src/bridge.c
+++ b/cesar/cp/sta/action/src/bridge.c
@@ -25,6 +25,8 @@
#include "cl/bridge_table.h" // bridge_table_*
#include "lib/utils.h" // less_mod2p32
#include "cp/sta/action/bridge.h"
+#include "config/cl/eoc.h"
+#include "cl/mcast.h"
/**
* Send a CM_BRG_INFO.CNF with the local bridge table of the CL.
diff --git a/cesar/cp/sta/action/src/drv.c b/cesar/cp/sta/action/src/drv.c
index 0e95aa02e0..36453f8ea4 100644
--- a/cesar/cp/sta/action/src/drv.c
+++ b/cesar/cp/sta/action/src/drv.c
@@ -20,6 +20,11 @@
#include "lib/stats.h"
#include "common/defs/igmp.h"
#include "cl/cl_mactotei.h"
+#include "cl/mcast.h"
+
+#if CONFIG_CP_EOC
+ #include "cp/eoc/sta/mgr/sta_own_data.h"
+#endif
void
cp_sta_action_drv__stopped__drv_sta_set_mac_addr_req (cp_t *ctx,
@@ -241,6 +246,9 @@ cp_sta_action_drv__stopped__drv_sta_set_dak_req (cp_t *ctx, cp_mme_rx_t *mme)
if (cp_msg_drv_sta_set_dak_req_receive (ctx, mme, &dak))
{
cp_sta_own_data_set_dak (ctx, dak);
+#if CONFIG_CP_EOC
+ cp_eoc_sta_own_data_set_original_dak (ctx, dak);
+#endif
cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_DAK_CNF,
CP_MSG_DRV_RESULT_SUCCESS);
}
diff --git a/cesar/cp/sta/action/src/misc.c b/cesar/cp/sta/action/src/misc.c
index 54fb95618f..577424c6f2 100644
--- a/cesar/cp/sta/action/src/misc.c
+++ b/cesar/cp/sta/action/src/misc.c
@@ -24,6 +24,7 @@
#include "common/defs/spidcom.h"
#include "mac/common/timings.h"
+#include "config/cp/sta/action/misc/eoc.h"
#include "cp/fsm/fsm.h"
#include "cp/cco/action/cco_action.h"
#include "cp/sta/action/misc.h"
@@ -549,7 +550,11 @@ cp_sta_action_process_cm_nw_stats_req (cp_t *ctx, cp_mme_rx_t *rx_mme)
cp_sta_t* sta_list = NULL;
uint NumSTAs = 0;
+#if (!CONFIG_CP_STA_ACTION_MISC_EOC)
if (cp_msg_cm_nw_stats_req_receive (ctx, rx_mme))
+#else
+ if (true)
+#endif
{
/* Make sure we have an avln */
if (MAC_TEI_IS_STA (cp_sta_own_data_get_tei (ctx)))
diff --git a/cesar/cp/sta/action/src/vs.c b/cesar/cp/sta/action/src/vs.c
index d3050d9482..8e28f20fd3 100644
--- a/cesar/cp/sta/action/src/vs.c
+++ b/cesar/cp/sta/action/src/vs.c
@@ -23,8 +23,11 @@
#include "ce/rx/bitloading/nsr.h"
#include "mac/sar/sar_pb_stats.h"
#include "cl/cl_mactotei.h"
+#include "cl/cl_eoc_mactotei.h"
#include "ce/rx/rx.h"
+#include "config/cl/eoc.h"
+
/**
* Handle STARTED => VS_GET_TONEMAP.REQ.
* \param ctx control plane context
@@ -646,21 +649,41 @@ cp_sta_action_vs__started__vs_get_mactotei_req (cp_t *ctx, cp_mme_rx_t *mme)
if (cp_msg_vs_get_mactotei_req_receive (ctx, mme))
{
cp_mme_tx_t *mme_tx;
- uint nb_entry = cl_mactotei_table_size (ctx->cl);
+ uint nb_entry = 0;
+
+ if (CONFIG_CL_EOC_ROUTE)
+ {
+ nb_entry = cl_eoc_mactotei_snapshot_create (ctx->cl);
+ }
+ else
+ {
+ nb_entry = cl_mactotei_table_size (ctx->cl);
+ }
mme_tx = cp_msg_vs_get_mactotei_cnf_send_begin (ctx, &mme->peer,
nb_entry);
dbg_assert (mme_tx);
+
uint i;
for (i=0; i<nb_entry; i++)
{
cl_mactotei_entry_t data;
- cl_mactotei_table_get_entry (ctx->cl, i, &data);
+ if (CONFIG_CL_EOC_ROUTE)
+ {
+ cl_eoc_mactotei_snapshot_get_mac_tei (ctx->cl, i, &data.mac,
+ &data.tei);
+ data.tag = 0;
+ }
+ else
+ {
+ cl_mactotei_table_get_entry (ctx->cl, i, &data);
+ }
cp_msg_vs_get_mactotei_cnf_send_entry (ctx, mme_tx, data.mac,
(cp_tei_t) data.tei,
data.tag);
}
+
cp_msg_vs_get_mactotei_cnf_send_end (ctx, mme_tx);
}
}
diff --git a/cesar/cp/sta/core/core.h b/cesar/cp/sta/core/core.h
index 6778c540d3..2410b31a12 100644
--- a/cesar/cp/sta/core/core.h
+++ b/cesar/cp/sta/core/core.h
@@ -160,6 +160,16 @@ cp_sta_core_get_date_ms (cp_t *ctx);
void
cp_sta_core_checkpoint (cp_t *ctx);
+/**
+ * refresh watch dog.
+ * \param user_data CP context
+ *
+ * Update tracking variable and resfresh watch dog. reset if gc is not
+ * called for about 25 sec.
+ */
+void
+cp_sta_core_refresh_watch_dog (void * user_data);
+
END_DECLS
/**
diff --git a/cesar/cp/sta/core/inc/core.h b/cesar/cp/sta/core/inc/core.h
index 5b33b0026f..4803da54dd 100644
--- a/cesar/cp/sta/core/inc/core.h
+++ b/cesar/cp/sta/core/inc/core.h
@@ -81,6 +81,10 @@ struct cp_sta_core_t
/* Ticks per RTC. */
u32 tck_per_rtc;
+ /** Last GC update */
+ u32 gc_update_date_ms;
+ /** Tracking watch dog variable */
+ u32 watch_dog_refresh_count;
};
/** Definition for sta core array of (event , action function). */
diff --git a/cesar/cp/sta/core/src/core.c b/cesar/cp/sta/core/src/core.c
index eb82426e82..281fc576fc 100644
--- a/cesar/cp/sta/core/src/core.c
+++ b/cesar/cp/sta/core/src/core.c
@@ -56,6 +56,10 @@
#include "cp/beacon/beacon.h"
#include "cp/sta/core/inc/core.h"
+#include "hal/arch/arch.h"
+
+#define CP_STA_CORE_GARBAGE_COLLECTOR_TIMEOUT_MS 1000
+#define CP_STA_CORE_WATCH_DOG_REFRESH_COUNT_MAX 100*10
/** array of cp sta core events/actions. */
static const cp_sta_core_event_action_t cp_sta_core_event_action[] =
@@ -122,7 +126,7 @@ cp_sta_core_init(cp_t *ctx)
ce_rx_cp_set_cp_signal_work_callback (ctx->ce_rx,
cp_sta_core_signal_ce_rx_work_event,
ctx);
-
+ ctx->sta_core.gc_update_date_ms = cp_sta_core_get_date_ms (ctx);
#ifndef STA_CORE_UNIT_TEST
// create and launch the CP sta core thread
cyg_thread_create (
@@ -538,8 +542,11 @@ void
cp_sta_core_garbage_collector(cp_t *cp_ctx)
{
dbg_assert (cp_ctx);
- /* Reset watchdog. */
- hal_watchdog_reset ();
+ /* reset tracking variable */
+ arch_dsr_lock ();
+ cp_ctx->sta_core.watch_dog_refresh_count = 0;
+ arch_dsr_unlock ();
+ cp_ctx->sta_core.gc_update_date_ms = cp_sta_core_get_date_ms (cp_ctx);
/* Call garbage functions. */
cp_sta_action_garbage (cp_ctx);
if (cp_sta_own_data_get_cco_status (cp_ctx))
@@ -561,6 +568,16 @@ cp_sta_core_quit_wait_event_loop(cp_t *cp_ctx)
cp_ctx->sta_core.terminate_flag = true;
}
+void
+cp_sta_core_refresh_watch_dog (void * user_data)
+{
+ cp_t *cp_ctx = (cp_t *) user_data;
+ dbg_assert (cp_ctx);
+ dbg_assert (cp_ctx->sta_core.watch_dog_refresh_count++
+ < CP_STA_CORE_WATCH_DOG_REFRESH_COUNT_MAX);
+ hal_watchdog_reset ();
+}
+
/**
* station core main wait event loop.
*
@@ -599,8 +616,25 @@ cp_sta_core_wait_event_loop(cp_t *ctx)
{
// wait for a cp sta core event
flag_value = cyg_flag_wait (&ctx->sta_core.wait_event_core_flag, flag_mask, CYG_FLAG_WAITMODE_OR | CYG_FLAG_WAITMODE_CLR );
+ i = 0;
+ /* check GC urgent event */
+ if (flag_value & CP_STA_CORE_EVENT_FLAG_GARBAGE
+ && ctx->sta_core.gc_update_date_ms
+ + CP_STA_CORE_GARBAGE_COLLECTOR_TIMEOUT_MS
+ < cp_sta_core_get_date_ms (ctx))
+ {
+ uint j;
+ /* find position of GC event */
+ for (j = 0; j < COUNT (cp_sta_core_event_action); j++)
+ if (cp_sta_core_event_action[j].event_flag ==
+ CP_STA_CORE_EVENT_FLAG_GARBAGE)
+ {
+ i = j;
+ break;
+ }
+ }
// process the event(s) in respect of event category priority order
- for (i = 0; i < COUNT (cp_sta_core_event_action); i++)
+ for (; i < COUNT (cp_sta_core_event_action); i++)
{
if (flag_value & cp_sta_core_event_action[i].event_flag)
{
diff --git a/cesar/cp/sta/core/test/Makefile.mk b/cesar/cp/sta/core/test/Makefile.mk
index eb427d0820..3a9f6a4106 100644
--- a/cesar/cp/sta/core/test/Makefile.mk
+++ b/cesar/cp/sta/core/test/Makefile.mk
@@ -12,24 +12,25 @@ core_events_SOURCES = core_events.c cp_cl_interf_stub.c action_stub.c \
core_events_MODULES = lib cp/sta/core cp/av/fsm/stub cp/cco/action/stub \
ce/rx/cp/stub cp/beacon/stub \
$(SPARC_MODULES)
-core_events_CONFIG_MODULES = cp
+core_events_CONFIG_MODULES = mac/common cp/sta/mgr cp
core_SOURCES = core.c cp_cl_interf_stub.c action_stub.c\
sta_mgr_stub.c
core_MODULES = lib cp/sta/core cp/av/fsm/stub cp/cco/action/stub \
ce/rx/cp/stub cp/beacon/stub \
$(SPARC_MODULES)
-core_CONFIG_MODULES = cp
+core_CONFIG_MODULES = cp mac/common cp/sta/mgr
core_thread_SOURCES = core_thread.c
core_thread_MODULES = lib cp/sta/core cp/av/fsm/stub ce/rx/cp/stub \
cp/cco/action/stub \
$(SPARC_MODULES)
+core_thread_CONFIG_MODULES = mac/common cp/sta/mgr
core_timer_SOURCES = core_timer.c sta_mgr_stub.c
core_timer_MODULES = lib cp/sta/core cp/av/fsm/stub ce/rx/cp/stub \
cp/cco/action/stub \
$(SPARC_MODULES)
-core_timer_CONFIG_MODULES = cp
+core_timer_CONFIG_MODULES = cp mac/common cp/sta/mgr
include $(BASE)/common/make/top.mk
diff --git a/cesar/cp/sta/mgr/Config b/cesar/cp/sta/mgr/Config
new file mode 100644
index 0000000000..736b4b9a0c
--- /dev/null
+++ b/cesar/cp/sta/mgr/Config
@@ -0,0 +1,2 @@
+CONFIG_GPIO_LED_IS_CCO = n
+CONFIG_GPIO_LED_IS_CCO_GPIO = 0
diff --git a/cesar/cp/sta/mgr/inc/sta.h b/cesar/cp/sta/mgr/inc/sta.h
index a5abd5d831..8be75ca4b7 100644
--- a/cesar/cp/sta/mgr/inc/sta.h
+++ b/cesar/cp/sta/mgr/inc/sta.h
@@ -37,6 +37,11 @@ struct cp_sta_private_t
mac_t mac_address;
/**
+ * Device password.
+ */
+ cp_dpw_t dpw;
+
+ /**
* Indicate if the station is Visible by our station.
*/
bool visible;
diff --git a/cesar/cp/sta/mgr/inc/sta_mgr.h b/cesar/cp/sta/mgr/inc/sta_mgr.h
index ed65ba43bf..bd45007c26 100644
--- a/cesar/cp/sta/mgr/inc/sta_mgr.h
+++ b/cesar/cp/sta/mgr/inc/sta_mgr.h
@@ -18,6 +18,7 @@
#include "cp/sta/mgr/inc/net.h"
#define CP_STA_MGR_STATION_RELEASE_MS (5000 * 60)
+#define OUTPUT_LEVEL_ALL 80
struct cp_sta_mgr_t
{
diff --git a/cesar/cp/sta/mgr/inc/sta_own_data.h b/cesar/cp/sta/mgr/inc/sta_own_data.h
index 308c7672c8..ff405d0d5f 100644
--- a/cesar/cp/sta/mgr/inc/sta_own_data.h
+++ b/cesar/cp/sta/mgr/inc/sta_own_data.h
@@ -98,6 +98,16 @@ struct cp_sta_own_data_private_t
cp_key_t dak;
/**
+ * The station's original DAK.
+ */
+ cp_key_t original_dak;
+
+ /**
+ * The station's output level.
+ */
+ uint output_level;
+
+ /**
* Simple connect procedure status.
*/
bool sc;
diff --git a/cesar/cp/sta/mgr/net.h b/cesar/cp/sta/mgr/net.h
index 3f1334556f..d2a6e7a72f 100644
--- a/cesar/cp/sta/mgr/net.h
+++ b/cesar/cp/sta/mgr/net.h
@@ -166,6 +166,26 @@ cp_sta_t *
cp_net_sta_get_next (cp_t *ctx, cp_net_t *net, cp_sta_t *prev_sta);
/**
+ * Get the next station from the AVLN stating by the previous one already
+ * request.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \param prev_sta the previous station requested, whose reference is
+ * released.
+ * \param status list status (CP_NET_STA_ASSOC, CP_NET_STA_UNASSOC)
+ * \return the next station.
+ *
+ * This function shall be call after get_first.
+ *
+ * Returns a reference to the next station, release a reference to the
+ * previous station. This is done to make this kind of loop easy:
+ *
+ */
+cp_sta_t *
+cp_net_sta_get_next_status (cp_t *ctx, cp_net_t *net, cp_sta_t *prev_sta,
+ cp_net_sta_status_t assoc);
+
+/**
* Get the network SNID.
* \param ctx the module context.
* \param net the network context.
diff --git a/cesar/cp/sta/mgr/src/net.c b/cesar/cp/sta/mgr/src/net.c
index da156b1b88..326c2b6097 100644
--- a/cesar/cp/sta/mgr/src/net.c
+++ b/cesar/cp/sta/mgr/src/net.c
@@ -98,7 +98,7 @@ cp_net_garbage_station_list (cp_t *ctx, cp_net_t *net, u32 date_ms,
for (sta = cp_net_sta_get_first (ctx, net, assoc); sta; sta = sta_next)
{
slab_addref (sta);
- sta_next = cp_net_sta_get_next (ctx, net, sta);
+ sta_next = cp_net_sta_get_next_status (ctx, net, sta, assoc);
if (less_mod2p32(sta->expired_date_ms, date_ms))
cp_sta_mgr_sta_remove (ctx, sta);
slab_release (sta);
@@ -336,6 +336,34 @@ cp_net_sta_get_next (cp_t *ctx, cp_net_t *net, cp_sta_t *prev_sta)
}
}
+cp_sta_t *
+cp_net_sta_get_next_status (cp_t *ctx, cp_net_t *net, cp_sta_t *prev_sta,
+ cp_net_sta_status_t assoc)
+{
+ set_t *set;
+ set_node_t *node;
+ cp_sta_t *sta;
+
+ dbg_assert (ctx);
+ dbg_assert (prev_sta);
+
+ set = (assoc == CP_NET_STA_UNASSOC) ? &net->unassociated_stas:
+ &net->associated_stas;
+
+ // Get the next node.
+ node = set_next (set, &prev_sta->node_net);
+ slab_release (prev_sta);
+
+ if (node)
+ {
+ sta = PARENT_OF (cp_sta_t, node_net, node);
+ slab_addref (sta);
+ return sta;
+ }
+ else
+ return NULL;
+}
+
cp_snid_t
cp_net_get_snid (cp_t *ctx, cp_net_t *net)
{
diff --git a/cesar/cp/sta/mgr/src/sta.c b/cesar/cp/sta/mgr/src/sta.c
index f021dcfab2..521070ff77 100644
--- a/cesar/cp/sta/mgr/src/sta.c
+++ b/cesar/cp/sta/mgr/src/sta.c
@@ -22,6 +22,12 @@
#include "cp/inc/context.h"
#include "cp/cp.h"
+#include "config/cp/eoc.h"
+
+#if CONFIG_CP_EOC
+#include "cp/eoc/sta/mgr/sta_mgr.h"
+#endif
+
cp_sta_t *
cp_sta_init (slab_cache_t *cache)
{
@@ -36,6 +42,15 @@ cp_sta_init (slab_cache_t *cache)
sta->association_confirmed = true;
sta->visible = CP_STA_VISIBLE_STATE_VISIBLE;
+#if CONFIG_CP_EOC && CONFIG_CP_EOC_IS_MASTER
+ /* Station authorization is initially set to false. It can be changed by adding the station
+ into the White List and setting the authorization to true. */
+ ((cp_sta_t *) sta)->multi_sta.allowed = false;
+ ((cp_sta_t *) sta)->multi_sta.ports.port[0].enabled = true;
+ ((cp_sta_t *) sta)->authenticated_to_unassociated = false;
+ ((cp_sta_t *) sta)->sta_in_wl = false;
+#endif /* CONFIG_CP_EOC && CONFIG_CP_EOC_IS_MASTER */
+
return (cp_sta_t *) sta;
}
@@ -164,7 +179,13 @@ cp_sta_get_authenticated (cp_t *ctx, cp_sta_t *sta)
if ((cp_sta_p->net == ctx->sta_mgr.our_avln)
&& (ctx->sta_mgr.our_avln))
{
- if (cp_sta_p->tei == MAC_TEI_UNASSOCIATED)
+ if (cp_sta_p->tei == MAC_TEI_UNASSOCIATED
+#if CONFIG_CP_EOC
+ || (CONFIG_CP_EOC_IS_MASTER
+ && !cp_eoc_sta_mgr_sta_is_assoc (ctx, ctx->sta_mgr.our_avln,
+ cp_sta_p->tei))
+#endif
+ )
state = false;
else
{
diff --git a/cesar/cp/sta/mgr/src/sta_mgr.c b/cesar/cp/sta/mgr/src/sta_mgr.c
index e91aa2a269..35423e7c46 100644
--- a/cesar/cp/sta/mgr/src/sta_mgr.c
+++ b/cesar/cp/sta/mgr/src/sta_mgr.c
@@ -27,9 +27,7 @@
#include "cp/inc/context.h"
#include "cp/sta/mgr/inc/sta.h"
-#include "cp/sta/mgr/inc/net.h"
#include "cp/sta/mgr/inc/sta_mgr.h"
-#include "cp/sta/mgr/inc/sta_own_data.h"
void
cp_sta_mgr_elects_sta_partial_ack (cp_t *ctx)
@@ -144,8 +142,10 @@ cp_sta_mgr_sta_add_realy (cp_t *ctx, cp_net_t *net, cp_tei_t tei,
if (MAC_TEI_IS_STA (tei))
sta->net->num_associated_stas ++;
+#if (CONFIG_CP_AV)
if (net == ctx->sta_mgr.our_avln && sta->net->num_associated_stas == 1)
cp_fsm_post_new_event (ctx, bare, sta_status_changed);
+#endif
net->num_visible_stas ++;
net->num_stas ++;
@@ -198,6 +198,7 @@ cp_sta_mgr_uninit (cp_t *ctx)
{
cp_net_t *net;
dbg_assert (ctx);
+
// Uninitialise the station contained in the release list.
if (ctx->sta_mgr.our_avln)
{
@@ -482,8 +483,10 @@ cp_sta_mgr_set_our_avln (cp_t *ctx, cp_net_t *net)
mac_store_sta_add (ctx->mac_store, cp_sta_get_tei (sta));
}
}
+#if (CONFIG_CP_AV)
/* Elects a partial acknowledger. */
cp_sta_mgr_elects_sta_partial_ack (ctx);
+#endif
}
void
@@ -563,6 +566,10 @@ cp_sta_mgr_sta_get_from_mac (cp_t *ctx, mac_t mac_addr)
dbg_assert (ctx);
dbg_assert (mac_addr);
+#if CONFIG_CP_EOC
+ dbg_assert (mac_addr < MAC_BROADCAST);
+#endif
+
if (!set_empty (&ctx->sta_mgr.stas))
{
sta.mac_address = mac_addr;
diff --git a/cesar/cp/sta/mgr/src/sta_own_data.c b/cesar/cp/sta/mgr/src/sta_own_data.c
index abed0aaf5b..c1d021ec41 100644
--- a/cesar/cp/sta/mgr/src/sta_own_data.c
+++ b/cesar/cp/sta/mgr/src/sta_own_data.c
@@ -28,6 +28,8 @@
#include "cp/inc/context.h"
#include "cp/sta/mgr/inc/sta_own_data.h"
+#include "config/av/only/mode.h"
+
/**
* Uninitialise the station own data to default values.
* \param ctx the module context.
@@ -49,14 +51,17 @@ void
cp_sta_own_data_set_tei (cp_t * ctx, u8 tei)
{
dbg_assert (ctx);
- dbg_assert (ctx->mac_config);
if (tei != ctx->sta_mgr.sta_own_data.tei)
{
+ dbg_assert (ctx->mac_config);
+
ctx->sta_mgr.sta_own_data.tei = tei;
ctx->mac_config->tei = tei;
+#if (CONFIG_CP_AV)
cp_fsm_post_new_event (ctx, bare, sta_status_changed);
+#endif
}
}
@@ -365,7 +370,9 @@ cp_sta_own_data_set_pco_status (cp_t *ctx, bool pco)
ctx->sta_mgr.sta_own_data.pco_glid = 0;
else
ctx->sta_mgr.sta_own_data.pco_glid |= (pco << 7);
+#if (CONFIG_CP_AV)
cp_fsm_post_new_event (ctx, bare, sta_status_changed);
+#endif
}
}
@@ -396,7 +403,9 @@ cp_sta_own_data_set_cco_status (cp_t *ctx, bool cco)
}
}
+#if (CONFIG_CP_AV)
cp_fsm_post_new_event (ctx, bare, sta_status_changed);
+#endif
}
}
@@ -429,7 +438,9 @@ cp_sta_own_data_set_authenticated_status (cp_t *ctx, bool authenticated)
{
ctx->sta_mgr.sta_own_data.authenticated = authenticated;
ctx->mac_config->authenticated = authenticated;
+#if (CONFIG_CP_AV)
cp_fsm_post_new_event (ctx, bare, sta_status_changed);
+#endif
}
}
@@ -565,7 +576,9 @@ cp_sta_own_data_set_sc (cp_t *ctx, bool status)
if (ctx->sta_mgr.sta_own_data.sc != status)
{
ctx->sta_mgr.sta_own_data.sc = status;
+#if (CONFIG_CP_AV)
cp_fsm_post_new_event (ctx, bare, sta_status_changed);
+#endif
}
}
@@ -576,3 +589,18 @@ cp_sta_own_data_get_sc (cp_t *ctx)
return ctx->sta_mgr.sta_own_data.sc;
}
+
+void
+cp_sta_own_data_set_output_level (cp_t *ctx, uint output_level)
+{
+ dbg_assert (ctx);
+ if (output_level)
+ ctx->sta_mgr.sta_own_data.output_level = output_level;
+}
+
+uint
+cp_sta_own_data_get_output_level (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ return ctx->sta_mgr.sta_own_data.output_level;
+}
diff --git a/cesar/cp/sta/mgr/sta.h b/cesar/cp/sta/mgr/sta.h
index cb52df22b2..3d2488b246 100644
--- a/cesar/cp/sta/mgr/sta.h
+++ b/cesar/cp/sta/mgr/sta.h
@@ -20,6 +20,13 @@
#include "cp/mme.h"
#include "mac/common/store.h"
+#include "config/cp/eoc.h"
+#if CONFIG_CP_EOC && CONFIG_CP_EOC_IS_MASTER
+#include "cp/eoc/multi_sta_fsm/inc/context.h"
+#endif /* CONFIG_CP_EOC && CONFIG_CP_EOC_IS_MASTER */
+
+#define PORT_NB 5
+
/** Enum */
enum cp_sta_visible_status_t
{
@@ -63,6 +70,46 @@ struct cp_sta_reassembly_ctx_t
};
typedef struct cp_sta_reassembly_ctx_t cp_sta_reassembly_ctx_t;
+#if CONFIG_CP_EOC && CONFIG_CP_EOC_IS_MASTER
+
+/**
+ * Control plane EoC port structure
+ */
+struct cp_eoc_port_t
+{
+ bool enabled;
+ u8 index_of_service;
+};
+typedef struct cp_eoc_port_t cp_eoc_port_t;
+
+/**
+ * Control plane EoC ports structure
+ */
+struct cp_eoc_ports_t
+{
+ cp_eoc_port_t port[PORT_NB];
+};
+typedef struct cp_eoc_ports_t cp_eoc_ports_t;
+
+/**
+ * Control plane multi station structure
+ */
+struct cp_multi_sta_t
+{
+ bool allowed;
+ u8 output_level;
+ u32 start_time;
+ u32 end_time;
+ cp_key_t dak;
+ u8 action;
+ bool to_leave;
+ cp_eoc_ports_t ports;
+ /* TBD */
+};
+typedef struct cp_multi_sta_t cp_multi_sta_t;
+
+#endif /* CONFIG_CP_EOC && CONFIG_CP_EOC_IS_MASTER */
+
/**
* Control plane station.
*/
@@ -81,6 +128,11 @@ struct cp_sta_t
u32 expired_date_ms;
/**
+ * Date of association.
+ */
+ uint associated_date_ms;
+
+ /**
* The Reassembly context for the cl_interf.
*/
cp_sta_reassembly_ctx_t reassembly_ctx;
@@ -141,6 +193,14 @@ struct cp_sta_t
/** Heap CCo selection node. */
heap_node_t cco_selection_node;
+ bool authenticated_to_unassociated;
+ bool sta_in_wl;
+
+#if CONFIG_CP_EOC && CONFIG_CP_EOC_IS_MASTER
+ /** Multi STA FSM */
+ cp_eoc_multi_sta_fsm_t fsm;
+ cp_multi_sta_t multi_sta;
+#endif /* CONFIG_CP_EOC && CONFIG_CP_EOC_IS_MASTER */
};
typedef struct cp_sta_t cp_sta_t;
diff --git a/cesar/cp/sta/mgr/sta_mgr.h b/cesar/cp/sta/mgr/sta_mgr.h
index b3eb3f1eef..aca79ed4ad 100644
--- a/cesar/cp/sta/mgr/sta_mgr.h
+++ b/cesar/cp/sta/mgr/sta_mgr.h
@@ -17,6 +17,7 @@
#include "cp/inc/variant.h"
#include "cp/sta/mgr/net.h"
#include "cp/sta/mgr/sta_own_data.h"
+#include "cp/sta/mgr/inc/sta.h"
/* Forward declaration. */
typedef struct cp_sta_mgr_t cp_sta_mgr_t;
diff --git a/cesar/cp/sta/mgr/sta_own_data.h b/cesar/cp/sta/mgr/sta_own_data.h
index 6dcf1d9da7..c09f5c4d88 100644
--- a/cesar/cp/sta/mgr/sta_own_data.h
+++ b/cesar/cp/sta/mgr/sta_own_data.h
@@ -76,6 +76,37 @@ struct cp_sta_own_data_t
cp_sta_t * pco;
/**
+ * The station's number of successful associations and authentications. In CCo case, it is
+ * the number of successful associations and authentications for all the slaves in the network.
+ */
+ uint num_good_assoc_auth;
+
+ /**
+ * The station's number of association requests with no response. In CCo case, it is
+ * the number of associations requests with no response for all the slaves in the network (zero).
+ */
+ uint num_bad_could_not_assoc;
+
+ /**
+ * The station's number of refused association requests. In CCo case, it is
+ * the number of refused associations requests for all the slaves in the network.
+ */
+ uint num_bad_assoc_failure;
+
+ /**
+ * The station's number of authentication requests with no response. In CCo case, it is
+ * the number of authentication requests with no response for all the slaves in the network (zero).
+ */
+ uint num_bad_could_not_auth;
+
+ /**
+ * The station's number of being disconnected by master. In CCo case, it is the number of CC_LEAVE
+ * requests sent to all the slaves in the network.
+ */
+ uint num_leave;
+
+
+ /*
* Current Force Role
*/
mac_force_role_t force_role;
@@ -416,6 +447,22 @@ cp_sta_own_data_set_sc (cp_t *ctx, bool status);
bool
cp_sta_own_data_get_sc (cp_t *ctx);
+/**
+ * Set the output level of the station.
+ * \param ctx the module context
+ * \param output_level the output level power to use
+ */
+void
+cp_sta_own_data_set_output_level (cp_t *ctx, uint output_level);
+
+/**
+ * Get the output level of the station.
+ * \param ctx the module context
+ * \return the output level power to use
+ */
+uint
+cp_sta_own_data_get_output_level (cp_t *ctx);
+
END_DECLS
#endif /* cp_sta_data_sta_own_data_h */
diff --git a/cesar/cp/sta/mgr/stub/src/net.c b/cesar/cp/sta/mgr/stub/src/net.c
index 9db8a7f5e1..a874009143 100644
--- a/cesar/cp/sta/mgr/stub/src/net.c
+++ b/cesar/cp/sta/mgr/stub/src/net.c
@@ -216,3 +216,11 @@ cp_net_blacklisted_status_get (cp_t *ctx, cp_net_t *net)
{
return false;
}
+
+void
+cp_net_garbage_station_list (cp_t *ctx, cp_net_t *net, u32 date_ms,
+ cp_net_sta_status_t assoc)
+ __attribute__ ((weak));
+void
+cp_net_garbage_station_list (cp_t *ctx, cp_net_t *net, u32 date_ms,
+ cp_net_sta_status_t assoc) {}
diff --git a/cesar/cp/sta/mgr/stub/src/sta.c b/cesar/cp/sta/mgr/stub/src/sta.c
index 5c43612fa0..c589706de7 100644
--- a/cesar/cp/sta/mgr/stub/src/sta.c
+++ b/cesar/cp/sta/mgr/stub/src/sta.c
@@ -17,6 +17,14 @@
#include "cp/mme.h"
#include "cp/sta/mgr/sta.h"
+cp_sta_t *
+cp_sta_init (slab_cache_t *cache) __attribute__ ((weak));
+cp_sta_t *
+cp_sta_init (slab_cache_t *cache)
+{
+ return NULL;
+}
+
cp_tei_t
cp_sta_get_tei (cp_sta_t *ctx) __attribute__ ((weak));
cp_tei_t
diff --git a/cesar/cp/sta/mgr/stub/src/sta_mgr.c b/cesar/cp/sta/mgr/stub/src/sta_mgr.c
index 9f265cc187..0f68cd9523 100644
--- a/cesar/cp/sta/mgr/stub/src/sta_mgr.c
+++ b/cesar/cp/sta/mgr/stub/src/sta_mgr.c
@@ -15,6 +15,7 @@
#include "common/std.h"
#include "cp/sta/mgr/net.h"
#include "cp/sta/mgr/sta.h"
+#include "cp/sta/mgr/sta_own_data.h"
void
cp_sta_mgr_elects_sta_partial_ack (cp_t *ctx) __attribute__ ((weak));