@@ -105,7 +105,7 @@ static void ws_bootstrap_nw_frame_counter_read(protocol_interface_info_entry_t *
105105static void ws_bootstrap_nw_info_updated (protocol_interface_info_entry_t * interface_ptr , uint16_t pan_id , uint16_t pan_version , char * network_name );
106106static void ws_bootstrap_authentication_completed (protocol_interface_info_entry_t * cur , auth_result_e result , uint8_t * target_eui_64 );
107107static const uint8_t * ws_bootstrap_authentication_next_target (protocol_interface_info_entry_t * cur , const uint8_t * previous_eui_64 , uint16_t * pan_id );
108- static bool ws_bootstrap_congestion_get (protocol_interface_info_entry_t * interface_ptr , uint16_t active_supp );
108+ static bool ws_bootstrap_eapol_congestion_get (protocol_interface_info_entry_t * interface_ptr , uint16_t active_supp );
109109static void ws_bootstrap_pan_version_increment (protocol_interface_info_entry_t * cur );
110110static ws_nud_table_entry_t * ws_nud_entry_discover (protocol_interface_info_entry_t * cur , void * neighbor );
111111static void ws_nud_entry_remove (protocol_interface_info_entry_t * cur , mac_neighbor_table_entry_t * entry_ptr );
@@ -2332,7 +2332,7 @@ int ws_bootstrap_init(int8_t interface_id, net_6lowpan_mode_e bootstrap_mode)
23322332 ret_val = -4 ;
23332333 goto init_fail ;
23342334 }
2335- if (ws_pae_controller_cb_register (cur , & ws_bootstrap_authentication_completed , & ws_bootstrap_authentication_next_target , & ws_bootstrap_nw_key_set , & ws_bootstrap_nw_key_clear , & ws_bootstrap_nw_key_index_set , & ws_bootstrap_nw_frame_counter_set , & ws_bootstrap_nw_frame_counter_read , & ws_bootstrap_pan_version_increment , & ws_bootstrap_nw_info_updated , & ws_bootstrap_congestion_get ) < 0 ) {
2335+ if (ws_pae_controller_cb_register (cur , & ws_bootstrap_authentication_completed , & ws_bootstrap_authentication_next_target , & ws_bootstrap_nw_key_set , & ws_bootstrap_nw_key_clear , & ws_bootstrap_nw_key_index_set , & ws_bootstrap_nw_frame_counter_set , & ws_bootstrap_nw_frame_counter_read , & ws_bootstrap_pan_version_increment , & ws_bootstrap_nw_info_updated , & ws_bootstrap_eapol_congestion_get ) < 0 ) {
23362336 ret_val = -4 ;
23372337 goto init_fail ;
23382338 }
@@ -3215,15 +3215,41 @@ static const uint8_t *ws_bootstrap_authentication_next_target(protocol_interface
32153215 return previous_eui_64 ;
32163216}
32173217
3218- static bool ws_bootstrap_congestion_get (protocol_interface_info_entry_t * interface_ptr , uint16_t active_supp )
3218+ static void ws_bootstrap_eapol_congestion_init (protocol_interface_info_entry_t * cur )
32193219{
3220- if (interface_ptr == NULL || interface_ptr -> random_early_detection == NULL ) {
3220+ random_early_detection_free (cur -> llc_random_early_detection );
3221+ cur -> llc_random_early_detection = NULL ;
3222+
3223+ if (cur -> llc_random_early_detection == NULL ) {
3224+ cur -> llc_random_early_detection = random_early_detection_create (
3225+ cur -> ws_info -> cfg -> sec_prot .max_simult_sec_neg_tx_queue_min ,
3226+ cur -> ws_info -> cfg -> sec_prot .max_simult_sec_neg_tx_queue_max ,
3227+ 100 , RED_AVERAGE_WEIGHT_EIGHTH );
3228+ }
3229+
3230+ random_early_detection_free (cur -> llc_eapol_random_early_detection );
3231+ cur -> llc_eapol_random_early_detection = NULL ;
3232+
3233+ if (cur -> llc_eapol_random_early_detection == NULL ) {
3234+ cur -> llc_eapol_random_early_detection = random_early_detection_create (
3235+ cur -> ws_info -> cfg -> sec_prot .max_simult_sec_neg_tx_queue_min ,
3236+ cur -> ws_info -> cfg -> sec_prot .max_simult_sec_neg_tx_queue_max ,
3237+ 100 , RED_AVERAGE_WEIGHT_EIGHTH );
3238+ }
3239+ }
3240+
3241+ static bool ws_bootstrap_eapol_congestion_get (protocol_interface_info_entry_t * cur , uint16_t active_supp )
3242+ {
3243+ if (cur == NULL || cur -> random_early_detection == NULL || cur -> llc_random_early_detection == NULL || cur -> llc_eapol_random_early_detection == NULL ) {
32213244 return false;
32223245 }
32233246
32243247 bool return_value = false;
32253248 static struct red_info_s * red_info = NULL ;
3226- uint16_t average = 0 ;
3249+ uint16_t adaptation_average = 0 ;
3250+ uint16_t llc_average = 0 ;
3251+ uint16_t llc_eapol_average = 0 ;
3252+ uint16_t average_sum = 0 ;
32273253 uint8_t active_max = 0 ;
32283254
32293255 //TODO implement API for HEAP info request
@@ -3248,6 +3274,13 @@ static bool ws_bootstrap_congestion_get(protocol_interface_info_entry_t *interfa
32483274 active_max = 50 ;
32493275 }
32503276
3277+ // Read the values for adaptation and LLC queues
3278+ adaptation_average = random_early_detetction_aq_read (cur -> random_early_detection );
3279+ llc_average = random_early_detetction_aq_read (cur -> llc_random_early_detection );
3280+ llc_eapol_average = random_early_detetction_aq_read (cur -> llc_eapol_random_early_detection );
3281+ // Calculate combined average
3282+ average_sum = adaptation_average + llc_average + llc_eapol_average ;
3283+
32513284 // Maximum for active supplicants based on memory reached, fail
32523285 if (active_supp >= active_max ) {
32533286 return_value = true;
@@ -3261,20 +3294,20 @@ static bool ws_bootstrap_congestion_get(protocol_interface_info_entry_t *interfa
32613294
32623295 if (red_info == NULL ) {
32633296 red_info = random_early_detection_create (
3264- interface_ptr -> ws_info -> cfg -> sec_prot .max_simult_sec_neg_tx_queue_min ,
3265- interface_ptr -> ws_info -> cfg -> sec_prot .max_simult_sec_neg_tx_queue_max ,
3297+ cur -> ws_info -> cfg -> sec_prot .max_simult_sec_neg_tx_queue_min ,
3298+ cur -> ws_info -> cfg -> sec_prot .max_simult_sec_neg_tx_queue_max ,
32663299 100 , RED_AVERAGE_WEIGHT_DISABLED );
32673300 }
32683301 if (red_info == NULL ) {
32693302 goto congestion_get_end ;
32703303 }
32713304
3272- average = random_early_detetction_aq_read ( interface_ptr -> random_early_detection );
3273- average = random_early_detetction_aq_calc (red_info , average );
3305+ // Check drop probability
3306+ average_sum = random_early_detetction_aq_calc (red_info , average_sum );
32743307 return_value = random_early_detection_congestion_check (red_info );
32753308
32763309congestion_get_end :
3277- tr_info ("Active supplicant limit, active: %i max: %i averageQ: %i drop: %s" , active_supp , active_max , average , return_value ? "T" : "F" );
3310+ tr_info ("Active supplicant limit, active: %i max: %i summed averageQ: %i adapt averageQ: %i LLC averageQ: %i LLC EAPOL averageQ: %i drop: %s" , active_supp , active_max , average_sum , adaptation_average , llc_average , llc_eapol_average , return_value ? "T" : "F" );
32783311
32793312 return return_value ;
32803313}
@@ -3628,6 +3661,9 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
36283661 // Set PAE port to 10254 and authenticator relay to 10253 (and to own ll address)
36293662 ws_pae_controller_authenticator_start (cur , PAE_AUTH_SOCKET_PORT , ll_addr , EAPOL_RELAY_SOCKET_PORT );
36303663
3664+ // Initialize eapol congestion tracking
3665+ ws_bootstrap_eapol_congestion_init (cur );
3666+
36313667 // Set retry configuration for bootstrap ready state
36323668 ws_bootstrap_configure_max_retries (cur , WS_MAX_FRAME_RETRIES , WS_NUMBER_OF_CHANNEL_RETRIES );
36333669
0 commit comments