Skip to content

Commit 8b7d018

Browse files
author
Arto Kinnunen
committed
Move indirect queue size public API to net_interface
Indirect queue size can be set for both 6LoWPAN and Thread. Therefore public API needs to be in common header.
1 parent d877c9e commit 8b7d018

File tree

3 files changed

+31
-24
lines changed

3 files changed

+31
-24
lines changed

nanostack/net_interface.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,23 @@ void arm_print_protocols2(void (*print_fn)(const char *fmt, ...), char sep);
987987
*
988988
*/
989989
extern void net_get_version_information(uint8_t *ptr);
990+
991+
/**
992+
* \brief Set buffer size for sleepy device parent.
993+
*
994+
* This function can be used to set sleepy device parent buffer size and packet threshold.
995+
*
996+
* Note! In Thread mode parent buffer size is automatically set during Thread initialization.
997+
*
998+
* \param big_packet_threshold Indicate how long packets are considered big. Thread specifies this to be 106 bytes.
999+
* \param small_packets_per_child_count Number of packets stored for each sleepy children.
1000+
* \param big_packets_total_count Total number of big packets parent can store for all sleepy children.
1001+
* \return 0 on success, <0 on errors.
1002+
*/
1003+
1004+
extern int arm_nwk_sleepy_device_parent_buffer_size_set(int8_t interface_id, uint16_t big_packet_threshold, uint16_t small_packets_per_child_count, uint16_t big_packets_total_count);
1005+
1006+
9901007
#ifdef __cplusplus
9911008
}
9921009
#endif

source/6LoWPAN/Thread/thread_management_if.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,27 +1452,3 @@ int thread_management_partition_weighting_set(int8_t interface_id, uint8_t parti
14521452
return -1;
14531453
#endif
14541454
}
1455-
1456-
int thread_management_sed_parent_buffer_size_set(int8_t interface_id, uint16_t small_packets_per_child_count, uint16_t big_packets_total_count)
1457-
{
1458-
#ifdef HAVE_THREAD
1459-
protocol_interface_info_entry_t *cur;
1460-
1461-
cur = protocol_stack_interface_info_get_by_id(interface_id);
1462-
if (!cur || !cur->thread_info) {
1463-
tr_debug("Invalid interface id");
1464-
return -1;
1465-
}
1466-
1467-
return lowpan_adaptation_indirect_queue_params_set(cur,
1468-
THREAD_INDIRECT_BIG_PACKET_THRESHOLD,
1469-
big_packets_total_count,
1470-
small_packets_per_child_count);
1471-
1472-
#else
1473-
(void) interface_id;
1474-
(void) small_packets_per_child_count;
1475-
(void) big_packets_total_count;
1476-
return -1;
1477-
#endif
1478-
}

source/libNET/src/ns_net.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "RPL/rpl_data.h"
3737
#endif
3838
#include "ccmLIB.h"
39+
#include "6LoWPAN/lowpan_adaptation_interface.h"
3940
#include "6LoWPAN/Bootstraps/network_lib.h"
4041
#include "6LoWPAN/Bootstraps/protocol_6lowpan.h"
4142
#include "6LoWPAN/Bootstraps/protocol_6lowpan_bootstrap.h"
@@ -1415,3 +1416,16 @@ void arm_ncache_flush(void)
14151416
{
14161417
nwk_interface_flush_neigh_cache();
14171418
}
1419+
1420+
int arm_nwk_sleepy_device_parent_buffer_size_set(int8_t interface_id, uint16_t big_packet_threshold, uint16_t small_packets_per_child_count, uint16_t big_packets_total_count)
1421+
{
1422+
protocol_interface_info_entry_t *cur;
1423+
1424+
cur = protocol_stack_interface_info_get_by_id(interface_id);
1425+
if (cur) {
1426+
return lowpan_adaptation_indirect_queue_params_set(cur, big_packet_threshold,
1427+
big_packets_total_count, small_packets_per_child_count);
1428+
}
1429+
return -1;
1430+
}
1431+

0 commit comments

Comments
 (0)