Commit Graph

310 Commits

Author SHA1 Message Date
Krzysztof Kopyściński e8a42b4fd1 host/mesh: Increase default CDB node count
The old default of 1 makes provisioner devices useless, as they can only
provision themselves before they run out of space.

This is port of f2579cb3f26bde3050306401de9cd2837c94024f
2021-11-10 06:24:00 +01:00
Hauke Petersen 4fd03df543 npl/riot: map nrf52_clock_hfxo_request/release()
Compiling the hal_timer abstractions requires
nrf52_clock_hfxo_request() and _release() functions to be available.
This commit maps the appropriate RIOT functions in the NPL layer.
2021-10-22 11:32:49 +02:00
Hauke Petersen 70021b6dd8 npl/riot: update syscfg/syscfg.h 2021-10-22 11:32:49 +02:00
Szymon Janc 4ed4f9e381 mesh: Fix linux port
It looks like create_free_list() in glue.c requires word aligned
blocks which on 64-bit is 8 bytes.
2021-10-08 13:57:29 +02:00
Szymon Janc 17f985ff00 porting: Fix typo in linux blemesh sample 2021-10-01 09:02:42 +02:00
Hauke Petersen 891a0c9496 npl/riot: simplify ble_npl_hw_is_in_critical()
Recently the RIOT IRQ API was extended to support irq_is_enabled(),
so time to switch away from the hacked implementation of
ble_npl_hw_is_in_critical().
2021-09-14 11:11:24 +02:00
Francisco Molina 7d3f3cc6af porting/nimble/src/nimble_port: riot initializes timers 2021-09-09 13:28:42 +02:00
Francisco Molina 9d3383b5eb porting/npl/riot: add namespaced syscfg symlink 2021-09-09 13:23:28 +02:00
Avamander c337666a34 Removed an illogical check from npl_freertos_callout_reset 2021-06-30 10:12:34 +02:00
Xiang Xiao cd8ab38c3d nuttx: fix error: use of undeclared identifier 'ENOMEM'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-05-20 10:39:16 +02:00
Krzysztof Kopyściński 4ad4395d7c ble_sm: add Secure Connections Only mode
Added mode allowing to enforce pairing only in SC mode 1 level 4. This mode is required to pass
GAP/SEC/SEM/BI testcases. Added BLE_SM_SC_LVL config to allow pairing only in selected levels.
2021-05-06 13:20:06 +02:00
Hauke Petersen 940cc0b4a8 npl/riot: rework to use RIOTs ztimer
ztimer is a new high-level timer API in RIOT that was introcuced a
while ago to be the successor of xtimer. This commit reworks the
RIOT NPL implementation to use ztimer instead of xtimer. This
simplifies the NPL implementation and it allows for significant
energy savings.
For the xtimer switch the implemenation further switches from
RIOTs `posix_semaphore` module to the slimmer `sema` module, as the
prior indirectly pulls in xtimer as dependency.
2021-04-15 11:25:05 +02:00
Szymon Janc dd7ebf179f porting: Fix mempool initialization
This fix crash on init due to changes in mmepool init after recent
sync with core.
2021-04-12 11:02:11 +02:00
Hauke Petersen 4fae6e1ab7 npl/riot: enable BLE_HCI_VS in default config 2021-03-29 13:54:31 +02:00
Hauke Petersen f8158661ed porting/nimble/hal_timer: fix NVIC setup
In commit ab53154 platform specific handling of the NVIC setup
for the timers priority and vectors were revertet. This leads
to problems on certain platforms, e.g. interrupt priority
related hard-faults on RIOT. This commit re-introduces the
platform specific setup.
2021-02-23 13:22:58 +01:00
Krzysztof Kopyściński 3caae6474c porting: fix "cast from pointer to integer of different size" error
Changed direct casting of pointer to uint32_t to (uint32_t)(uintptr_t).
2021-02-19 09:49:43 +01:00
Krzysztof Kopyściński 0aa3fe6d51 porting: fix typo in CROSS_COMPILE 2021-02-17 14:45:44 +01:00
Krzysztof Kopyściński ab53154c1c nimble/porting: sync with core
Synchronization of state with core repository.
2021-02-16 07:07:37 +01:00
Matias N 7b5b5e5b51 nuttx: fix callout mechanism
SIGEV_THREAD on NuttX currently has a limitation where the thread
is not really a child of original process so it is not possible to
interact with the open POSIX queue. This is addressed by having a
specific thread wait for a condition variable which is triggered
from the handler.
2021-02-04 17:57:51 +01:00
Matias N f25b1de0d3 nuttx example: generate random address 2021-02-04 17:57:51 +01:00
Krzysztof Kopyściński 5bcfd162e7 mesh: fix cdb.c conflicts when BLE_MESH_CDB is disabled 2021-01-12 14:05:19 +01:00
Krzysztof Kopyściński 011dbfda65 mesh: Encapsulate feature config
Moves mesh feature configuration to a separate module, deprecating the
bt_mesh_cfg_srv structure. The initial values for the features should
now be enabled through KConfig, where new config entries have been added
for each feature.

This removes the upward dependency on the config server from the core
stack, and makes the config server a pure frontend for the configuration
states, as all spec mandated behavior around the feature states is now
encapsulated.

this is port of ad2fd44d7ad915e66765ba17ce53d4c5829a0efb
2021-01-12 14:05:19 +01:00
Krzysztof Kopyściński c06a03adfc mesh: Move heartbeat to separate module
Encapsulates the Heartbeat state and functionality in a separate
heartbeat module, removing all manipulation of the heartbeat state from
the transport and config server modules.

this is port of 0dc9e5cd9695e4ab403bf13f4d51d84de6a5ebb9
2021-01-12 14:05:19 +01:00
Krzysztof Kopyściński 044f08b117 mesh: split prov.c into two separate modules
Currently all provisioning procedure into common source
files call `prov.c`, that will not compile separately.

Add `BT_MESH_NODE` to control whether nodes are supported
and device provisioning is supported, this will be used in
provisioner role.

Add more provisioner OOB authentication method.

this is port of 5374245dd66e630932267663546d5f1108aff9b5 with patch
0bcd66ac36d8c02d2c3b3851c4086e8b692578a6
2021-01-12 14:05:19 +01:00
Krzysztof Kopyściński 7ad5d4d8cb mesh: Isolate cryptographic material
This is a major refactoring of the handling of the cryptographic
material of both the network and transport layers. The aim is to
encapsulate the key object manipulation, and improve overall modularity.

Pulls Applications and Subnets out of the bt_mesh and into separate
modules, with static storage types on the data. This has several
side-effects:
- The Config Server no longer operates directly on the bt_mesh.subs and
  bt_mesh.apps lists, but goes through a public configuration interface,
  following the pattern set in #27908.
- All iteration through the keys is done through iteration APIs
- Key resolution on RX and TX is centralized.
- Changes to the keys triggers events the other modules can register
  handlers for.
- Friendship credentials are stored in the lpn and friend structures.

this is port of eca014115287bdb8a8a57355514fbd5e1d27b75b
2021-01-12 14:05:19 +01:00
Krzysztof Kopyściński baf1549bc8 mesh: Change the default value to syscfg
Move default value of segment retransmit and timeout value
to syscfg.

this is port of 4acfd5f6aff7d77ee4c5eec218864ec9693d2b7c
2021-01-12 14:05:19 +01:00
Krzysztof Kopyściński 78f95c5b7f mesh: replace zephyr integer types with C99 types
this is port of a1b77fd589dbe7284c17b029f251426a724abd47
2021-01-12 14:05:19 +01:00
Krzysztof Kopyściński 97279150a1 mesh: Move Replay Protect to seperate module
Move RPL to seperate module, and remove it in bt_mesh
structure.

this is port of 2a6b1bab93fbfa31f7469b351ca0d84934cb0966
2021-01-12 14:05:19 +01:00
Krzysztof Kopyściński 27cb1c9411 mesh: Network loopback
Changes the local network interface to exclusively handle packets for
the local interface, duplicating the buffers in the process.

The loopback mechanism now operates its own packet pool for the local
interface queue. The loopback is moved ahead of encryption, allowing the
local interface packets to go back up the stack without network crypto,
saving a full round of encrypt/decrypt for self-send.

Packets for group addresses the local node subscribes to are now
duplicated, with one unencrypted variant going into the network
queue, and the network bound packets following the regular path to the
advertiser.

Introduces one new configuration for setting the number of loopback
buffers.

this is port of 9bd58062b9fc8272f2950a343bbcef6f3f79f481
and caa9dc7c032f8bfb96f3a6ea20618dd57e0b009f
2021-01-12 14:05:19 +01:00
Krzysztof Kopyściński bfe7f21053 mesh: Add Option config unprov beacon interval
1 Add Option to specifies the second interval when device
send Unprovisioned Beacon.

2 Move BT_MESH_LPN_SUB_ALL_NODES_ADDR to LPN subgroup.

this is port of 81fc15c4d64aab5f73f8d6ab755fa9688dd67734,
c86966719fef7564e7350cae5f0f2ab843f70eaa and
72315cf01e69ec2df802c6417f100a3777cd0345
2021-01-12 14:05:19 +01:00
Krzysztof Kopyściński 6b6c67eebf mesh: Slab based segmentation handling
Allocates segmented message buffers as slabs in a common pool for RX and
TX. This reduces memory requirements for both TX and RX, as TX messages
can be stored without the network and advertising buffer overhead, and
RX can use only the slabs it needs, instead of allocating a full size
segmented message. This approach also removes the need for decrypting
the segments for each retransmission, reducing overall processing load.

Slab based segmentation for tx also introduces queuing of segmented
messages, which allows the application layer to send multiple messages
to the same destination without violating Bluetooth Mesh specification
v1.0.1, section 3.6.4.1. This mechanism is provided through a flag that
blocks segmented messages to a destination which a message is already
being sent to until the previous message finishes.

This changes the SDU size configuration to a symmetrical
RX_SEG_MAX/TX_SEG_MAX pair of configurations, plus a new segment pool
side configuration. It also removes the binding between the TX_SEG_MAX
config and the advertising buffers, reducing the minimum advertising
buffer count from 6 to 3.

this is port of 901b5b2b2b0a33f5426f621277e7238e8b83740b and
7443c1bd3ded598b56db3c931614072098af84e1
2021-01-12 14:05:19 +01:00
Krzysztof Kopyściński 0b1e0d72a8 mesh: Add database for managing nodes and keys
Refactor the handling of network nodes and their keys into a separate
Mesh Configuration Database (CDB). This, not only creates a separation
of the local node and the other nodes, but also makes it possible to
implement functions to manage the whole, or at least parts of the mesh
network.

this is port of 29291bfe9ef5af4e6b7ae630812922f668fd0668
2021-01-12 14:05:19 +01:00
Matias N c14c47bb68 add support for NuttX 2020-12-17 18:37:20 +01:00
Hauke Petersen cd6da7f680 porting: cleanup porting_init()
- code simplification
- add some more comments
- call ble_hci_ram_init() before ble_ll_init() to make sure the
  buffers are intialized before they are potentially used
2020-06-29 16:46:22 +02:00
Hauke Petersen d4d4fd88e0 porting: rm store_ram_init from nimble_port_run()
The ble_store_ram module is (i) deprecated and (ii) nowhere used in the
NimBLE code base, hence there is no need to intialize it.
2020-06-26 12:26:57 +02:00
Hauke Petersen 5aa31b5569 npl/riot: regenerate syscfg.h 2020-06-10 09:49:48 +02:00
Hauke Petersen 2803eb5f1c npl/riot: change dflt value for BLE_ACL_BUF_COUNT 2020-06-10 09:49:48 +02:00
Michał Narajowski f434b3f0e2 porting: Update generated configuration files 2020-06-09 10:31:22 +02:00
Michał Narajowski c1597ec775 porting: Update targets and updating script
We need to update pkg names to represent at path to the targets.
Also update the update_generated_files.sh script to
refer to the targets using a path. This is required
after recent change to Newt.
2020-06-09 10:31:22 +02:00
Andrzej Kaczmarek f0adf2de7f nimble/ll: Add common setting for SCA
Currently we have two separate SCA settings: actual SCA as ppm value and
enumerated one based on ranges of SCA value. This means user needs to
update both values and they ideally should be in sync.

To make our life easier, we can just have single BLE_LL_SCA setting to
provide ppm value and enumerated one can be easily determined at build
time.
2020-04-22 09:43:32 +02:00
Łukasz Rymanowski 1a57236fde nimble/l2cap: Add support for Enhanced LE CoC
This patch adds initial support for enhanced LE CoC.
For now we allow for MTU reconfiguration as it bilongs to the
application.
We do not allow for MPS reconfiguration, as it is assumed that MPS
is always used the biggest possible.
However that might change as we start PTS testing.

Some of the initial verification has been done with PTS

To enable feture BLE_L2CAP_ENHANCED_COC shall be enabled along with
BLE_VERSION >= 52 and non zero BLE_L2CAP_COC_MAX_NUM
2020-03-07 01:09:21 +01:00
Michał Narajowski bb3de036fb porting: Add a script to automatically update generated files
Updating these files requires some manual work so no one is actually
doing it when they add new features. This script may improve this
situation or at least serve as a documentation of this "feature".
2020-02-27 16:20:48 +01:00
Hauke Petersen 2b03b2cc4c npl/riot: update generated syscfg.h 2020-02-20 08:53:24 +01:00
Hauke Petersen 99f162e769 npl/riot: disable SM in default configuration 2020-02-19 10:36:37 +01:00
Koen Zandberg 310d6ac586 npl/riot: Prevent overflow issues in timer glue 2020-02-14 16:25:00 +01:00
Koen Zandberg 6f66890c1d npl/riot: Use RIOT conversion defines 2020-02-14 16:25:00 +01:00
Hauke Petersen 37245d0c3f npl/riot: adapt to xtimer API change 2020-01-13 16:26:59 +01:00
Michał Narajowski c5553d776d porting/linux_blemesh: Add new configs 2020-01-08 14:34:58 +01:00
Michał Narajowski 3a2f0dab95 nimble/mesh: Add support for log modules
This PR adds support for various log modules which is possible
thanks to modlog feature. With this feature we can specify
a logging level for each module separately which could have the
following advantages:

- Being able to filter out only the logs that we are interested in at
  the moment
- Controlling log level in runtime
- Improved readability if we start printing module name in log header
- Ability to use color-coded log messages by mapping module to a
  specific color
2019-11-26 09:51:50 +01:00
Michał Narajowski f5cd0b32d3 porting: Update syscfg.h and other artifacts 2019-11-20 14:46:09 +01:00