This change primarily adds additional debug logging and statistics
counters. It also includes the ability to change the small-packet
size, which was previously hard-coded to a value of 5. The default
value for the small-packet size has been increased to 32, which
improves performance.
We also now do a better job of tracking flow control and slave
liveliness.
This change includes many improvements which reduce latency, increase
throughput, and improve reliability.
The most significant change from this commit is addressing a frame
corruption bug which would occasionally corrupt frames received from
the slave during periods of congestion. This was occurring because
`push_pull_spi()` was allowed to be called when `sSpiTxIsReady` was
set, even if `sSpiRxPayloadSize` was not equal to zero. Under such
circumstances the previously received frame would be corrupted. This
change makes sure that `push_pull_spi()` does not get called until
`sSpiRxPayloadSize` is zero.
`push_pull_spi()` now only performs a single SPI transaction (instead
of two), which eliminates a significant amount of duplicated code. The
call to `usleep()` has been removed entirely, along with the
associated static `sSpiTransactionDelay`.
Statistics are now gathered and reported at exit. You can also induce
`spi-hdlc-adapter` to dump its statistics while it is running by
sending it a `SIGUSR1` signal.
This change also includes miscellaneous smaller changes.
The data packing format that I designed for Spinel was a bit too
clever for its own good. While elegant from a certain perspective, the
behavior of the data blob (`D`), array (`A(...)`), and structure
(`T(...)`) types was way too confusing. I thought that I was (as the
guy who came up with it) immune from such confusion, but after taking
the time to go through all the code and address all of the mishaps in
the code it seems that the subtleties befuddled even its creator on a
time or two.
The specific issue that made me realize I needed to prioritize making
this fix was #1393.
As far as packing types go, this commit makes the following changes:
* **New type `DATATYPE_DATA_WLEN` (`d`)**: Just like `DATATYPE_DATA`
except that it ALWAYS prepends the length, irrespective of the
type's location in the type string. Think of WLEN as being "With
LENgth". Unless you are adding a property that has a type which is
just a single data blob, you should use this type instead of
`DATATYPE_DATA` (`D`). `DATATYPE_DATA` is still useful, so it will
be sticking around.
* **Changed type `DATATYPE_STRUCT` (was `T`, now `t`)**: The new
struct type, ALWAYS prepends the length of the contents of the
struct, just like `DATATYPE_DATA_WLEN`. The old `T` style struct
still works and behaves the same way, but its use is now
deprecated.
* **Changed type `DATATYPE_ARRAY` (`A`)**: This type has changed in
documentation only, as no one is currently using it in the way
that it was originally specified. The change is that this type
NEVER prepends the length of the entire array, and using it
alongside other types is now unspecified (it should only be used
alone).
I also added some convenient macros for building up datatype signature
strings that include structs.
One of the goals of these changes was to make this commit a change in
specification only, not to change what was currently on-the-wire.
However, after updating the spec and then going through and updating
all of the code to use the new nomenclature, I was horrified to find
that, due to the confusing nature of the previous datatype signature
string format, many properties that are arrays were not implemented
correctly --- making them impossible to update or add fields to
without breaking backward compatibility. To add insult to injury, some
of these instances were written by me!
This change updates all of the array properties to reflect how they
should have been implemented to begin with.
* Add a new build target: ncp-mtd.
* Platform with "--enable-ftd" build option will build both MTD and FTD.
* Platform without "--enable-ftd" build option will only build MTD.
This commit adds support for two new arguments:
* `--raw`: Do not encode/decode packets using HDLC. Instead, write
whole, raw frames to the specified input and output FDs. This is
useful for emulating a serial port, or when datagram-based sockets
are supplied for `stdin` and `stdout` (when used with `--stdio`).
* `--mtu=[MTU]`: Specify the MTU. Currently only used in raw mode.
Default and maximum value is 2043. Must be greater than zero.
The `--raw` argument will allow `wpantund` to use `spi-hdlc-adapter`
without HDLC escaping by supplying datagram sockets for stdin and
stdout. This should improve performance and reduce latency.
The `--mtu` argument is supplied to benefit the use case where we
are emulating an asynchronous serial port over SPI. In such a case,
you would likely want to lower the MTU significantly to match the
internal buffer size of the MCU.
Version is bumped to 0.04.
* Update design image and general design description.
* Update install scripts
* Update Travis build script
* Remove build/install from readme as it is already in wiki
- Processing channel mask bits from left-side.
- Host swap Ticks field of Timestamp in big-endian order.
- Set transmit frame counter for Announce message to an incrementing value.
- Add additional check for ALOC as the destination address of CoAP request messages.
- Leader uses RLOC instead of ALOC as source address to response messages.
This commit makes a change in `spi-hdlc-adapter` to copy the passed
in spi path (from the argv) in a max 64 char array before passing it
to `syslog()`. This ensures `syslog()` string argument has a limited
size.
* Add 'leaderdata' command to spinel-cli.py.
* Add 'parent' command to the spinel-cli.py.
* Add 'child' command to the spinel-cli.py
* Add THREAD_NEIGHBOR_TABLE property to codec in spinel-cli.
This commit makes a change to `spi-hdlc-adapter` to check for any
possible error case where either `sHdlcInputFd` or `sHdlcOutputFd`
are invalid (e.g., `dup()` failures) before starting the main loop.
This commit makes the following changes in spi-hdlc-adapter:
- It adds `IGNORE_RETURN_VALUE()` macro for cases where the returned
value from a function can/should be safely ignored.
- It creates a local max 32 bytes string copy of the program name
from `argv[0]` (to ensure the length is limited).
- It fixes some of the typos in comments.
The big change in this commit is a change in the transmission strategy used.
This change isn't fixing any particular bug, but these changes should improve
performance.
Instead of always using a throw-away transaction to figure out the buffer sizes
for the NCP, we now attempt to send any frame we have in the first transaction.
If the NCP has a response that happens to fit in the size of that packet, it
will be processed.
This change also adds a lot more comments better explaining the more
complicated parts of the code.