Commit graph

42559 commits

Author SHA1 Message Date
Luiz Augusto von Dentz
18dccd7f64 Bluetooth: Add gatt-write-without-response command to btshell
This adds gatt-write-without-response which can be used as following:

btshell> gatt-write-without-response <handle> <data>
bt: bt_gatt_write_without_response (0x0010f0a0): handle 0x0011 length 1
Write Complete (err 0)

Change-Id: Ide166049cf53e691a2269778bca1489f7027621f
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:15:23 -05:00
Andrei Emeltchenko
d5c55b75ae Bluetooth: Fix wrong check
Checking for (!conn && conn->state != BT_CONN_CONNECTED) makes NULL
dereference in a case conn is NULL.

Change-Id: I73c93e4eefad046eecb76958184880ef8b72676e
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:15:23 -05:00
Luiz Augusto von Dentz
c6c89a8529 Bluetooth: GATT: Add bt_gatt_write_without_response
This split the use of ATT Write Command and ATT Write Request since with
the former it is possible to sign the data thus making combinations of
parameters in bt_gatt_write complex/confusing.

Change-Id: I0349acd16d22ea4e38ac3e5ad8c3cdc318851633
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:15:23 -05:00
Ravi kumar Veeramally
1d55b64fdf net: apps: Validate received data
Change-Id: Ieb9a810918c4e5abad25ac416071ec503856f014
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-02-05 20:15:23 -05:00
Ravi kumar Veeramally
00c8baadc9 net: contiki: Add beacon support for 802.15.4
Importing patch 9974bb6599333cface655bd63b01dfbbfe5dcead from Contiki.
Original commit by Niclas Finne <nfi@sics.se>

Change-Id: I90e6da7c596edca6f8c78f667cc14723b9e3f2d7
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-02-05 20:15:23 -05:00
Ravi kumar Veeramally
e6e55bc943 net: contiki: Add option to set/get PAN ID and get next framer seqno
Importing patch b541cd24725591f586162497b493f37902120217 from Contiki.
Original commit by Niclas Finne <nfi@sics.se>

Change-Id: Id8a287c2cd21966039397ab7a596d978a14941f2
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-02-05 20:15:23 -05:00
Ravi kumar Veeramally
26d68bafa0 net: contiki: Add support for multiple fragmented IPv6 packets
Add support for handling multiple interleaved fragmented
IPv6 packets. Non fragmented packets will no longer disturb
the reassembly at all.

Importing patch 8489582746e401e0c52b9f7e861bdd759924017e from Contiki.
Original commit by Joakim Eriksson <joakime@sics.se>

Change-Id: I2202779cb71dd12c0cbe05e8a96e34ded2e65995
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-02-05 20:15:23 -05:00
Ravi kumar Veeramally
bb9343cf56 net: contiki: Remove deprecated HC1 compression.
Importing patch e5616fc4687827818b78e66825e7da6d37de858a from Contiki.
Original commit by Joakim Eriksson <joakime@sics.se>

Change-Id: Ic53fb92f33d1d77d659c2368cc13b1314de11ea6
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-02-05 20:15:23 -05:00
Ravi kumar Veeramally
4bbd1e9465 net: apps: Fix test_15_4 parameter order
Change-Id: I63f287f7a18d926917d2fb4fac6f5572f67bd197
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-02-05 20:15:23 -05:00
Jukka Rissanen
ade2baeca9 net: contiki: Added RPL API to setup root with a specified DAG version
Importing patch b21deba19914d95e6dfe92a902d1a406d167be43 from Contiki.
Original commit by Niclas Finne <nfi@sics.se>

Change-Id: I2be1719f169394f0a9fd0f43b1ae878e018e95c3
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:23 -05:00
Jukka Rissanen
1e7ed734a3 net: contiki: Added buffer size check in frame802154
Importing patch 565ff0b3dcaca5d0c31ba388447e3f71c914ccc8 from Contiki.
Original commit by Niclas Finne <nfi@sics.se>

Change-Id: I27014bf0af0770cd7f572655f288b6c382fdd659
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:23 -05:00
Jukka Rissanen
f47f63616c net: contiki: Add callback to DIO handling in RPL
Importing patch 5eea977ea24145b2181a4faf182951016cf3a199 from Contiki.
Original commit by Niclas Finne <nfi@sics.se>

Added callback to DIO handling for application control if a RPL DAG
should be joined or not (originally implemented by Joakim).

Change-Id: If22bfea13c456d5e170cc2c952a8d6ad48a6b37d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:23 -05:00
Jukka Rissanen
9bd473b715 net: contiki: Set uip_ext_len to 0 after dropping packet
Importing patch 778e6536b022fe24398d3c026bb99ff35b07495b from Contiki.
Original commit by Maciej Wasilak <wasilak@gmail.com>

Change-Id: I70f5cf2b1abd8f3748623d0217d9f0ef830e128c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:23 -05:00
Jukka Rissanen
6aeb812105 net: contiki: Removed obsolete argument in framer-802154
Importing patch d935acc7c115503ad5192e30ef832796d3dd6795 from Contiki.
Original commit by Niclas Finne <nfi@sics.se>

Change-Id: I4c3a9c23bde26631bbe5917568a17574898713f9
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:23 -05:00
Jukka Rissanen
08309b9cd6 net: contiki: Update parent rank in rpl_process_dio
Importing patch 9782a760b1165af7849a742a7a30767f2d4c7137 from Contiki.
Original commit by Laurent Deru <laurent.deru@cetic.be>

Change-Id: Ife33e5c38fcf00dab592df79fb8c843240ef39a4
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:23 -05:00
Jukka Rissanen
5e458839db net: contiki: Add cast to printout for portability
Cast clock_time_t to unsigned for portable printout
in rpl_print_neighbor_list().

Importing patch fc178dab876ea8ac72f4c0f1395fea1f71f9df81 from Contiki.
Original commit by Simon Duquennoy <simonduq@sics.se>

Change-Id: If5a0adcbc8aafd0a2bda8788173000bd8c4c9d7f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:23 -05:00
Jukka Rissanen
a71abdbafe net: contiki: Probe last recently update parent in RPL
When no probing target is found, probe least recently updated parent.

Importing patch 9ced5b7bac2150f993ba0c6e602f279e7b27127f from Contiki.
Original commit by Simon Duquennoy <simonduq@sics.se>

Change-Id: If494663ed7df38865d3a8776c56de74bf2d2fc04
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:23 -05:00
Jukka Rissanen
45543c1b2a net: contiki: Make probing expiration time configurable
Importing patch 832a4d3e01349458a48a585e2e1af72ec6be0411 from Contiki.
Original commit by Simon Duquennoy <simonduq@sics.se>

Change-Id: Ida5dff1a5d592f77fb1a21b4016ea4fd4c10db80
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:23 -05:00
Jukka Rissanen
e034a32095 net: contiki: Fix const argument in uip_connect()
Made the first argument to uip_connect() const, to ensure it isn't altered

Importing patch daef1ea252feca2ae540c2c06f5f49496231a209 from Contiki.
Original commit by Adam Dunkels <adam@thingsquare.com>

Change-Id: I92a8c389b0331c2cddcdac0190965209a4488eb3
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:22 -05:00
Jukka Rissanen
c95a072786 net: contiki: Cast IPv4 and IPv6 in copy macros
Importing patch daef1ea252feca2ae540c2c06f5f49496231a209 from Contiki.
Original commit by Adam Dunkels <adam@thingsquare.com>

Cast the addresses when copying IPv4 and IPv6 addresses using
the IPv4 and IPv6 copy macros.

Change-Id: Id34a294c653ec3310ef8152e600db3eb39778ae1
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:22 -05:00
Jukka Rissanen
ea889225ad net: contiki: Added a function for getting the default RPL instance
Importing patch 06daa08ffc4da0f0e2e5d32c222c0f513d273cec from Contiki.
Original commit by Adam Dunkels <adam@thingsquare.com>

Change-Id: I20b69b440923061f1993f7063c668351ee304a77
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:22 -05:00
Jukka Rissanen
14ac018d95 net: contiki: Make delay function user-configurable in RPL probing
Importing patch 6a5f238255a3a3450db2588cba7383d1be8529a0 from Contiki.
Original commit by Simon Duquennoy <simonduq@sics.se>

Change-Id: I4684d403a8a3d65f442f11f2d66f53c6968709aa
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:22 -05:00
Jukka Rissanen
3d86cfe13d net: contiki: Modified the default RPL probing selection process
Will now probe the least recently updated parent from time to time.

Importing patch 2dd182f4a8a322867f90cdbc8f1a983b972ac7cd from Contiki.
Original commit by Simon Duquennoy <simonduq@sics.se>

Change-Id: Ifa87485a3a5fdb895cf3fc375ef9589cbbb950f6
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:22 -05:00
Jukka Rissanen
fdbfff44d1 net: contiki: Implement RPL probing
Importing patch 47ba4c0c4bd81fd429ba23557aa44ee75daa2b3a from Contiki.
Original commit by Simon Duquennoy <simonduq@sics.se>

Change-Id: I30da9aac6f1057239fc3689996aa45b0a019f6f6
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:22 -05:00
Jukka Rissanen
1e9cb6f925 net: contiki: Added rpl_print_neighbor_list function for RPL state monitoring
Importing patch 529376be7758eec8320e695c1efb5e416f2d8c1c from Contiki.
Original commit by Simon Duquennoy <simonduq@sics.se>

Change-Id: I21aebbdff3687e6d29c4c28afa7d8095e185dc8b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:22 -05:00
Jukka Rissanen
da6d884b7a net: contiki: Added missing sanity check in uip-ds6-route.c
Importing patch 8344290e0898bb54a68d0e417a7a1c6dee992200 from Contiki.
Original commit by Simon Duquennoy <simonduq@sics.se>

Change-Id: I46ab31bbba06a54f020ec792a4e12ef60ae3caff
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:22 -05:00
Jukka Rissanen
fdbeba4967 net: contiki: Remove all the DODAG from the instance when the node is set as Root
Importing patch 9d94c4efae9c7604790034264d22e6cbf7fb61cd from Contiki.
Original commit by Laurent Deru <laurent.deru@cetic.be>

Change-Id: Iffd51ce5b4e68acf7e15b4559843f128cf5f13d0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:22 -05:00
Jukka Rissanen
3294a5796b net: contiki: Do not delete instance when a new DODAG can not be created
Importing patch 49bfb1308db8eff186677bcd8f1dd3861d9b26d8 from Contiki.
Original commit by Laurent Deru <laurent.deru@cetic.be>

Change-Id: I307fbec3ff6325a06c895411b83b811c2a392d44
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:22 -05:00
Jukka Rissanen
29ee1cceef net: Refactor echo-server test application
Now uses net_receive() with a proper timeout. Removed also
extra waits when sending data. Removed extra semaphores
and streamlined the code to act as fast as possible.

Change-Id: I577d4d5ff85bf13400fb6e157bc0023267658ba4
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:22 -05:00
Jukka Rissanen
35c147b85d net: Fix net_receive() for microkernel
Make sure to use the correct fifo wait function for microkernel.

Change-Id: Ie3e365a2e24836485d028c05c936c30dfce91ba4
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:22 -05:00
Jukka Rissanen
20319a1dca net: Remove extra debug print when packet is received
This debug print will flood the console is certain scenarios
so remove it.

Change-Id: I9e1d04ef48d9a6acf21c360c5ebb0dfa15c0173f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:22 -05:00
Jukka Rissanen
ed7b370213 net: Set buffer user data pointer correctly when receiving packet
The buf->data was incorrectly set.

Change-Id: I721a849a79ba9ba7d114cb1dfc7f853192c6807d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:22 -05:00
Jukka Rissanen
7f77a6774d net: contiki: Added clarification for UDP packet reception
Added comment how UDP packet is handled when receiving it.

Change-Id: If1e10c5bde55cb2cf7a8928b0f1ec38dd6ab84b4
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:22 -05:00
Jukka Rissanen
04dfda8927 net: Fix the documentation of net_release()
Fixed the description of what happens if there is a timeout.

Change-Id: Id19a791193b527a8ee086f069e103f42d2d9b0f4
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:22 -05:00
Jukka Rissanen
c0f04fd599 net: apps: echo-client test application
The echo-client app will run in Zephyr and will send network
packets to host process (echo-server) via SLIP.

Change-Id: Icaf941ce883aec82136ef909db67e43ab6b981f7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:22 -05:00
Jukka Rissanen
0ee55d73af net: tools: Add echo-server test application
This echo-server app is run in the host side. It will
connect to Zephyr via UART using SLIP. The app will
listen data in socket 4242 and will reverse the returned
bytes and send them back to the sender. The application
supports both IPv4 and IPv6 protocols and it will also
listen multicast packets sent to it.

Change-Id: Icf0805794a16842e70fbb5e8a3f843a3782e1968
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:22 -05:00
Jukka Rissanen
e6d1925a96 net: Make sure Contiki will not remove received packet
We must not touch uip_len(buf) value as Contiki IP stack
will use it to determine what it should do with the
received packet. So after we have received the packet,
we update separate datalen variable in net_buf that will
store the correct length of the packet.

Change-Id: Iab79b741508e95e581d1727645e6b1d1eacded4c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:22 -05:00
Jukka Rissanen
d3b0d1afdf net: Clear only desired network context when releasing it
We were clearing too many contexts in net_context_put().

Change-Id: Ie65fc7d4f3949cca4035bc459c0127179038bd85
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:22 -05:00
Jukka Rissanen
e1359ab16b net: Add timeout to net_receive function
Allow caller to specify a timeout in ticks while waiting
network data. The timeout value has following meaning:
  TICKS_UNLIMITED  wait forever
  TICKS_NONE       do not wait
  value > 0        timeout value (only applicaple if
                   CONFIG_NANO_TIMEOUTS is defined)

Change-Id: Icbb33fa0eeb462659d4006dd9d948a04f39a87a9
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:22 -05:00
Jukka Rissanen
0dc19ba88a net: Allow network buffer tweaking from Kconfig
User is able to tweak the number of network buffers via
Kconfig file. Default value of network buffers is 2.
Each buffer will occupy 1280 bytes and can either hold
received or sent IPv6 or IPv4 packet.

Change-Id: I81c099bc5d97972ec9cc1cae775f891f8b8f887c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:22 -05:00
Jukka Rissanen
1d7caf6b52 net: Add debug print when receiving a buffer in rx queue
Useful in order to see what is going on in the stack.

Change-Id: I9fa7d12d836d449b253a0339c70bb25f471059df
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:22 -05:00
Jukka Rissanen
d9e2a98a9b net: UDP packet reply callback was losing net_buf
UDP reply handler was not freeing net_buf properly if the
context was not passed properly to the callback. This
happened because the callback user data pointer was having
incorrect value.

Change-Id: Idfefd37b29674129252aa8f903fa9fe55de191cb
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:22 -05:00
Jukka Rissanen
20aa77ce6f net: Network buffers could be lost when sending packets
When sending data to network, make sure to check the return
code from network driver. The driver should return these codes:
 0 : If packet could not be sent. In this case buf should
     not be released.
 1 : If the packet was sent successfully. In this case the buf
     should be released by either the send() or some other
     lower layer function.
 <0: If there is an error, the buf should not be released by
     send() function.

Fixed the relevant part in Contiki code so that the tcpip_output()
return correct value
  0 = packet was not sent, caller needs to free it
  1 = packet was sent, network driver will free the net_buf
      after sending it to medium

Change-Id: I4380d7747985fc057f5ef73ca97b76f6e9888a55
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:22 -05:00
Jukka Rissanen
65ce2d8be1 net: contiki: Improve UDP connection matching debug prints
Make the debug prints a bit more useful by printing also
the relevant IP addresses.

Change-Id: I2029f7a7bc5e888d184467dee19802af9621e36e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:22 -05:00
Luiz Augusto von Dentz
c9b3116c5b Bluetooth: Add offset support to btshell gatt-write command
This adds offset to gatt-write which can be used as following:

btshell> gatt-write 0011 0001 01
bt: gatt_prepare_write (0x0010f680): handle 0x0011 offset 1 len 1
Write pending
btshell> bt: bt_att_recv (0x00111918): Received ATT code 0x17 len 6
bt: att_handle_prepare_write_rsp (0x00111918):
bt: att_prepare_write_rsp (0x00111918): err 0x00
bt: gatt_exec_write (0x00111918):
bt: bt_att_recv (0x00111918): Received ATT code 0x19 len 1
bt: att_handle_exec_write_rsp (0x00111918):
bt: att_write_rsp (0x00111918): err 0x00
Write complete: err 0

Change-Id: I4d3c038ea572da92efe0de8ce426ffca15506440
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:15:22 -05:00
Luiz Augusto von Dentz
0636edfdd7 Bluetooth: GATT: Add offset to bt_gatt_write
This enables writing from offset using Prepare Write + Execute Write
procedures including Long Write procedure when the data is bigger than
the MTU.

Change-Id: Id35d66c011ba582a4ba92ffe75444226e479335a
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:15:22 -05:00
Luiz Augusto von Dentz
752315a082 Bluetooth: ATT: Add bt_att_get_mtu
This can be used to check what is the configured MTU for the given
connection.

Change-Id: I292b06dbe079fbd567cd8d39615cfbc3dad6b2a5
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:15:22 -05:00
Luiz Augusto von Dentz
2ee7df52f4 Bluetooth: ATT: Handle Execute Write response
This adds the callback necessary to parse Execute Write response PDU:

< ACL Data TX: Handle 3585 flags 0x00 dlen 6
      ATT: Execute Write Request (0x18) len 1
        Flags: Immediately write all pending values (0x01)
> ACL Data RX: Handle 3585 flags 0x02 dlen 5
      ATT: Execute Write Response (0x19) len 0

Change-Id: Ida1f73021097628bd5e60faa007441db9b92a38d
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:15:22 -05:00
Luiz Augusto von Dentz
fb0f86fd2b Bluetooth: ATT: Handle Prepare Write response
This adds the callback necessary to parse Prepare Write response PDU:

< ACL Data TX: Handle 3585 flags 0x00 dlen 10
      ATT: Prepare Write Request (0x16) len 5
        Handle: 0x0011
        Offset: 0x0001
          Data: 01
> ACL Data RX: Handle 3585 flags 0x02 dlen 10
      ATT: Prepare Write Response (0x17) len 5
        Handle: 0x0011
        Offset: 0x0001
          Data: 01

Change-Id: Iaa16ec1477f25a2ebdfbefa5c0056aa3177c930c
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:15:22 -05:00
Peter Mitsis
e2a0c4f2f9 Add "Sample Output:" section to profiler_sample README.txt
Sample project README.txt files are supposed to follow a particular format
AND have a "Sample Output:" section.

Change-Id: I91fff1057e56bc222ab82d680018a673e19e479d
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:21 -05:00