Commit graph

3021 commits

Author SHA1 Message Date
Anas Nashif a9e879e273 logging: move sys_log to subsys/logging
Move logging out of misc/ to its own subsystem. Anything related to
logging and any new logging features or backends could be added here
instead of the generic location in misc/ which is overcrowded with
options that are not related to eachother.

Jira: ZEP-1467
Change-Id: If6a3ea625c3a3562a7a61a0ba5fd7e6ca75518ba
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 19:58:39 +00:00
Tomasz Bursztyka 675277e28d net: nbuf: Initialize nbuf memory area after allocation
After commit 71c7c01819 about buf pool, we
started to get spurious behaviors on various places of the code on
different boards (a101, frdm...) BUT on qemu. Basically, outgoing ip/udp
packets were full of garbage. Or sometimes it was the abilitty to parse
incoming packet that was happening.

The difference between qemu and actualy boards is - afaik, at least, let
me know if I am wrong - that qemu provide initialized memory (full of
0s). Following this asssumption, this patch just reset the nbuf right
after it got allocated. And all started to work again as thought.

It's in fact a good thing to reset nbuf memory. Even before the above
commit: after being used more than once, a buffer would have ended up
with old content, and this could have been generating a bug. So let's be
on the safe side and always intialize nbuf content.

Change-Id: I50647d9e9b82a4ed340a5ceb0d69409b0194dddd
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-16 19:14:56 +01:00
Tomasz Bursztyka f991b82209 net: buf: Use buf->pool instead of now removed buf->free
Tiny debug message fix.

Change-Id: I464ff28d55b946a2e9ba4a0f9d88fbedd7ccef57
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-16 19:14:56 +01:00
Tomasz Bursztyka cff19c17c4 net: l2: ethernet: Handle Ethernet II minimal frame size relevantly
Minimal frame size is 60 bytes, but IP frame might be smaller than this
size minus the ethernet header. In that case, Ethernet frames are padded
so it does reach this minimal size. In this case, ethernet L2 should
update the buffer list so it remove the padding length from the whole.

Change-Id: Id370cad09ad82bb54febeb60b05f7e430cc8f963
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-16 19:14:54 +01:00
Luiz Augusto von Dentz 73e76c2ce2 net: Remove unnecessary k_wakeup
net_buf_put already awakes the RX thread so k_wakeup is not necessary.

Change-Id: I18b5aef5d6e85a9461bc01c17f56c3d4d9a13824
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-12-16 19:14:53 +01:00
Flavio Santes a8b73aa287 tcp: Validate net_context_put return code
Validate the return code of net_context_put and add debug information
in case any error is detected.

This patch fixes the error reported by Coverity:

Error handling issues  (CHECKED_RETURN)
Calling "net_context_put" without checking return value
(as is done elsewhere 4 out of 5 times).

Coverity-CID: 157833

Change-Id: Ia4a87cc08094bee465c8828411d7c1311481695a
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-16 19:14:52 +01:00
Tomasz Bursztyka 9acd710a2a net: Update TODO list on L2 and 15.4 tasks
Change-Id: I1c9e11b05cc8af337349d249d46f524c8a75a4fc
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-16 19:14:51 +01:00
Anas Nashif fe958df4dd libc: rework libc selection and reduce Kconfigs
Moved all libc Kconfigs to where the code is and remove the default
Kconfig for selecting the minimal libc. Minimal libc is now the default
if nothing else is configured in.

Removed the options for extended libc, this obviously was restricting
features in the minimal libc without a good reason, most of the
functions are available directly when using newlib, so there is no
reason why we need to restrict those in minimal libc.

Jira: ZEP-1440
Change-Id: If0a3adf4314e2ebdf0e139dee3eb4f47ce07aa89
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-15 22:31:28 +00:00
Anas Nashif 42738fdff4 net: multicast_eth_addr is use only with IPV6
Change-Id: Ia204a327ec7a85d1b0b0bf79778b4ebee8f294a6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-15 14:32:57 +00:00
Tomasz Bursztyka 353cd721a9 net: Fix incorrect logging format specifiers
Following commit fc21a76db6
Some more fixes are needed.

Change-Id: I19c2c979d44be5edfd76041d3cf4507860795c78
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-15 12:29:03 +00:00
Johan Hedberg 692771fbe9 net: buf: Switch from k_fifo to k_lifo for free buffers
Using a LIFO instead of a FIFO has the potential benefit that more
recently in-use buffers may be "cache-hot" and therefore accessed
faster than least recently used (which is what we get with a FIFO).

Change-Id: I59bb083ca2e00d0d404406540f7db216742a27cf
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-15 12:06:22 +02:00
Johan Hedberg d659bb020e net: buf: Remove redundant user_data_size from buffers
Since the user data size is now stored in the pool there's very little
value in storing it as well per-buffer.

Change-Id: I17a99123b232423c52a2179b4eccd813728d51b1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-15 09:58:17 +02:00
Johan Hedberg 71c7c01819 net: buf: Remove the need for net_buf_pool_init()
In order to keep the initialization process light-weight, remove
net_buf_pool_init() and instead perform the initialization of the pool
and buffers in a "lazy" manner. This means storing more information
in the pool, and removing any 'const' members from net_buf. Since
there are no more const members in net_buf the buffer array can be
declared with __noinit, which further reduces initialization overhead.

Change-Id: Ia126af101c2727c130651b697dcba99d159a1c76
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-15 09:58:02 +02:00
Johan Hedberg 45bc46d42e net: buf: Introduce net_buf_destroy() wrapper
This is only for use with custom destroy callbacks, so that the
application gets isolated away from the details of how exactly the
buffers are managed. This opens up the possibility of switching away
from k_fifo to potentially better solutions, such as k_lifo.

Change-Id: I0d8322fdec3500d8ae060ae471b9448aeaa4572a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-15 08:45:05 +02:00
Tomasz Bursztyka c8f8527d55 net: ieee802154: ACK reply needs to set all FCF attributes.
That bug never got caught because the buffer in unit test is always
clean and fully initialized to 0, and that part of the code being
tested is never used in real as the ACK reply is directly made by the
chip.

Change-Id: I88c4dd3767b4addf2250165b94f49fae29d322ea
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-15 08:45:05 +02:00
Marcus Shawcroft b42587e9cd net: Switch net dependency to CONFIG_RANDOM_GENERATOR
The CONFIG_TEST_RANDOM_GENERATOR parameter is not intended for
production use.  Switch to CONFIG_RANDOM_GENERATOR.

Change-Id: Id6ce986259270455223ce6a42d19a3d9c9b1e642
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-13 22:50:19 +00:00
Johan Hedberg c3e08c8fea net: buf: Redesigned pool & buffer allocation API
Until now it has been necessary to separately define a k_fifo and
an array of buffers when creating net_buf pools. This has been a bit
of an inconvenience as well as blurred the line of what exactly
constitutes the "pool".

This patch removes the NET_BUF_POOL() macro and replaces it with a
NET_BUF_POOL_DEFINE() macro that internally expands into the buffer
array and new net_buf_pool struct with a given name:

	NET_BUF_POOL_DEFINE(pool_name, ...);

Having a dedicated context struct for the pool has the added benefit
that we can start moving there net_buf members that have the same
value for all buffers from the same pool. The first such member that
gets moved is the destroy callback, thus shrinking net_buf by four
bytes. Another potential candidate is the user_data_size, however
right not that's left out since it would just leave 2 bytes of padding
in net_buf (i.e. not influence its size). Another common value is
buf->size, however that one is also used by net_buf_simple and can
therefore not be moved.

This patch also splits getting buffers from a FIFO and allocating a
new buffer from a pool into two separate APIs: net_buf_get and
net_buf_alloc, thus simplifying the APIs and their usage. There is no
separate 'reserve_head' parameter anymore when allocating, rather the
user is expected to call net_buf_reserve() afterwards if something
else than 0 headroom is desired.

Change-Id: Id91b1e5c2be2deb1274dde47f5edebfe29af383a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-13 21:41:53 +00:00
Johan Hedberg fc21a76db6 net: Fix incorrect logging format specifiers
Fix compilation issues that show up if SYS_LOG is mapped to printk
instead of printf. Unlike printf, printk is annotated so that the
compiler catches incorrect format specifiers passed to it.

Change-Id: Iab7cc6da110e9c98720211a6f773dcf055a3a411
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-07 13:15:58 +00:00
Tomasz Bursztyka 562f9c1c2e net: ieee802154: Add support for big endian
Structures attribute need to be ordered according to endianness.

Change-Id: Ib3053728cbc49e54631057c779aba0f16aace283
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:20 +02:00
Jukka Rissanen 5ece8c26b5 net: tcp: Fixing the constness of TCP state debug string
Change-Id: I42a8271cf10efcd9ce67ef860a45fa54c0690387
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:20 +02:00
Jukka Rissanen 3eaec41ab8 net: Moved net/ to subsys/net
* Moved networking code into subsys/net.
* Renamed net/yaip to net/ip at the same time.
* Fixed the tests/net to compile
* Fixed the Makefiles and Kconfig files in subsys/net
  to use the new location of the IP stack

Change-Id: Ie45d9e8cb45a93fefdf969b20a81e3b1d3c16355
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:20 +02:00