Skip to content

Commit 35fc91c

Browse files
alwa-nordicnashif
authored andcommitted
Bluetooth: bsim/att/pipeline: add rx tx priority inverted prj
Resolves: #71444 Signed-off-by: Aleksander Wasaznik <[email protected]>
1 parent a3660d1 commit 35fc91c

File tree

6 files changed

+124
-0
lines changed

6 files changed

+124
-0
lines changed

tests/bsim/bluetooth/host/att/compile.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ app=tests/bsim/bluetooth/host/att/retry_on_sec_err/server compile
2323
app=tests/bsim/bluetooth/host/att/sequential/dut compile
2424
app=tests/bsim/bluetooth/host/att/sequential/tester compile
2525
app=tests/bsim/bluetooth/host/att/pipeline/dut compile
26+
app=tests/bsim/bluetooth/host/att/pipeline/dut \
27+
conf_file='prj.conf;rx_tx_prio_invert.extra.conf' compile
2628
app=tests/bsim/bluetooth/host/att/pipeline/tester compile
2729
app=tests/bsim/bluetooth/host/att/long_read compile
2830
app=tests/bsim/bluetooth/host/att/open_close compile
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright 2024 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# This file adds prompts to allow setting the symbols in a
5+
# configuration file (e.g. 'prj.conf'), as needed for some of
6+
# the test variants.
7+
8+
config BT_HCI_TX_PRIO
9+
prompt ""
10+
11+
config BT_RX_PRIO
12+
prompt ""
13+
14+
source "Kconfig.zephyr"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_BT_HCI_TX_PRIO=8
2+
CONFIG_BT_RX_PRIO=7

tests/bsim/bluetooth/host/att/pipeline/test_scripts/_compile.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ INCR_BUILD=1
88
source ${ZEPHYR_BASE}/tests/bsim/compile.source
99

1010
app="$(guess_test_relpath)"/dut compile
11+
app="$(guess_test_relpath)"/dut conf_file='prj.conf;rx_tx_prio_invert.extra.conf' compile
1112
app="$(guess_test_relpath)"/tester compile
1213

1314
wait_for_background_jobs
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2023-2024 Nordic Semiconductor ASA
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
# Test purpose:
6+
#
7+
# Basic check that the DUT GATT client does not pipeline ATT
8+
# requests.
9+
#
10+
# Sending a new request on a bearer before the response to the
11+
# previous request has been received ('pipelining') is a
12+
# protocol violation.
13+
#
14+
# Test variant 'rx_tx_prio_invert':
15+
#
16+
# - The priority of the RX and TX threads is inverted compared
17+
# to the default configuration. The result shall be the same.
18+
#
19+
# Test procedure:
20+
#
21+
# - DUT is excercised by calling `gatt_write` in a loop.
22+
# - Tester does not immediately respond but delays the response
23+
# a bit to ensure the LL has time to transport any extra
24+
# requests, exposing a bug.
25+
# - Tester verifies there is no such extra request while it's
26+
# delaying the response. Detecting an extra request proves a
27+
# protocol violation.
28+
29+
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
30+
31+
dut_exe="bs_${BOARD_TS}_tests_bsim_bluetooth_host_att_pipeline_dut_prj_conf"
32+
dut_exe+="_rx_tx_prio_invert_extra_conf"
33+
tester_exe="bs_${BOARD_TS}_tests_bsim_bluetooth_host_att_pipeline_tester_prj_conf"
34+
35+
simulation_id="att_pipeline_test_shall_not_pipeline_variant_rx_tx_prio_invert"
36+
verbosity_level=2
37+
sim_length_us=100e6
38+
39+
cd ${BSIM_OUT_PATH}/bin
40+
41+
Execute ./bs_2G4_phy_v1 \
42+
-v=${verbosity_level} -s="${simulation_id}" -D=2 -sim_length=${sim_length_us} $@
43+
44+
Execute "./$tester_exe" \
45+
-v=${verbosity_level} -s="${simulation_id}" -d=1 -testid=tester_1 -RealEncryption=1 -rs=100
46+
47+
Execute "./$dut_exe" \
48+
-v=${verbosity_level} -s="${simulation_id}" -d=0 -testid=dut_1 -RealEncryption=1
49+
50+
wait_for_background_jobs
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2023-2024 Nordic Semiconductor ASA
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
# Test purpose:
6+
#
7+
# Check that DUT GATT server gracefully handles a pipelining
8+
# client.
9+
#
10+
# The DUT GATT server must remain available to a well-behaved
11+
# peer while a bad peer tries to spam ATT requests.
12+
#
13+
# Test variant 'rx_tx_prio_invert':
14+
#
15+
# - The priority of the RX and TX threads is inverted compared
16+
# to the default configuration. The result shall be the same.
17+
#
18+
# Test procedure:
19+
#
20+
# - The well-behaved peer performs a discovery procedure
21+
# repeatedly.
22+
# - The bad peer spams ATT requests as fast as possible.
23+
# - The connection with the well-behaved peer shall remain
24+
# responsive.
25+
# - Either: The DUT may disconnect the bad peer ACL after
26+
# receiving a protocol violation occurs. The bad peer shall
27+
# be able to reconnect and continue the bad behavior.
28+
# - Or: The DUT may process and respond to the pipelined
29+
# requests, preserving their ordering.
30+
31+
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
32+
33+
dut_exe="bs_${BOARD_TS}_tests_bsim_bluetooth_host_att_pipeline_dut_prj_conf"
34+
dut_exe+="_rx_tx_prio_invert_extra_conf"
35+
tester_exe="bs_${BOARD_TS}_tests_bsim_bluetooth_host_att_pipeline_tester_prj_conf"
36+
37+
simulation_id="att_pipeline_test_tolerate_pipeline_variant_rx_tx_prio_invert"
38+
verbosity_level=2
39+
sim_length_us=100e6
40+
41+
cd ${BSIM_OUT_PATH}/bin
42+
43+
Execute ./bs_2G4_phy_v1 \
44+
-v=${verbosity_level} -s="${simulation_id}" -D=3 -sim_length=${sim_length_us} $@
45+
46+
Execute "./$tester_exe" \
47+
-v=${verbosity_level} -s="${simulation_id}" -d=2 -testid=tester -RealEncryption=1 -rs=100
48+
49+
Execute "./$dut_exe" \
50+
-v=${verbosity_level} -s="${simulation_id}" -d=1 -testid=dut -RealEncryption=1 -rs=2000
51+
52+
Execute "./$dut_exe" \
53+
-v=${verbosity_level} -s="${simulation_id}" -d=0 -testid=dut -RealEncryption=1
54+
55+
wait_for_background_jobs

0 commit comments

Comments
 (0)