collect: making some protocol parameters configurable by COLLECT_CONF_ style defines

TTL (which has a rather low default of 15), MAC level retransmissions,
overall number of retransmissions, and the header bits dedicated to these
were all fixed in the collect.h and collect.c, without a simple way to
override them.
Extracted these as COLLECT_CONF_ parameters, keeping defaults as they were
before.

Signed-off-by: Csaba Kiraly <kiraly@disi.unitn.it>
This commit is contained in:
Csaba Kiraly 2014-01-24 12:53:16 +01:00
parent 3724c01637
commit d1822b5880
2 changed files with 42 additions and 6 deletions

View file

@ -123,8 +123,18 @@ struct ack_msg {
forwarding queue before it is removed. The MAX_SENDING_QUEUE forwarding queue before it is removed. The MAX_SENDING_QUEUE
specifies the maximum length of the output queue. If the queue is specifies the maximum length of the output queue. If the queue is
full, incoming packets are dropped instead of being forwarded. */ full, incoming packets are dropped instead of being forwarded. */
#define MAX_MAC_REXMITS 2 #ifdef COLLECT_CONF_MAX_MAC_REXMITS
#define MAX_ACK_MAC_REXMITS 5 #define MAX_MAC_REXMITS COLLECT_CONF_MAX_MAC_REXMITS
#else /* COLLECT_CONF_MAX_MAC_REXMITS */
#define MAX_MAC_REXMITS 2
#endif /* COLLECT_CONF_MAX_MAC_REXMITS */
#ifdef COLLECT_CONF_MAX_ACK_MAC_REXMITS
#define MAX_ACK_MAC_REXMITS COLLECT_CONF_MAX_ACK_MAC_REXMITS
#else /* COLLECT_CONF_MAX_ACK_MAC_REXMITS */
#define MAX_ACK_MAC_REXMITS 5
#endif /* COLLECT_CONF_MAX_ACK_MAC_REXMITS */
#define REXMIT_TIME (CLOCK_SECOND * 32 / NETSTACK_RDC_CHANNEL_CHECK_RATE) #define REXMIT_TIME (CLOCK_SECOND * 32 / NETSTACK_RDC_CHANNEL_CHECK_RATE)
#define FORWARD_PACKET_LIFETIME_BASE REXMIT_TIME * 2 #define FORWARD_PACKET_LIFETIME_BASE REXMIT_TIME * 2
#define MAX_SENDING_QUEUE 3 * QUEUEBUF_NUM / 4 #define MAX_SENDING_QUEUE 3 * QUEUEBUF_NUM / 4
@ -150,7 +160,11 @@ MEMB(send_queue_memb, struct packetqueue_item, MAX_SENDING_QUEUE);
/* This defines the maximum hops that a packet can take before it is /* This defines the maximum hops that a packet can take before it is
dropped. */ dropped. */
#define MAX_HOPLIM 15 #ifdef COLLECT_CONF_MAX_HOPLIM
#define MAX_HOPLIM COLLECT_CONF_MAX_HOPLIM
#else /* COLLECT_CONF_MAX_HOPLIM */
#define MAX_HOPLIM 15
#endif /* COLLECT_CONF_MAX_HOPLIM */
/* Proactive probing: when there are no packets in the send /* Proactive probing: when there are no packets in the send

View file

@ -67,14 +67,36 @@
#include "sys/ctimer.h" #include "sys/ctimer.h"
#include "lib/list.h" #include "lib/list.h"
#ifdef COLLECT_CONF_PACKET_ID_BITS
#define COLLECT_PACKET_ID_BITS COLLECT_CONF_PACKET_ID_BITS
#else /* COLLECT_CONF_PACKET_ID_BITS */
#define COLLECT_PACKET_ID_BITS 8 #define COLLECT_PACKET_ID_BITS 8
#endif /* COLLECT_CONF_PACKET_ID_BITS */
#ifdef COLLECT_CONF_TTL_BITS
#define COLLECT_TTL_BITS COLLECT_CONF_TTL_BITS
#else /* COLLECT_CONF_TTL_BITS */
#define COLLECT_TTL_BITS 4
#endif /* COLLECT_CONF_TTL_BITS */
#ifdef COLLECT_CONF_HOPS_BITS
#define COLLECT_HOPS_BITS COLLECT_CONF_HOPS_BITS
#else /* COLLECT_CONF_HOPS_BITS */
#define COLLECT_HOPS_BITS 4
#endif /* COLLECT_CONF_HOPS_BITS */
#ifdef COLLECT_CONF_MAX_REXMIT_BITS
#define COLLECT_MAX_REXMIT_BITS COLLECT_CONF_MAX_REXMIT_BITS
#else /* COLLECT_CONF_REXMIT_BITS */
#define COLLECT_MAX_REXMIT_BITS 5
#endif /* COLLECT_CONF_REXMIT_BITS */
#define COLLECT_ATTRIBUTES { PACKETBUF_ADDR_ESENDER, PACKETBUF_ADDRSIZE }, \ #define COLLECT_ATTRIBUTES { PACKETBUF_ADDR_ESENDER, PACKETBUF_ADDRSIZE }, \
{ PACKETBUF_ATTR_EPACKET_ID, PACKETBUF_ATTR_BIT * COLLECT_PACKET_ID_BITS }, \ { PACKETBUF_ATTR_EPACKET_ID, PACKETBUF_ATTR_BIT * COLLECT_PACKET_ID_BITS }, \
{ PACKETBUF_ATTR_PACKET_ID, PACKETBUF_ATTR_BIT * COLLECT_PACKET_ID_BITS }, \ { PACKETBUF_ATTR_PACKET_ID, PACKETBUF_ATTR_BIT * COLLECT_PACKET_ID_BITS }, \
{ PACKETBUF_ATTR_TTL, PACKETBUF_ATTR_BIT * 4 }, \ { PACKETBUF_ATTR_TTL, PACKETBUF_ATTR_BIT * COLLECT_TTL_BITS }, \
{ PACKETBUF_ATTR_HOPS, PACKETBUF_ATTR_BIT * 4 }, \ { PACKETBUF_ATTR_HOPS, PACKETBUF_ATTR_BIT * COLLECT_HOPS_BITS }, \
{ PACKETBUF_ATTR_MAX_REXMIT, PACKETBUF_ATTR_BIT * 5 }, \ { PACKETBUF_ATTR_MAX_REXMIT, PACKETBUF_ATTR_BIT * COLLECT_MAX_REXMIT_BITS }, \
{ PACKETBUF_ATTR_PACKET_TYPE, PACKETBUF_ATTR_BIT }, \ { PACKETBUF_ATTR_PACKET_TYPE, PACKETBUF_ATTR_BIT }, \
UNICAST_ATTRIBUTES UNICAST_ATTRIBUTES