Skip to content

Commit 70244f6

Browse files
author
Juha Heiskanen
committed
Wi-sun parameter and debug trace update
Updated EAPOL data MTU size from 1100->600 Dynamic Temporary entry size for table size <= 32, <= 64 and 128 EAPOL temporary unicast entry downgrade from 30 -> 20. Added debug trace for helping a debug why we not triggering ACK possible.
1 parent 5752eae commit 70244f6

File tree

10 files changed

+55
-12
lines changed

10 files changed

+55
-12
lines changed

nanostack/dhcp_service_api.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ typedef int (dhcp_service_receive_req_cb)(uint16_t instance_id, uint32_t msg_tr_
109109

110110
typedef int (dhcp_service_receive_resp_cb)(uint16_t instance_id, void *ptr, uint8_t msg_name, uint8_t *msg_ptr, uint16_t msg_len);
111111

112-
/* \brief Neighbour table update callback this is called for DHCP relay and server link local responses
112+
/**
113+
* \brief Neighbour table update callback this is called for DHCP relay and server link local responses.
113114
*
114115
* \param interface interface where address is got
115116
* \param ll_addr Link local which neighbour must be guarantee.
116117
*
117-
*
118118
*/
119119
typedef void (dhcp_relay_neighbour_cb)(int8_t interface, uint8_t ll_addr[static 16]);
120120

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1745,7 +1745,7 @@ static void ws_bootstrap_neighbor_table_clean(struct protocol_interface_info_ent
17451745
{
17461746
uint8_t ll_target[16];
17471747

1748-
if (mac_neighbor_info(interface)->neighbour_list_size <= mac_neighbor_info(interface)->list_total_size - WS_NON_CHILD_NEIGHBOUR_COUNT) {
1748+
if (mac_neighbor_info(interface)->neighbour_list_size <= mac_neighbor_info(interface)->list_total_size - ws_common_temporary_entry_size(mac_neighbor_info(interface)->list_total_size)) {
17491749
// Enough neighbor entries
17501750
return;
17511751
}

source/6LoWPAN/ws/ws_common.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,12 +379,21 @@ void ws_common_neighbor_remove(protocol_interface_info_entry_t *cur, const uint8
379379
ws_bootstrap_neighbor_remove(cur, ll_address);
380380
}
381381

382-
382+
uint8_t ws_common_temporary_entry_size(uint8_t mac_table_size)
383+
{
384+
if (mac_table_size >= 128) {
385+
return (WS_RPL_CANDIDATE_PARENT_COUNT + WS_LARGE_TEMPORARY_NEIGHBOUR_ENTRIES);
386+
} else if (mac_table_size >= 64) {
387+
return (WS_RPL_CANDIDATE_PARENT_COUNT + WS_MEDIUM_TEMPORARY_NEIGHBOUR_ENTRIES);
388+
} else {
389+
return (WS_RPL_CANDIDATE_PARENT_COUNT + WS_SMALL_TEMPORARY_NEIGHBOUR_ENTRIES);
390+
}
391+
}
383392

384393
uint8_t ws_common_allow_child_registration(protocol_interface_info_entry_t *interface, const uint8_t *eui64)
385394
{
386395
uint8_t child_count = 0;
387-
uint8_t max_child_count = mac_neighbor_info(interface)->list_total_size - WS_NON_CHILD_NEIGHBOUR_COUNT;
396+
uint8_t max_child_count = mac_neighbor_info(interface)->list_total_size - ws_common_temporary_entry_size(mac_neighbor_info(interface)->list_total_size);
388397

389398
// Test API to limit child count
390399
if (test_max_child_count_override != 0xffff) {

source/6LoWPAN/ws/ws_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ void ws_common_primary_parent_update(protocol_interface_info_entry_t *interface,
156156
void ws_common_secondary_parent_update(protocol_interface_info_entry_t *interface);
157157

158158
void ws_common_link_temporary_remove(struct protocol_interface_info_entry *interface, const uint8_t *ll64);
159-
159+
uint8_t ws_common_temporary_entry_size(uint8_t mac_table_size);
160160
#define ws_info(cur) ((cur)->ws_info)
161161
#else
162162
#define ws_info(cur) ((ws_info_t *) NULL)

source/6LoWPAN/ws/ws_config.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,10 @@ extern uint8_t DEVICE_MIN_SENS;
153153
* Amount of ND reply entries left
154154
* rest are used as child count, but is related to neighbour table size
155155
*/
156-
#define WS_RPL_CANDIDATE_PARENT_COUNT 3 // Largest possible value
157-
#define WS_TEMPORARY_NEIGHBOUR_ENTRIES 7
158-
#define WS_NON_CHILD_NEIGHBOUR_COUNT (WS_RPL_CANDIDATE_PARENT_COUNT + WS_TEMPORARY_NEIGHBOUR_ENTRIES)
156+
#define WS_RPL_CANDIDATE_PARENT_COUNT 3
157+
#define WS_SMALL_TEMPORARY_NEIGHBOUR_ENTRIES 7
158+
#define WS_MEDIUM_TEMPORARY_NEIGHBOUR_ENTRIES 12
159+
#define WS_LARGE_TEMPORARY_NEIGHBOUR_ENTRIES 22
159160

160161
/*
161162
* Neighbour blacklist timers

source/6LoWPAN/ws/ws_llc_data_service.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ typedef struct {
100100
typedef NS_LIST_HEAD(llc_message_t, link) llc_message_list_t;
101101

102102
#define MAX_NEIGH_TEMPORARY_MULTICAST_SIZE 5
103-
#define MAX_NEIGH_TEMPORRY_EAPOL_SIZE 30
103+
#define MAX_NEIGH_TEMPORRY_EAPOL_SIZE 20
104104
#define MAX_NEIGH_TEMPORAY_LIST_SIZE (MAX_NEIGH_TEMPORARY_MULTICAST_SIZE + MAX_NEIGH_TEMPORRY_EAPOL_SIZE)
105105

106106
typedef struct {

source/MAC/IEEE802_15_4/mac_mcps_sap.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,13 +1883,19 @@ int8_t mcps_generic_ack_build(protocol_interface_rf_mac_setup_s *rf_ptr, bool in
18831883
//Remember to update security counter here!
18841884
key_desc = mac_frame_security_key_get(rf_ptr, buffer);
18851885
if (!key_desc) {
1886+
#ifdef __linux__
1887+
tr_debug("Drop a ACK missing key desc");
1888+
#endif
18861889
buffer->status = MLME_UNAVAILABLE_KEY;
18871890
return -2;
18881891
}
18891892
if (init_build) {
18901893
buffer->aux_header.frameCounter = mac_sec_mib_key_outgoing_frame_counter_get(rf_ptr, key_desc);
18911894
}
18921895
if (!mac_frame_security_parameters_init(&ccm_ptr, rf_ptr, buffer, key_desc)) {
1896+
#ifdef __linux__
1897+
tr_debug("Drop a ACK ignored by security init");
1898+
#endif
18931899
return -2;
18941900
}
18951901
if (init_build) {
@@ -1921,6 +1927,9 @@ int8_t mcps_generic_ack_build(protocol_interface_rf_mac_setup_s *rf_ptr, bool in
19211927
mac_sec_mib_key_outgoing_frame_counter_decrement(rf_ptr, key_desc);
19221928
ccm_free(&ccm_ptr);
19231929
}
1930+
#ifdef __linux__
1931+
tr_debug("Drop a ACK send by frame too long %u", frame_length);
1932+
#endif
19241933
return -1;
19251934
}
19261935

@@ -2092,6 +2101,11 @@ static int8_t mcps_pd_data_cca_trig(protocol_interface_rf_mac_setup_s *rf_ptr, m
20922101
if (rf_ptr->active_pd_data_request) {
20932102
mac_csma_backoff_start(rf_ptr);
20942103
}
2104+
#ifdef __linux__
2105+
if (buffer->fcf_dsn.frametype == MAC_FRAME_ACK) {
2106+
tr_debug("Drop ACK by CCA request");
2107+
}
2108+
#endif
20952109
platform_exit_critical();
20962110
return -1;
20972111
}

source/MAC/IEEE802_15_4/mac_mlme.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,6 +1659,7 @@ int8_t mac_mlme_rf_channel_change(protocol_interface_rf_mac_setup_s *rf_mac_setu
16591659
if (new_channel == rf_mac_setup->mac_channel) {
16601660
return 0;
16611661
}
1662+
16621663
platform_enter_critical();
16631664
if (rf_mac_setup->dev_driver->phy_driver->extension(PHY_EXTENSION_SET_CHANNEL, &new_channel) == 0) {
16641665
rf_mac_setup->mac_channel = new_channel;

source/MAC/IEEE802_15_4/mac_pd_sap.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,9 @@ static int8_t mac_data_interface_tx_done_cb(protocol_interface_rf_mac_setup_s *r
460460
}
461461

462462
//Compare time to started time
463-
if (mac_mcps_sap_get_phy_timestamp(rf_ptr) - rf_ptr->enhanced_ack_handler_timestamp > ENHANCED_ACK_NEIGHBOUR_POLL_MAX_TIME_US || mcps_generic_ack_build(rf_ptr, false) != 0) {
463+
if (mac_mcps_sap_get_phy_timestamp(rf_ptr) - rf_ptr->enhanced_ack_handler_timestamp > ENHANCED_ACK_NEIGHBOUR_POLL_MAX_TIME_US) {
464+
mac_data_ack_tx_finish(rf_ptr);
465+
} else if (mcps_generic_ack_build(rf_ptr, false) != 0) {
464466
mac_data_ack_tx_finish(rf_ptr);
465467
}
466468

@@ -847,6 +849,9 @@ static int8_t mac_pd_sap_generate_ack(protocol_interface_rf_mac_setup_s *rf_ptr,
847849
return 0;
848850
}
849851
if (rf_ptr->mac_ack_tx_active) {
852+
#ifdef __linux__
853+
tr_debug("Drop a New ack by pending request");
854+
#endif
850855
return -1;
851856
}
852857

@@ -905,11 +910,17 @@ static mac_pre_parsed_frame_t *mac_pd_sap_allocate_receive_buffer(protocol_inter
905910
if (fcf_read->frametype != FC_ACK_FRAME) {
906911
if (!ns_monitor_packet_allocation_allowed()) {
907912
// stack can not handle new packets for routing
913+
#ifdef __linux__
914+
tr_debug("Packet ingress drop buffer allocation");
915+
#endif
908916
return NULL;
909917
}
910918
}
911919
mac_pre_parsed_frame_t *buffer = mcps_sap_pre_parsed_frame_buffer_get(pd_data_ind->data_ptr, pd_data_ind->data_len);
912920
if (!buffer) {
921+
#ifdef __linux__
922+
tr_debug("macPD buffer allocate fail %u", pd_data_ind->data_len);
923+
#endif
913924
return NULL;
914925
}
915926
//Copy Pre Parsed values
@@ -1000,6 +1011,9 @@ int8_t mac_pd_sap_data_cb(void *identifier, arm_phy_sap_msg_t *message)
10001011
arm_pd_sap_generic_ind_t *pd_data_ind = &(message->message.generic_data_ind);
10011012
mac_pre_parsed_frame_t *buffer = NULL;
10021013
if (pd_data_ind->data_len == 0) {
1014+
#ifdef TIMING_TOOL_TRACES
1015+
tr_info("Collission at RF?");
1016+
#endif
10031017
goto ERROR_HANDLER;
10041018
}
10051019

@@ -1023,9 +1037,13 @@ int8_t mac_pd_sap_data_cb(void *identifier, arm_phy_sap_msg_t *message)
10231037
goto ERROR_HANDLER;
10241038
}
10251039
if (!mac_pd_sap_rx_filter(pd_data_ind->data_ptr, &fcf_read, rf_ptr->mac_frame_filters, rf_ptr->mac64, rf_ptr->mac_short_address, rf_ptr->pan_id)) {
1040+
pd_data_ind->data_len = 0; // Do not update RX drop in that case
10261041
goto ERROR_HANDLER;
10271042
}
10281043
if (mac_pd_sap_generate_ack(rf_ptr, &fcf_read, pd_data_ind)) {
1044+
#ifdef __linux__
1045+
tr_debug("Drop a Data by ignored ACK generation");
1046+
#endif
10291047
goto ERROR_HANDLER;
10301048
}
10311049
if (buffer) {

source/Security/protocols/eap_tls_sec_prot/eap_tls_sec_prot_lib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ typedef struct {
5454
uint16_t handled_len; /**< Handled length of the data buffer (e.g. acked by other end) */
5555
} tls_data_t;
5656

57-
#define TLS_FRAGMENT_LEN 1100 //EAP-TLS fragment length
57+
#define TLS_FRAGMENT_LEN 600 //EAP-TLS fragment length
5858
#define TLS_HEAD_LEN 5 //EAP-TLS flags and EAP-TLS length
5959

6060
extern const uint8_t eap_msg_trace[4][10];

0 commit comments

Comments
 (0)