Commit graph

7273 commits

Author SHA1 Message Date
Vinayak Kariappa Chettimada 97355e4799 Bluetooth: controller: split: Fix for missing Aux PDU
Fix missing Auxiliary PDU when primary PDU is calculating
the offset. Schedule the auxiliary PDU ticker before primary
PDU ticker is scheduled.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 23ef75f6d9 Bluetooth: controller: split: Fix Low Latency Prepare Done
Fix the Low Latency Prepare Done that disables ULL_LOW
context executions inside a radio event, so that
ticker_job_idle_get is invoked from ULL_LOW instead of LLL
context so that its enqueued alongwith others scheduled
in ULL_LOW. This is avoid premature disable of ULL_LOW
context executions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada e9bee3b070 Bluetooth: controller: split: Updated HCI BT_INFO of scanned PDU
Updated HCI BT_INFO of printing the parsed extended PDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 45231fd071 Bluetooth: controller: split: Fix missing enh conn complete HCI event
When Privacy is not supported in the build and Advertising
Extensions is enabled, HCI LE Enhanced Connection Complete
event was missing. This is fixed now.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada fa91a80f28 Bluetooth: controller: split: Port openisa files
Port OpenISA LLL files to reflect some of the changes done
in Nordic LLL.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada e51167b787 Bluetooth: controller: split: Fix to stop preempt ticker
Fixed premature abort of events due to stale preempt ticker
expiry.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 4702d9cead Bluetooth: controller: split: Minor refactor return variable
Minor refactor return variable name and fix return value
type.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada ef97208eeb Bluetooth: controller: split: Fix DID increment
Fix missing DID increment when AD data changed to zero len.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada cc2cb6a347 Bluetooth: controller: split: Fix incorrect adv_addr type
Fix incorrect adv_addr type in auxiliary PDU when address
is removed from primary and added to auxiliary PDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada e099cfd6d7 Bluetooth: controller: split: Add correct aux scan ticks slot
Implemented the missing ticks_slot calculation for the
auxiliary channel PDU scanning window.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada cb3024fe86 Bluetooth: controller: split: Fix slave HCTO calculation
Fix missing sleep clock accuracy related jitter in the
header complete timeout calculation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 746ffdc194 Bluetooth: controller: split: Add Extended Scanning window widening
Added implementation to calculate the window widening for
the reception of auxiliary PDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada e9c80f8534 Bluetooth: controller: split: Initial extended scanning code
Initial extended scanning code added.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 6a86307ad4 Bluetooth: controller: split: Abort auxiliary LLL if aux_ptr missing
Abort Auxiliary LLL prepare if current primary PDU is
missing the aux_ptr.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 29f26bac24 Bluetooth: controller: split: Schedule auxiliary after primary PDU
Fix to avoid a crash due to missing aux_ptr in current
primary PDU constructed by LE Set Extended Advertising
Parameter Set, while aux_ptr was populated by LE Set
Extended Advertising Data Set in the latest double buffered
PDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 9a82f38435 Bluetooth: controller: split: Fix extended event properties changes
Added implementation to handle updates to adv mode and event
properties of an already created advertising set.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 6c2bccfb09 Bluetooth: controller: split: Refactor PKT_US for Adv. Ext. use
Refactor the PKT_US for reuse with Extended Scanning.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada e0bd57901f Bluetooth: controller: split: Use uint8_t for advertising handles
Refactor to use uint8_t for advertising handles.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada d6cc180168 Bluetooth: controller: Fix collision resolution for single-shot ticker
Fix collision resolution to consider single-shot ticker,
current single-shot with ticks_slot as older that a next
periodic or single-shot ticker with ticks_slot.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 35d9933597 Bluetooth: controller: Fix single-short ticker operation failure
Fix ticker to correctly generate the operation callback if
single-shot ticker fails to be scheduled and does not
expire.

As the collision resolution is deferred to the worker, if
a single-shot ticker is cancelled, then appropriately call
the operation callback with failure status. This is allow
the user to take necessary actions, like release resources
allocated that need to be release on the failure to schedule
the single-shot ticker expiry.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada ba9b065c13 Bluetooth: controller: split: Move PKT_US into pdu.h
Move the definition of PKT_US into pdu.h so that it can be used
by Advertising Extensions implementations too.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 5d6c4a6cb5 Bluetooth: controller: split: Refactor node_rx_ftr
Remove us_radio_rdy field in the footer structure as its always
a constant value which can be obtained using a functional
interface to HAL.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 0681c80573 Bluetooth: controller: Fix to use advertiser random address
Fix legacy advertising started using Extended Advertising
sets to use the set advertising random address.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada c89c94f940 Bluetooth: controller: split: Workaround succeed on zero len scan rsp set
Added a workaround to succeed setting a zero length Extended
Scan Response Data.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 3527778c41 Bluetooth: controller: split: Fix extended scan param set
Fix missing reset of phy struct member for scan set that is
not being enabled by use of LE Extended Scan Parameter Set
command.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 281fa4c4a9 Bluetooth: controller: split: Allow set rand addr when using ext cmds
Allow use of HCI LE Set Random Address cmd when advertising
is enabled using Extended Advertising commands.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada eb102d7822 Bluetooth: controller: split: Fix missing coded PHY scanning
Fix, use phy variable instead of type to determine if
scanning on Coded PHY is to be enabled.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada a40b1e9212 Bluetooth: controller: hci: Integrate LE Ext. Create Connection
Integrate the support for HCI LE Extended Create Connection.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada a74276e1bd Bluetooth: controller: split: Added LE Ext. Create Connection
Added implementation of LE Extended Create Connection.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada b87cae97bb Bluetooth: controller: split: Add generate of ext adv legacy report
Added implementation to generate LE Extended Advertising
Report for received legacy PDUs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada d9523c5005 Bluetooth: controller: split: SCAN_RSP for ADV_IND or SCAN_IND
Added implementation to differentiate SCAN_RSP received for
ADV_IND or SCAN_IND PDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 60a117c6ca Bluetooth: controller: split: Add the missing enable of dup filtering
Add implementation to enable duplicate filtering for extended
scanning.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 24e3fd521e Bluetooth: controller: split: Fix missing reset of scanner state
Fix missing reset of scanner state which could cause a
spurious SCAN_RSP packet without a prior SCAN_REQ being sent
to be reported.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 608063b3ec Bluetooth: controller: hci: Indent BT_INFO of extended header
Indent when logging out the field value of common extended
advertising header format.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 561354dde2 Bluetooth: controller: hci: Integrate Adv Extensions commands
Integrate Advertising Extensions related Extended Advertising
and Extended Scan HCI commands.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada e941e72092 Bluetooth: controller: split: Added Extended Scan Support
Updated implementation to support Extended Scan Parameters
and Extended Scan Enable.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 6b17eb2291 Bluetooth: controller: split: Added Adv Random Address set
Added implementation to set advertising random address.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada b0dd599db1 Bluetooth: controller: split: Support legacy AD/SR data
Added implementation to support setting of legacy
Advertising Data and Scan Response Data using Extended
Advertising Data set functions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada f84ebf4869 Bluetooth: controller: split: Differentiate extended ll_adv_params_set
Differentiate call to ll_adv_params_set, whether used by
legacy LE Set Advertising Parameters or LE Set Extended
Advertising Parameters.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 179b213fce Bluetooth: controller: split: use CONFIG_BT_CTLR_ADV_SET
Use CONFIG_BT_CTLR_ADV_SET instead of derived BT_CTLR_ADV_SET.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 594e12139b Bluetooth: controller: split: Use uint8_t for scan handles
Use uint8_t for scan set handles.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 5db91100bc Bluetooth: controller: split: Enable Adv Extensions
Enable Advertising Extensions features in the controller
when enabled in the Host in combined host+controller based
applications.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada c8b050ee77 Bluetooth: controller: split: cond compile Ext Adv without Aux chan
Conditional compile Extended Advertising without Auxiliary
channel PDU use.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 46299e71cc Bluetooth: controller: split: Fix uninitialized variable use error
Fix for compiler complaining of uninitialized variable use.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 55cebf0eaa Bluetooth: controller: split: handle latency for cancelled sync events
Update implementation of periodic advertiser's LLL to
correctly handle event counter values when latencies
introduced due to sync events cancelled by active events
operating in unreserved time space.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada b3190cf24c Bluetooth: controller: split: handle latency for cancelled conn events
Update implementation of master and slave LLL's to correctly
handle event counter values when latencies introduced due to
connection events cancelled by active events operating in
unreserved time space.

When an active radio event extends into unreserved time
space, and a connection event prepare is scheduled but at
the time of pre-emption timeout if the connection event is
cancelled then the event count and latencies needs to be
continiued to get acummulated.

In the current controller usecases the above scenarios does
not get exercised, the changes in this commit is needed for
future roles that can extend into unreserved time space and
would cancel a scheduled connection event.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada b348b7fa28 Bluetooth: controller: split: Fix cond. complile of periodic adv
Fix conditional compilation of advertising extensions and
periodic advertising do that platforms with not support in
their LLL can be built without advertising extensions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada de3d4a3a64 Bluetooth: controller: split: Fix piggy back implementation
Fix conditional compilation of piggy back implementation.
This code should be deleted once periodic advertising
implementation is complete.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 4d79d43db1 Bluetooth: controller: split: Implement Aux Sets
Implement use of configurable Auxiliary advertising sets.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 59f2bb1337 Bluetooth: controller: split: Fix to use correct secondary PHY
Fix using correct secondary PHY for auxiliary PDUs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 18e916b22e Bluetooth: controller: split: Handle SyncInfo in Aux Data set
Handle using existing SyncInfo when updating Aux PDU AD Data.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada a43c3be2b9 Bluetooth: controller: split: Added SyncInfo into Aux Packet
Added SyncInfo population in Aux packet.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada a126850c15 Bluetooth: controller: split: Use correct secondary PHY, AA and CRC
Implement use of correct secondary PHY for transmission,
access address and CRC setup.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 1773274118 Bluetooth: controller: split: Moved chan map helper functions
Moved Channel Map helper functions into separate file.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 5c512d6e9a Bluetooth: controller: Move access address helper to util.c
Move the access address helper function to util.c file.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada bb720d68ce Bluetooth: controller: split: Refactor to reuse common ISR code
Refactor to reuse common repeated code in ISR that reset
status, and performed abort, done and cleanup.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 5949205315 Bluetooth: controller: split: Add periodic adv LLL implementation
Add LLL implementation to perform periodic advertising.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 3eac6c3a52 Bluetooth: controller: split: Add periodic adv ULL implementation
Add ULL implementation to perform periodic advertising.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 5ebbac32d9 Bluetooth: controller: split: Fill bdaddr in aux packet
Fill the bdaddr on advertising enable in the aux packet.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 0b99773037 Bluetooth: controller: Minor refactor of SyncInfo structure
Minor refactor of SyncInfo structure field names.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada be3dd3687b Bluetooth: controller: split: non-conn non-scan with aux packets
Added implementation to advertise non-connectable
non-scannable advertising with auxiliary packets.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 365774da7c Bluetooth: controller: Move Adv Ext interface to ll interface
Move Advertising Extensions interface to LL interface header
file.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada fdd91bb116 Bluetooth: controller: split: Add AuxPtr to ADV_EXT_IND PDU
Add implementation to support ADV_EXT_IND PDU with AuxPtr.
Changes in this commit only prepares the ADV_EXT_IND PDU
in the primary channel.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada eec42ca522 Bluetooth: controller: split: Added le_set_ext_adv_param interface
Added le_set_ext_adv_param functional interface to integrate
HCI with controller's functional interface.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 5f1301245c Bluetooth: shell: Updated advx command to use Adv Data Set
Updated the shell commands related to Advertising Extensions
to call the LE Set Extended Advertising Data command
functional interface for testing purposes.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 505fdadef2 Bluetooth: controller: split: Add Adv. Ext. HCI debug informations
Added debug information print outs in HCI code related to
Advertising Extensions events.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada c4b6fd0248 Bluetooth: controller: nRF5x: Introduce sw_switch_cleanup function
Refactor and introduce hal_radio_sw_switch_cleanup interface.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 12:22:29 +02:00
Flavio Ceolin 77bc3815af mgmt: fs: Add security warning
Add a warning in fs mgmt option about security risks.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-06-12 11:15:24 +02:00
Vinayak Kariappa Chettimada 428799295d Bluetooth: controller: Add support for nRF5340 debug pins
Add support for Bluetooth Controller GPIO Debug Pins for
nRF5340 PDK board. GPIO Pin toggling can be captured on the
P3 pinhead of the PDK.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 11:13:39 +02:00
Lingao Meng 7239dc1cbd Bluetooth: Mesh: Add key-value concept to store model data
Previous mode store function only can store single data,
change this to store as KV model, let's app-layer to manager
model data, other than by stack when node reset.

Signed-off-by: Lingao Meng <mengabc1086@gmail.com>
2020-06-12 11:09:11 +02:00
Kumar Gala 59708769ea net: lwm2m: Remove deprecated functions
Remove deprecated functions that have been marked deprecated since
Zephyr 2.0.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-11 15:50:48 +03:00
Robert Lubos 7f9b85e8c3 net: openthread: Fix u16_t usage
PR #25936 introduced u16_t type usage and was merged after the type
transition in Zephyr.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-06-10 19:24:20 -04:00
Xavier Chapron 57db336b98 dfu: flash_img: Constify flash_img_buffered_write() data parameter
The data passed has no reason to be changed and can therefore be passed
as read only.

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2020-06-10 09:30:08 +02:00
Gerson Fernando Budke ebe5345e87 net: lwm2m: Refactor to use coap_get_option_int
Small clean-up to use coap_get_option_int.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-06-09 21:25:11 +03:00
Gerson Fernando Budke 1ca95e7bc4 net: coap: Rem macros that uses coap_get_option_int
Clean up and remove macros that uses coap_get_option_int.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-06-09 21:25:11 +03:00
Gerson Fernando Budke 76e32ba32b net: coap: Add coap_get_option_int public method
Any CoAP implementation when use at least block transfer or is a server
side need access some CoAP options as integer values. This add a method
at public interface and defines for block wise operations to avoid code
useless code duplication.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-06-09 21:25:11 +03:00
Emil Gydesen 299ef2e5fe cpp: Fixed compile warning with extern array declaration
The extern array declaration of size 0 gives a warning when
compiling with GCC. Updated to use [] rather than [0].

Signed-off-by: Emil Gydesen <emil_gydesen@bose.com>
2020-06-09 14:42:16 +02:00
Emil Gydesen adc5fab141 shell: Fixed compile warning with extern array declaration
The extern array declaration of size 0 gives a warning when
compiling with GCC. Updated to use [] rather than [0].

Signed-off-by: Emil Gydesen <emil_gydesen@bose.com>
2020-06-09 14:42:16 +02:00
Markus Becker 2291de6abf subsys/fs/littlefs: initialize LittleFS at POST_KERNEL
Initialize LittleFS at POST_KERNEL and not at APPLICATION stage.

When using LittleFS as settings backend for OpenThread, LittleFS needs
to be available when net_init is performed.

Arguably, FS is an OS kernel component that should be ready when
applications are starting.

Possibly, the same change should be applied to FAT fs as well.

Signed-off-by: Markus Becker <markus.becker@tridonic.com>
2020-06-09 13:48:34 +02:00
Vinayak Kariappa Chettimada d96a1a5fef Bluetooth: controller: split: Fix endianness in ull_sched
Use sys_put_le16 and sys_get_le16 in populating PDU with
offset values.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-09 10:43:58 +02:00
Vinayak Kariappa Chettimada 6dce205b95 Bluetooth: controller: split: Port advanced scheduling
Port advanced scheduling implementation from legacy
controller.

This implementation schedules
- non-overlapping scan window when there are simulataneous
central connections active
- central connection establishment with similar connection
intervals be placed in a non-overlapping  group, temporally
- connection parameter request with calculated window offset
hints to have non-overlapping BLE radio events.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-09 10:43:58 +02:00
Vinayak Kariappa Chettimada 0b6664fc3d Bluetooth: controller: split: Add function to reset conn upd mutex
Add a function to reset the variable holding the connection
context of the currently active Connection Parameter Request
Procedure.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-09 10:43:58 +02:00
Vinayak Kariappa Chettimada da95c08977 USB: Bluetooth: Fix rx_thread_stack size
Increase rx_thread_stack size to follow BT_HCI_TX_STACK_SIZE
value defined by the Bluetooth subsystem.

Below, thread 0x20000d28, the hci_rx_thread earlier had 512
bytes which could be insufficient under edge cases like an
interrupt being asserted at the deepest stack usage.

Logging output as part of update to stack size:
<inf> thread_analyzer: Thread analyze:
<inf> thread_analyzer:  workqueue           : unused 648 usage 376 /
	1024 (36 %)
<inf> thread_analyzer:  thread_analyzer     : unused 264 usage 248 /
	512 (48 %)
<inf> thread_analyzer:  0x20000e30          : unused 280 usage 232 /
	512 (45 %)
<inf> thread_analyzer:  0x20000d28          : unused 584 usage 440 /
	1024 (42 %)
<inf> thread_analyzer:  BT RX               : unused 320 usage 192 /
	512 (37 %)
<inf> thread_analyzer:  BT RX pri           : unused 284 usage 164 /
	448 (36 %)
<inf> thread_analyzer:  sysworkq            : unused 824 usage 200 /
	1024 (19 %)
<inf> thread_analyzer:  logging             : unused 200 usage 568 /
	768 (73 %)
<inf> thread_analyzer:  idle 00             : unused 272 usage 48 /
	320 (15 %)

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-09 10:43:35 +02:00
Lukasz Maciejonczyk ff8b864f48 net: openthread: Make OT thread priority class be configurable
It add an option to configure openthread thread priority class
by the application if there is a such need.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2020-06-09 11:00:17 +03:00
Andrew Boie 5d1ce47ef6 net: sockets: fix zsock_gethostname_ctx()
The SET_ERRNO() macro does nothing if a positive value is provided
to it, and the functions were not returning -1 or setting errno
as expected.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-09 10:58:02 +03:00
Andrew Boie 71d4aeb1c2 net: sockets: set errno EBADF on bad fd
APIs were returning -1 without setting errno if the file
descriptor looked up a null object or there was no function
installed in the vtable. Set to EBADF for this case.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-09 10:58:02 +03:00
Lukasz Maciejonczyk 3fa2fa9a50 net: openthread: Fix the order of adding net pkt in ot_receive_handler
Net pkt is added into the ot net list after queued net pkt into
the net_rx which bases on it. It affects in losting net pkt when for
instance ot thread is preemptive.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2020-06-09 10:57:00 +03:00
Lukasz Majewski 0e32a84bcc net: eth: Add check if passed iface pointer is NULL
The eth_stats_update_errors_rx() implicitly assumes that passed pointer
to struct net_if is not NULL.

This is not true for MCUX's eth_rx() (in eth_mcux.c), where we can
execute eth_stats_update_errors_rx() after net_recv_data() returning
-EINVAL because of passed NULL iface pointer.

This change fixes this problem with adding extra check on iface not
being NULL before it is dereferenced.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2020-06-09 10:54:29 +03:00
Jukka Rissanen 043400ce89 net: context: Remove obsolete goto in net_context_put()
Some cleanup earlier left unnecessary goto. Cleaning the code
and removing it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-06-09 10:21:47 +03:00
Christian Taedcke 768968a445 net: ipv6: Also look for nexthop in nbr list
This change fixes routing for routes when the nexthop is a link-local
address of a connected peer.

The issue was that nexthop was correctly set from the routes, but the
code did not detect that the nexthop address (link local of the pc on
ppp interface) was on the ppp interface, because
net_if_ipv6_addr_onlink() only evaluated the network prefix and not
any other information (like the nbr list).

Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
2020-06-09 10:19:42 +03:00
Lukasz Majewski 38d38ed90a net: shell: Allow to set interface for ping (add -I option)
This change adds new, optional switch to 'net ping' command - to
be more specific the '-I <iface index>', where the <iface index>
is the number of supported network interface.

One can discover this number from the Zephyr shell after running
'net iface'.

The default interface stays the same - just the switch is added to
override the used interface for 'net ping' invocation.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2020-06-09 10:10:23 +03:00
Xavier Naveira 0fd16f8b78 net: mqtt: Make client "cleansession" flag configurable.
Cleansession is hardcoded to 1 but some use case might require 0
to make the sessions persistent (ie get messages sent while the
client was offline)

Signed-off-by: Xavier Naveira <xnaveira@gmail.com>
2020-06-09 10:09:04 +03:00
Michael Hope ff50ca1974 fs: nvs: fail on >= 256 B block sizes
The current code truncates the size_t block size to a u8_t, which
causes a 256 or 512 byte block size to be truncated to zero and
passing the size check.

Check as a size_t then truncate once the check passes.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-06-08 23:03:21 -04:00
Vinayak Kariappa Chettimada 3cabacce9a Bluetooth: controller: Address nRF5340 Engineering A Errata 16
Address the nRF5340 Engineering A Errata 16, RADIO: POWER
register is not functional.

This affects the dependency of controller's HAL
implementation that expected correct reset values being
set in the Radio peripheral.

As the SUBSCRIBE_TXEN and SUBSCRIBE_RXEN where not in their
reset value, Radio transmission and reception start using
DPPI was broken.

Fixes #25942.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-08 22:04:25 +02:00
Eduardo Montoya 75a69b940e net: openthread: cli: Align config of OT and Zephyr shell max cmd size
This PR enables the user to configure the maximum command length for
OpenThread's CLI using Zephyr's shell, which is currently fixed to
256 characteres. This limitation was not enough for certain allowed
OpenThread commands, like some variants of 'ot dataset mgmtsetcommand'.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2020-06-08 21:45:29 +03:00
Eduardo Montoya fc1d0635df net: l2: openthread: Add config option to enable OpenThread ref. device
This option enables specific features used by Thread Certification
reference devices.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2020-06-08 21:41:40 +03:00
Marcin Niestroj 747f20720a net: wifi: shell: store shell in context before scan
Right now shell pointer is not assigned before doing a scan, so scan
results are printed using printk(). Save shell instance in context, so
results are printed using shell_fprintf(), thus better aligned in the
console output.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-06-08 21:37:33 +03:00
Jukka Rissanen 2c66525b7b net: stats: Priority field was used instead of traffic class
The network statistics is stored for each traffic class, but the
collecting function was given net_pkt priority. The priority
must be first converted to traffic class and then the statistics
stored to correct place in the stats array.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-06-08 21:35:18 +03:00
Jukka Rissanen 43287d2323 net: socket: Add sendmsg() support to AF_PACKET
The AF_PACKET was missing support for sendmsg() socket call.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-06-08 21:34:35 +03:00
Markus Becker 2115b575a4 net: ieee802154: Allow to disable auto-start of 802.15.4 interfaces
Some radio drivers need configuration before start-up. Up to now only
the RF2XX drivers allowed this, but other radio drivers need this as
well. In particular for setting EUI64 addresses.

Signed-off-by: Markus Becker <markus.becker@tridonic.com>
2020-06-08 19:55:19 +03:00
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Robert Lubos 370dfe088f net: sockets: Fix socket ctx check in usermode
When `z_get_fd_obj_and_vtable()` function returns NULL (no valid entry
in the FD table for the socket), there is no need for further usermode
checks on the `ctx` pointer, as there is nothing to invalidate in that
case.

Fixes #25990
Fixes #25991

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-06-05 18:34:25 +02:00
Andrew Boie c951d71eba net: check permissions on net contexts
The original sockets system calls used file descriptors which
were actually net_context pointers. For all socket system calls,
any calls from user mode would check if the caller had permission
to use the net context.

This was later changed to not stuff net_context pointers into file
descriptors, but all the permission checking was unintentionally
lost, allowing all threads on the system to
read/write all socket file descriptors in the system at will, with
no way to isolate applications running on the same microcontroller
from each other's network activity.

This patch restores the permission checks on network context objects
for socket system calls that originated from user mode.

The call to z_object_recycle() was never removed from
zsock_socket_internal(); this is again leveraged to grant the
caller who opened the socket permission on the net_context
associated with the returned file descriptor.

To ensure that all socket calls do this checking, all uses of
z_get_fd_obj_and_vtable() have been routed through get_sock_vtable().

Objects have initialization state set and thread permissions
reset to just the caller in common zsock_socket() code.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-03 22:33:32 +02:00
Andrew Boie 8ea273b44a net: socketpair: fix user mode access
The socketpair file descriptor context objects are heap allocated
and not drawn from a static pool. Register these as kernel objects
when we create them if user mode is enabled.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-03 22:33:32 +02:00
Andrew Boie 9f63a0a0a0 net: lib: remove socket-specific recycle calls
This is just done in common code now.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-03 22:33:32 +02:00
Andrew Boie 04bba6772b net: sockets: add API to fetch an fd's ctx object
Zephyr running on MPU devices have a different memory model than
process-oriented OSes like Linux and require a method to set
kernel object permissions on a file descriptor's underlying
context object. Add this, and a test to show that it is working.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-03 22:33:32 +02:00
Andrew Boie fed960b94a net: tag net socket objects
Used for permission validation when accessing the associated file
descriptors from user mode.

There often get defined in implementation code, expand the search
to look in drivers/ and subsys/net/.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-03 22:33:32 +02:00
Kumar Gala ff29d306c9 net: tcp2: Fix compile failure on native_posix_64
Need to use %zd in formatter string for net_pkt_get_len since it returns
a size_t otherwise we get something like:

	error: format ‘%d’ expects argument of type ‘int’, but argument
	3 has type ‘size_t’ {aka ‘long unsigned int’} [-Werror=format=]

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-03 22:29:16 +02:00
Jukka Rissanen a2f0a9effe net: sockets: Fix sendmsg() user mode param checks for aux data
If we are calling sendmsg() without any aux data, then msg_controllen
is 0 and msg_control is NULL. Check these allowed values properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-06-03 18:33:59 +02:00
Jukka Rissanen d3dde1ad1c net: sockets: Fix sendmsg() user mode param checks for dst address
If we are calling sendmsg() for a connected socket, then msg_namelen
is 0 and msg_name is NULL. Check these allowed values properly.

Also modify unit tests so that we test this scenario.

Fixes #25925

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-06-03 18:33:59 +02:00
Christopher Friedt 2715357e63 net: socket: socketpair: initialize after NULL check
Fixes #25788
Coverity-CID: 210581

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-06-03 18:33:19 +02:00
Christopher Friedt 195a536073 net: socket: socketpair: remove dead code
In this, case is_nonblock is false and will_block is true.
Therefore, we *may* block, and furthermore we *expect* to
block. Checking is_nonblock is, in fact, redundant, and
passing K_FOREVER to k_sem_take() is justified.

Fixes #25727
Coverity-CID: 210611

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-06-03 18:33:19 +02:00
Marcin Niestroj 62b985409e shell: fix showing 'command not found'
After recent changes to shell, there is no more "no_such_command:
command not found" message when executing non-existing command. Restore
that message, so users are warned once again about wrong command,
instead of silently ignoring their request.

Fixes: 512de5ecac ("shell: Refactor command execution to enable raw
  arguments")
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-06-03 10:23:24 +02:00
Robert Lubos bc5b05f223 modules: mbedtls: Add Kconfig entry for MBEDTLS_MD and MBEDTLS_CIPHER
Due to new checks in mbedTLS config sanitizer, TLS option can no longer
be left enabled, when TLS is not used. OpenThread needs MBEDTLS_MD_C
and MBEDTLS_CIPHER_C even without TLS being used, so we need an option
to enable them manually.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-06-02 15:24:36 +02:00
Jukka Rissanen 35f4ffb186 net: sockets: Add sendmsg() parameter verification
If run in usermode, the sendmsg() parameters were not verified.

Fixes #25702

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-06-02 15:22:47 +02:00
Oleg Zhurakivskyy cbea5c81bb net: tcp2: Fix pointer to local outside scope in th_get()
Fix pointer to local outside scope in th_get().

Coverity CID :209942

Fixes #25779

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-06-01 14:59:54 +02:00
Jim Luther ffd15131d2 bluetooth: host: fix unpacked l2cap struct
The bt_l2cap_le_conn_rsp struct in l2cap_internal.h has not been
declared __packed. This can cause alignment problems on some
platforms if the struct is placed on an unaligned address.

A __packed declaration solves this issue by forcing the compiler to
use store instructions that do not required alignment.

Signed-off-by: Jim Luther <jilu@oticon.com>
2020-05-29 17:43:32 +02:00
Vinayak Kariappa Chettimada ba487feb0f Bluetooth: controller: split: Workaround nRF52832 CCM overrun
Implemented an intermediate decrypt buffer to cover the CCM
overrun under CRC error conditions. The workaround is
applicable to nRF52832 SoC only, which is missing the
MAXPACKETSIZE register in the NRF_CCM peripheral.

Fixes #21107 for nRF52832 SoC.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-05-29 13:12:28 +02:00
Jukka Rissanen bc40177020 net: ipv6: RA prefix option length not checked
The Router Advertisement can have prefix option. It's length
is 4 but the code did not check that which meant that we could
accept malformed packet. See RFC 4861 chapter 4.6.2 for details.

Fixes #25694

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-29 13:11:48 +02:00
Jukka Rissanen 71686dde4b net: ipv6: Do not add same prefix multiple times to timer list
Make sure that we do not add same IPv6 prefix, received from RA,
multiple times to prefix timer list. This avoids possible
denial-of-service issue if we receive suitably crafted RA packet.

Fixes #25698

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-28 17:49:03 +02:00
Andrew Fernandes 4653b4e63f logging: set 'log_backend_rtt:panic_mode' before 'log_backend_std_panic'
Set 'log_backend_rtt:panic_mode' before calling 'log_backend_std_panic',
because otherwise the RTT backend behaves as if the system is NOT
panicking and tries to do asynchronous writes via RTT_LOCK/UNLOCK.

Signed-Off-By: Andrew Fernandes <andrew@fernandes.org>
2020-05-28 11:45:42 +02:00
Trond Einar Snekvik a385873336 Bluetooth: Mesh: Fail init on model init error
Adds propagation of error returns from the model init callbacks in
Access, and removing any other checks for successful init in the
foundation models.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-05-27 18:45:18 +02:00
Vinayak Kariappa Chettimada cd7a73c20a Bluetooth: controller: split: Fix NRF_CCM overrun
Fix missing assignment of NRF_CCM->MAXPACKETSIZE register
for PDU sizes smaller than 251 bytes. If there is CRC errors
causing PDU length fields to be higher than configured PDU
buffer sizes in the controller, without the MAXPACKETSIZE
register set to correct PDU size, CCM module could overrun
the PDU buffer and cause memory corruption. This fix is
applicable for all nRF52 Series SoCs except nRF52832 SoC.

Fixes #21107.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-05-27 18:06:17 +02:00
Tomasz Bursztyka d2a139ee9b power: Let's have core device setup in case of CONFIG_NET_TEST
This will be useful to test network stack's power management support.
There is no other way to do it, so far, but to hardcode such config
option test there.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-26 21:41:00 +02:00
Andrzej Puzdrowski 06827ecd14 storage/stream: fix possible unaligned write on buffer flush
On buffer flush request it is very probably that write buffer
contains amount of data which is non write-block-size aligned.
Flash memory need to be write at minimal by write-block-size chunks.
This patch addresses mechanism which ensure such behavior by adding
missing bytes.

fixes #25471

streamer buffer size should be multiple write-block-size of
the flash device in order to avoid unaligned flash write
request.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-05-26 16:35:19 +02:00
Andries Kruithof 3a91f35893 Bluetooth: controller: split: include proper header file
After removal of legacy controller ll_adv_aux.h does not exist anymore.
This is fixed in this PR by including ull_adv_aux.h instead.
The error only shows up when Advertisement Extensions are enabled
in the LL (CONFIG_BT_CTLR_ADV_EXT=y)

Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
2020-05-26 15:28:12 +02:00
chao an 2f15e3901a Bluetooth: Mesh: correct the return type
CC:  mesh/access.c
mesh/access.c: In function 'model_has_dst':
mesh/access.c:483:10:
	warning: returning 'u16_t *' {aka 'short unsigned int *'} from
	a function with return type '_Bool8' {aka 'unsigned char'} makes
	integer from pointer without a cast [-Wint-conversion]
  483 |   return bt_mesh_model_find_group(&mod, dst);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: chao an <anchao@xiaomi.com>
2020-05-26 14:36:40 +02:00
chao an bb5ce8ae30 Bluetooth: Mesh: fix shadow declare
CC:  mesh/adv.c
mesh/adv.c: In function 'bt_mesh_scan_cb':
mesh/adv.c:247:13: warning: declaration of 'adv_type'
                   shadows a global declaration [-Wshadow]
  247 |        u8_t adv_type, struct net_buf_simple *buf)
      |        ~~~~~^~~~~~~~
mesh/adv.c:58:19: note: shadowed declaration is here
   58 | static const u8_t adv_type[] = {
      |                   ^~~~~~~~

CC:  mesh/prov.c
mesh/prov.c: In function 'bt_mesh_prov_enable':
mesh/prov.c:1203:30: warning: declaration of 'prov'
                     shadows a global declaration [-Wshadow]
 1203 |   const struct bt_mesh_prov *prov = bt_mesh_prov_get();
      |                              ^~~~
mesh/prov.c:129:35: note: shadowed declaration is here
  129 | static const struct bt_mesh_prov *prov;
      |                                   ^~~~

Signed-off-by: chao an <anchao@xiaomi.com>
2020-05-26 14:36:40 +02:00
Andries Kruithof 6a2f50aba2 Bluetooth: controller: split: Update feature exchange to BTCore V5.0
The existing feature exchange procedure does not give the proper
response as specified in the BT core spec 5.0.
The old behaviour is that the feature-response returns the logical and
of the features for both peers.
The behaviour implemented here is that the feature-response returns the
featureset of the peer, except for octet 0 which is the logical and of
the supported features.
Tested by using the bt shell, and having different featuresets
on the 2 peers.

This fixes #25483

Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
2020-05-26 14:34:39 +02:00
Eduardo Montoya dd1a71f0c4 net: config: align Kconfig debug levels with OpenThread ones
OpenThread moved from 4 to 5 debug levels and it was not possible
to configure all of them with Kconfig.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2020-05-25 20:41:42 +02:00
Henrik Brix Andersen 4e4139cf9e canbus: canopen: program: add missing include for FLASH_AREA
Add missing include after the conversion from DT_FLASH_AREA to
FLASH_AREA.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-25 13:26:28 +02:00
Oleg Zhurakivskyy 6096efb3da net: tcp2: Implement the retransmission for the outgoing data
In order to support the retransmission for the outgoing data:

1. The outgoing data packet is appended to the send_data queue
   in net_tcp_queue_data().

2. tcp_send_queued_data() is called and will use tcp_send_data()
   to sends queued but unsent data packet by packet
   until there's an unsent data and the receiver's window isn't full.

   tcp_send_queued_data() subscribes send_data_timer
   that will handle retrasmissions with tcp_resend_data().

3. tcp_send_data() peeks a single chunk of data from the send_data
   queue that will not exceed the maximum segment size
   until the the receiver's window is full.

   tcp_send_data() uses conn->seq and conn->unack_len as the sequence
   number for the TCP packet.

   conn->unacked_len is advanced on each send.

4. On data acknowledgment:

   - acknowledged amount of data is removed from the beginning
     of the send_data queue
   - conn->seq is advanced by the acknowledged amount
   - conn->unacked_len is decremented by the acknowledged amount
   - send_data_timer is cancelled
   - tcp_send_queued_data() is called to send queued but
     prevoiusly unsent data

5. On timeout, tcp_resend_data() will reset conn->unack_len,
   peek one packet from the beginning of the send_queue and resend,
   terminating the connection on retries exceeded.

   Meanwhile the outgoing data tcp_send_queued_data() is just
   appended to the send_data but not sent.

   In case of the acknowledgement, tcp_send_queued_data() will
   start sending multiple packets until the receiver's window
   is full.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-05-25 12:42:22 +02:00
Oleg Zhurakivskyy f779678ff4 net: tcp2: Add send_data queue into the TCP connection
In order to support the retransmission for the outgoind data,
add the following into the TCP connection:

- struct net_pkt *send_data (used as a queue)
- send_data_total
- unack_len
- send_data_timer
- send_data_retries

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-05-25 12:42:22 +02:00
Oleg Zhurakivskyy 58b7847afb net: tcp2: Extract the MSS from the TCP option value
Extract the maximum segment size (MSS) from the TCP option value.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-05-25 12:42:22 +02:00
Oleg Zhurakivskyy 9efdbe19dd net: tcp2: Add send_win into the TCP connection
In order to support the send window, add send_win into
the TCP connection.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-05-25 12:42:22 +02:00
Oleg Zhurakivskyy 5b54daea36 net: tcp2: Refactor tcp_out()
In order to support the data retransmission, refactor tcp_out()
into tcp_out_ext() which supports passing the sequence number.

In addition drop modifications of the connection sequence number
from tcp_out_ext(), this is the responsibility of data retransmission.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-05-25 12:42:22 +02:00
Oleg Zhurakivskyy 762b0aeb5a net: tcp2: Update tcp_pkt_alloc() macros
In order to use struct net_pkt for the outgoing data queue,
update tcp_pkt_alloc() macros, so they support allocation
without buffer.

Additionally, merge tcp_pkt_alloc() macros macros into one.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-05-25 12:42:22 +02:00
Oleg Zhurakivskyy aac4261e73 net: tcp2: Handle the packet clone failure
Handle the packet clone failure in tcp_send_process() and
terminate the connection.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-05-25 12:42:22 +02:00
Oleg Zhurakivskyy 13bcfc165a net: tcp2: Handle the packet clone error in tcp_data_get()
Unsuccessfull packet clone in tcp_data_get() isn't handled,
add an error handling and don't ACK the incoming data in this case.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-05-25 12:42:22 +02:00
Oleg Zhurakivskyy d65e654766 net: tcp2: Update the sequence compare on peer resend
In order to handle sequence overflow cases, use
net_tcp_seq_greater() to check if the sequence is greater/lower.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-05-25 12:42:22 +02:00
Oleg Zhurakivskyy 42ef3861d4 net: tcp2: Randomize the initial sequence number
The initial sequence number for a connection should be randomized
to prevent easy guesses.

Do not randomize the sequence number if network test or
test protocol is enabled.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-05-25 12:42:22 +02:00
Oleg Zhurakivskyy 502842297e net: tcp2: Eliminate/remove extra prototypes
To improve readability, eliminate/remove extra prototypes.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-05-25 12:42:22 +02:00
Erwan Gouriou 2716cbcaa6 drivers: susbsys: Check errors on devices selected using dt macro
Some Kconfig defined devices may be defined using dt_chosen_label
function. Since there is no way to ensure a device enabled in dts
is also defined in Kconfig, it may happen that instance is not
actually defined.
In this case device_get_binding might return 0, leading to undefined
behavior in the function that calls it.
When not already done, systematically check return of function
device_get_binding on devices defined through dt_chosen_label macro.
Trigger ASSERT when required and return error when possible.

Fixes #20068

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-05-25 11:43:14 +02:00
François Delawarde 24729bb7c6 bluetooth: host: fix wrong bt/cf settings loading
This commits fixes the loading of bt/cf settings into memory. Only data
was loaded and not the address.

Signed-off-by: François Delawarde <fnde@demant.com>
2020-05-23 22:42:25 +02:00
Peter Bigot d99aa367f6 power: device: adapt to new behavior for devices with nop pm ctrl
For backwards compatibility ignore not-supported errors for devices
that don't support power management.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-21 20:32:12 +02:00
Marek Pieta 775b2457d7 settings_fcb: Fix storing the data
Change fixes storing the data by adding missing write retry after
the last compression. Without the change error was returned instead
of retrying.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2020-05-21 17:42:20 +02:00
Joel Westerberg b2da4e24cb tracing: cpu_stats: add missing macro
add missing macro K_MSEC() for CONFIG_TRACING_CPU_STATS_INTERVAL

Signed-off-by: Joel Westerberg <joel@teenage.engineering>
2020-05-21 11:01:50 +02:00
chao an 32e6347f42 Bluetooth: host: foreach bond only SMP is enabled
build breakage if SMP is disabled

In function `bt_unpair':
bluetooth/host/hci_core.c:2640: undefined reference to `bt_foreach_bond'

Signed-off-by: chao an <anchao@xiaomi.com>
2020-05-20 15:36:10 +02:00
Christopher Friedt 6161ea2542 net: socket: socketpair: mitigate possible race condition
There was a possible race condition between sock_is_nonblock()
and k_sem_take() in spair_read() and spair_write() that was
mitigated.

Also clarified some of the conditional branching in those
functions.

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-05-20 10:34:07 +02:00
Johan Hedberg a7f3875134 debug: Fix BOOT_TIME_MEASUREMENT dependencies
The boot time measurement can also run with the HPET timer so there's
no reason to restrict it to APIC.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2020-05-19 17:25:36 +02:00
Jukka Rissanen dd516650d3 net: context: log_strup() missing from AF_PACKET bind() call
The link address was not printed correctly as log_strdup() was
missing from the debug print.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-19 14:48:08 +02:00
Trond Einar Snekvik 4a2e56d42a Bluetooth: Mesh: Transport tx fields overflow
The transport segmented TX nack and seg_pending fields must be at least
6 bits to avoid overflow for 32 segment messages. This change rearranges
the seg_tx fields to gather all state flag fields in one byte, while
making the counter fields whole bytes.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-05-19 14:44:51 +02:00
Vinayak Kariappa Chettimada 122c43562e Bluetooth: controller: split: Fix slave latency cancel race
Fix missing transmit buffer demutiplexing before checking if
slave latency needs to be maintained or cancelled.

This bug was detected when new transmit buffer was enqueued
overlapping with on-air radio transmission of empty PDU
preceding the handling of radio event done.

Symptoms of this bug being data transmission latency of upto
slave latency plus one times connection interval.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-05-15 17:07:33 +02:00
Trond Einar Snekvik e1c6ea9241 Bluetooth: Mesh: Transport tx seg_o overflow
Increases the transport segmentented tx seg_o counter to 6 bits to avoid
overflow when sending 32 segments. The check in the send loop would
previously never be false, which causes segments to repeat
unnecessarily.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-05-15 17:04:45 +02:00
Trond Einar Snekvik 0aeba0eb12 Bluetooth: Mesh: Transport seg with few adv bufs
Fixes bug where the transport segmented tx would decrement the attempt
counter every time it ran out of buffers. If transport ran out of
buffers 4 times before the sending could complete, the transfer would
end prematurely.

Moves the attempt decrement to only execute when all segments have been
sent.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-05-15 17:04:24 +02:00
Trond Einar Snekvik 266e3f27da Bluetooth: Mesh: Friend with unknown appkey
Ensures that friend messages are enqueued, even if the packet is
received with an appkey is unknown to the friend. Previously, sdu_recv
would return EINVAL if the appkey was unknown, which would prevent the
lower transport layer from adding the packet to the friend queue. This
is irrelevant for the logic in lower transport, and should not be
returned as an error.

Fixes #24014.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-05-15 17:04:07 +02:00
Luiz Augusto von Dentz ef25b864e2 Bluetooth: hci_core: Fix invalid if LE Read PHY
If LE Read PHY fails the code was still trying to parse the buffer as a
valid response.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-05-15 11:29:41 +03:00
Joakim Andersson a1b8cc2671 Bluetooth: host: Fix extended advertiser address with privacy disabled
Fix extended advertiser not using correct set random address command
to set private (NRPA) address when privacy feature has been disabled.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-13 21:23:20 +02:00
Kumar Gala ff579a3af3 flash: Convert DT_FLASH_AREA to FLASH_AREA macros
Convert with a combo of scripts and by hand fixups:

git grep -l DT_FLASH_AREA_.*_ID | \
 xargs sed -i -r 's/DT_FLASH_AREA_(.*)_ID/FLASH_AREA_ID(\L\1)/'

git grep -l DT_FLASH_AREA_.*_OFFSET | \
 xargs sed -i -r 's/DT_FLASH_AREA_(.*)_OFFSET/FLASH_AREA_OFFSET(\L\1)/'

git grep -l DT_FLASH_AREA_.*_SIZE | \
 xargs sed -i -r 's/DT_FLASH_AREA_(.*)_SIZE/FLASH_AREA_SIZE(\L\1)/'

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-13 21:22:53 +02:00
Kumar Gala 7310eb9e4a storage: flash_map_default: Convert to new dts macros
Convert to use new DTS macros to populate default flash map

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-13 21:22:53 +02:00
Martí Bolívar 6e8775ff84 devicetree: remove DT_HAS_NODE_STATUS_OKAY
Several reviewers agreed that DT_HAS_NODE_STATUS_OKAY(...) was an
undesirable API for the following reasons:

- it's inconsistent with the rest of the DT_NODE_HAS_FOO names
- DT_NODE_HAS_FOO_BAR_BAZ(node) was agreed upon as a shorthand
  for macros which are equivalent to
  DT_NODE_HAS_FOO(node) && DT_NODE_HAS_BAR(node) &&
- DT_NODE_HAS_BAZ(node), and DT_HAS_NODE_STATUS_OKAY is an odd duck
- DT_NODE_HAS_STATUS(..., okay) was viewed as more readable anyway
- it is seen as a somewhat aesthetically challenged name

Replace all users with DT_NODE_HAS_STATUS(..., okay), which is
semantically equivalent.

This is mostly done with sed, but a few remaining cases were done by
hand, along with whitespace, docs, and comment changes. These special
cases include the Nordic SOC static assert files.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-13 18:24:42 +02:00
Simon Glass 4b2c413e13 subsys/testsuite: Shorten the assertion messages
At present these can be very long since they include the full path of
the filename with the error.

    Assertion failed at /home/sglass/cosarm/zephry/zephyrproject/
	zephyr/tests/drivers/flash_simulator/src/main.c:102:
	test_write_read: (0 not equal to rc)

Reduce the length by omitting the current directory (where the tests
are being run) from the output:

    Assertion failed at tests/drivers/flash_simulator/src/main.c:102:
	test_write_read: (0 not equal to rc)

This improves usability for people running tests locally.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-13 16:23:39 +02:00
Krzysztof Chruscinski 1fb61ea01e shell: Move default terminal width and height to Kconfig
Default values were fixed in the code. Moved to Kconfig to allow
customized configuration. Custom configuration may be used to prevent
line breaking injected on terminal width.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-05-13 11:28:41 +02:00
Joakim Andersson 831ffcd4c2 Bluetooth: host: Fix Service Changed not cleared from flash
Fix Service Changed configuration stored in flash not deleted in flash
when calling bt_gatt_clear from bt_unpair.
When clearing the check for "is bonded" should not be made. If the
bond information is already removed this check will fail.
When clearing the check for "modified" should not be made, clearing
is in itself a modification, and should always be made.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-12 21:00:58 +03:00
Joakim Andersson 6de4294aed Bluetooth: host: Fix CCC cfg not cleared when overwriting oldest bond
Fix CCC cfg not cleared when overwriting oldest bond. Calling
bt_unpair with a pointer to the key will result in the key addr being
memset to zero and bt_gatt_clear is called with an zero-set address.
This happens because unpair (hci_core.c) calls bt_keys_clear before
calling bt_gatt_clear.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-12 21:00:58 +03:00
Emil Obalski 0c9331993f usb: dt: Update USB audio class to recent changes in DT
This commit updates USB audio class implementation with
DT changes introduced in 7e0eed9235. In particular rename
DT_NUM_INST to DT_NUM_INST_STATUS_OKAY.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-05-12 17:18:14 +02:00
Jukka Rissanen d940a813b1 net: lldp: Write LLDPDU data to pkt correctly
Make sure that net_pkt_write() sets the LLDPDU data correctly
in net_pkt.

Fixes #25184

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-11 17:11:23 +02:00
Christopher Friedt 3bfc765aad tests: socket: socketpair: tests for socketpair(2) syscall
Tests for issue #24366

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-05-10 17:46:43 +02:00
Christopher Friedt 09f957c47a net: socket: syscall for socketpair(2)
Working:

* non-blocking reads / writes
* blocking reads / writes
* send(2) / recv(2) / sendto(2) / recvfrom(2) / sendmsg(2)
* select(2)
* poll(2)

Fixes #24366

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-05-10 17:46:43 +02:00
Alexey Brodkin bf981135a0 OpenOCD: Make incompatible with SMP
In case of SMP (i.e. multiple execution units processing
the same list of tasks) we cannot use the same data structures for
getting data about active tasks as with just one processor (UP).

So until explicit support of SMP is added make sure we don't allow
to select both OPENOCD & SMP simultaneously.

Moreover starting from
commit a203d21962 ("kernel: remove legacy fields in _kernel")
this will lead to build-time error if MP_NUM_CPUS > 1.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2020-05-10 16:18:27 +02:00
Peter A. Bigot cca0b79c27 Bluetooth: host: fix warning on unused function
get_phy is referenced by BT_EXT_ADV only when BT_OBSERVER is also
selected.  Avoid defined-but-not-used warnings in that situation.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-05-10 11:07:35 +03:00
Xavier Chapron e5aaf21a73 subsys: Replace printf by printk when applicable
Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2020-05-09 21:25:33 +02:00
Tomasz Bursztyka 97326c0445 device: Fix structure attributes access
Since struct devconfig was merged earlier into struct device, let's fix
accessing config_info, name, ... attributes everywhere via:

grep -rlZ 'dev->config->' | xargs -0 sed -i 's/dev->config->/dev->/g'

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Tomasz Bursztyka 8d7bb8ffd8 device: Refactor device structures
When the device driver model got introduced, there were no concept of
SYS_INIT() which can be seen as software service. These were introduced
afterwards and reusing the device infrastructure for simplicity.
However, it meant to allocate a bit too much for something that only
required an initialization function to be called at right time.

Thus refactoring the devices structures relevantly:
- introducing struct init_entry which is a generic init end-point
- struct deviceconfig is removed and struct device owns everything now.
- SYS_INIT() generates only a struct init_entry via calling
  INIT_ENTRY_DEFINE()
- DEVICE_AND_API_INIT() generates a struct device and calls
  INIT_ENTRY_DEFINE()
- init objects sections are in ROM
- device objects sections are in RAM (but will end up in ROM once they
  will be 'constified')

It also generate a tiny memory gain on both ROM and RAM, which is nice.

Perhaps kernel/device.c could be renamed to something more relevant.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Wentong Wu ab8392fb8f logging: syst: enable protocol timestamp in SyS-T message
Enable protocol timestamp in SyS-T message.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2020-05-08 17:47:30 +02:00
Wentong Wu 450f21ff42 logging: syst: enable length field for SyS-T message
Enable generation of length field for SyS-T message.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2020-05-08 17:47:30 +02:00
Wentong Wu c3f38db5cb logging: add syst initialization code to zephyr tree
Add syst initialization code to zephyr tree.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2020-05-08 17:47:30 +02:00
Andrew Boie a203d21962 kernel: remove legacy fields in _kernel
UP should just use _kernel.cpus[0].

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-05-08 17:42:49 +02:00
Emil Obalski 8d2f13c203 usb: Add USB audio implementation
By this commit USB audio class implementation is introduced
to Zephyr.

The Zephyr USB audio device class follows bellow
documentations:

- Universal Serial Bus specification rev2.0 (usb20.pdf)
- Universal Serial Bus Device Class Definition for Audio Devices
  (audio10.pdf)
- Universal Serial Bus Device Class Definition for Audio Data Formats
  (frmts10.pdf)
- Universal Serial Bus Device Class Definition for Terminal Types
  (termt10.pdf)

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-05-08 15:12:27 +02:00
Emil Obalski 38aea280e7 usb: Sync receiving data from ISO OUT endpoint with SOF
This commit adds support for receiveing data from ISO OUT endpoint
for NRF devices. NRF USB IP core does not generate IRQ when
data are received on ISO OUT endpoint and it must be synchronized
with SOF event.

Enable SOF handling by default if usb audio is configured
with NRF devices.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-05-08 15:12:27 +02:00
Emil Obalski 98c9cebfac usb: Add Audio class related files
This commit adds files related to USB audio device class.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-05-08 15:12:27 +02:00
Carles Cufi b67a31e411 Bluetooth: controller: Remove legacy LL
Remove the legacy Link Layer implementation.

Closes #24187.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-08 15:07:00 +02:00
Mieszko Mierunski f93924c689 bluetooth: Add bluetooth support for nRF52820
This commit adds support for bluetooth in nRF52820 SoC.
Bluetooth radio related files created and added to Zephyr.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2020-05-08 15:00:41 +02:00
Jukka Rissanen 601b972700 net: shell: Add command to print information about net_pkt
Print detailed information about a given net_pkt. This is
useful if there is a memory leak and you want to see more
detailed information about the data inside the buffer.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-08 13:24:42 +03:00
Stephanos Ioannidis aaf93205bb kconfig: Rename CONFIG_FP_SHARING to CONFIG_FPU_SHARING
This commit renames the Kconfig `FP_SHARING` symbol to `FPU_SHARING`,
since this symbol specifically refers to the hardware FPU sharing
support by means of FPU context preservation, and the "FP" prefix is
not fully descriptive of that; leaving room for ambiguity.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-05-08 10:58:33 +02:00
Henrik Brix Andersen bbc1928dd1 canbus: canopen: add program download support
Add program download (firmware update) support according to the CAN in
Automation (CiA) 302-3 draft standard proposal v4.1.0.

The implementation supports a Zephyr specific vendor command allowing
external confirmation of a newly booted firmware image. If this is not
desired, the application can confirm the image by other means.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-08 10:53:42 +02:00
Anthony Brandon 631cad428b disk: add stm32 sdmmc disk access driver
Add a disk access driver for the stm32 sdmmc component. The driver is
based around the stm32 cube HAL and uses the blocking API.

Signed-off-by: Anthony Brandon <anthony@amarulasolutions.com>
2020-05-08 10:53:10 +02:00
Bilal Wasim 54550c04eb net: qemu: Adding support for User Networking
Added support for Qemu User Networking and tested with
qemu_x86 model. The support is kept simple assuming that
the TAP interface will always be preferred for more
sophisticated / practical use cases.

QEMU User Networking is implemented using "slirp", which
provides a full TCP/IP stack within QEMU and uses that
stack to implement a virtual NAT'd network. As this
support is built into QEMU, it can be used with any model
and requires no admin privileges on the host machine,
unlike TAP.

Added documentation to facilitate the user.

Signed-off-by: Bilal Wasim <bilalwasim676@gmail.com>
2020-05-08 10:47:38 +02:00
Jukka Rissanen ad9f32a4e9 net: lldp: Sent LLDP packet was missing proper net_pkt type
The LLDP packet was created but its type was not set to LLDP
and was sent as ARP message.

Fixes #25084

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-08 11:43:00 +03:00
Robert Lubos 139da50e3c net: openthread: Allow to disable automatic network attachment
Add OpenThread configuration option, which allows to configure and start
OpenThread stack operation manually. This mode should be used in NCP
devices, as well as is needed for certification purposes, where
OpenTread stack have to be configured by the test framework and not
initialize and join the network on its own.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-05-08 10:44:27 +03:00
Jukka Rissanen 34b7a6c81c testsuite: Allow user to override minimal logging
The testsuite was always forcing minimal logging. This is problematic
as it does not allow user to see full logging string. Allow user to
override the minimal logging if needed, the default is still to
enable minimal logging.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-07 23:47:55 -05:00
Krzysztof Chruscinski 512de5ecac shell: Refactor command execution to enable raw arguments
Added special flag that can be used to indicate that optional
arguments are passed without any parsing (e.g. quotation marks
removal). Modified execute command to parse command line buffer
argument by argument.

After this change it is possible to forward whole command to
command handler (using select).

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-05-07 23:47:39 -05:00
Robert Lubos 3fa97df43c net: openthread: Update mbedTLS configuration
After the update, CMAC is also required when DTLS is not used.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-05-07 23:27:49 -05:00
Andrew Boie 1ff066548a ztest: end tests more robustly
If a ztest test case creates child thread(s), and one of the
descendent threads invokes ztest_test_pass(), ztest_test_fail(),
or ztest_thread_skip(), only that descendent thread will be
aborted.

Then ztest will try to run the next scenario on the ztest_thread
which is already in use. This was causing corruption issues on
SMP systems, and possibly other subtle, hard-to-debug
situations.

This patch ensures that ztest_thread is always dead before
re-using it, as run_test() now attempts to join on it instead
of using a semaphore.

The ztest_test_* functions now ensure that the ztest_thread
is always aborted, in addition to the current thread.

This isn't perfect. If the testcase spawned other threads,
they will keep running. The most robust way to fix this is to
iterate over all non-essential threads in the system and abort
them. Unfortunately, Zephyr doesn't have a facility to do
this safely.

It would also be simpler to re-use thread objects if
k_thread_create() could detect whether the thread was already
active and abort it, but this is currently not possible
since k_thread_create() can be used with uninitialzed
thread object memory and no checks are possible. This
may be improved in the future, see #23030.

Fixes: #22738
Partial fix for: #24713

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-05-07 19:21:16 -04:00
Joakim Andersson 21a42f3b67 Bluetooth: shell: Add phy handling to the shell
Add phy update callback and command to the shell.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-07 20:12:29 +02:00
Joakim Andersson 322f70243e Bluetooth: shell: Add data length handling in the shell
Add data length callback and command to the shell.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-07 20:12:29 +02:00
Joakim Andersson 0ccee9ba60 Bluetooth: host: Read current PHY when using extended advertising
When using extended advertising the connection can be established on
different PHY. In order to have an updated value of the current PHY
we need to read the PHY of the connection in the connection complete
event.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-07 20:12:29 +02:00
Joakim Andersson 6f0b8c1421 Bluetooth: host: Add application control of PHY change procedure
Add application control of initiating phy change procedure and it's
parameters.
The reasons for allowing the application control over the PHY:
 - Allow changing to Coded PHY.
 - Application may change PHY to react to changes in environment
   to balance throughput and range.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-07 20:12:29 +02:00
Joakim Andersson d9e228a4b0 Bluetooth: host: Add application control of data length procedure
Add application control of initiating data length procedure and it's
parameters.
The reasons for allowing the application control over the data length:
 - Bandwidth control adjusted based on number of active connections.
 - Changing data length before switching to coded phy.
 - Applying workarounds for interoperability problems.
 - Controlling order of ATT MTU and data length procedures.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-07 20:12:29 +02:00
Joakim Andersson 69dfcc6fca Bluetooth: host: Add Kconfig option for auto data length procedure
Add Kconfig option so that the application can disable automatic
initiation of the data length procedure. This is symmetric with the
PHY auto initiation kconfig option.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-07 20:12:29 +02:00