Commit graph

42249 commits

Author SHA1 Message Date
Tomasz Bursztyka
d02fe29616 net: ieee802154: Add support for requesting ACK on packets
This is meant if only one needs reliability when sending non-TCP packets
(as TCP would make is redundant).

Change-Id: I7dc605094b422a750424c3498d18f32d809d23a8
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:57 +02:00
Tomasz Bursztyka
b986c7681e net: ieee802154: Add RFD feature level choice
This level will support the basic features any 15.4 device needs to
have. Unlike ORFD, RFD is spec compliant.
(This choice is introduced now for clearer history)

Change-Id: I70cdd9fcd9cdf224207478f7a76f75ee8da8a31b
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:57 +02:00
Tomasz Bursztyka
8d2afd3c72 net: ieee802154: Reindent Kconfig help as they are mandated to be
Indentation in Kconfig is as follows:
- 1 tab for config attributes but for help content
- 1 tab + 2 spaces for help content

Change-Id: I026adb56fd8046d6bb8767857fcc7224a6248a97
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Tomasz Bursztyka
91c3f06e97 tests: net: Moving IEEE 802.15.4 fragmentation test in proper place
fragment is only about testing 15.4 6lo fragmentation, so let's put it
in dedicated tests/net/ieee802154/ directory.

Change-Id: Ib838600e571753ab976c74dac78ee774f628c2ab
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Tomasz Bursztyka
593fc81bf4 tests: net: Multiple test will go inside ieee802154
So reordering files in order to put more specific tests in it.

Change-Id: I000bc5efb8442d02e9a50e1b85cb45e0bec12789
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Tomasz Bursztyka
2cb620d4c9 net: ieee802154: Integrate 6lo fragmentation when sending
Relevantly provide ieee802154_fragment() to the 6lo library.

Change-Id: I77d4ff9e6d37a17ee30354a3026c295f8dfaa25c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Tomasz Bursztyka
4266653c8c net: ieee802154: Integrate 6lo fragmentation reassembly
Relevantly call ieee802154_reassemble() on reception.

Change-Id: I10ec027f5300e6e0a14e7483961b1ae2d6dfafe2
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Tomasz Bursztyka
831bfcb048 net: ieee802154: Improve 6lo frag reassemble API
No reassembly logic is changed besides removing the final reassembled
pointer. Instead of requiring such pointer, let's just use the frag one.
Such changes will ease the usage of ieee802154_reassemble():
the given frag buffer, in case it finally got reassembled and thus
provided a NET_CONTINUE verdict, will directly be handled by net_core.

This makes things consistent as well with verdicts:
- in case of NET_OK, buf has been consumed and thus unrefed
- in case of NET_DROP, buf needs to be unrefed by caller
- in case of NET_CONTINUE, buf is updated with reassembled and
  decompressed data packet, up to net_core to handel it accordingly.

Change-Id: Ibd1588debd22a7f4571b36713dd46bf8b1d88329
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Tomasz Bursztyka
34988043a4 net: ieee802154: Reverse 6lo fragmentation verdict
As soon as fragment is put into the cache and as long as it is not
identified to be the last one: let's return NET_OK to notifiy the
fragment has been consumed by ieee802154 L2.

That way, net_core will not try to interpret it - and fail - unnecessary
increasing the drop statistics.

On the contrary, once the buffer is fully reassemble, let's return
NET_CONTINUE in order to let net_core consume the buffer relevantly.

Change-Id: I715b687e451f4643656e122b0d119f114696340b
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Tomasz Bursztyka
e7773fa255 net: ieee802154: Let's update fragmentation tag on relevant buffers
Such tag is meant for fragmented buffers only, so let's update it only
when:
- given buffer is valid
- given buffer needs to be fragmented

Change-Id: Ic3f41a9194ea11cd129fb0903bcd242facea7197
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Tomasz Bursztyka
12f74bd658 net: ieee802154: Fix minor style issues in fragmentation part
Change-Id: Ie309a0aed1866a3f4b9b97fc932195c2fde138fb
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Tomasz Bursztyka
6e1c9f02bc net: ieee802154: Generate 802.15.4 data frame for each data frag
A buffer can be made of multiple fragments, so let's generate the 15.4
header for all of them.

Change-Id: I41fd8c939964da1ea6cdd3e00f16bb7297da509d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Tomasz Bursztyka
7aa15f0257 net: ieee802154: Make pkt_hexdump ready to handle multi-fragment buffer
This debug print is heavy and disabled by default (hardcoded, no Kconfig
option). But it's anyway useful in some cases so let's update it to
handle multi-fragment buffers properly.

Change-Id: Ic20a9d4056bb91cc9816c129d78aa3fe80fc9fef
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Tomasz Bursztyka
b18bbedfb1 net: ieee802154: L2 radio drivers should handle multi-fragment buffers
For each fragment it should transmit it, handle the error, retry if
possible, wait for the ack if necessary, all along the current
transmission strategy.

Change-Id: I28a01553e28d9bb51024321ce7d22372ad6a1335
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Tomasz Bursztyka
ffa39e05a6 net: ieee802154: Refactor data frame function signature
This will be necessary to handle multi-frag buffers. As each frag needs
a unique sequence number, incrementing the sequence at every call.

Change-Id: I4e002dd42e89a1ef3f65e7591157d3e9d346ceff
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Tomasz Bursztyka
2887bbf7fc tests: ieee802154: Make the test ready to handle multi fragments buffer
Buffer sent by 802.15.4 L2 might have more than one fragment, thus
handling it properly.

Change-Id: I12fef8a9c5de56615c3a084c57f438e71b320fcf
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Tomasz Bursztyka
11a1d9ef32 drivers: ieee802154: Make uart pipe driver tx one fragment only
Let's not count the whole buffer length but only the very first frag's.
Up to L2 radio strategy to loop on every fragments and call tx for each.
(once sent, it deletes the fragment, so next fragment is always
buf->frags).

Change-Id: I94130fedfbecffdf62286bcb7f10563c776a255e
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:55 +02:00
Tomasz Bursztyka
0f2164cb5a drivers: ieee802154: Make CC2520 ready to tx only one fragment
The given buffer can come with many fragments, but it's not up to the
hardware driver to send all of these but only the first in the list.
The overall fragments send procedure is handled in l2 level where the
radio transmission strategy loops over the list of framents and send
them one by one relevantly.

Change-Id: Ia7ae42ab4e9f8efb83bf07de6791918059b1e1c9
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:55 +02:00
Tomasz Bursztyka
d48f36636d net: ieee802154: Refactor how address fields are generated
This is meant to generalize how these are computed, for future usage
like in MAC command frames.

Change-Id: I6b1cea93666f6df46a76b920077af5b0e413342e
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:55 +02:00
Tomasz Bursztyka
7e4bba03b4 net: ieee802154: Optimize context structure usage
For future purpose, let's not occupy a full byte for a unique boolean.

Change-Id: I36f2824cca4806eb90640a71ed3cea37a353b276
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:55 +02:00
Tomasz Bursztyka
1f429015fa net: ieee802154: Optimizing how dst addr is validated in beacons
No need to use goto, validate_addr() is going to set dst addr to NULL as
expected.

Change-Id: I804a51307d9d8e5e21dbb4e6a794e23c7bbe2762
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:55 +02:00
Tomasz Bursztyka
bcdca02ab0 net: l2: ieee802154: Fix radio utils comment
These routines are generic and not ALOHA specific.

Change-Id: I431e2f4a135d321a428e2ea98e41440cdc128a61
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:55 +02:00
Tomasz Bursztyka
62ea188772 net: mgmt: Fix include recursion loop
Including net_if.h can makes things looping, as this one will include
net_l2.h, which one might include a technology that will in turn include
net_mgmt.h again.

Change-Id: I514720875937414167f0396edb9147ed29dd6d69
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:55 +02:00
Tomasz Bursztyka
efaa46594f net: mgmt: Define request handlers to avoid build warning
Up to the part declaring mgmt request to define such handler. This is
meant to avoid such warning:

warning: implicit declaration of function ...

Change-Id: Ide6e9abf886169c26d81fe6b5c7bc280e1ac4e4d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:55 +02:00
Vinicius Costa Gomes
86b1ef7b7b tests/zoap: Fix extra unref on net_buf fragments
Since "22e919872206b1d net: Adapt to new behavior of net_buf_frag_add"
net_buf_frag_add() takes onwership of the fragment, so this _unref()
after a net_buf_frag_add() is wrong.

Change-Id: I1559c2978cf8d800891d6e752478537fbee7c02b
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:40:55 +02:00
Vinicius Costa Gomes
3aa352e622 tests/zoap: Port observer tests to the native stack
This enables the tests for the observer feature to be run using the
native IP stack.

Change-Id: I325dcd1f5d9fffe3821eed1bd950a717e5f17b67
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:40:55 +02:00
Tomasz Bursztyka
1cd4190b2f drivers: ieee802154: cc2520: do not recalibrate rx after tx
As we use STXONCCA, RX will be stopped and reinstated afterwards.
We would be using STXON, since FRMCTRL1_SET_RXENMASK_ON_TX bit is set,
behavior would be the same.

Recalibrating the RX will uselessly abort any received frames before TX
or right after RX got reinstated. So, let's not do that and trust that
RX is anyway properly calibrated after TX.

Change-Id: Iac4fa03a175f8d139c1fc821de01caab1ec86e6b
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:55 +02:00
Leandro Pereira
d5f906d493 net: tcp: Print TCP flags as a string rather than individual bits
Print TCP flags in a similar fashion to tcpdump, where uppercase
characters mean a particular flag is set, and lowercase characters mean
a particular flag is unset.

Supported flags by net_tcp_trace() remain the same: FIN, SYN, RST, PSH,
ACK, and URG, respectively represented by the letters 'f', 's', 'r',
'p', 'a', and 'u'.

Change-Id: Iaeb0b5c4fa5b4ab2b877d523b155dc431e9fc909
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:40:55 +02:00
Leandro Pereira
9ff4c5f41b net: ipv6: net_ipv6_create() should know about TCP
This fixes the following build warning:
	net/yaip/ipv6.c:333:9: warning: 'nexthdr' is used unin-
		itialized in this function [-Wuninitialized]

This relies on net_context_get_ip_proto() providing the correct
protocol given a certain context.  Currently, it only returns either
TCP or UDP, which is sufficient for net_ipv6_create().  However, enum
net_ip_protocol contains other unhandled protocols (ICMP and ICMPv6,
respectively), which might or might not need to be handled in the
future.

Change-Id: I1f7af54612c3e1c978e734fc0e6b2ff1a61089f8
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:40:55 +02:00
Leandro Pereira
cec8703618 net: Do not dereference context before asserting
Change-Id: Ic8f2aa754ff8c3fca64e9950fd3b63d9218d826a
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:40:55 +02:00
Leandro Pereira
e230b9cdf3 net: tcp: Correctly set remote address when accepting connections
Change-Id: Icb112dcb50a04755eb8ce25be2fc043074679ae1
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:40:54 +02:00
Leandro Pereira
8865dbd3a5 net: tcp: Correctly calculate SYN_ACK ack#
When a connection is being established, the ack sequence number in the
SYN+ACK segment must be the sequence number from the SYN packet + 1.

Change-Id: I91df986f1f1b7cf8eaff0171921ab4c8cf1ddf93
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:40:54 +02:00
Jukka Rissanen
ded457d5fa slip: Fix hexdump print
The fragment count value was incorrectly printed. All
the values > 9 had their last digit chopped off.

Change-Id: I8304b8047baa97995c3927809e4616653c87928b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:54 +02:00
Jukka Rissanen
5f3f331d48 net: Adapt to new behavior of net_buf_frag_add v2
This change is related to patch called
"net: Adapt to new behavior of net_buf_frag_add"

This version removes extra net_nbuf_unref() from
the code. The unref was done because net_buf_frag_del()
did not remove the double ref from the list element.

Because of the other patch, the list does not have
double ref any more, so we need to remove the extra
unref in couple of extra places.

Change-Id: If90e01c24b9b4e68afbfa283850d2a1ecb3065ed
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:54 +02:00
Luiz Augusto von Dentz
82ae330bfc net: Adapt to new behavior of net_buf_frag_add
net_buf_frag_add takes the ownership of the reference passed to it so it
is no longer needed to unref when deleting fragments.

Change-Id: I73f44ba313819a176b6a64b7644c80a83d86000e
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-12-02 12:40:54 +02:00
Ravi kumar Veeramally
78502f1804 net: tests: Update DHCPv4 test results based on events
Earlier test results was updated as soon as test server ACK client
dhcpv4 request. But update results on IPv4 address add event on
interface.

Change-Id: I212309a4d1d2eae88f73470e00754db1d6fecda5
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:54 +02:00
Ravi kumar Veeramally
6210b7c19f net: Notify IPv4 related events on interface
Change-Id: Ie97f1f4b577973e2b0b4dd126db6f332e954210c
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:54 +02:00
Ravi kumar Veeramally
f1986a1d1e net: Add IPv4 related events
Change-Id: Ieb26ab96b2b9aa6765ddba21628ab1530a2597ea
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:54 +02:00
Andrei Emeltchenko
899df8742f wpanusb: Add wpanusb syslog domain
Change-Id: I06f2df88678658a495b3ae0064b542f4697161a9
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:54 +02:00
Andrei Emeltchenko
3c75cc9c9c wpanusb: Correct definition names
Change definition name suffix to WPANUSB

Change-Id: I3456ebff061866a67b7a07b33f6ff83a31a2d7a8
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:54 +02:00
Andrei Emeltchenko
cb77016c23 net: samples: Add samples overview for wpanusb and wpan_serial
Change-Id: I05f6ce9a823cb8a5466bd02739386f23e9266cc2
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:54 +02:00
Leandro Pereira
b014cc01d9 net: tcp: Master socket should never go to ESTABLISHED state
It should go to LISTEN state as soon as possible, to service another
connection.  The client connection, though, should be in the
ESTABLISHED state.

Change-Id: I98708e67bd969f09b84e60ac2fecc284bf82a79f
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:40:54 +02:00
Leandro Pereira
9abf988079 net: tcp: Put new_connection on handshake failure
When an incoming TCP connection is accepted, a net_context for the
client is allocated.  However, some steps prior to calling the
user-defined accept callback can fail, without freeing the
newly-allocated client context.

Change-Id: I94ed03d2f3b69eb3edd23c990da5842fa4605a29
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:40:54 +02:00
Leandro Pereira
03d4596c10 net: tcp: Drop early when accepting without accept callback
Avoids creating context for client socket.

Change-Id: I2ed98060c991db37a5d80f739e944f7e46206ad5
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:40:54 +02:00
Leandro Pereira
c0d6863272 net: tcp: Ensure iface set in LISTEN state on SYN_RCVD state
Change-Id: Ibf853eb0c7c5116dfc86c8d685496e992ab6018f
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:40:53 +02:00
Leandro Pereira
1cffdd8cbd net: tcp: Return -EOPNOTSUPP for non-TCP in net_context_listen()
Only TCP sockets are supported by net_context_listen(), so check if the
socket family is TCP rather than UDP in order to return success or
error.

Change-Id: I2ab5e9985d448811da2e1414d3ecafd9b3b3e475
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:40:53 +02:00
Leandro Pereira
82530f94d8 net: tcp: Change TCP state to listen on call to net_context_listen()
This keeps the semantics of the low-level network stack API closer to
the BSD sockets API. Prior to this change, listen() primitive was a
no-op, and accept() would change the connection state to LISTEN; this
changes the functions so that calling listen() is required before
calling accept().

Change-Id: Icd89eb8d76439d63339fc99277d5d3dad66fa5f5
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:40:53 +02:00
Leandro Pereira
56f6a86270 net: tcp: Use macros from byteorder.h to obtain ints
Instead of defining the poorly-named a2u32() and a2u16() functions
inside tcp.c, use macros provided in <misc/byteorder.h> to obtain
unsigned 32- and 16-bit values instead.

Change-Id: I344fe0e495c574cb8cc717036154221e912b4406
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:40:53 +02:00
Marcus Shawcroft
88e6e403fe net: dhcpv4: Adjust DHCPv4 debug config wording.
Adjust the DHCPv4 client configuration wording to distinguish the
option that enables dhcpv4 client from the option that enables its
debug. Provide help text for the latter.

Change-Id: Iadb115bc93f56e7dd3f1c0824f57a9cfc4453e75
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-02 12:40:53 +02:00
Marcus Shawcroft
5d102604ad net: dhcpv4: Adjust debug diagnostic wording.
Adjust the workding of NET_DBG() diagnostic to emphasize that the
contents of a received dhcpv4 message where not expected, rather than
incorrect.

Change-Id: Iee29e1b93c6a4876effa2e968bf77d9a0ada4ff0
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-02 12:40:53 +02:00