Commit graph

349 commits

Author SHA1 Message Date
Niclas Finne 68730566a3 Added method to framer that returns the header length if the framer
would create a header with the current packet information.

This allows sicslowpan to calculate the max payload size without
consuming a sequence number or clearing/restoring the packet buffer.
2014-04-11 17:03:23 +02:00
Adam Dunkels 5b1a9f5bc2 Bugfix: when a packet is sent by the RDC layer, we should count the number of transmissions made because a single callback can pertain to multiple transmissions at the RDC layer. 2014-03-24 08:36:18 +01:00
Adam Dunkels 45265249fc Changed the name of the rimeaddr module to linkaddr 2014-01-29 20:12:24 +01:00
Adam Dunkels bddd96d5c8 Removed all module makefiles. Instead, all .c files in a module directory are compiled. 2014-01-26 23:20:46 +01:00
Adam Dunkels 8eace27f9b Moved net/rime.h to net/rime/rime.h 2014-01-26 23:20:45 +01:00
Adam Dunkels 0fe08205e1 Moved the rimeaddr.[ch] code from the core/net/rime module to the core/net module, as it is used not only by rime code 2014-01-26 23:20:36 +01:00
Adam Dunkels 0f255606b0 Turned sicslowmac into a module 2014-01-26 23:20:28 +01:00
Adam Dunkels b78ab6753c Added makefiles to make core/net/mac into a separate module 2014-01-26 23:20:26 +01:00
Adam Dunkels d777ae14e4 Moved cxmac into a separate module 2014-01-26 23:20:26 +01:00
Adam Dunkels 083fe0b594 Moved the contikimac code into a core/net/mac/contikimac module 2014-01-26 23:20:25 +01:00
Adam Dunkels 5f3fe7f7c7 Updated include paths for the moved files under net/ 2014-01-26 23:20:23 +01:00
Martin Heusse 662eb4db14 Fix compilation error when DEBUG enabled in core/net/mac/framer-nullmac.c 2014-01-24 20:23:26 +01:00
Adam Dunkels 0908924f91 Removed the lpp.c code 2013-11-28 15:24:40 +01:00
Adam Dunkels f86aaf7c14 Removed the xmac.c code 2013-11-28 15:24:22 +01:00
Nicolas Tsiftes db4cada4e7 Merge pull request #462 from adamdunkels/push/no-reserved-double-inclusion-defines
Remove all leading double underscore inclusion #defines
2013-11-26 14:26:37 -08:00
Benoît Thébaudeau 4deba89f81 rdc: duplicate packets: Keep only the last sequence number for each address
According to IEEE 802.15.4e (§6.4.3.9), in order to detect duplicate received
MAC-layer frames, only the most recently received frame's sequence number needs
to be stored for each unique device address. Doing so limits the possible false
duplicate packet detections to a single sequence number. This also allows to
keep the last sequence number of more device addresses for the same value of
MAX_SEQNOS.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
2013-11-25 13:01:11 +01:00
Benoît Thébaudeau 477a4a7178 rdc: duplicate packets: Factor out detection code
The code detecting duplicate packets in the RDC layer had been copied into most
RDC implementations. Factor it out into a new mac-sequence module in order to
have a single instance of this code.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
2013-11-25 13:01:11 +01:00
Benoît Thébaudeau 14db3382af csma: Initialize sequence number with random value
According to IEEE 802.15.4 (§5.1.6.1, §6.4.2), the MAC sequence numbers should
be initialized to random values. This was already the case in
framer-802154.c:create(), but not in csma.c:send_packet(), sometimes causing
false detections of duplicate MAC-layer packets in other devices when a device
was restarted too quickly. This patch decreases the probability of such an
event.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
2013-11-25 13:01:11 +01:00
Adam Dunkels bb2dcaa057 A massive all-tree automated update of all double inclusion guard #defines that changes from using two underscores as a prefix, which are reserved, to not using two underscores as a prefix 2013-11-24 20:20:11 +01:00
Adam Dunkels bec721d313 Allow payload len to be larger than 256 bytes 2013-11-16 14:22:48 +01:00
Simon Duquennoy 03dcca15cb Implement a truncated exponential backoff for csma 2013-11-14 15:02:36 +01:00
Enrico Joerns 4ba22102fd [core/net/mac] Removed invalid struct member u8 in PRINTADDR 2013-10-15 01:43:26 +02:00
Simon Duquennoy 248301a041 Fix naming issues and includes in uip-ds6-nbr.h 2013-08-19 17:48:30 +02:00
Simon Duquennoy 5a1d8d8006 Make phase module use neighbor-table. 2013-08-19 17:48:29 +02:00
Fredrik Osterlind 8041f66d8c link-layer acks support for cooja motes 2013-08-15 14:32:35 +02:00
Adam Dunkels 0aa448f190 6lowpan fragmentation bugfix: the 6lowpan code had an unfortunate
interaction with the behavior of the rdc layer. If the first packet of a
fragment transmission was lost, the remaining packets would get dropped
on reception. Moreover, the reception code contained a bug that
sometimes would cause fragments to be misidentified as fragments. Taken
together, these problems would result in a pathelogical network
breakdown if too many fragmented packets would occur simultaneously.
2013-08-11 14:27:20 +02:00
Jelmer Tiete cf894b8b95 changed inter packet interval to 0.4ms 2013-06-21 13:15:45 +02:00
Nicolas Tsiftes 7cc8f326f4 Merge pull request #257 from adamdunkels/hotfix-csma
CSMA bugfix
2013-06-20 01:49:48 -07:00
Adam Dunkels 09f30e875d Bugfix: when a CSMA callback is received, we should remove the packet
that was transmitted and not just the first packet that happens to be on
the output queue.
2013-05-25 12:13:07 +02:00
Adam Dunkels c9de0e49be Added a number of default options for ContikiMAC, and allow them to be overridden with contiki-conf.h configuration options 2013-05-25 12:10:27 +02:00
lebrush 82d498f3a1 Removed undef 2013-05-15 16:25:34 +02:00
lebrush 071cfaf1cb Corrects some leftover uncapitalized printfs which may cause some platforms
to crash.
2013-05-15 12:21:15 +02:00
Nicolas Tsiftes 7f2a842b71 Merge pull request #174 from adamdunkels/feature-net-improvements
Improvements to the core/net/ code
2013-03-18 17:12:12 -07:00
Nicolas Tsiftes 6a07172662 Merge pull request #176 from adamdunkels/feature-net-bugfixes
Network system bugfixes
2013-03-18 13:38:44 -07:00
Adam Dunkels 7742b05d8c Major bugfix: when nullrdc is asked to send a list of packets, send the list of packets and not just the first packet - this is essential for retransmissions of fragmented IP packets to work 2013-03-18 13:35:29 +01:00
Adam Dunkels 4efd570cf9 Minor bugfix: explicitly cast pointer argument in debug printf 2013-03-18 11:22:05 +01:00
Adam Dunkels f2fbb4b49d Defensive programming: make sure that we don't fail completely if we get a callback for a NULL pointer 2013-03-18 11:22:04 +01:00
Adam Dunkels 82b755c017 Bugfix: keep track of receiver being awake as a local variable rather than a global, as it may have changed between invokations 2013-03-18 11:22:02 +01:00
Adam Dunkels 0670a8e1e2 Minor code style fixes to the contikimac and nullrdc code 2013-03-18 11:22:01 +01:00
Adam Dunkels 5993595a8f A number of updates to nullrdc
* add a few rimestats to keep track of sent and received acks
* made a number of configuration options possible to override (ack timing)
* added the logic for sending 802.15.4 link layer ack packets, despite not being able to guarentee the 802.15.4 MAC timing
* increased the number of sequence numbers to keep track of for duplicate filtering
2013-03-18 11:19:20 +01:00
Adam Dunkels 4541d3e85b Let the framer functions use ints instead of uint8_t to make them more generic 2013-03-18 11:19:18 +01:00
Robert Quattlebaum c0a693672c core/net: Added support for "bridge mode".
"Bridge mode" allows devices to more easily send 802.15.4 packets as if
they were a different device. It also turns off any packet filtering
that may be implemented at layer 2. It works by allowing
`PACKETBUF_ADDR_SENDER` to be set earlier in the stack.

This is useful for implementing 6LoWPAN-ethernet bridges.

Enabled via setting `NETSTACK_CONF_BRIDGE_MODE` to 1. Disabled by
default.
2013-03-10 14:45:15 -07:00
Adam Dunkels cb7842bd16 Added support for encryption and decryption of the packetbuf if macros
NETSTACK_ENCRYPT and NETSTACK_DECRYPT are defined. Those are intended
to be called as functions NETSTACK_ENCRYPT() and NETSTACK_DECRYPT() to
encrypt and decrypt the packetbuf, respectively. If needed, an
initialization function by the name NETSTACK_ENCRYPTION_INIT() can
also be defined.
2012-11-25 12:05:00 +01:00
Adam Dunkels 6ee1f72486 Removed old unused TDMA-based MAC and RDC code 2012-11-20 20:48:34 +01:00
Adam Dunkels ec8c7e9be0 Cleanup of the node-id.h files. The node-id.h file contains
declarations of functions for setting and getting a node ID number, a
functionality that exists on many platforms. Since this functionality
was not considered part of the Contiki core, each platform defined its
own node-id.h file. This commit attempts to clean this up by
collecting the node-id.h into a core/sys/node-id.h file that replaces
the old node-id.h files from the platform directories.
2012-11-20 19:59:46 +01:00
George Oikonomou 713c2e5974 DOS EOL and indentation fixes (core/ apps/ cpu/)
- Removed some DOS EOLs
- Changed some tabs to spaces
- Removed some trailing whitespaces

Part of Pull Request #6
2012-10-30 13:43:51 +00:00
Adam Dunkels 944537fccf Removed all old RCS tags in the Contiki source tree. Those RCS tags are not used any more, as we are now using git to manage the Contiki source tree 2012-10-26 15:54:49 +02:00
Fredrik Osterlind 076c208b72 avoid gcc optimization bug by extracting struct values 2012-05-30 17:58:45 +02:00
simonduq 63ea562568 base encounter_time on the time before last strobe, remove unused previous_txtime 2012-03-26 22:49:28 +02:00
simonduq 7784cf7827 stm32w platforms: use 2 cca and default contikimac guard time 2012-03-20 17:30:05 +01:00
simonduq 5da4463236 adding ducy cycling support to the stm32w-based platforms (patch by Chi-Anh La) 2012-03-20 17:29:58 +01:00
George Oikonomou e6819effef Fix compile errors with SDCC
Intermingled declarations and code are not yet implemented in sdcc.
2012-03-14 17:52:50 +00:00
David Kopf 07f6e10c1c Add display options to border router web page, default now uses stack instead of static buffer.
Turn radio off until prefix is acquired.
2012-03-02 16:01:12 -05:00
David Kopf 745f071c98 Eliminate unused variable warnings. Dummy test of PT_YIELD_FLAG does not change program size. 2012-02-21 11:23:54 -05:00
David Kopf 24d58edf15 Adjust cycle starts when RTIMER_ARCH_SECOND not a power of two. 2012-01-10 12:48:39 -05:00
Joakim Eriksson 65163a9b57 Changed FRAMER to return negative values for error to allow 0 size headers. 2012-01-01 09:10:56 +01:00
Nicolas Tsiftes d0ebeb409e Merge remote-tracking branch 'sf/master' into rpl-patch
Conflicts:
	core/net/tcpip.c
2011-12-08 15:26:11 +01:00
Adam Dunkels 1e57ddb6c7 Disable phase shift correction by default 2011-12-08 14:04:01 +01:00
Adam Dunkels 0a428c9489 style fix; added fas check for cycle_time being a power of two or not. 2011-12-05 16:28:04 +01:00
David Kopf 74aa63de43 Add optional correction for phase drift of receiver. 2011-12-01 10:02:37 -05:00
Nicolas Tsiftes 0e32956a63 Merge remote-tracking branch 'sf/master' into rpl-patch 2011-11-21 14:59:31 +01:00
Niclas Finne 63e40d195e Restore packetbuf before mac callback (earlier commit was accidental reverted) 2011-11-15 16:59:12 +01:00
David Kopf 8e47694597 Add RDC_CONF_HARDWARE_CSMA, RDC_CONF_HARDWARE_ACK, RDC_CONF_MCU_SLEEP, CONTIKIMAC_CONF_SHORTEST_PACKET_SIZE for use with hardware having those modes.
Default behaviour should be unchanged.
2011-11-14 12:02:47 -05:00
Niclas Finne b01cbb996d Fixed to restore packetbuf before mac callback 2011-10-21 17:52:31 +02:00
David Kopf 8ebd7a65a4 Add missing includes, remove unimplemented function declaration. 2011-10-13 11:23:53 -04:00
simonduq a2073db715 Removed ContikiMAC burst dependency to phase optimization 2011-10-04 10:29:40 +02:00
Joakim Eriksson e0ae036a69 added static on the list send functions to get less compiler errors with IAR compiler 2011-10-03 15:17:30 +02:00
simonduq 222f9bd3af Include string.h 2011-09-29 15:07:00 +02:00
simonduq dd8576830e Added bursts support in CSMA/ContikiMAC, and CFS-swapping in
queuebuf. Exemplified in examples/udp-stream.
2011-09-27 16:47:03 +02:00
Adam Dunkels bd951031ef Cleanup of the ContikiMAC code; removed the old an unused announcement code 2011-09-02 14:06:29 +02:00
Adam Dunkels 61ef9b6fc3 Cleanup of the ContikiMAC code; removed the old an unused announcement code 2011-09-02 14:06:27 +02:00
Adam Dunkels 3cb42ceb10 Made the ContikiMAC header configurable from contiki-conf.h 2011-09-02 13:37:46 +02:00
Adam Dunkels d6508cf3c0 Made the number of phase neighbors configurable 2011-08-31 20:54:21 +02:00
Vincent Brillault b0907f0344 Cleaning old .h :
- Delete unimplemented function and unused structures
- Remove misleading configuration options
- Transfer some comments from 6lowmac to framer-802154
(doc/uip6-doc.txt should be cleaned as well)
2011-07-11 13:20:30 +02:00
Niclas Finne 28b0479c06 Added optional address filtering 2011-06-15 17:51:57 +02:00
Niclas Finne e8a96dc202 Bug fix: update packet attributes in queued packets in CSMA instead of doing a full packetbuf copy after transmissions. The lower layers often add their own headers to packetbuf. 2011-06-15 16:10:07 +02:00
dak664 580efaa412 Fix compiler warning for unused variable 2011-05-18 11:22:25 -04:00
Salvatore Pitrulli 4fb433ac1f 'if' statement replaced by a preprocessor directive. 2011-05-12 21:50:47 +02:00
Adam Dunkels 74f1754d88 Bugfix: energy consumption for retransmissions was miscounted 2011-04-13 14:10:39 +02:00
Adam Dunkels af4ce9ba9e Bugfix: idle power consumption was sometimes misestimated for transmissions, when a duty cycle rtimer fired in the middle of a transmission 2011-04-13 14:10:02 +02:00
Mariano Alvira e826ccd3b9 add NULLRDC_CONF_802154_AUTOACK_HW for radios that only pass-up NOACK
status but not the actual ack packet.
2011-02-23 15:19:44 -08:00
Mariano Alvira a8f9119ace pass up a RADIO_NOACK to the MAC layer. 2011-02-23 15:19:43 -08:00
Adam Dunkels 733aaa546f Made the number of MAC sequence numbers to remember configurable; fixed bug with power attribution to the idle state. 2011-02-21 14:11:32 +01:00
Adam Dunkels 24af4888bc Made the number of MAC sequence numbers to remember configurable 2011-02-21 14:11:17 +01:00
Lionel Debroux 5cb49e8b07 Several compiler warning fixes:
* msp430: fix "implicit declaration of function" warnings in clock.c, by including watchdog.h;
     * sky: fix a couple pointer target signedness warnings;
     * core: fix several signed/unsigned comparison warnings;
     * framer-802154: "const static" -> "static const" to fix compiler warnings;
     * core: comment or remove unused variables and function definitions.

Signed-off-by: Lionel Debroux <lionel_debroux@yahoo.fr>
Signed-off-by: Mariano Alvira <mar@devl.org>
2011-02-20 19:28:14 -05:00
Adam Dunkels 46348d9013 Added the low-power streaming mode where frequent channel checks are performed when streaming is on. Enabling this will (by setting WITH_STREAMING to 1), however, significantly slow down Cooja/MSPsim simulations. 2011-02-08 21:57:46 +01:00
adamdunkels 09c223f549 Updated Contiki X-MAC to use hardware acks, which allows for tighter timing and results in a lower duty cycle. Hardware acks also make X-MAC more robust against packet losses, as there is a direct way for the CSMA layer to detect loss of data packets. Before, Contiki X-MAC only detected loss of strobes. 2011-01-25 14:31:09 +00:00
adamdunkels d51e99a3dd Updated streaming mode to use only about 20% radio. Made guard time more conservative due to problem report by Ricklef Wohlers. 2011-01-25 14:29:46 +00:00
adamdunkels fa524fabd7 Bugfix: q->buf was not tested for NULL, as it should be. Fix by Simon Duquennoy. 2011-01-25 14:24:38 +00:00
adamdunkels 808c21fbfa Bugfix: default should be 3 MAC-level retransmissions if collissions or loss occurs 2011-01-18 16:03:57 +00:00
adamdunkels affba785b5 Enabled phase-lock only for channel check rates of 32 Hz or lower 2011-01-18 16:03:19 +00:00
adamdunkels 26e3b6fdc0 Bugfix by Simon Duquennoy: don't transmit packet until previous packet has been sent by the RDC layer. 2011-01-13 19:06:22 +00:00
adamdunkels a0960154ba Cleaned up parts of the code; added comments 2011-01-09 21:07:01 +00:00
dak664 322d835fee Fix avr-gcc compiler warnings 2010-12-18 22:12:53 +00:00
adamdunkels 4a89cc9db3 Rework of the new CSMA in-order code that fixes a number of smalllish bugs in the in-order code. 2010-12-16 22:44:02 +00:00
adamdunkels 79f2c25dae Rework of the phase-lock optimization mechanism. There were several bugs in the existing code, such as the phase-lock would lose synchronization when a packet was lost. 2010-12-16 22:43:07 +00:00
adamdunkels 952dfc9384 Rework of the CSMA layer: instead of using one timer per packet, the module now uses one central timer and a queue of outgoing packets. This helps to keep packets in order, which is extremely useful for TCP transfers, and reduces the amount of congestion since consecutive packets now are spaced in time if there is a collision. Based on the observations and ideas of Simon Duquennoy. 2010-12-14 07:57:14 +00:00
adamdunkels af21afa750 Make sure that the cycle timing is exact 2010-12-10 13:36:06 +00:00
adamdunkels c19a967973 Bugfix: with the recent bugfixes, it was no longer possible to turn duty cycling back on after it had been turned off 2010-12-07 23:12:54 +00:00
adamdunkels 4c9793f428 Let ContikiMAC remember the state that the radio should have when duty cycling is turned off. This fixes a bug in which the radio was turned on after sending, even when NETSTACK_RDC.off(0) was enabled. 2010-12-06 09:08:22 +00:00