Skip to content

Commit 089fb3b

Browse files
author
Juha Heiskanen
committed
Neighbour temporary entry update and Enhanced ACK tx update
MAC will trig enhanced ACK now if it can allocate buffer for data and ACK TX is possible. Removed Temporary entry instant remove and wait timeout. Cleaned dead code.
1 parent 70244f6 commit 089fb3b

File tree

15 files changed

+3
-155
lines changed

15 files changed

+3
-155
lines changed

nanostack/mlme.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@ typedef enum {
267267
macEdfeForceStop = 0xf2, /*< Use this command for Data wait timeout at LLC: Mac stop Edfe session data wait and enable normal FHSS mode */
268268
macSetDataWhitening = 0xf3, /*< Enable or disable data whitening, boolean true for enable, false for disable */
269269
macCCAThresholdStart = 0xf4, /*< Start automatic CCA threshold */
270-
macDevicePendingAckTrig = 0xf5, /*< Trig Pending ACK for Accepted Data packet for temporary neighbour */
271270
mac802_15_4Mode = 0xf6, /*<IEEE 802.15.4 mode*/
272271
macDeviceDescriptionPanIDUpdate = 0xf7, /*<Thread pending link update case this will update device descrioton list pan-id to new one*/
273272
macTXPower = 0xf8, /*<TX output power*/

source/6LoWPAN/MAC/mac_helper.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -947,21 +947,6 @@ void mac_helper_devicetable_direct_set(struct mac_api_s *mac_api, const mlme_dev
947947
mac_api->mlme_req(mac_api, MLME_SET, &set_req);
948948
}
949949

950-
void mac_helper_devicetable_ack_trig(const mlme_device_descriptor_t *device_desc, protocol_interface_info_entry_t *cur)
951-
{
952-
if (!cur->mac_api) {
953-
return;
954-
}
955-
956-
mlme_set_t set_req;
957-
set_req.attr = macDevicePendingAckTrig;
958-
set_req.attr_index = 0;
959-
set_req.value_pointer = (void *)device_desc;
960-
set_req.value_size = sizeof(mlme_device_descriptor_t);
961-
cur->mac_api->mlme_req(cur->mac_api, MLME_SET, &set_req);
962-
}
963-
964-
965950
int8_t mac_helper_mac_mlme_max_retry_set(int8_t interface_id, uint8_t mac_retry_set)
966951
{
967952
protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(interface_id);

source/6LoWPAN/MAC/mac_helper.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,6 @@ void mac_helper_devicetable_set(const mlme_device_descriptor_t *device_dec, stru
128128

129129
void mac_helper_devicetable_direct_set(struct mac_api_s *mac_api, const mlme_device_descriptor_t *device_desc, uint8_t attribute_index);
130130

131-
void mac_helper_devicetable_ack_trig(const mlme_device_descriptor_t *device_desc, struct protocol_interface_info_entry *cur);
132-
133131
int8_t mac_helper_mac_mlme_max_retry_set(int8_t interface_id, uint8_t mac_retry_set);
134132

135133
int8_t mac_helper_mac_device_description_pan_id_update(int8_t interface_id, uint16_t pan_id);

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -175,16 +175,6 @@ static void ws_bootstrap_neighbor_delete(struct protocol_interface_info_entry *i
175175
ws_neighbor_class_entry_remove(&interface->ws_info->neighbor_storage, entry_ptr->index);
176176
}
177177

178-
void ws_bootstrap_mac_neighbor_temporary_remove(struct protocol_interface_info_entry *interface, const uint8_t *src64)
179-
{
180-
mac_neighbor_table_entry_t *neighbor = mac_neighbor_table_address_discover(mac_neighbor_info(interface), src64, MAC_ADDR_MODE_64_BIT);
181-
182-
if (neighbor && neighbor->link_lifetime != WS_NEIGHBOR_LINK_TIMEOUT) {
183-
tr_debug("Remove temporary neighbour %s", trace_array(src64, 8));
184-
mac_neighbor_table_neighbor_remove(mac_neighbor_info(interface), neighbor);
185-
}
186-
}
187-
188178
static void ws_bootstap_eapol_neigh_entry_allocate(struct protocol_interface_info_entry *interface)
189179
{
190180
uint8_t mac_64[8];
@@ -205,14 +195,6 @@ static void ws_bootstap_eapol_neigh_entry_allocate(struct protocol_interface_inf
205195
interface->ws_info->eapol_tx_index = mac_entry->index;
206196
}
207197

208-
void ws_bootstrap_eapol_rx_temporary_set(struct protocol_interface_info_entry *interface, const uint8_t *src64)
209-
{
210-
mlme_device_descriptor_t device_desc;
211-
212-
mac_helper_device_description_write(interface, &device_desc, src64, 0xffff, 0, false);
213-
mac_helper_devicetable_ack_trig(&device_desc, interface);
214-
}
215-
216198
ws_neighbor_class_entry_t *ws_bootstrap_eapol_tx_temporary_set(struct protocol_interface_info_entry *interface, const uint8_t *src64)
217199
{
218200
mlme_device_descriptor_t device_desc;

source/6LoWPAN/ws/ws_bootstrap.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ bool ws_bootstrap_validate_channel_plan(struct ws_us_ie *ws_us, struct protocol_
8686

8787
bool ws_bootstrap_validate_channel_function(struct ws_us_ie *ws_us, struct ws_bs_ie *ws_bs);
8888

89-
void ws_bootstrap_eapol_rx_temporary_set(struct protocol_interface_info_entry *interface, const uint8_t *src64);
90-
9189
struct ws_neighbor_class_entry *ws_bootstrap_eapol_tx_temporary_set(struct protocol_interface_info_entry *interface, const uint8_t *src64);
9290

9391
void ws_bootstrap_eapol_tx_temporary_clear(struct protocol_interface_info_entry *interface);
@@ -98,8 +96,6 @@ int ws_bootstrap_get_info(protocol_interface_info_entry_t *cur, struct ws_stack_
9896

9997
void ws_bootstrap_mac_neighbor_short_time_set(struct protocol_interface_info_entry *interface, const uint8_t *src64, uint32_t valid_time);
10098

101-
void ws_bootstrap_mac_neighbor_temporary_remove(struct protocol_interface_info_entry *interface, const uint8_t *src64);
102-
10399
#else
104100

105101
#define ws_bootstrap_init(interface_id, bootstrap_mode) (-1)
@@ -108,7 +104,6 @@ void ws_bootstrap_mac_neighbor_temporary_remove(struct protocol_interface_info_e
108104
#define ws_bootstrap_neighbor_remove(cur, ll_address)
109105
#define ws_bootstrap_aro_failure(cur, ll_address)
110106
#define ws_bootstrap_neighbor_set_stable(interface, src64)
111-
#define ws_bootstrap_mac_neighbor_temporary_remove(interface, src64)
112107
#define ws_bootstrap_primary_parent_update(interface, neighbor)
113108
#define ws_bootstrap_secondary_parent_update(interface)
114109
#define ws_bootstrap_get_info(cur, info_ptr)

source/6LoWPAN/ws/ws_common.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -498,12 +498,5 @@ void ws_common_secondary_parent_update(protocol_interface_info_entry_t *interfac
498498
{
499499
ws_bootstrap_secondary_parent_update(interface);
500500
}
501-
void ws_common_link_temporary_remove(struct protocol_interface_info_entry *interface, const uint8_t *ll64)
502-
{
503-
uint8_t mac64[8];
504-
memcpy(mac64, ll64 + 8, 8);
505-
mac64[0] ^= 2;
506-
ws_bootstrap_mac_neighbor_temporary_remove(interface, mac64);
507-
}
508501

509502
#endif // HAVE_WS

source/6LoWPAN/ws/ws_common.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ void ws_common_primary_parent_update(protocol_interface_info_entry_t *interface,
155155

156156
void ws_common_secondary_parent_update(protocol_interface_info_entry_t *interface);
157157

158-
void ws_common_link_temporary_remove(struct protocol_interface_info_entry *interface, const uint8_t *ll64);
159158
uint8_t ws_common_temporary_entry_size(uint8_t mac_table_size);
160159
#define ws_info(cur) ((cur)->ws_info)
161160
#else
@@ -170,7 +169,6 @@ uint8_t ws_common_temporary_entry_size(uint8_t mac_table_size);
170169
#define ws_common_latency_estimate_get(cur) 0
171170
#define ws_common_datarate_get(cur) 0
172171
#define ws_common_network_size_estimate_get(cur) 0
173-
#define ws_common_link_temporary_remove(interface, ll64) ((void)0)
174172
#define ws_common_primary_parent_update(interface, neighbor)
175173
#define ws_common_secondary_parent_update(interface)
176174

source/Common_Protocols/icmpv6.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1648,7 +1648,6 @@ buffer_t *icmpv6_build_na(protocol_interface_info_entry_t *cur, bool solicited,
16481648
}
16491649
/* All other than ARO NA messages are omitted and MAC ACK is considered as success */
16501650
if (!tllao_required && (!aro && cur->ipv6_neighbour_cache.omit_na)) {
1651-
ws_common_link_temporary_remove(cur, src_addr);
16521651
return NULL;
16531652
}
16541653

source/MAC/IEEE802_15_4/mac_defines.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ typedef struct protocol_interface_rf_mac_setup {
204204
bool macBroadcastDisabled: 1;
205205
bool scan_active: 1;
206206
bool rf_csma_extension_supported: 1;
207-
bool ack_tx_possible: 1;
208207
uint16_t mac_short_address;
209208
uint16_t pan_id;
210209
uint8_t mac64[8];

source/MAC/IEEE802_15_4/mac_mlme.c

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -673,50 +673,13 @@ static int8_t mac_mlme_set_ack_wait_duration(protocol_interface_rf_mac_setup_s *
673673
return 0;
674674
}
675675

676-
static void mac_mlme_trig_pending_ack(protocol_interface_rf_mac_setup_s *rf_mac_setup, mlme_device_descriptor_t *device_ptr)
677-
{
678-
platform_enter_critical();
679-
if (rf_mac_setup->mac_ack_tx_active && !rf_mac_setup->ack_tx_possible &&
680-
device_ptr->PANId == rf_mac_setup->enhanced_ack_buffer.DstPANId) {
681-
682-
//Compare address for pending neigbour add
683-
if (rf_mac_setup->enhanced_ack_buffer.fcf_dsn.DstAddrMode == MAC_ADDR_MODE_16_BIT) {
684-
uint16_t short_id = common_read_16_bit(rf_mac_setup->enhanced_ack_buffer.DstAddr);
685-
if (short_id == device_ptr->ShortAddress) {
686-
rf_mac_setup->ack_tx_possible = true;
687-
}
688-
} else if (rf_mac_setup->enhanced_ack_buffer.fcf_dsn.DstAddrMode == MAC_ADDR_MODE_64_BIT) {
689-
if (memcmp(device_ptr->ExtAddress, rf_mac_setup->enhanced_ack_buffer.DstAddr, 8) == 0) {
690-
rf_mac_setup->ack_tx_possible = true;
691-
}
692-
}
693-
}
694-
platform_exit_critical();
695-
}
696-
697676
static int8_t mac_mlme_device_description_set(protocol_interface_rf_mac_setup_s *rf_mac_setup, const mlme_set_t *set_req)
698677
{
699678

700679
if (set_req->value_size != sizeof(mlme_device_descriptor_t)) {
701680
return -1;
702681
}
703-
if (mac_sec_mib_device_description_set(set_req->attr_index, (mlme_device_descriptor_t *) set_req->value_pointer, rf_mac_setup) != 0) {
704-
return -1;
705-
}
706-
707-
mac_mlme_trig_pending_ack(rf_mac_setup, (mlme_device_descriptor_t *) set_req->value_pointer);
708-
return 0;
709-
}
710-
711-
static int8_t mac_mlme_device_pending_ack_trig(protocol_interface_rf_mac_setup_s *rf_mac_setup, const mlme_set_t *set_req)
712-
{
713-
714-
if (set_req->value_size != sizeof(mlme_device_descriptor_t)) {
715-
return -1;
716-
}
717-
mac_mlme_trig_pending_ack(rf_mac_setup, (mlme_device_descriptor_t *) set_req->value_pointer);
718-
719-
return 0;
682+
return mac_sec_mib_device_description_set(set_req->attr_index, (mlme_device_descriptor_t *) set_req->value_pointer, rf_mac_setup);
720683
}
721684

722685
static int8_t mac_mlme_key_description_set(protocol_interface_rf_mac_setup_s *rf_mac_setup, const mlme_set_t *set_req)
@@ -795,8 +758,6 @@ int8_t mac_mlme_set_req(protocol_interface_rf_mac_setup_s *rf_mac_setup, const m
795758
return mac_mlme_set_ack_wait_duration(rf_mac_setup, set_req);
796759
case macDeviceTable:
797760
return mac_mlme_device_description_set(rf_mac_setup, set_req);
798-
case macDevicePendingAckTrig:
799-
return mac_mlme_device_pending_ack_trig(rf_mac_setup, set_req);
800761
case macKeyTable:
801762
return mac_mlme_key_description_set(rf_mac_setup, set_req);
802763
case macDefaultKeySource:

source/MAC/IEEE802_15_4/mac_pd_sap.c

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -453,23 +453,8 @@ static int8_t mac_data_interface_tx_done_cb(protocol_interface_rf_mac_setup_s *r
453453

454454
if (status == PHY_LINK_CCA_PREPARE) {
455455

456-
if (rf_ptr->mac_ack_tx_active) {
457-
//Accept direct non crypted acks and crypted only if neighbor is at list
458-
if (rf_ptr->ack_tx_possible) {
459-
goto VALIDATE_TX_TIME;
460-
}
461-
462-
//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) {
464-
mac_data_ack_tx_finish(rf_ptr);
465-
} else if (mcps_generic_ack_build(rf_ptr, false) != 0) {
466-
mac_data_ack_tx_finish(rf_ptr);
467-
}
468-
469-
return PHY_TX_NOT_ALLOWED;
470-
}
471456

472-
if (rf_ptr->mac_edfe_tx_active) {
457+
if (rf_ptr->mac_ack_tx_active || rf_ptr->mac_edfe_tx_active) {
473458
goto VALIDATE_TX_TIME;
474459
}
475460

@@ -864,18 +849,6 @@ static int8_t mac_pd_sap_generate_ack(protocol_interface_rf_mac_setup_s *rf_ptr,
864849
return -1;
865850
}
866851

867-
868-
if (rf_ptr->enhanced_ack_buffer.fcf_dsn.securityEnabled == 0 || rf_ptr->enhanced_ack_buffer.aux_header.securityLevel == 0) {
869-
//Unsecured data will be acked immediately
870-
rf_ptr->ack_tx_possible = true;
871-
} else {
872-
if (mac_sec_mib_device_description_get(rf_ptr, rf_ptr->enhanced_ack_buffer.DstAddr, rf_ptr->enhanced_ack_buffer.fcf_dsn.DstAddrMode, rf_ptr->enhanced_ack_buffer.DstPANId)) {
873-
rf_ptr->ack_tx_possible = true;
874-
} else {
875-
rf_ptr->ack_tx_possible = false;
876-
}
877-
}
878-
879852
return mcps_generic_ack_build(rf_ptr, true);
880853
}
881854

test/nanostack/unittest/mac/mac_pd_sap/test_mac_pd_sap.c

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -841,32 +841,12 @@ bool test_mac_cca_prepare_cb()
841841
phy_message.message.mac15_4_pd_sap_confirm.status = PHY_LINK_CCA_PREPARE;
842842

843843
int8_t ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message);
844-
if (ret != -1) {
845-
return false;
846-
}
847-
848-
rf_ptr.ack_tx_possible = true;
849-
ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message);
850844
if (ret != 0) {
851845
return false;
852846
}
853847

854-
rf_ptr.ack_tx_possible = false;
855-
856-
rf_ptr.enhanced_ack_handler_timestamp = 10;
857-
858-
ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message);
859-
if (ret != -1 || rf_ptr.mac_ack_tx_active) {
860-
return false;
861-
}
862-
863-
ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message);
864-
if (ret != -1) {
865-
return false;
866-
}
867-
868848
mac_pre_build_frame_t test_packet;
869-
849+
rf_ptr.mac_ack_tx_active = false;
870850
memset(&test_packet, 0, sizeof(mac_pre_build_frame_t));
871851
rf_ptr.active_pd_data_request = &test_packet;
872852
test_packet.csma_periods_left = 0;

test/nanostack/unittest/stub/mac_helper_stub.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,6 @@ void mac_helper_devicetable_direct_set(struct mac_api_s *mac_api, const mlme_dev
259259

260260
}
261261

262-
void mac_helper_devicetable_ack_trig(const mlme_device_descriptor_t *device_desc, struct protocol_interface_info_entry *cur)
263-
{
264-
265-
}
266-
267262
int8_t mac_helper_mac_mlme_max_retry_set(int8_t interface_id, uint8_t mac_retry_set)
268263
{
269264

test/nanostack/unittest/stub/ws_bootstrap_stub.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,6 @@ struct ws_neighbor_class_entry *ws_bootstrap_eapol_tx_temporary_set(struct proto
141141
return NULL;
142142
}
143143

144-
void ws_bootstrap_eapol_rx_temporary_set(struct protocol_interface_info_entry *interface, const uint8_t *src64)
145-
{
146-
147-
}
148144
void ws_bootstrap_eapol_tx_temporary_clear(struct protocol_interface_info_entry *interface)
149145
{
150146

test/nanostack/unittest/stub/ws_common_stub.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,3 @@ void ws_common_primary_parent_update(protocol_interface_info_entry_t *interface,
110110
void ws_common_secondary_parent_update(protocol_interface_info_entry_t *interface)
111111
{
112112
}
113-
114-
void ws_common_link_temporary_remove(struct protocol_interface_info_entry *interface, const uint8_t *ll64)
115-
{
116-
117-
}

0 commit comments

Comments
 (0)