Skip to content
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
3 changes: 2 additions & 1 deletion subsys/bluetooth/controller/ll_sw/ull_llcp_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,8 @@ static void lp_pu_st_wait_rx_phy_update_ind(struct ll_conn *conn, struct proc_ct
break;
case LP_PU_EVT_REJECT:
llcp_rr_set_incompat(conn, INCOMPAT_NO_COLLISION);
ctx->data.pu.error = BT_HCI_ERR_LL_PROC_COLLISION;
llcp_pdu_decode_reject_ext_ind(ctx, (struct pdu_data *) param);
ctx->data.pu.error = ctx->reject_ext_ind.error_code;
ctx->data.pu.ntf_pu = 1;
lp_pu_complete(conn, ctx, evt, param);
default:
Expand Down
15 changes: 13 additions & 2 deletions subsys/bluetooth/controller/ll_sw/ull_llcp_remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,8 @@ static void rr_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode)
{
struct node_tx *tx;
struct pdu_data *pdu;
struct proc_ctx *ctx_local;
uint8_t reject_code;

/* Allocate tx node */
tx = llcp_tx_alloc(conn, ctx);
Expand All @@ -373,11 +375,20 @@ static void rr_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode)
/* Encode LL Control PDU */
switch (opcode) {
case PDU_DATA_LLCTRL_TYPE_REJECT_IND:
ctx_local = llcp_lr_peek(conn);
if (ctx_local->proc == ctx->proc ||
(ctx_local->proc == PROC_CONN_UPDATE &&
ctx->proc == PROC_CONN_PARAM_REQ)) {
reject_code = BT_HCI_ERR_LL_PROC_COLLISION;
} else {
reject_code = BT_HCI_ERR_DIFF_TRANS_COLLISION;
}

if (conn->llcp.fex.valid && feature_ext_rej_ind(conn)) {
llcp_pdu_encode_reject_ext_ind(pdu, conn->llcp.remote.reject_opcode,
BT_HCI_ERR_LL_PROC_COLLISION);
reject_code);
} else {
llcp_pdu_encode_reject_ind(pdu, BT_HCI_ERR_LL_PROC_COLLISION);
llcp_pdu_encode_reject_ind(pdu, reject_code);
}
break;
case PDU_DATA_LLCTRL_TYPE_UNKNOWN_RSP:
Expand Down
17 changes: 17 additions & 0 deletions tests/bluetooth/controller/ctrl_collision/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)

if (NOT BOARD STREQUAL unit_testing)
message(FATAL_ERROR "This project can only be used with '-DBOARD=unit_testing'.")
endif()

FILE(GLOB SOURCES
src/*.c
)

project(bluetooth_ull_llcp_collision)
find_package(ZephyrUnittest HINTS $ENV{ZEPHYR_BASE})
include(${ZEPHYR_BASE}/tests/bluetooth/controller/common/defaults_cmake.txt)

target_sources(testbinary PRIVATE ${ll_sw_sources} ${mock_sources} ${common_sources})
Loading