From d1822b5880bb3c3a8f07725982e7107cb0532807 Mon Sep 17 00:00:00 2001 From: Csaba Kiraly Date: Fri, 24 Jan 2014 12:53:16 +0100 Subject: [PATCH] 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 --- core/net/rime/collect.c | 20 +++++++++++++++++--- core/net/rime/collect.h | 28 +++++++++++++++++++++++++--- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/core/net/rime/collect.c b/core/net/rime/collect.c index d225e1574..4c271e584 100644 --- a/core/net/rime/collect.c +++ b/core/net/rime/collect.c @@ -123,8 +123,18 @@ struct ack_msg { forwarding queue before it is removed. The MAX_SENDING_QUEUE specifies the maximum length of the output queue. If the queue is full, incoming packets are dropped instead of being forwarded. */ -#define MAX_MAC_REXMITS 2 -#define MAX_ACK_MAC_REXMITS 5 +#ifdef COLLECT_CONF_MAX_MAC_REXMITS +#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 FORWARD_PACKET_LIFETIME_BASE REXMIT_TIME * 2 #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 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 diff --git a/core/net/rime/collect.h b/core/net/rime/collect.h index 6d1ca249c..4a530ebc1 100644 --- a/core/net/rime/collect.h +++ b/core/net/rime/collect.h @@ -67,14 +67,36 @@ #include "sys/ctimer.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 +#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 }, \ { PACKETBUF_ATTR_EPACKET_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_HOPS, PACKETBUF_ATTR_BIT * 4 }, \ - { PACKETBUF_ATTR_MAX_REXMIT, PACKETBUF_ATTR_BIT * 5 }, \ + { PACKETBUF_ATTR_TTL, PACKETBUF_ATTR_BIT * COLLECT_TTL_BITS }, \ + { PACKETBUF_ATTR_HOPS, PACKETBUF_ATTR_BIT * COLLECT_HOPS_BITS }, \ + { PACKETBUF_ATTR_MAX_REXMIT, PACKETBUF_ATTR_BIT * COLLECT_MAX_REXMIT_BITS }, \ { PACKETBUF_ATTR_PACKET_TYPE, PACKETBUF_ATTR_BIT }, \ UNICAST_ATTRIBUTES