Contiki-NG
tsch-queue.c File Reference

Per-neighbor packet queues for TSCH MAC. More...

#include "contiki.h"
#include "lib/list.h"
#include "lib/memb.h"
#include "lib/random.h"
#include "net/queuebuf.h"
#include "net/mac/tsch/tsch.h"
#include "net/nbr-table.h"
#include <string.h>
#include "sys/log.h"

Go to the source code of this file.

Functions

struct tsch_neighbortsch_queue_add_nbr (const linkaddr_t *addr)
 Add a TSCH neighbor queue. More...
 
struct tsch_neighbortsch_queue_get_nbr (const linkaddr_t *addr)
 Get a TSCH neighbor. More...
 
struct tsch_neighbortsch_queue_get_time_source (void)
 Get the TSCH time source (we currently assume there is only one) More...
 
linkaddr_t * tsch_queue_get_nbr_address (const struct tsch_neighbor *)
 Get the address of a neighbor. More...
 
int tsch_queue_update_time_source (const linkaddr_t *new_addr)
 Update TSCH time source. More...
 
struct tsch_packettsch_queue_add_packet (const linkaddr_t *addr, uint8_t max_transmissions, mac_callback_t sent, void *ptr)
 Add packet to neighbor queue. More...
 
int tsch_queue_global_packet_count (void)
 Returns the number of packets currently in all TSCH queues. More...
 
int tsch_queue_nbr_packet_count (const struct tsch_neighbor *n)
 Returns the number of packets currently a given neighbor queue (by pointer) More...
 
struct tsch_packettsch_queue_remove_packet_from_queue (struct tsch_neighbor *n)
 Remove first packet from a neighbor queue. More...
 
void tsch_queue_free_packet (struct tsch_packet *p)
 Free a packet. More...
 
void tsch_queue_free_packets_to (const linkaddr_t *addr)
 Flush packets to a specific address. More...
 
int tsch_queue_packet_sent (struct tsch_neighbor *n, struct tsch_packet *p, struct tsch_link *link, uint8_t mac_tx_status)
 Updates neighbor queue state after a transmission. More...
 
void tsch_queue_reset (void)
 Reset neighbor queues module.
 
void tsch_queue_free_unused_neighbors (void)
 Deallocate all neighbors with empty queue.
 
int tsch_queue_is_empty (const struct tsch_neighbor *n)
 Is the neighbor queue empty? More...
 
struct tsch_packettsch_queue_get_packet_for_nbr (const struct tsch_neighbor *n, struct tsch_link *link)
 Returns the first packet that can be sent from a queue on a given link. More...
 
struct tsch_packettsch_queue_get_packet_for_dest_addr (const linkaddr_t *addr, struct tsch_link *link)
 Returns the first packet that can be sent to a given address on a given link. More...
 
struct tsch_packettsch_queue_get_unicast_packet_for_any (struct tsch_neighbor **n, struct tsch_link *link)
 Gets the head packet of any neighbor queue with zero backoff counter. More...
 
int tsch_queue_backoff_expired (const struct tsch_neighbor *n)
 Is the neighbor backoff timer expired? More...
 
void tsch_queue_backoff_reset (struct tsch_neighbor *n)
 Reset neighbor backoff. More...
 
void tsch_queue_backoff_inc (struct tsch_neighbor *n)
 Increment backoff exponent of a given neighbor queue, pick a new window. More...
 
void tsch_queue_update_all_backoff_windows (const linkaddr_t *dest_addr)
 Decrement backoff window for the queue(s) able to Tx to a given address. More...
 
void tsch_queue_init (void)
 Initialize TSCH queue module.
 

Detailed Description

Per-neighbor packet queues for TSCH MAC.

The list of neighbors uses the TSCH lock, but per-neighbor packet array are lock-free. Read-only operation on neighbor and packets are allowed from interrupts and outside of them. Other operations are allowed outside of interrupt only.

Author
Simon Duquennoy simon.nosp@m.duq@.nosp@m.sics..nosp@m.se Beshr Al Nahas beshr.nosp@m.@sic.nosp@m.s.se Domenico De Guglielmo <d.deg.nosp@m.ugli.nosp@m.elmo@.nosp@m.iet..nosp@m.unipi.nosp@m..it > Atis Elsts atis..nosp@m.elst.nosp@m.s@edi.nosp@m..lv

Definition in file tsch-queue.c.