Commit Graph

3769 Commits

Author SHA1 Message Date
Fabio Utzig 4656a5a9c7 Add style ignored dirs
Signed-off-by: Fabio Utzig <utzig@apache.org>
2020-03-13 08:45:44 -03:00
Fabio Utzig 7a9ad883ac Add CI style checking
Signed-off-by: Fabio Utzig <utzig@apache.org>
2020-03-13 08:45:44 -03:00
Łukasz Rymanowski 56229549cf nimble/l2cap: Move proc initialization
Without that identifier was incorrectly set to 0
2020-03-12 14:03:45 +01:00
Łukasz Rymanowski 7bc2227df8 nimble/l2cap: Fix hs locking on reconfigure request 2020-03-12 14:03:45 +01:00
Łukasz Rymanowski f14bc9b6a0 nimble/l2cap: Fix possible memory leak 2020-03-12 14:03:45 +01:00
Prasad Alatkar 11f16a0ee2 nimble/host: Fix check for valid static random address 2020-03-09 12:04:44 +01:00
Łukasz Rymanowski 4931bbdccb btshell: Add better handling on stalled CoC 2020-03-07 01:09:21 +01:00
Łukasz Rymanowski 8a83364da0 btshell: Allow to set own L2CAP CoC MTU
We allow it in order to test L2CAP CoC reconfigure.

Note that it is not possible to set more than BTSHELL_COC_MTU.
2020-03-07 01:09:21 +01:00
Łukasz Rymanowski b7849bbbab btshell: Extend l2cap cli to support enhanced LE CoC 2020-03-07 01:09:21 +01: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
Łukasz Rymanowski 1fc7f44cf2 nimble/l2cap: Minor change to avoid confusion on MPS/MTU meaning 2020-03-07 01:09:21 +01:00
Łukasz Rymanowski 791e663654 nimble/test: Fix l2cap coc verification 2020-03-07 01:09:21 +01:00
Łukasz Rymanowski 01ac200e99 nimble/l2cap: Rename opcodes for LE CoC
Preparation to add new ones
2020-03-07 01:09:21 +01:00
Łukasz Rymanowski 3a1a6d3d13 nimble/l2cap: Change API to retrieve L2CAP channel info
Remove helpers which where used only by the test code (hopefully)
with nicer helper which gives us more info.
2020-03-07 01:09:21 +01:00
Łukasz Rymanowski 050c2b6598 nimble/l2cap: Redo defines to static inline 2020-03-07 01:09:21 +01:00
Łukasz Rymanowski 7f0a9c9503 nimble/l2cap: Disconnect CoC when too big SDU is sent by peer
This is to satisfy PTS and we actually planned to do so anyway.
2020-03-07 01:09:21 +01:00
Łukasz Rymanowski 531c49e31a nimble/l2cap: Fix searching channel by dcid
Source CIDs are ordered in the list, but dcid not, therefore when
searching by dcid we cannot assume the order.
2020-03-07 01:09:21 +01:00
Fabio Utzig e14ce24db3 Add unittest target
A recent newt change removed final-atom support
(https://github.com/apache/mynewt-newt/pull/381); this has a side-effect
that results in the "unittest" target not being found if is not located
in the repo where tests are being run (it does not search for "unittest"
inside @apache-mynewt-core anymore). So add the same "unittest" target
that already exists in @apache-mynewt-core repo here.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2020-03-06 10:41:08 -03:00
Andrzej Kaczmarek 01b91ea01d nimble/ll: Add some ll_sched GPIO debugging 2020-02-29 17:40:50 +01:00
Andrzej Kaczmarek 2fb31aa2d1 nimble/ll: Update ll_hci GPIO debug to new macros 2020-02-29 17:40:50 +01:00
Andrzej Kaczmarek 3e8f04da1c nimble/ll: Add GPIO debug macros 2020-02-29 17:40:50 +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
Andrzej Kaczmarek d7e9bb9b8d nimble/ll: Fix data length update from host
When host updates suggested data length we should also update values for
coded and uncoded PHYs since these values will be used when connection
is initialized. Otherwise we will basically disregard host suggestion
when PHY support is enabled (which we can do, but we do not want to).
2020-02-27 10:55:02 +01:00
Andrzej Kaczmarek 2621bf2d22 nimble/ll: Fix DTM TX scheduling
1st DTM packet does not take scheduler offset into account so actual
start time is before RFMGMT enable time and this apparantly makes things
go out of sync.

This also makes scheduling more intuitive as we keep track of TX start
time separately from scheduler item (as in advertising) so scheduler
start_time can be updated with scheduler offset in-place (as it is
already done) without risk that we use invalid value somewhere.
2020-02-26 11:51:06 +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
Szymon Janc f1f79af6cc nimble/btshell: Fix comment about default sync timeout 2020-02-14 13:11:28 +01:00
Szymon Janc 550526703d nimble/ll: Allow to fine tune scheduler when scanning
This allows to tune expected PDUs length when scheduling for auxilary
or sync PDUs.
2020-02-14 10:12:13 +01:00
Szymon Janc a3d81b7ae4 nimble/ll: Fix offset calculation in SyncInfo
If advertising event is interleaved by current periodic event offset
was calculated from that event, and not future event. This resulted
in sending SyncInfo with offset=0 which was causing random failures
on LL/DDI/ADV/BV-56-C qualification test.
2020-02-14 10:11:56 +01:00
Szymon Janc b8d107fb89 nimble/ll: Fix SCA in SyncInfo when transfering sync
SCA in SyncInfo should contain advertiser clock accuracy.
2020-02-10 11:31:14 +01:00
Szymon Janc de3521cec7 nimble/ll: Fix periodic sync transfer offset calculation
Make sure we always calculate offset from connection event before
periodic event.
2020-02-10 11:31:14 +01:00
Andrzej Kaczmarek 8a13cfe421 nimble/ll: Fix crash when scanning with privacy enabled 2020-02-06 14:37:58 -06:00
Andrzej Kaczmarek c905dcfcca nimble/ll: Fix PHY change on slave request
This fixes PHY switch in case slave tries to change from asymmetric to
symmetric PHY and the target PHY is one of currently used PHYs. The
issue is because we first calculate PHY change in both directions and
only then check if slave requested symmetric PHY. However, since either
m_to_s or s_to_m are already set to 0 (due to no change required), the
subseqent checks assume we should not change PHY in either direction.

The current behavior is technically correct, since master is always
allowed to leave PHY in both directions unchanged, but it's just dumb
since we should make a change assuming our PHY preference allows it.

To fix this we basically skip PHY calculation if we determined that
slave requested symmetric PHY and we can apply it in both directions.
If requested symmetric PHY cannot be applied in at least one direction,
we leave both directions unchanged. If there was no request for
symmetric PHY from slave, we calculated PHYs as usual.
2020-02-06 12:30:02 -06:00
Szymon Janc 3c9e302945 nimble/ll: Fix assert in extended scanner
It is possible that scheduler already fired and aux data is NULL so
we should unref it only if scheduler item was removed.

ble_ll_scan_aux_data_unref (aux_data=<optimized out>) at repos/apache-mynewt-nimble/nimble/controller/src/ble_ll_scan.c:1079
1079        BLE_LL_ASSERT(aux_data);
(gdb) bt
 #0  ble_ll_scan_aux_data_unref (aux_data=<optimized out>) at repos/apache-mynewt-nimble/nimble/controller/src/ble_ll_scan.c:1079
 #1  0x0001f732 in ble_ll_scan_rx_pkt_in_on_aux (pdu_type=<optimized out>, om=0x2000d6f8 <os_msys_1_data>, hdr=0x2000d710 <os_msys_1_data+24>, addrd=addrd@entry=0x20004ecc <g_ble_ll_stack+404>)
    at repos/apache-mynewt-nimble/nimble/controller/src/ble_ll_scan.c:3156
 #2  0x0002010e in ble_ll_scan_rx_pkt_in (ptype=ptype@entry=7 '\a', om=om@entry=0x2000d6f8 <os_msys_1_data>, hdr=hdr@entry=0x2000d710 <os_msys_1_data+24>)
    at repos/apache-mynewt-nimble/nimble/controller/src/ble_ll_scan.c:3198
 #3  0x0001299e in ble_ll_rx_pkt_in () at repos/apache-mynewt-nimble/nimble/controller/src/ble_ll.c:837
 #4  0x000129de in ble_ll_event_rx_pkt (ev=<optimized out>) at repos/apache-mynewt-nimble/nimble/controller/src/ble_ll.c:1164
 #5  0x00012830 in ble_npl_event_run (ev=<optimized out>) at repos/apache-mynewt-nimble/porting/npl/mynewt/include/nimble/nimble_npl_os.h:116
 #6  ble_ll_task (arg=<optimized out>) at repos/apache-mynewt-nimble/nimble/controller/src/ble_ll.c:1214
 #7  0x00038e9c in nrf52_clock_hfxo_release () at repos/apache-mynewt-core/hw/mcu/nordic/nrf52xxx/include/mcu/cortex_m4.h:37
 #8  0x00000000 in ?? ()
2020-02-04 23:26:48 +01:00
Szymon Janc 9b4ac9529b nimble/btshell: Use sane default for sync timeout 2020-02-04 17:23:17 +01:00
Szymon Janc 643eff996c nimble/ll: Fix SyncInfo units when no offset is provided
If periodic advertising event is too far in future to be represented
in SyncInfo, offset is set to 0 and units should also not be set.
2020-02-04 17:23:17 +01:00
Andrzej Kaczmarek 1c561c316f nimble/phy: Fix timings for LE Coded
e8f9ecca changed values for S2 and S8 phy modes. This did not affect LL
code since it was using symbols everywhere, however in nRF52 PHY timings
are indexed by raw values so LE Coded timings are now used incorrectly.

To avoid such issues in future, let's just index arrays with timings
using proper symbols.
2020-02-03 16:38:05 -06:00
Szymon Janc b7cbcd528c nimble/ll: Fix HCI checks for periodic advertising
Core Specification 5.2 clarified HCI behavior for periodic advertising
with regards to reconfiguring advertising instance and checking
data length against periodic advertising interval.
2020-01-31 12:27:41 +01:00
Andrzej Kaczmarek e8f9ecca38 nimble/ll: Use S=8 coding by default
It makes more sense to use S=8 by default as we can assume that LE Coded
is used for Long Range so we should use best possible coding scheme at
the expense of data speed.
2020-01-30 12:19:00 +01:00
Michał Narajowski 9fccd78f43 mesh: Fix GATT Proxy behavior to match Mesh Profile Spec 1.0.1
According to Mesh Profile Spec 1.0.1, Section 4.2.11:
"If the Proxy feature is disabled, a GATT client device can connect
over GATT to that node for configuration and control. Messages from
the GATT bearer are not relayed to the advertising bearer."

Moreover some notes have been removed from the spec compared to
version 1.0:

Mesh Profile Spec 1.0, Section 4.2.11:

"Upon transition from GATT Proxy state 0x01 to GATT Proxy state 0x00
the GATT Bearer Server shall disconnect all GATT Bearer Clients."

"The Configuration Client should turn off the Proxy state as the last
step in the configuration process."

Mesh Profile Spec 1.0, Section 4.2.11.1:

"When the GATT Proxy state is set to 0x00, the Node Identity state
for all subnets shall be set to 0x00 and shall not be changed."
2020-01-29 11:50:01 +01:00
Łukasz Rymanowski 96cabb9822 nimble/ll: Add hci set host supported features
With this patch, host is able to set features flags with  HCI
command from Bluetooth v5.2
2020-01-28 10:43:19 +01:00
Łukasz Rymanowski 9ae8a9a186 nimble/ll: Rename feature flags related with sync transfer
This patch changes name of two features related to sync
transfer:

BLE_LL_FEAT_SYNC_SEND -> BLE_LL_FEAT_SYNC_TRANS_SEND
BLE_LL_FEAT_SYNC_RECV ->BLE_LL_FEAT_SYNC_TRANS_RECV

as there is new feature call

BLE_LL_FEAT_SYNC_RECV (Synchronizer receiver)

added in following patch
2020-01-28 10:43:19 +01:00
Łukasz Rymanowski b018a1a71b nimble/ll: Use uint64_t for features
In Bluetooth 5.2 more than 32 bits are used for the supported
features, therefore let us use uint64_t from now on.
2020-01-28 10:43:19 +01:00
Łukasz Rymanowski a353136211 nimble: Add 52 version for BT 5.2 2020-01-28 10:43:19 +01:00
Szymon Janc f44bda8310 nimble/ll: Fix misleading comment 2020-01-27 20:16:16 +01:00
Szymon Janc e390de8676 nimble/ll: Make flags in Extended Header optional
If no flags are specified there is no need to put flags into extended
header. This was affecting LL/DDI/ADV/BV-61-C qualification test case.
2020-01-27 20:16:16 +01:00
Szymon Janc 8f4b9b4f1b nimble/ll: Fix adv data length calculation if SyncInfo is present
When placing SyncInfo into Extended Header it needs to be taken into
account when calculating available space for advertisign data.
2020-01-27 20:16:16 +01:00
Szymon Janc 5705d6f606 nimble/ll: Don't put TxPower into AUX_CHAIN_IND PDU
This is not recommended for extended advertising chains and forbidden
for periodic advertising chains.

This was affecting LL/DDI/ADV/BV-61-C qualification test case.
2020-01-27 20:16:16 +01:00