Skip to content

Commit

Permalink
Generic forwarding callback and EF state enabler for Wi-SUN BBR.
Browse files Browse the repository at this point in the history
  • Loading branch information
Juha Heiskanen committed Apr 13, 2021
1 parent 007dfa2 commit 2f5e5e2
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 0 deletions.
9 changes: 9 additions & 0 deletions source/6LoWPAN/adaptation_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,15 @@ static void lowpan_adaptation_priority_status_update(protocol_interface_info_ent
}
}

void lowpan_adaptation_expedite_forward_enable(protocol_interface_info_entry_t *cur)
{
fragmenter_interface_t *interface_ptr = lowpan_adaptation_interface_discover(cur->id);
if (!interface_ptr) {
return;
}
lowpan_adaptation_high_priority_state_enable(cur, interface_ptr);
}

void lowpan_adaptation_interface_slow_timer(protocol_interface_info_entry_t *cur)
{
fragmenter_interface_t *interface_ptr = lowpan_adaptation_interface_discover(cur->id);
Expand Down
2 changes: 2 additions & 0 deletions source/6LoWPAN/lowpan_adaptation_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ int8_t lowpan_adaptation_free_messages_from_queues_by_address(struct protocol_in

int8_t lowpan_adaptation_indirect_queue_params_set(struct protocol_interface_info_entry *cur, uint16_t indirect_big_packet_threshold, uint16_t max_indirect_big_packets_total, uint16_t max_indirect_small_packets_per_child);

void lowpan_adaptation_expedite_forward_enable(struct protocol_interface_info_entry *cur);

void lowpan_adaptation_interface_slow_timer(struct protocol_interface_info_entry *cur);

#endif /* LOWPAN_ADAPTATION_INTERFACE_H_ */
15 changes: 15 additions & 0 deletions source/6LoWPAN/ws/ws_bbr_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@
#include "RPL/rpl_data.h"
#include "Common_Protocols/icmpv6.h"
#include "Common_Protocols/icmpv6_radv.h"
#include "Common_Protocols/ip.h"
#include "ws_management_api.h"
#include "net_rpl.h"
#include "Service_Libs/nd_proxy/nd_proxy.h"
#include "6LoWPAN/ws/ws_bbr_api_internal.h"
#include "6LoWPAN/ws/ws_pae_controller.h"
#include "6LoWPAN/lowpan_adaptation_interface.h"
#include "DHCPv6_Server/DHCPv6_server_service.h"
#include "DHCPv6_client/dhcpv6_client_api.h"
#include "libDHCPv6/libDHCPv6_vendordata.h"
Expand Down Expand Up @@ -907,6 +909,18 @@ bool ws_bbr_ready_to_start(protocol_interface_info_entry_t *cur)
return true;
}

static void ws_bbr_forwarding_cb(protocol_interface_info_entry_t *interface, buffer_t *buf)
{
uint8_t traffic_class = buf->options.traffic_class >> IP_TCLASS_DSCP_SHIFT;

if (traffic_class == IP_DSCP_EF) {
//indicate EF forwarding to adaptation
lowpan_adaptation_expedite_forward_enable(interface);
}
}



void ws_bbr_init(protocol_interface_info_entry_t *interface)
{
(void) interface;
Expand All @@ -919,6 +933,7 @@ void ws_bbr_init(protocol_interface_info_entry_t *interface)
ws_bbr_fhss_bsi = ws_bbr_bsi_read(&bbr_info_nvm_tlv);
tr_debug("Read BSI %u from NVM", ws_bbr_fhss_bsi);
}
interface->if_common_forwarding_out_cb = &ws_bbr_forwarding_cb;
}


Expand Down
1 change: 1 addition & 0 deletions source/6LoWPAN/ws/ws_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,7 @@ static int8_t ws_bootstrap_down(protocol_interface_info_entry_t *cur)
ws_pae_controller_stop(cur);
ws_bootstrap_candidate_table_reset(cur);
blacklist_clear();
cur->if_common_forwarding_out_cb = NULL;

return nwk_6lowpan_down(cur);
}
Expand Down
3 changes: 3 additions & 0 deletions source/Common_Protocols/ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -1362,6 +1362,9 @@ buffer_t *ipv6_forwarding_up(buffer_t *buf)
}
} else { /* unicast */
if (!for_us) {
if (cur->if_common_forwarding_out_cb) {
cur->if_common_forwarding_out_cb(cur, buf);
}
return ipv6_consider_forwarding_unicast_packet(buf, cur, &ll_src);
}
}
Expand Down
1 change: 1 addition & 0 deletions source/NWK_INTERFACE/Include/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ struct protocol_interface_info_entry {
int8_t (*if_down)(struct protocol_interface_info_entry *cur);
int8_t (*if_up)(struct protocol_interface_info_entry *cur);
void (*if_stack_buffer_handler)(buffer_t *);
void (*if_common_forwarding_out_cb)(struct protocol_interface_info_entry *, buffer_t *);
bool (*if_ns_transmit)(struct protocol_interface_info_entry *cur, ipv6_neighbour_t *neighCacheEntry, bool unicast, uint8_t seq);
bool (*if_map_ip_to_link_addr)(struct protocol_interface_info_entry *cur, const uint8_t *ip_addr, addrtype_t *ll_type, const uint8_t **ll_addr_out);
bool (*if_map_link_addr_to_ip)(struct protocol_interface_info_entry *cur, addrtype_t ll_type, const uint8_t *ll_addr, uint8_t *ip_addr_out);
Expand Down
1 change: 1 addition & 0 deletions source/NWK_INTERFACE/protocol_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ static void protocol_core_base_init(protocol_interface_info_entry_t *entry, nwk_
entry->ipv6_configure = NULL;
entry->if_lowpan_security_params = NULL;
entry->if_ns_transmit = NULL;
entry->if_common_forwarding_out_cb = NULL;
entry->if_special_forwarding = NULL;
entry->if_snoop = NULL;
entry->if_icmp_handler = NULL;
Expand Down
5 changes: 5 additions & 0 deletions test/nanostack/unittest/stub/adaptation_interface_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,8 @@ void lowpan_adaptation_interface_slow_timer(protocol_interface_info_entry_t *cur
{

}

void lowpan_adaptation_expedite_forward_enable(struct protocol_interface_info_entry *cur)
{

}

0 comments on commit 2f5e5e2

Please sign in to comment.