Commit graph

41120 commits

Author SHA1 Message Date
Jukka Rissanen
6bd7430a34 net: yaip: Start to use logging macros from sys_log.h
Instead of directly calling printk/printf, the network printing
macros will use syslog macros defined in sys_log.h

Change-Id: I3f12f81557f50b24ca47a43f345162f9ffbd574c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:23:49 +00:00
Jukka Rissanen
b133b01d67 net: yaip: Add send() to net_if API
The send() function is called from IP stack and it is used
when the network packet needs to be send via a specific
network interface.

Change-Id: Id6ce86b1748915fee73b62366dee13fcb7cf11a1
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:23:41 +00:00
Jukka Rissanen
5f8c18fc1b net: yaip: Add Kconfig option for compiling IPv4 support
The YAIP stack uses CONFIG_NET_IPV4 to compile IPv4 support.

Change-Id: Ia4a579591d6d2050e168c35e68546281043d53a8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:23:33 +00:00
Jukka Rissanen
17ddda8721 net: yaip: Add net_if_get_by_link_addr() util function
This will return the network interface that has some specific
link address.

Change-Id: Iaebcf6e769d4f91f3cda6d3a0779324f89603b54
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:23:24 +00:00
Jukka Rissanen
9291f82cd9 net: yaip: Execute net_init() automatically
User does not need to call net_init() as it is automatically
called when system is brought up.

Change-Id: I2cb10f4402088a0ca4feff226b65341f337194ea
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:23:16 +00:00
Jukka Rissanen
f2f7bc1c13 net: yaip: Add Kconfig option for compiling IPv6 support
The YAIP stack uses CONFIG_NET_IPV6 to compile IPv6 support.

Change-Id: I25c3b2d6775ed610fca43960a569ddab0ec470aa
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:23:05 +00:00
Jukka Rissanen
99a04e263d net: Show only uIP debug options when needed
uIP specific debug options are shown only when uIP is
being compiled.

Change-Id: Ieea5db021227a2b3cbe625a9c774e7c1f99b5e83
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:22:56 +00:00
Jukka Rissanen
a8aabd8571 net: yaip: Add net_analyze_stack() macro
This macro can be used to check stack usage. It should only
be used when debugging is activated.

Change-Id: I99fe6f9db1f3e955152a91f3a18d031126172cfd
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:22:48 +00:00
Jukka Rissanen
bc24ec86fe net: yaip: Fix compilation error in net_if.h
The NET_IF_INIT() macro used parameter pasting incorrectly.

Change-Id: I40a988ffb06ce135731cd69f18931b7507cd71cc
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:22:40 +00:00
Jukka Rissanen
184e251fdb slip: Add driver for host to qemu connectivity
The SLIP driver is using UART pipe driver to communicate with
host when Zephyr is running in Qemu. Currently this is only
used by networking sub-system when testing the networking
stack.

Change-Id: I432b4136670766a7fc190f146057924c266f9bea
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:22:31 +00:00
Jukka Rissanen
b7bc53ece9 net: yaip: Add nbuf buffer API
User should use the net_nbuf API that is supporting a concept
of RX, TX and DATA buffers, instead of using directly the net_buf
low level API.

Change-Id: I3b8f5f13cd37d42d2322a58b35573e117d520c54
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:22:24 +00:00
Jukka Rissanen
c630347683 net: yaip: Compile IPv6 and IPv4 address conditionally
Save 12 bytes per IP address if IPv4 is active and IPv6 is not.

Change-Id: Ia01d2feb83e6ba80b2775f9eed3065c956932632
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:22:14 +00:00
Jukka Rissanen
6c6a3856bc net: yaip: Add function that feeds data to RX fifo
Network drivers should call this when new data has been
received from network.

Change-Id: Ife78fa0683b8c410c38358300a6a18e9325f0ef8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:22:05 +00:00
Jukka Rissanen
5bd0d378f5 net: yaip: Refactored RX fiber init
Change-Id: I2f8a43ac63162844d0df0c1b69dc93837479a91d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:21:57 +00:00
Jukka Rissanen
5a90d28a72 net: yaip: Add TX fifo to network interface
Network packets to be sent are placed to correct fifo that
is allocated to certain network interface.

Change-Id: Idd5eded42758c5bed2c18769122c38d9d03dc419
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:21:47 +00:00
Jukka Rissanen
8e3defbe73 net: yaip: Let new IP stack know the debug Kconfig options
Change-Id: I1a549317b3072536a6eddf59fb5912aa3795e02e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:21:38 +00:00
Jukka Rissanen
61aae6ab27 net: yaip: Add IPv6 prefixes to network interface
Change-Id: I34c75eec6068abbd6af1eac2e178e42ce382b128
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:21:30 +00:00
Jukka Rissanen
daf4871e36 net: yaip: Add multicast address to network interface
Change-Id: Ifc09d2e1d3ac44ab0f5980ee17299119fbe2a867
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:21:21 +00:00
Jukka Rissanen
d4e0025eb7 net: yaip: Add network address information to interface
Change-Id: I14b9257362a1e6f4144900c7acde6a125ecf6a02
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:21:12 +00:00
Jukka Rissanen
cba9d3096c net: yaip: apps: Create a skeleton echo-server for new IP stack
This echo-server does not yet do anything useful.

Change-Id: I317051b3a2bfb0a80584ad385c2f308978a243cd
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:21:03 +00:00
Tomasz Bursztyka
5f165e743f net: Add generic network interface header
This will be used by the new network stack to relate a device to actual
network context, and used in the different layers (mac, ip ...).

Change-Id: I30c08fa975314544c36b71636fd9653d562891b3
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-07-12 07:20:51 +00:00
Tomasz Bursztyka
257379d0ff net: Add header file for generic link address
It only describes the structure for now, but will then provide helpers.

Change-Id: I7ac7717a3289086dac50d90e25b2a1ce7d7abc91
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-07-12 07:20:40 +00:00
Jukka Rissanen
ca2f26999a net: yaip: Compile new stack if enabled
Change-Id: Ifb9c1b49e253af0428187898c6c3e6aa7f4851cd
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:20:31 +00:00
Jukka Rissanen
d53c56fff4 net: yaip: Use same prefix in new IP stack Kconfig
Use CONFIG_NET_... prefix for Kconfig options.

Change-Id: I3e882845e7c09ba910f108179208fcaf33360f21
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:20:19 +00:00
Jukka Rissanen
8e7007c26f net: yaip: Add ntohl() and related macros
Change-Id: Ia329a63644eab8ca1ce6debb8f7e7b97b8de711d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:19:51 +00:00
Jukka Rissanen
7db376cfec net: yaip: Add defines for various IP protocol header lengths
Change-Id: I05dcb7a26f50cd0c8d544c5d829e1154ed3f8119
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:18:45 +00:00
Jukka Rissanen
75ae39518c net: yaip: Initial commit for new IP stack
This is a placeholder that just compiles but does nothing else.

Change-Id: I9689fa26eb13bc23d29940938f7b3c11f32b2ff1
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:18:06 +00:00
Arkadiusz Lichwa
ca57a7816d Bluetooth: L2CAP: Start servicing configuration request from remote
To make channel operational in basic mode a process of BR/EDR CoC
channel configuration needs to be performed in both directions. Remote
peer is mandated as well to inform local about its segmentation
requirements. Here is added such request handler focused on grabbing
remote MTU which is mandatory in channel setup.

> ACL Data RX: Handle 12 flags 0x02 dlen 12  [hci1] 12.133539
      L2CAP: Connection Request (0x02) ident 3 len 4
        PSM: 1 (0x0001)
        Source CID: 64
< HCI Command: Host Number of Completed Packets (0x03|0x0035) plen 5  [hci1] 12.133631
        Num handles: 1
        Handle: 12
        Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5  [hci1] 12.133792
        Num handles: 1
        Handle: 12
        Count: 2
< ACL Data TX: Handle 12 flags 0x00 dlen 16  [hci1] 12.141644
      L2CAP: Connection Response (0x03) ident 3 len 8
        Destination CID: 64
        Source CID: 64
        Result: Connection successful (0x0000)
        Status: No further information available (0x0000)
< HCI Command: Host Number of Completed Packets (0x03|0x0035) plen 5  [hci1] 12.142054
        Num handles: 1
        Handle: 12
        Count: 1
< ACL Data TX: Handle 12 flags 0x00 dlen 16  [hci1] 12.143276
      L2CAP: Configure Request (0x04) ident 6 len 8
        Destination CID: 64
        Flags: 0x0000
        Option: Maximum Transmission Unit (0x01) [mandatory]
          MTU: 48
> HCI Event: Number of Completed Packets (0x13) plen 5  [hci1] 12.150945
        Num handles: 1
        Handle: 12
        Count: 2
> ACL Data RX: Handle 12 flags 0x02 dlen 16  [hci1] 12.150959
      L2CAP: Configure Request (0x04) ident 4 len 8
        Destination CID: 64
        Flags: 0x0000
        Option: Maximum Transmission Unit (0x01) [mandatory]
          MTU: 128
> ACL Data RX: Handle 12 flags 0x02 dlen 18  [hci1] 12.152160
      L2CAP: Configure Response (0x05) ident 6 len 10
        Source CID: 64
        Flags: 0x0000
        Result: Success (0x0000)
        Option: Maximum Transmission Unit (0x01) [mandatory]
          MTU: 48
< HCI Command: Host Number of Completed Packets (0x03|0x0035) plen 5  [hci1] 12.158806
        Num handles: 1
        Handle: 12
        Count: 1
< ACL Data TX: Handle 12 flags 0x00 dlen 14  [hci1] 12.161822
      L2CAP: Configure Response (0x05) ident 4 len 6
        Source CID: 64
        Flags: 0x0000
        Result: Success (0x0000)
< HCI Command: Host Number of Completed Packets (0x03|0x0035) plen 5  [hci1] 12.163197
        Num handles: 1
        Handle: 12
        Count: 1

Change-Id: I7919fe180cf1d761023bb1478d8e1fb2d21a94d9
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-07-11 19:34:17 +00:00
Jukka Rissanen
83707d5675 net: buf: Calculate amount of bytes in fragments
Utility function net_buf_frags_len() calculates amount of data
stored in the fragments.

Change-Id: I89ebc8dac4f216ff9e77b5c44002082398957f7b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-11 18:06:24 +00:00
Jukka Rissanen
95f5cd2b9a net: buf: Add tests for net_buf fragmentation
More realistic IPv6 packet creation tests created.
One test creates one big IPv6 packet and manipulates that.
Second test creates a list of IPv6 header + data fragments
and sets some user data in those fragment buffers.

Change-Id: Ic8309ff115e1d735e98c30b3c8292b0d6ffc5f42
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-11 18:06:11 +00:00
Jukka Rissanen
7d6197cf94 net: buf: Add fragmentation API tests
Add tests for checking that the net_buf fragmentation works ok.

Change-Id: I778f79bae971314b6f19c1bf00ed42e1c2128e99
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-11 18:05:41 +00:00
Andrew Boie
8a80ce5c6f Revert "REVERTME: test_pool disable due to memory corruption bug"
Allan fixed the underlying issue, re-enable.

This reverts commit 19fa82ab91.

Change-Id: I6e517f76a6650a3e9ba5a09118187e6c965a147a
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-11 17:53:45 +00:00
Luiz Augusto von Dentz
d98068be94 Bluetooth: L2CAP: Fix not canceling RTX work
If the channel is being destroyed the RTX work should be cancelled as
it may cause destroy to be called again.

Change-Id: I49c10d64a2108719d28e456fb5b4bfb50ef8a140
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-07-11 15:40:39 +00:00
Luiz Augusto von Dentz
a6a78bfbca Bluetooth: L2CAP: Unify code for adding and deleting channels
The code for adding and removing channels is very similar for LE and
BR/EDR so it can be unified and just leave the CID allocation up for the
bearer implementation.

Change-Id: Icf4c66262c4e973039381ebd1861fad4d46e1535
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-07-11 15:39:59 +00:00
Luiz Augusto von Dentz
2329d82432 Bluetooth: L2CAP: Make l2cap_chan_add initialize the destroy callback
This is cleaner and safer as destroy is garanteed to be initialized once
it is added to the list of channels.

Change-Id: Iae674f6e25527d71c03c5903337b0bd18c3dd0be
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-07-11 15:38:30 +00:00
Jukka Rissanen
4605a3771c net: buf: Add fragmentation API support
User can add fragments to the network packet if the data cannot
be placed in one buffer.

Change-Id: I060ef533cc4fdda0f38405fb7dc72015f5cac7fc
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-11 15:37:45 +00:00
Johan Hedberg
4efe39ff04 Bluetooth: SMP: Take advantage of new bt_hex helper
The h() helper isn't needed anymore.

Change-Id: Ica1b4beb086237c1c792d5376e8ee71bc64394fe
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-07-11 09:44:13 +00:00
Johan Hedberg
6e701275af Bluetooth: Add hexadecimal conversion logging helper
This has so far been used in SMP code as the h() function. Now it has
a more generic name and is accessible by all parts of the Bluetooth
subsystem.

Change-Id: Iae4607da9c8b3e6779d9c97f84a4e486d5258ef0
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-07-11 09:38:53 +00:00
Johan Hedberg
f7d802b1e3 Bluetooth: Fix enabling ECDH HCI events when SMP is not selected
Now that there's an API always exposed for this the events should
always be enabled whenever the controller supports this feature.

Change-Id: I4965c9463ae7b3f6424784dab2c03403fdf3f179
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-07-11 09:38:42 +00:00
Johan Hedberg
abc142bdc3 net: buf: Add net_buf_push_u8() helper API
This is similar to the other net_buf_*_u8() helpers that already
exist.

Change-Id: I63fc963877c1946964e675067dd98f748be7cbbc
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-07-09 15:43:31 +03:00
Johan Hedberg
30cb395bbf net: buf: Add big-endian helpers
Add helpers for big-endian 16-bit values, similar to the ones that
already exist for little-endian values.

Change-Id: I63bf4dd7df802669ea6657cd95d6da48e6176487
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-07-09 15:43:31 +03:00
Johan Hedberg
727a2459b1 net: buf: Add net_buf_reserve() API
This API allows initializing the buffer with a given headroom. This
prepares the way for eventually removing the 'reserve_head' parameter
from the net_buf_get APIs, but can already now be useful in some
scenarios where the headroom is desired to be different than some
higher level API sets it to be.

Change-Id: Iffbe5761fdf3d2ad8cb4b8437b1074cf42ea9c6c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-07-09 15:43:31 +03:00
Johan Hedberg
e03151ee3e net: buf: Use precise buffer size given to NET_BUF_POOL
Until now, NET_BUF_POOL() would be opportunistic and allocate a few
more bytes extra for the buffer content if the given size wasn't a
multiple of 4. This is an issue however if the API user really wants
to have a precise size for the buffer so that e.g. net_buf_tailroom
gives meaningful and deterministic results.

This patch removes the opportunistic rounding up, basically leaving it
up to the application to decide if it wants to have unused padding in
the data structure or not.

The crucial thing here is to ensure that locating the user data
section (which is aligned to a 4-byte boundary) doesn't break, since
buf->size is used for that. However, the net_buf_user_data()
implementation already uses ROUND_UP() so the result will still be
the same even if buf->size is not a multiple of 4.

Change-Id: I4bc17139cda19a680180c2d326d417a41ad0d4cd
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-07-09 15:43:31 +03:00
Szymon Janc
bccc1bf0e1 Bluetooth: SMP: Send pairing failed on unexpected PDU
If unexpected PDU is recevied it is better to reply with Pairing
Failed and abort pairing then just silently ingore such PDU as
pairing will most likely fail anyway.

Change-Id: I3c67a6997a5e8d33b1e97cb955981a52baf38d02
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-07-09 12:40:48 +00:00
Allan Stephens
c002401295 sysgen: Cosmetic cleanup of memory pool generation code
Does renaming of variables and comments to conform to the
"block set" and "quad-block" terminology now used by the kernel's
memory pool code. (Note: This renaming also includes names of
some variables generated by sysgen.)

Change-Id: I8e04cb1ee9ca83daddb487b477da7dd2e1004fd8
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-07-08 23:04:41 +00:00
Allan Stephens
7bbf48bf5b kernel: Cosmetic cleanups to memory pool code
Improves a handful of comments, and removes some unneeded blank lines.

Change-Id: Ia2b951d23131b0080104c18c06324342de3359ef
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-07-08 23:04:40 +00:00
Allan Stephens
ff48e07f70 kernel: Rename fields of private memory pool type
Revises two fields of the memory pool structure to better reflect
that block sets are involved.

Change-Id: I44a751e7457270391fbe99705010345448df2ff4
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-07-08 23:04:40 +00:00
Allan Stephens
dc9556c4f7 kernel: Rename field of private memory pool type
Revises the memory pool block set field that points to its array
of quad-blocks to better reflect that quad-blocks are involved.

Change-Id: I159805ce8eee9091221cb1f494a4ab082e3736e5
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-07-08 23:04:39 +00:00
Allan Stephens
c0fd08e82d kernel: Rename private memory pool types
Revises the names of 2 types to make them better reflect the
data structures they represent, namely:

- block set: a collection of memory pool blocks of a given size
- quad-block: four contiguous memory pool blocks of a given size

Change-Id: I3e424586e97157eea185fba6836e2e89d10d9cd6
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-07-08 23:04:39 +00:00
Allan Stephens
569d08a940 kernel: Eliminate unused memory pool structure field
Eliminates the memory pool field indicating the size of the
pool's memory buffer, since it isn't used anywhere.
(Anyway, it could be computed by multiplying the maximum
block size by the number of maximum-sized blocks.)

Change-Id: Ia11554bdc2b246a1ba0ea33f05c5e6ce6a32ca13
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-07-08 23:04:39 +00:00