Commit graph

41120 commits

Author SHA1 Message Date
Ravi kumar Veeramally
dc36bdb89d net: Integrate 6lo and 802.15.4 fragmentation
Change-Id: I348656e0049d79f4dfdaba7909ad0b770f3ee922
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:21 +02:00
Ravi kumar Veeramally
3f69b42c9f net: Add support for IEEE 802.15.4 fragmentation
If IPv6 packet exceeds IEEE 8021.15.4 payload, it should be
fragmented as per RFC 4944 and RFC 6282.

Change-Id: Ic02c3089a510a8f6ffe3c3cd4537284a06ac1453
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:20 +02:00
Ravi kumar Veeramally
8743ac7ec8 net: tests: Add unit tests for 6lo IPv6 dispatch
Change-Id: I962b1f94b6b2ba6ef2429ef0deca3ee5352df3d8
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:20 +02:00
Ravi kumar Veeramally
3f15c2c476 net: Fix wrong UDP length calc in 6lo compression
Change-Id: Ida07d86d643948871fca1bc6e66a9f5092c2dc7a
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:20 +02:00
Ravi kumar Veeramally
1725ac66d7 net: Add 6lowpan without compression header support
Add support for IPv6 header dispatch (without IPv6 compression
and uncompression). Only IPv6 dispatch header will be added at the
beginning of the buffer.

Change-Id: I7400a4dd115ac3b4b3d9deecd3cdb9ea292573fb
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:20 +02:00
Ravi kumar Veeramally
9217b68f3c net: Change 6lo API returned parameter
6lowpan compression and uncompression done on original
input buffer. So no need to return paramter as net_buf *.
If the compression or uncompression fails, unref the buffer
as it cannot be used further.

Change-Id: I64f496e22b2008a91a358fff65de1b87659cd9eb
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:20 +02:00
Ravi kumar Veeramally
142ca7f01e net: tests: Fix 6lo tests
UDP length was wrongly set and test count was hardcoded.

Change-Id: Iade959e1b8c3580b43aa2a9ff1fc10eb5a462f2f
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:20 +02:00
Ravi kumar Veeramally
9ea261ed4e net: Fix typo and alignment in 6lo
Fix typo DISPATH -> DISPATCH and #define alignment.

Change-Id: I39864362ca0ed740ce1ab7e17cb6e789bc415e23
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:20 +02:00
Jukka Rissanen
58116f8b94 net: Do not access IPv6 neighbor cache directly
The neighbor index only works when indexed over neighbor pool
as that takes into account the additional data that is embedded
after the net_nbr struct.

Change-Id: I3a5b971beccb24735e75dd87bfefc75bebba30dc
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:20 +02:00
Jukka Rissanen
06c8d99cc1 net: Neighbor cache table was incorrectly accessed
The code tried to access the neighbor via index but this does
not work as there is embedded data after the net_nbr struct.

Change-Id: I3efe325266ac244d82f2c713ed5530eeb0e6a363
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:20 +02:00
Jukka Rissanen
181adfdadb net: Add support for IPv6 prefix lifetime
If the received IPv6 router advertisement contains prefix
address options, set the validity of the prefix and expire
them when needed.

Change-Id: I7026d2101bd9eca1f90688c14d5c6aaa66e4af5e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:20 +02:00
Jukka Rissanen
b94fc5c707 net: Use target address in IPv6 NS to lookup neighbor
We need to use target address when checking whether
the IPv6 neighbor cache as the destination address is
typically a multicast address and it will never be in
the neighbor cache.

Change-Id: I13ba90e164393a7ab92bcb388a9d1d83f849fd4b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:20 +02:00
Jukka Rissanen
282d020222 net: Send available pending data after receiving IPv6 NA
If there is no pending data when IPv6 neighbor advertisement
is received, then do not try to use NULL pointer and send
bogus data.

Change-Id: I3225e0ffbfdfcd6f2cb3789af0b3a7158ffca24d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:20 +02:00
Jukka Rissanen
9329f4a92a net: Add IPv6 ND reachability support
IPv6 neighbor discovery reachability timer support
was missing.

Change-Id: I54e934b65abe2e99b11762ad29f43b69a8a97754
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:20 +02:00
Jukka Rissanen
7bc11597aa net: Add neighbor free function to IPv6 cache
Add utility function that cleanups the neighbor cache.

Change-Id: I77363566469c4f9d0410c08b5a3009bbe8d1b96e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:20 +02:00
Jukka Rissanen
0604534072 net: Add network iface to neighbor creation call
As we know the network interface, use it when creating
initial entry in neighbor cache.

Change-Id: Ife022ffbdf0e8fb84253091b4072aebcee026e34
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:19 +02:00
Jukka Rissanen
25f4fbd80d net: Add more debugging prints in IPv6 ND handling
Change-Id: I1cbcfeaad55a159c14b128bda313bc60ba185660
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:19 +02:00
Jukka Rissanen
224defa4e6 net: Add debug helper for neigh tables
Change-Id: I7991d73023688bf855479f95282583885f60ba14
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:19 +02:00
Jukka Rissanen
5d7e085a3d net: Set initial neighbor value when IPv6 NS is received
We allocate a neighbor entry when neighbor solicitation is received
from peer.

Change-Id: I837262af1ccfba42d52075f32cb15f402b483f55
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:19 +02:00
Jukka Rissanen
b8ec80fe33 net: IPv6 ND fixes
Do not try to send invalid packet that does not have
link layer address set.

Change-Id: I48292fbd57841d069e00c57028b4be53eba4e732
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:19 +02:00
Jukka Rissanen
f9303446c2 net: Timeout a pending NS
Install a timer that will drop pending packet if we have not
received NA in timely manner.

Change-Id: I32b133314603a9a1b52d304eb8631f5b174e26f5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:19 +02:00
Jukka Rissanen
9c5149fc5f net: Utility helper to access IPv6 ND cache data
Instead of macros use inline functions to access the data so
we can catch wrong pointer type kind of errors.

Change-Id: I281a4c902cd98e71b77d2f555b2edbe56ecceea3
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:19 +02:00
Jukka Rissanen
27d9936bd3 net: Print buffer usage after receiving or sending data
Change-Id: Iae56937f8609b46778bc433ec88c193fe91e6cf4
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:19 +02:00
Jukka Rissanen
7ae3d667d5 net: Fix compilation warning
The nbuf.h was not included by net_private.h

Change-Id: I51daf4fecded6347ffcc9cf2be44a6d94319220c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:19 +02:00
Jukka Rissanen
d3b1fa31c8 net: Ethernet mac address length was incorrectly set
When an ethernet frame is received, we pre-set the ll address
length. In this case the length of the ethernet mac address was
set too long.

Change-Id: I10d8c60da644558af33644309db51e294d7233d7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:19 +02:00
Jukka Rissanen
1bb53d3ae7 net: Discard ethernet frame if it is not for us
No need to receive ethernet frames that are not meant for us.

Change-Id: Ib49fc12d11b365a99a26c65106d765e125375302
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:19 +02:00
Jukka Rissanen
dfc1e66780 net: Add ll address checker function
The net_linkaddr_cmp() will compare two link layer addresses
and return true if they are the same.

Change-Id: I13f5ee9e7976a4118e891aefdb6e7c08f098c0b6
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:19 +02:00
Jukka Rissanen
a4f56b6fa8 net: Fix compilation if IPv4 is disabled
Change-Id: I4ef4ce1c418361ce01ceb77204c830258a163683
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:19 +02:00
Jukka Rissanen
44e2ce92f5 net: Fix the debug prints in echo-server
Change-Id: I1bda06e3b8727544727d0929aa180022b7a162d5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:19 +02:00
Tomasz Bursztyka
93ac4a2520 net: Sample code to play with ieee 802.15.4 stack
Meant to setup a real 802.15.4 device, changing channel, pan id, etc...

Change-Id: I221ad197aa221bc8f9ec67d0fd523da2023f7979
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:18 +02:00
Tomasz Bursztyka
8ec020066a boards: quark_se_devboard: Build cc2520 if new IEEE 802.15.4 driver is in
Making sure we build cc2520 driver when native IP stack is used.

Change-Id: I25f3cb38a2da0c7a54ac4befcea217dc70b31028
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:18 +02:00
Tomasz Bursztyka
4c0d9bcf9a drivers: cc2520: Add a new IP stack ready adaptation of CC2520 driver
It's basically a copy/paste of original driver,
using native IP stack API.

This is meant to avoid cluttering the original driver
code with #ifdef, and in future it will help removing
the old driver as well.

Change-Id: I67d974ad7440d258583a5c7c6c7160e99210808c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:18 +02:00
Tomasz Bursztyka
ed6ad65427 drivers: cc2520: Make current driver for legacy stack only
Another driver will be made for native IP stack. This is meant
to avoid cluttering the code with #ifdef all over the place.
Instead driver will be transparently selected at built time.

Change-Id: I283f1194fece9357425b87794b5cb51938ca80d3
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:18 +02:00
Tomasz Bursztyka
4e7efd4bcb tests: net: Add a IEEE 802.15.4 ACK replies test
- Parsing a proper ACK reply
- Generating a ACK reply from a data packet requesting it, and comparing
  it to a proper one.

Change-Id: I1717fedc899eafa0aa849e1e253f02cd3dc3d4fc
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:18 +02:00
Tomasz Bursztyka
d82d96a93d net: ieee802154: Support ACK replies
If a data packet is received with AR flag set, it will reply
accordingly. This is meaningful when running the stack above hardware
that cannot reply automatically to ACK request.

Change-Id: I7e5be94c4a5b1c889adb67ceb6f44dadd36db3ce
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:18 +02:00
Tomasz Bursztyka
11c9b8dac7 tests: Add grounds for IEEE 802.15.4 stack tests.
First test is a unit test for frame parsing

Change-Id: I080d64a71fe4b6ff00e071a0cdee97ab9cd922d5
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:18 +02:00
Tomasz Bursztyka
79aea80ebf net: Add support for the IEEE 802.15.4 ORFD
Overly Reduced Functionality Device, which is meant only for
testing as well as to mimic legacy stack's behavior. This is
not spec compliant!

Change-Id: I2f98092c85d538b9fbfcef0e812461a80b0d67d3
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:18 +02:00
Tomasz Bursztyka
0624199e1f net: Adding ALOHA radio protocol to IEEE 802.15.4 L2 driver
This is the simplest - if not the dumbest - radio protocol we can use
for IEEE 802.15.4 stack. It just transmsits right away (with optional
retry) without taking care of doing any CCA (Clear Channel Assesment).

See IEEE 802.15.4 specification document, part 4.5.4.2

Change-Id: I341ad197aa221bc8f9ec67d0fd523da294a0351b
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:18 +02:00
Tomasz Bursztyka
df9b6f76af net: Add preliminary IEEE 802.15.4 L2 driver
It currently supports the basics for the Data MAC service. A radio
protocol is still necessary to send packets.

Change-Id: I78f974ad7440d258583a5c7c6c7160e904eb54f4
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:18 +02:00
Tomasz Bursztyka
c3ce028d3b net: Add new IEEE 802.15.4 Radio API for device drivers
This new radio API will be provided by 802.15.4 device drivers in order
to fit in the new IEEE 802.15.4 stack within native IP stack.

Change-Id: Ib28e8dd3f25e5c802284568b88c2ea6d5cf58f89
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:18 +02:00
Tomasz Bursztyka
3560f58293 net: L2 might need private data per-interface
Allocate the right amount of space for L2's context.

Change-Id: Ia2f4f4162334e9e9c26dc95230abdfde5986e052
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:18 +02:00
Tomasz Bursztyka
981da5cb4a net: Fix TX fiber on net_if
API pointer was set twice.

Change-Id: I51d8b72ea3ec5f343589f550dd011d90dc245a9c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:18 +02:00
Tomasz Bursztyka
f0003c3a25 net: Add a function to lookup for an iface from a device
One might need to find out the proper interface from a given struct
device pointer.

Change-Id: Id480d0a2bdf57f0b2d38379727ea1491dedf213e
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:18 +02:00
Tomasz Bursztyka
8565db639c net: Add some debug message on net_if
To track down the initialization of each interface.

Change-Id: Ia52aba0979689ab6ce24433853d1d87ecb693b3d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:17 +02:00
Tomasz Bursztyka
3501290245 net: Add documentation to net_l2 header file
Change-Id: Ib07406a6d988cd742d2077503b70de230197d390
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:17 +02:00
Tomasz Bursztyka
f7a9b07a84 net: l2 layer reserve size might need extra parameter
The dst_ip6 is a parameter, required for future 802.15.4 L2 layer.
At some point such parameter could be changed to a void pointer,
and a utility function would populate it depending on L2 layer,
if such parameter needs someday to be variable and complex (some
specific struct or else).

Also make sure we use ARG_UNUSED() relevantly, and using proper prefix
to functions.

Change-Id: I43297bb4fb48a8f1bb5075c216342db16261cbb8
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:17 +02:00
Jukka Rissanen
56d3dfdeb9 net: Sent NS was two bytes too long
Change-Id: If330aabd767e0c69d6a2224a6cc72df161cc6123
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:17 +02:00
Jukka Rissanen
08c54ec566 net: Check ICMPv6 options length correctly
The options length check was using fragment length to
verify the correctness of options. This is incorrect
as we need to check against the remaining length of the
packet after we have removed IPv6 and ICMPv6 header lengths.

Change-Id: Ied1b19e3f4b1a88409e81a1974ba5a4bdf022e72
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:17 +02:00
Jukka Rissanen
04a65534e1 net: Change srctree to ZEPHYR_BASE in Makefiles
This is related to changes in commit 7dcbbc39e7
("build: move from srctree to ZEPHYR_BASE for app include paths")

Change-Id: Ie902ed66bb74188ed54aae44e2f4289f954ec351
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:17 +02:00
Tomasz Bursztyka
a4796121a3 net: Add a function to retrieve a neigh from an IPv6 address
This is necessary when an external component tries to relate an address
to an actual neighbour.

Change-Id: Ic1b40032300e9fa06e029017098c16b6260c3a41
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:17 +02:00