Skip to content

Commit

Permalink
Wi-sun parameter and debug trace update
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Juha Heiskanen committed Aug 24, 2020
1 parent 5752eae commit 70244f6
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 12 deletions.
4 changes: 2 additions & 2 deletions nanostack/dhcp_service_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ typedef int (dhcp_service_receive_req_cb)(uint16_t instance_id, uint32_t msg_tr_

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);

/* \brief Neighbour table update callback this is called for DHCP relay and server link local responses
/**
* \brief Neighbour table update callback this is called for DHCP relay and server link local responses.
*
* \param interface interface where address is got
* \param ll_addr Link local which neighbour must be guarantee.
*
*
*/
typedef void (dhcp_relay_neighbour_cb)(int8_t interface, uint8_t ll_addr[static 16]);

Expand Down
2 changes: 1 addition & 1 deletion source/6LoWPAN/ws/ws_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1745,7 +1745,7 @@ static void ws_bootstrap_neighbor_table_clean(struct protocol_interface_info_ent
{
uint8_t ll_target[16];

if (mac_neighbor_info(interface)->neighbour_list_size <= mac_neighbor_info(interface)->list_total_size - WS_NON_CHILD_NEIGHBOUR_COUNT) {
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)) {
// Enough neighbor entries
return;
}
Expand Down
13 changes: 11 additions & 2 deletions source/6LoWPAN/ws/ws_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,12 +379,21 @@ void ws_common_neighbor_remove(protocol_interface_info_entry_t *cur, const uint8
ws_bootstrap_neighbor_remove(cur, ll_address);
}


uint8_t ws_common_temporary_entry_size(uint8_t mac_table_size)
{
if (mac_table_size >= 128) {
return (WS_RPL_CANDIDATE_PARENT_COUNT + WS_LARGE_TEMPORARY_NEIGHBOUR_ENTRIES);
} else if (mac_table_size >= 64) {
return (WS_RPL_CANDIDATE_PARENT_COUNT + WS_MEDIUM_TEMPORARY_NEIGHBOUR_ENTRIES);
} else {
return (WS_RPL_CANDIDATE_PARENT_COUNT + WS_SMALL_TEMPORARY_NEIGHBOUR_ENTRIES);
}
}

uint8_t ws_common_allow_child_registration(protocol_interface_info_entry_t *interface, const uint8_t *eui64)
{
uint8_t child_count = 0;
uint8_t max_child_count = mac_neighbor_info(interface)->list_total_size - WS_NON_CHILD_NEIGHBOUR_COUNT;
uint8_t max_child_count = mac_neighbor_info(interface)->list_total_size - ws_common_temporary_entry_size(mac_neighbor_info(interface)->list_total_size);

// Test API to limit child count
if (test_max_child_count_override != 0xffff) {
Expand Down
2 changes: 1 addition & 1 deletion source/6LoWPAN/ws/ws_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void ws_common_primary_parent_update(protocol_interface_info_entry_t *interface,
void ws_common_secondary_parent_update(protocol_interface_info_entry_t *interface);

void ws_common_link_temporary_remove(struct protocol_interface_info_entry *interface, const uint8_t *ll64);

uint8_t ws_common_temporary_entry_size(uint8_t mac_table_size);
#define ws_info(cur) ((cur)->ws_info)
#else
#define ws_info(cur) ((ws_info_t *) NULL)
Expand Down
7 changes: 4 additions & 3 deletions source/6LoWPAN/ws/ws_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,10 @@ extern uint8_t DEVICE_MIN_SENS;
* Amount of ND reply entries left
* rest are used as child count, but is related to neighbour table size
*/
#define WS_RPL_CANDIDATE_PARENT_COUNT 3 // Largest possible value
#define WS_TEMPORARY_NEIGHBOUR_ENTRIES 7
#define WS_NON_CHILD_NEIGHBOUR_COUNT (WS_RPL_CANDIDATE_PARENT_COUNT + WS_TEMPORARY_NEIGHBOUR_ENTRIES)
#define WS_RPL_CANDIDATE_PARENT_COUNT 3
#define WS_SMALL_TEMPORARY_NEIGHBOUR_ENTRIES 7
#define WS_MEDIUM_TEMPORARY_NEIGHBOUR_ENTRIES 12
#define WS_LARGE_TEMPORARY_NEIGHBOUR_ENTRIES 22

/*
* Neighbour blacklist timers
Expand Down
2 changes: 1 addition & 1 deletion source/6LoWPAN/ws/ws_llc_data_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ typedef struct {
typedef NS_LIST_HEAD(llc_message_t, link) llc_message_list_t;

#define MAX_NEIGH_TEMPORARY_MULTICAST_SIZE 5
#define MAX_NEIGH_TEMPORRY_EAPOL_SIZE 30
#define MAX_NEIGH_TEMPORRY_EAPOL_SIZE 20
#define MAX_NEIGH_TEMPORAY_LIST_SIZE (MAX_NEIGH_TEMPORARY_MULTICAST_SIZE + MAX_NEIGH_TEMPORRY_EAPOL_SIZE)

typedef struct {
Expand Down
14 changes: 14 additions & 0 deletions source/MAC/IEEE802_15_4/mac_mcps_sap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1883,13 +1883,19 @@ int8_t mcps_generic_ack_build(protocol_interface_rf_mac_setup_s *rf_ptr, bool in
//Remember to update security counter here!
key_desc = mac_frame_security_key_get(rf_ptr, buffer);
if (!key_desc) {
#ifdef __linux__
tr_debug("Drop a ACK missing key desc");
#endif
buffer->status = MLME_UNAVAILABLE_KEY;
return -2;
}
if (init_build) {
buffer->aux_header.frameCounter = mac_sec_mib_key_outgoing_frame_counter_get(rf_ptr, key_desc);
}
if (!mac_frame_security_parameters_init(&ccm_ptr, rf_ptr, buffer, key_desc)) {
#ifdef __linux__
tr_debug("Drop a ACK ignored by security init");
#endif
return -2;
}
if (init_build) {
Expand Down Expand Up @@ -1921,6 +1927,9 @@ int8_t mcps_generic_ack_build(protocol_interface_rf_mac_setup_s *rf_ptr, bool in
mac_sec_mib_key_outgoing_frame_counter_decrement(rf_ptr, key_desc);
ccm_free(&ccm_ptr);
}
#ifdef __linux__
tr_debug("Drop a ACK send by frame too long %u", frame_length);
#endif
return -1;
}

Expand Down Expand Up @@ -2092,6 +2101,11 @@ static int8_t mcps_pd_data_cca_trig(protocol_interface_rf_mac_setup_s *rf_ptr, m
if (rf_ptr->active_pd_data_request) {
mac_csma_backoff_start(rf_ptr);
}
#ifdef __linux__
if (buffer->fcf_dsn.frametype == MAC_FRAME_ACK) {
tr_debug("Drop ACK by CCA request");
}
#endif
platform_exit_critical();
return -1;
}
Expand Down
1 change: 1 addition & 0 deletions source/MAC/IEEE802_15_4/mac_mlme.c
Original file line number Diff line number Diff line change
Expand Up @@ -1659,6 +1659,7 @@ int8_t mac_mlme_rf_channel_change(protocol_interface_rf_mac_setup_s *rf_mac_setu
if (new_channel == rf_mac_setup->mac_channel) {
return 0;
}

platform_enter_critical();
if (rf_mac_setup->dev_driver->phy_driver->extension(PHY_EXTENSION_SET_CHANNEL, &new_channel) == 0) {
rf_mac_setup->mac_channel = new_channel;
Expand Down
20 changes: 19 additions & 1 deletion source/MAC/IEEE802_15_4/mac_pd_sap.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,9 @@ static int8_t mac_data_interface_tx_done_cb(protocol_interface_rf_mac_setup_s *r
}

//Compare time to started time
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) {
if (mac_mcps_sap_get_phy_timestamp(rf_ptr) - rf_ptr->enhanced_ack_handler_timestamp > ENHANCED_ACK_NEIGHBOUR_POLL_MAX_TIME_US) {
mac_data_ack_tx_finish(rf_ptr);
} else if (mcps_generic_ack_build(rf_ptr, false) != 0) {
mac_data_ack_tx_finish(rf_ptr);
}

Expand Down Expand Up @@ -847,6 +849,9 @@ static int8_t mac_pd_sap_generate_ack(protocol_interface_rf_mac_setup_s *rf_ptr,
return 0;
}
if (rf_ptr->mac_ack_tx_active) {
#ifdef __linux__
tr_debug("Drop a New ack by pending request");
#endif
return -1;
}

Expand Down Expand Up @@ -905,11 +910,17 @@ static mac_pre_parsed_frame_t *mac_pd_sap_allocate_receive_buffer(protocol_inter
if (fcf_read->frametype != FC_ACK_FRAME) {
if (!ns_monitor_packet_allocation_allowed()) {
// stack can not handle new packets for routing
#ifdef __linux__
tr_debug("Packet ingress drop buffer allocation");
#endif
return NULL;
}
}
mac_pre_parsed_frame_t *buffer = mcps_sap_pre_parsed_frame_buffer_get(pd_data_ind->data_ptr, pd_data_ind->data_len);
if (!buffer) {
#ifdef __linux__
tr_debug("macPD buffer allocate fail %u", pd_data_ind->data_len);
#endif
return NULL;
}
//Copy Pre Parsed values
Expand Down Expand Up @@ -1000,6 +1011,9 @@ int8_t mac_pd_sap_data_cb(void *identifier, arm_phy_sap_msg_t *message)
arm_pd_sap_generic_ind_t *pd_data_ind = &(message->message.generic_data_ind);
mac_pre_parsed_frame_t *buffer = NULL;
if (pd_data_ind->data_len == 0) {
#ifdef TIMING_TOOL_TRACES
tr_info("Collission at RF?");
#endif
goto ERROR_HANDLER;
}

Expand All @@ -1023,9 +1037,13 @@ int8_t mac_pd_sap_data_cb(void *identifier, arm_phy_sap_msg_t *message)
goto ERROR_HANDLER;
}
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)) {
pd_data_ind->data_len = 0; // Do not update RX drop in that case
goto ERROR_HANDLER;
}
if (mac_pd_sap_generate_ack(rf_ptr, &fcf_read, pd_data_ind)) {
#ifdef __linux__
tr_debug("Drop a Data by ignored ACK generation");
#endif
goto ERROR_HANDLER;
}
if (buffer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ typedef struct {
uint16_t handled_len; /**< Handled length of the data buffer (e.g. acked by other end) */
} tls_data_t;

#define TLS_FRAGMENT_LEN 1100 //EAP-TLS fragment length
#define TLS_FRAGMENT_LEN 600 //EAP-TLS fragment length
#define TLS_HEAD_LEN 5 //EAP-TLS flags and EAP-TLS length

extern const uint8_t eap_msg_trace[4][10];
Expand Down

0 comments on commit 70244f6

Please sign in to comment.