Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blestress fixes #986

Merged
merged 4 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions apps/blestress/src/rx_stress.c
Original file line number Diff line number Diff line change
Expand Up @@ -1456,12 +1456,6 @@ rx_stress_main_task_fn(void *arg)

/* Standard tests perform */
for (i = 11; i < STRESS_UUIDS_NUM; ++i) {
if (i == 7 || i == 8 || i == 13) {
/* 7,8: PHY update tests cause that the device during the next test
* will stuck somewhere and will reset. Skip them for now.
* 13: Should work after fixing ble_gatts_notify_custom (nimble issue on GitHub)*/
continue;
}
/* Start test. */
rx_stress_start(i);
}
Expand Down
54 changes: 32 additions & 22 deletions apps/blestress/src/tx_stress.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ tx_stress_simple_scan(ble_gap_event_fn *cb, uint16_t duration)
params.passive = 1;
params.window = BLE_GAP_SCAN_FAST_WINDOW;

rc = ble_gap_ext_disc(own_addr_type, duration, 0, 1, 0, 0, &params, NULL,
rc = ble_gap_ext_disc(own_addr_type, duration, 0, 0, 0, 0, &params, NULL,
cb, NULL);

if (rc != 0) {
Expand All @@ -83,7 +83,7 @@ tx_stress_simple_scan(ble_gap_event_fn *cb, uint16_t duration)
}

static int
tx_stress_simple_connect(ble_gap_event_fn *cb, int test_num)
tx_stress_simple_connect(ble_gap_event_fn *cb, int test_num, struct ble_gap_conn_params *params)
{
uint8_t own_addr_type;
int rc;
Expand All @@ -105,7 +105,7 @@ tx_stress_simple_connect(ble_gap_event_fn *cb, int test_num)
rc = ble_gap_ext_connect(own_addr_type, &tx_stress_ctx->dev_addr,
10000,
BLE_GAP_LE_PHY_1M_MASK | BLE_GAP_LE_PHY_2M_MASK,
NULL, NULL, NULL, cb, NULL);
params, params, NULL, cb, NULL);

if (rc != 0) {
MODLOG_DFLT(INFO, "\033[0;31mError during connection; rc=%d\033[0m\n",
Expand Down Expand Up @@ -175,7 +175,7 @@ tx_stress_switcher_gap_event(struct ble_gap_event *event, void *arg)
}
/* Connect to rx device just to give it a signal to switch test. */
tx_stress_simple_connect(tx_stress_switcher_gap_event,
tx_stress_ctx->cur_test_id);
tx_stress_ctx->cur_test_id, NULL);
return 0;

case BLE_GAP_EVENT_DISCONNECT:
Expand Down Expand Up @@ -212,7 +212,7 @@ tx_stress_switch_test()
tx_stress_simple_scan(tx_stress_switcher_gap_event, 0);
os_sem_pend(&tx_stress_main_sem, OS_TIMEOUT_NEVER);

tx_stress_simple_connect(tx_stress_switcher_gap_event, 0);
tx_stress_simple_connect(tx_stress_switcher_gap_event, 0, NULL);
}

static int
Expand Down Expand Up @@ -363,7 +363,7 @@ tx_stress_2_gap_event(struct ble_gap_event *event, void *arg)
return 0;
}
tx_stress_simple_connect(tx_stress_2_gap_event,
tx_stress_ctx->cur_test_id);
tx_stress_ctx->cur_test_id, NULL);
return 0;

default:
Expand Down Expand Up @@ -405,7 +405,7 @@ tx_stress_3_gap_event(struct ble_gap_event *event, void *arg)
return 0;
}
tx_stress_simple_connect(tx_stress_3_gap_event,
tx_stress_ctx->cur_test_id);
tx_stress_ctx->cur_test_id, NULL);
return 0;

default:
Expand Down Expand Up @@ -848,6 +848,16 @@ tx_stress_9_gap_event(struct ble_gap_event *event, void *arg)
{
ble_addr_t addr;
int test;
struct ble_gap_conn_params conn_params = {
.scan_itvl = 0x0010,
.scan_window = 0x0010,
.itvl_min = BLE_GAP_INITIAL_CONN_ITVL_MIN,
.itvl_max = BLE_GAP_INITIAL_CONN_ITVL_MAX,
.latency = 0,
.supervision_timeout = 0x0C80,
.min_ce_len = 0x0010,
.max_ce_len = 0x0300,
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are those connections maintained in test for at least this timeout after last one is created?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are total of 15 successful concurrent connections. For example run, last succesfull connection occurs ~164343728us timestamp and first disconnect at 196078120us. This gives us 31.734392s. 0x0C80 is 3200, x10ms = 32s, which considering print delays seems pretty close IMO.


switch (event->type) {
case BLE_GAP_EVENT_EXT_DISC:
Expand All @@ -860,7 +870,7 @@ tx_stress_9_gap_event(struct ble_gap_event *event, void *arg)
ble_gap_disc_cancel();
tx_stress_ctx->dev_addr = event->ext_disc.addr;
tx_stress_simple_connect(tx_stress_9_gap_event,
tx_stress_ctx->cur_test_id);
tx_stress_ctx->cur_test_id, &conn_params);
}
return 0;

Expand Down Expand Up @@ -1169,7 +1179,7 @@ tx_stress_11_gap_event(struct ble_gap_event *event, void *arg)
ble_gap_disc_cancel();
tx_stress_ctx->dev_addr = event->ext_disc.addr;
tx_stress_simple_connect(tx_stress_11_gap_event,
tx_stress_ctx->cur_test_id);
tx_stress_ctx->cur_test_id, NULL);
}
return 0;

Expand Down Expand Up @@ -1467,7 +1477,7 @@ tx_stress_15_gap_event(struct ble_gap_event *event, void *arg)
return 0;
}
/* Reconnect */
tx_stress_simple_connect(tx_stress_15_gap_event, 15);
tx_stress_simple_connect(tx_stress_15_gap_event, 15, NULL);
return 0;

default:
Expand Down Expand Up @@ -1537,59 +1547,59 @@ tx_stress_test_perform(int test_num)
break;
case 2:
console_printf("Stress Connect/Disconnect legacy\033[0m\n");
tx_stress_simple_connect(&tx_stress_2_gap_event, 2);
tx_stress_simple_connect(&tx_stress_2_gap_event, 2, NULL);
break;
case 3:
console_printf("Stress Connect/Disconnect ext adv\033[0m\n");
tx_stress_simple_connect(&tx_stress_3_gap_event, 3);
tx_stress_simple_connect(&tx_stress_3_gap_event, 3, NULL);
break;
case 4:
console_printf("Stress connection params update (TX)\033[0m\n");
tx_stress_simple_connect(&tx_stress_4_gap_event, 4);
tx_stress_simple_connect(&tx_stress_4_gap_event, 4, NULL);
break;
case 5:
console_printf("Stress connection params update (RX)\033[0m\n");
tx_stress_simple_connect(&tx_stress_5_gap_event, 5);
tx_stress_simple_connect(&tx_stress_5_gap_event, 5, NULL);
break;
case 6:
console_printf("Stress Scan\033[0m\n");
tx_stress_6_perform();
break;
case 7:
console_printf("Stress PHY Update (TX)\033[0m\n");
tx_stress_simple_connect(&tx_stress_7_gap_event, 7);
tx_stress_simple_connect(&tx_stress_7_gap_event, 7, NULL);
break;
case 8:
console_printf("Stress PHY Update (RX)\033[0m\n");
tx_stress_simple_connect(&tx_stress_8_gap_event, 8);
tx_stress_simple_connect(&tx_stress_8_gap_event, 8, NULL);
break;
case 9:
console_printf("Stress multi connection\033[0m\n");
tx_stress_9_perform();
break;
case 10:
console_printf("Stress L2CAP send\033[0m\n");
tx_stress_simple_connect(&tx_stress_10_gap_event, 10);
tx_stress_simple_connect(&tx_stress_10_gap_event, 10, NULL);
break;
case 11:
console_printf("Stress Advertise/Connect/Disconnect\033[0m\n");
tx_stress_simple_connect(&tx_stress_11_gap_event, 11);
tx_stress_simple_connect(&tx_stress_11_gap_event, 11, NULL);
break;
case 12:
console_printf("Stress GATT indication\033[0m\n");
tx_stress_simple_connect(&tx_stress_12_gap_event, 12);
tx_stress_simple_connect(&tx_stress_12_gap_event, 12, NULL);
break;
case 13:
console_printf("Stress GATT notification\033[0m\n");
tx_stress_simple_connect(&tx_stress_13_gap_event, 13);
tx_stress_simple_connect(&tx_stress_13_gap_event, 13, NULL);
break;
case 14:
console_printf("Stress GATT Subscribe/Notify/Unsubscribe\033[0m\n");
tx_stress_simple_connect(&tx_stress_14_gap_event, 14);
tx_stress_simple_connect(&tx_stress_14_gap_event, 14, NULL);
break;
case 15:
console_printf("Stress Connect/Send/Disconnect\033[0m\n");
tx_stress_simple_connect(&tx_stress_15_gap_event, 15);
tx_stress_simple_connect(&tx_stress_15_gap_event, 15, NULL);
break;
default:
console_printf("\033[0;31mFound test, but do not know how to perform."
Expand Down
3 changes: 3 additions & 0 deletions apps/blestress/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,6 @@ syscfg.vals:

# Whether to save data to sys/config, or just keep it in RAM.
BLE_STORE_CONFIG_PERSIST: 0

# ACL buf size must be able to contain CoC MPS plus ACL header
BLE_TRANSPORT_ACL_SIZE: MYNEWT_VAL_BLE_L2CAP_COC_MPS + 4
Loading