Skip to content

Commit b400a6a

Browse files
Fix for pr #1984 (#1987)
Fixed functions that made space for indirect packets. Reverted unit test changes.
1 parent 30d25bc commit b400a6a

File tree

2 files changed

+4
-28
lines changed

2 files changed

+4
-28
lines changed

source/6LoWPAN/adaptation_interface.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,8 @@ static bool lowpan_adaptation_is_priority_message(buffer_t *buf)
823823
static bool lowpan_adaptation_make_room_for_small_packet(protocol_interface_info_entry_t *cur, fragmenter_interface_t *interface_ptr, mac_neighbor_table_entry_t *neighbour_to_count, fragmenter_tx_entry_t *new_entry)
824824
{
825825
if (interface_ptr->max_indirect_small_packets_per_child == 0) {
826-
return false;
826+
// this means there is always space for small packets - no need to check further
827+
return true;
827828
}
828829

829830
uint_fast16_t count = 0;
@@ -861,7 +862,8 @@ static bool lowpan_adaptation_make_room_for_small_packet(protocol_interface_info
861862
static bool lowpan_adaptation_make_room_for_big_packet(struct protocol_interface_info_entry *cur, fragmenter_interface_t *interface_ptr, fragmenter_tx_entry_t *new_entry)
862863
{
863864
if (interface_ptr->max_indirect_big_packets_total == 0) {
864-
return false;
865+
// this means there is always space for big packets - no need to check further
866+
return true;
865867
}
866868

867869
uint_fast16_t count = 0;

test/nanostack/unittest/6LoWPAN/adaptation_interface/test_adaptation_interface.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -134,19 +134,13 @@ bool test_lowpan_adaptation_interface_reset()
134134
buf.buf_ptr = 10;
135135
buf.buf_end = 80;
136136

137-
138137
if (-1 != lowpan_adaptation_interface_reset(0)) {
139138
return false;
140139
}
141140

142141
nsdynmemlib_stub.returnCounter = 2;
143142
lowpan_adaptation_interface_init(0, 127);
144143

145-
// Set small and big buffer size to 2
146-
if (0 != lowpan_adaptation_indirect_queue_params_set(&entry, 106, 2, 2)) {
147-
return false;
148-
}
149-
150144
//Set 2 direct and 2 indirect buffer
151145
buf.link_specific.ieee802_15_4.indirectTxProcess = false;
152146
lowpan_adaptation_interface_tx(&entry, &buf);
@@ -303,17 +297,10 @@ bool test_lowpan_adaptation_indirect_purge()
303297
entry.id = 0;
304298
api.mcps_data_req = &mcps_data_req_cb;
305299

306-
307-
308300
//Test Indirect data allocation fail
309301
nsdynmemlib_stub.returnCounter = 2;
310302
lowpan_adaptation_interface_init(0, 127);
311303

312-
// Set small and big buffer size to 2
313-
if (0 != lowpan_adaptation_indirect_queue_params_set(&entry, 106, 2, 2)) {
314-
return false;
315-
}
316-
317304
test_buf->link_specific.ieee802_15_4.indirectTxProcess = true;
318305
nsdynmemlib_stub.returnCounter = 2;
319306
if (0 != lowpan_adaptation_interface_tx(&entry, test_buf)) {
@@ -797,7 +784,6 @@ bool test_lowpan_adaptation_interface_tx_confirm()
797784
buffer_t *test_buf = malloc(sizeof(buffer_t) + 2100);
798785
memset(test_buf, 0, sizeof(buffer_t) + 2100);
799786

800-
801787
entry.mac_parameters->mac_in_direct_entry_timeout = 14000;
802788
test_buf->link_specific.ieee802_15_4.useDefaultPanId = true;
803789
test_buf->dst_sa.addr_type = ADDR_802_15_4_SHORT;
@@ -833,7 +819,6 @@ bool test_lowpan_adaptation_interface_tx_confirm()
833819
entry.id = 0;
834820
api.mcps_data_req = &mcps_data_req_cb;
835821

836-
837822
if (-1 != lowpan_adaptation_interface_tx_confirm(NULL, &data_confirm)) {
838823
lowpan_adaptation_interface_free(0);
839824
free(test_buf);
@@ -868,10 +853,6 @@ bool test_lowpan_adaptation_interface_tx_confirm()
868853
return false;
869854
}
870855
test_buf2->ip_routed_up = true;
871-
// Set small and big buffer size to 2
872-
if (0 != lowpan_adaptation_indirect_queue_params_set(&entry, 106, 2, 2)) {
873-
return false;
874-
}
875856

876857
lowpan_adaptation_interface_tx(&entry, test_buf);
877858
lowpan_adaptation_interface_tx(&entry, test_buf2);
@@ -887,7 +868,6 @@ bool test_lowpan_adaptation_interface_tx_confirm()
887868
return false;
888869
}
889870

890-
891871
data_confirm.msduHandle = test_buf->seq;
892872
data_confirm.status = MLME_SUCCESS;
893873
if (0 != lowpan_adaptation_interface_tx_confirm(&entry, &data_confirm)) {
@@ -918,7 +898,6 @@ bool test_lowpan_adaptation_interface_tx_confirm()
918898
return false;
919899
}
920900

921-
922901
data_confirm.msduHandle = test_buf3->seq;
923902
data_confirm.status = MLME_TRANSACTION_EXPIRED;
924903
if (0 != lowpan_adaptation_interface_tx_confirm(&entry, &data_confirm)) {
@@ -1345,11 +1324,6 @@ bool test_lowpan_adaptation_interface_mpx_register()
13451324
entry.id = 0;
13461325
api.mcps_data_req = &mcps_data_req_cb;
13471326

1348-
// Set small and big buffer size to 2
1349-
if (0 != lowpan_adaptation_indirect_queue_params_set(&entry, 106, 2, 2)) {
1350-
return false;
1351-
}
1352-
13531327
test_buf2->ip_routed_up = true;
13541328
protocol_core_stub.entry_ptr = &entry;
13551329
lowpan_adaptation_interface_tx(&entry, test_buf);

0 commit comments

Comments
 (0)