From 95086700a6b5fb3944d21bd5449a6c247acc87b2 Mon Sep 17 00:00:00 2001 From: Emilio Aguila Escalante Date: Wed, 23 Oct 2024 09:35:57 +0200 Subject: [PATCH 1/8] [nrf fromtree] Bluetooth: Mesh: Use dfd_phase_set() in dfu_suspended() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, dfu_suspended() sets the phase SUSPENDED directly in the structure, bypassing the dfd_phase_set() function. This prevents the phase change callback in the bt_mesh_dfd_srv_cb structure from receiving the SUSPENDED event. Signed-off-by: Emilio Aguila Escalante (cherry picked from commit dda9ba6031daea1d2a76a7f26edd720192c77887) Signed-off-by: Håvard Reierstad --- subsys/bluetooth/mesh/dfd_srv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/mesh/dfd_srv.c b/subsys/bluetooth/mesh/dfd_srv.c index e765f2d5d7b..4a395a175bd 100644 --- a/subsys/bluetooth/mesh/dfd_srv.c +++ b/subsys/bluetooth/mesh/dfd_srv.c @@ -801,7 +801,7 @@ static void dfu_suspended(struct bt_mesh_dfu_cli *cli) struct bt_mesh_dfd_srv *srv = CONTAINER_OF(cli, struct bt_mesh_dfd_srv, dfu); - srv->phase = BT_MESH_DFD_PHASE_TRANSFER_SUSPENDED; + dfd_phase_set(srv, BT_MESH_DFD_PHASE_TRANSFER_SUSPENDED); } static void dfu_ended(struct bt_mesh_dfu_cli *cli, From 62fdca9fa4f3e44c3a074e91bcfa730c8c6ef644 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Reierstad?= Date: Wed, 23 Oct 2024 09:35:57 +0200 Subject: [PATCH 2/8] [nrf fromtree] Tests: Bluetooth: Tester: Increase the number of max mesh tx segments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Increasing the number of max tx segments to be able to fit composition page 0 into composition data status message. After the subnet bridge config client and server are added to the tester, the size needed to report composition data page 0 increased. Current behaviour of the tester is correct, dropping the element when there is not enough space in data field, however the PTS application does not handle the composition data status message without element. Signed-off-by: alperen sener (cherry picked from commit 9ae8ebfadef412ed6981445988bbc05f1d23bba5) Signed-off-by: Håvard Reierstad --- tests/bluetooth/tester/overlay-mesh.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/bluetooth/tester/overlay-mesh.conf b/tests/bluetooth/tester/overlay-mesh.conf index a9e96686da8..1e488bad00b 100644 --- a/tests/bluetooth/tester/overlay-mesh.conf +++ b/tests/bluetooth/tester/overlay-mesh.conf @@ -15,6 +15,7 @@ CONFIG_BT_MESH_HEALTH_CLI=y CONFIG_BT_MESH_FRIEND=y CONFIG_BT_MESH_FRIEND_QUEUE_SIZE=32 CONFIG_BT_MESH_RX_SEG_MAX=13 +CONFIG_BT_MESH_TX_SEG_MAX=7 CONFIG_BT_MESH_TX_SEG_MSG_COUNT=3 CONFIG_BT_MESH_LPN_POLL_TIMEOUT=100 CONFIG_BT_MESH_PROVISIONER=y From 72af046c27a4558d99f297b9738f6f1ec93e16ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Reierstad?= Date: Wed, 23 Oct 2024 09:35:57 +0200 Subject: [PATCH 3/8] [nrf fromtree] Bluetooth: Mesh: Add prefix to Subnet Bridge API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds the `bt_mesh_brg_cfg` prefix to the public Subnet Bridge API, and aligns the function and callback naming with the rest of the Bluetooth Mesh API. Signed-off-by: Håvard Reierstad (cherry picked from commit 8049c249940a0a073ee2b849f31c85d2385f993d) Signed-off-by: Håvard Reierstad --- .../bluetooth/api/mesh/brg_cfg.rst | 15 +- include/zephyr/bluetooth/mesh/brg_cfg.h | 24 ++-- include/zephyr/bluetooth/mesh/brg_cfg_cli.h | 76 +++++------ subsys/bluetooth/mesh/brg_cfg_cli.c | 102 +++++++------- subsys/bluetooth/mesh/brg_cfg_srv.c | 10 +- subsys/bluetooth/mesh/shell/brg_cfg.c | 58 ++++---- tests/bluetooth/tester/src/btp_mesh.c | 35 +++-- tests/bsim/bluetooth/mesh/src/test_brg.c | 129 +++++++++--------- 8 files changed, 215 insertions(+), 234 deletions(-) diff --git a/doc/connectivity/bluetooth/api/mesh/brg_cfg.rst b/doc/connectivity/bluetooth/api/mesh/brg_cfg.rst index b118116f620..d6e7462c546 100644 --- a/doc/connectivity/bluetooth/api/mesh/brg_cfg.rst +++ b/doc/connectivity/bluetooth/api/mesh/brg_cfg.rst @@ -69,15 +69,15 @@ Enabling or disabling the Subnet Bridge feature The Bridge Configuration Client (or Configuration Manager) can enable or disable the Subnet Bridge feature on a node by sending a **Subnet Bridge Set** message to the Bridge Configuration -Server model on the target node, using the :c:func:`bt_mesh_brg_cfg_cli_subnet_bridge_set` function. +Server model on the target node, using the :c:func:`bt_mesh_brg_cfg_cli_set` function. Adding or removing subnets ************************** The Bridge Configuration Client can add or remove an entry from the Bridging Table by sending a **Bridging Table Add** or **Bridging Table Remove** message to the Bridge Configuration -Server model on the target node, calling the :c:func:`bt_mesh_brg_cfg_cli_bridging_table_add` or -:c:func:`bt_mesh_brg_cfg_cli_bridging_table_remove` functions. +Server model on the target node, calling the :c:func:`bt_mesh_brg_cfg_cli_table_add` or +:c:func:`bt_mesh_brg_cfg_cli_table_remove` functions. .. _bluetooth_mesh_brg_cfg_states: @@ -89,20 +89,19 @@ The Subnet Bridge has the following states: - *Subnet Bridge*: This state indicates whether the Subnet Bridge feature is enabled or disabled on the node. The Bridge Configuration Client can retrieve this information by sending a **Subnet Bridge Get** - message to the Bridge Configuration Server using the - :c:func:`bt_mesh_brg_cfg_cli_subnet_bridge_get` function. + message to the Bridge Configuration Server using the :c:func:`bt_mesh_brg_cfg_cli_get` function. - *Bridging Table*: This state holds the bridging table. The Client can request a list of entries from a Bridging Table by sending a **Bridging Table Get** message to the target node using - the :c:func:`bt_mesh_brg_cfg_cli_bridging_table_get` function. + the :c:func:`bt_mesh_brg_cfg_cli_table_get` function. The Client can get a list of subnets currently bridged by a Subnet Bridge by sending a **Bridged Subnets Get** message to the target Server by calling the - :c:func:`bt_mesh_brg_cfg_cli_bridged_subnets_get` function. + :c:func:`bt_mesh_brg_cfg_cli_subnets_get` function. - *Bridging Table Size*: This state reports the maximum number of entries the Bridging Table can store. The Client can retrieve this information by sending a **Bridging Table Size Get** message - using the :c:func:`bt_mesh_brg_cfg_cli_bridging_table_size_get` function. + using the :c:func:`bt_mesh_brg_cfg_cli_table_size_get` function. This is a read-only state. Subnet bridging and replay protection diff --git a/include/zephyr/bluetooth/mesh/brg_cfg.h b/include/zephyr/bluetooth/mesh/brg_cfg.h index 906a2e0bb38..a488fed09c5 100644 --- a/include/zephyr/bluetooth/mesh/brg_cfg.h +++ b/include/zephyr/bluetooth/mesh/brg_cfg.h @@ -21,20 +21,20 @@ extern "C" { */ /** Subnet Bridge states */ -enum bt_mesh_subnet_bridge_state { +enum bt_mesh_brg_cfg_state { /** Subnet bridge functionality is disabled. */ - BT_MESH_SUBNET_BRIDGE_DISABLED, + BT_MESH_BRG_CFG_DISABLED, /** Subnet bridge state functionality is enabled. */ - BT_MESH_SUBNET_BRIDGE_ENABLED, + BT_MESH_BRG_CFG_ENABLED, }; /* Briding from Addr1 to Addr2. */ -#define BT_MESH_SUBNET_BRIDGE_DIR_ONEWAY 1 +#define BT_MESH_BRG_CFG_DIR_ONEWAY 1 /* Bidirectional briging between Addr1 and Addr2. */ -#define BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY 2 +#define BT_MESH_BRG_CFG_DIR_TWOWAY 2 /** Bridging Table state entry corresponding to a entry in the Bridging Table. */ -struct bt_mesh_bridging_table_entry { +struct bt_mesh_brg_cfg_table_entry { /** Allowed directions for the bridged traffic (or bridged traffic not allowed) */ uint8_t directions; /** NetKey Index of the first subnet */ @@ -48,24 +48,24 @@ struct bt_mesh_bridging_table_entry { }; /** Bridging Table Status response */ -struct bt_mesh_bridging_table_status { +struct bt_mesh_brg_cfg_table_status { /** Status Code of the requesting message */ uint8_t status; /** Requested Bridging Table entry */ - struct bt_mesh_bridging_table_entry entry; + struct bt_mesh_brg_cfg_table_entry entry; }; /** Used to filter set of pairs of NetKey Indexes from the Bridging Table */ -struct bt_mesh_filter_netkey { +struct bt_mesh_brg_cfg_filter_netkey { uint16_t filter: 2, /* Filter applied to the set of pairs of NetKey Indexes */ prohibited: 2, /* Prohibited */ net_idx: 12; /* NetKey Index used for filtering or ignored */ }; /** Bridged Subnets List response */ -struct bt_mesh_bridged_subnets_list { +struct bt_mesh_brg_cfg_subnets_list { /** Filter applied NetKey Indexes, and NetKey Index used for filtering. */ - struct bt_mesh_filter_netkey net_idx_filter; + struct bt_mesh_brg_cfg_filter_netkey net_idx_filter; /** Start offset in units of bridges */ uint8_t start_idx; /** Pointer to allocated buffer for storing filtered of NetKey Indexes */ @@ -73,7 +73,7 @@ struct bt_mesh_bridged_subnets_list { }; /** Bridging Table List response */ -struct bt_mesh_bridging_table_list { +struct bt_mesh_brg_cfg_table_list { /** Status Code of the requesting message */ uint8_t status; /** NetKey Index of the first subnet */ diff --git a/include/zephyr/bluetooth/mesh/brg_cfg_cli.h b/include/zephyr/bluetooth/mesh/brg_cfg_cli.h index c29650a5df9..37666ac6dcd 100644 --- a/include/zephyr/bluetooth/mesh/brg_cfg_cli.h +++ b/include/zephyr/bluetooth/mesh/brg_cfg_cli.h @@ -42,8 +42,8 @@ struct bt_mesh_brg_cfg_cli_cb { * @param addr Address of the sender. * @param status Status received from the server. */ - void (*subnet_bridge_status)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr, - enum bt_mesh_subnet_bridge_state status); + void (*bridge_status)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr, + enum bt_mesh_brg_cfg_state status); /** @brief Optional callback for Bridging Table Size Status message. * @@ -54,8 +54,7 @@ struct bt_mesh_brg_cfg_cli_cb { * @param addr Address of the sender. * @param size Size received from the server. */ - void (*bridging_table_size_status)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr, - uint16_t size); + void (*table_size_status)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr, uint16_t size); /** @brief Optional callback for Bridging Table Status message. * @@ -66,8 +65,8 @@ struct bt_mesh_brg_cfg_cli_cb { * @param addr Address of the sender. * @param rsp Response received from the Bridging Configuration Server. */ - void (*bridging_table_status)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr, - struct bt_mesh_bridging_table_status *rsp); + void (*table_status)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr, + struct bt_mesh_brg_cfg_table_status *rsp); /** @brief Optional callback for Bridged Subnets List message. * @@ -78,8 +77,8 @@ struct bt_mesh_brg_cfg_cli_cb { * @param addr Address of the sender. * @param rsp Response received from the Bridging Configuration Server. */ - void (*bridged_subnets_list)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr, - struct bt_mesh_bridged_subnets_list *rsp); + void (*subnets_list)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr, + struct bt_mesh_brg_cfg_subnets_list *rsp); /** @brief Optional callback for Bridging Table List message. * @@ -90,8 +89,8 @@ struct bt_mesh_brg_cfg_cli_cb { * @param addr Address of the sender. * @param rsp Response received from the Bridging Configuration Server. */ - void (*bridging_table_list)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr, - struct bt_mesh_bridging_table_list *rsp); + void (*table_list)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr, + struct bt_mesh_brg_cfg_table_list *rsp); }; /** Bridge Configuration Client Model Context */ @@ -121,13 +120,12 @@ struct bt_mesh_brg_cfg_cli { * @param net_idx Network index to encrypt the message with. * @param addr Target node address. * @param status Status response parameter, returns one of - * @ref BT_MESH_SUBNET_BRIDGE_DISABLED or - * @ref BT_MESH_SUBNET_BRIDGE_ENABLED on success. + * @ref BT_MESH_BRG_CFG_DISABLED or + * @ref BT_MESH_BRG_CFG_ENABLED on success. * * @return 0 on success, or (negative) error code on failure. */ -int bt_mesh_brg_cfg_cli_subnet_bridge_get(uint16_t net_idx, uint16_t addr, - enum bt_mesh_subnet_bridge_state *status); +int bt_mesh_brg_cfg_cli_get(uint16_t net_idx, uint16_t addr, enum bt_mesh_brg_cfg_state *status); /** @brief Sends a Subnet Bridge Set message to the given destination address * with the given parameters @@ -145,17 +143,16 @@ int bt_mesh_brg_cfg_cli_subnet_bridge_get(uint16_t net_idx, uint16_t addr, * @param net_idx Network index to encrypt the message with. * @param addr Target node address. * @param val Value to set the Subnet Bridge state to. Must be one of - * @ref BT_MESH_SUBNET_BRIDGE_DISABLED or - * @ref BT_MESH_SUBNET_BRIDGE_ENABLED. + * @ref BT_MESH_BRG_CFG_DISABLED or + * @ref BT_MESH_BRG_CFG_ENABLED. * @param status Status response parameter, returns one of - * @ref BT_MESH_SUBNET_BRIDGE_DISABLED or - * @ref BT_MESH_SUBNET_BRIDGE_ENABLED on success. + * @ref BT_MESH_BRG_CFG_DISABLED or + * @ref BT_MESH_BRG_CFG_ENABLED on success. * * @return 0 on success, or (negative) error code on failure. */ -int bt_mesh_brg_cfg_cli_subnet_bridge_set(uint16_t net_idx, uint16_t addr, - enum bt_mesh_subnet_bridge_state val, - enum bt_mesh_subnet_bridge_state *status); +int bt_mesh_brg_cfg_cli_set(uint16_t net_idx, uint16_t addr, enum bt_mesh_brg_cfg_state val, + enum bt_mesh_brg_cfg_state *status); /** @brief Sends a Bridging Table Size Get message to the given destination * address with the given parameters @@ -176,7 +173,7 @@ int bt_mesh_brg_cfg_cli_subnet_bridge_set(uint16_t net_idx, uint16_t addr, * * @return 0 on success, or (negative) error code on failure. */ -int bt_mesh_brg_cfg_cli_bridging_table_size_get(uint16_t net_idx, uint16_t addr, uint16_t *size); +int bt_mesh_brg_cfg_cli_table_size_get(uint16_t net_idx, uint16_t addr, uint16_t *size); /** @brief Sends a Bridging Table Add message to the given destination address * with the given parameters @@ -198,9 +195,9 @@ int bt_mesh_brg_cfg_cli_bridging_table_size_get(uint16_t net_idx, uint16_t addr, * * @return 0 on success, or (negative) error code on failure. */ -int bt_mesh_brg_cfg_cli_bridging_table_add(uint16_t net_idx, uint16_t addr, - struct bt_mesh_bridging_table_entry *entry, - struct bt_mesh_bridging_table_status *rsp); +int bt_mesh_brg_cfg_cli_table_add(uint16_t net_idx, uint16_t addr, + struct bt_mesh_brg_cfg_table_entry *entry, + struct bt_mesh_brg_cfg_table_status *rsp); /** @brief Sends a Bridging Table Remove message to the given destination * address with the given parameters @@ -226,9 +223,9 @@ int bt_mesh_brg_cfg_cli_bridging_table_add(uint16_t net_idx, uint16_t addr, * * @return 0 on success, or (negative) error code on failure. */ -int bt_mesh_brg_cfg_cli_bridging_table_remove(uint16_t net_idx, uint16_t addr, uint16_t net_idx1, - uint16_t net_idx2, uint16_t addr1, uint16_t addr2, - struct bt_mesh_bridging_table_status *rsp); +int bt_mesh_brg_cfg_cli_table_remove(uint16_t net_idx, uint16_t addr, uint16_t net_idx1, + uint16_t net_idx2, uint16_t addr1, uint16_t addr2, + struct bt_mesh_brg_cfg_table_status *rsp); /** @brief Sends a Bridged Subnets Get message to the given destination address * with the given parameters @@ -244,7 +241,7 @@ int bt_mesh_brg_cfg_cli_bridging_table_remove(uint16_t net_idx, uint16_t addr, u * * When @c rsp is set, the user is responsible for providing a buffer for the * filtered set of N pairs of NetKey Indexes in - * @ref bt_mesh_bridged_subnets_list::list. If a buffer is not provided, the + * @ref bt_mesh_brg_cfg_subnets_list::list. If a buffer is not provided, the * bridged subnets won't be copied. * @param net_idx Network index to encrypt the message with. @@ -256,10 +253,9 @@ int bt_mesh_brg_cfg_cli_bridging_table_remove(uint16_t net_idx, uint16_t addr, u * * @return 0 on success, or (negative) error code on failure. */ -int bt_mesh_brg_cfg_cli_bridged_subnets_get(uint16_t net_idx, uint16_t addr, - struct bt_mesh_filter_netkey filter_net_idx, - uint8_t start_idx, - struct bt_mesh_bridged_subnets_list *rsp); +int bt_mesh_brg_cfg_cli_subnets_get(uint16_t net_idx, uint16_t addr, + struct bt_mesh_brg_cfg_filter_netkey filter_net_idx, + uint8_t start_idx, struct bt_mesh_brg_cfg_subnets_list *rsp); /** @brief Sends a Bridging Table Get message to the given destination address * with the given parameters @@ -276,10 +272,10 @@ int bt_mesh_brg_cfg_cli_bridged_subnets_get(uint16_t net_idx, uint16_t addr, * * When @c rsp is set, the user is responsible for providing a buffer for the * filtered set of N pairs of NetKey Indexes in - * @ref bt_mesh_bridging_table_list::list. If a buffer is not provided, the - * bridged addresses won't be copied. If a buffer size is shorter than received - * list, only those many entries that fit in the buffer will be copied from the - * list, and rest will be discarded. + * @ref bt_mesh_brg_cfg_table_list::list. If a buffer is not provided, + * the bridged addresses won't be copied. If a buffer size is shorter than + * received list, only those many entries that fit in the buffer will be copied + * from the list, and rest will be discarded. * * @param net_idx Network index to encrypt the message with. * @param addr Target node address. @@ -291,9 +287,9 @@ int bt_mesh_brg_cfg_cli_bridged_subnets_get(uint16_t net_idx, uint16_t addr, * * @return 0 on success, or (negative) error code on failure. */ -int bt_mesh_brg_cfg_cli_bridging_table_get(uint16_t net_idx, uint16_t addr, uint16_t net_idx1, - uint16_t net_idx2, uint16_t start_idx, - struct bt_mesh_bridging_table_list *rsp); +int bt_mesh_brg_cfg_cli_table_get(uint16_t net_idx, uint16_t addr, uint16_t net_idx1, + uint16_t net_idx2, uint16_t start_idx, + struct bt_mesh_brg_cfg_table_list *rsp); /** @brief Get the current transmission timeout value. * diff --git a/subsys/bluetooth/mesh/brg_cfg_cli.c b/subsys/bluetooth/mesh/brg_cfg_cli.c index 229b0b6f892..3f398408708 100644 --- a/subsys/bluetooth/mesh/brg_cfg_cli.c +++ b/subsys/bluetooth/mesh/brg_cfg_cli.c @@ -17,12 +17,11 @@ static int32_t msg_timeout; static struct bt_mesh_brg_cfg_cli *cli; -static int subnet_bridge_status(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, - struct net_buf_simple *buf) +static int bridge_status(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, + struct net_buf_simple *buf) { - enum bt_mesh_subnet_bridge_state status = - (enum bt_mesh_subnet_bridge_state)net_buf_simple_pull_u8(buf); - enum bt_mesh_subnet_bridge_state *rsp; + enum bt_mesh_brg_cfg_state status = (enum bt_mesh_brg_cfg_state)net_buf_simple_pull_u8(buf); + enum bt_mesh_brg_cfg_state *rsp; if (bt_mesh_msg_ack_ctx_match(&cli->ack_ctx, OP_SUBNET_BRIDGE_STATUS, ctx->addr, (void **)&rsp)) { @@ -30,17 +29,17 @@ static int subnet_bridge_status(const struct bt_mesh_model *model, struct bt_mes bt_mesh_msg_ack_ctx_rx(&cli->ack_ctx); } - if (cli->cb && cli->cb->subnet_bridge_status) { - cli->cb->subnet_bridge_status(cli, ctx->addr, status); + if (cli->cb && cli->cb->bridge_status) { + cli->cb->bridge_status(cli, ctx->addr, status); } return 0; } -static int bridging_table_status(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, - struct net_buf_simple *buf) +static int table_status(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, + struct net_buf_simple *buf) { - struct bt_mesh_bridging_table_status table_status; - struct bt_mesh_bridging_table_status *rsp; + struct bt_mesh_brg_cfg_table_status table_status; + struct bt_mesh_brg_cfg_table_status *rsp; table_status.status = net_buf_simple_pull_u8(buf); table_status.entry.directions = net_buf_simple_pull_u8(buf); @@ -63,17 +62,17 @@ static int bridging_table_status(const struct bt_mesh_model *model, struct bt_me bt_mesh_msg_ack_ctx_rx(&cli->ack_ctx); } - if (cli->cb && cli->cb->bridging_table_status) { - cli->cb->bridging_table_status(cli, ctx->addr, &table_status); + if (cli->cb && cli->cb->table_status) { + cli->cb->table_status(cli, ctx->addr, &table_status); } return 0; } -static int bridged_subnets_list(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, - struct net_buf_simple *buf) +static int subnets_list(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, + struct net_buf_simple *buf) { - struct bt_mesh_bridged_subnets_list subnets_list; - struct bt_mesh_bridged_subnets_list *rsp; + struct bt_mesh_brg_cfg_subnets_list subnets_list; + struct bt_mesh_brg_cfg_subnets_list *rsp; uint16_t net_idx_filter; net_idx_filter = net_buf_simple_pull_le16(buf); @@ -102,17 +101,17 @@ static int bridged_subnets_list(const struct bt_mesh_model *model, struct bt_mes bt_mesh_msg_ack_ctx_rx(&cli->ack_ctx); } - if (cli->cb && cli->cb->bridged_subnets_list) { - cli->cb->bridged_subnets_list(cli, ctx->addr, &subnets_list); + if (cli->cb && cli->cb->subnets_list) { + cli->cb->subnets_list(cli, ctx->addr, &subnets_list); } return 0; } -static int bridging_table_list(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, - struct net_buf_simple *buf) +static int table_list(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, + struct net_buf_simple *buf) { - struct bt_mesh_bridging_table_list table_list; - struct bt_mesh_bridging_table_list *rsp; + struct bt_mesh_brg_cfg_table_list table_list; + struct bt_mesh_brg_cfg_table_list *rsp; table_list.status = net_buf_simple_pull_u8(buf); key_idx_unpack_pair(buf, &table_list.net_idx1, &table_list.net_idx2); @@ -141,14 +140,14 @@ static int bridging_table_list(const struct bt_mesh_model *model, struct bt_mesh bt_mesh_msg_ack_ctx_rx(&cli->ack_ctx); } - if (cli->cb && cli->cb->bridging_table_list) { - cli->cb->bridging_table_list(cli, ctx->addr, &table_list); + if (cli->cb && cli->cb->table_list) { + cli->cb->table_list(cli, ctx->addr, &table_list); } return 0; } -static int bridging_table_size_status(const struct bt_mesh_model *model, - struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf) +static int table_size_status(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, + struct net_buf_simple *buf) { uint16_t size = net_buf_simple_pull_le16(buf); uint16_t *rsp; @@ -159,18 +158,18 @@ static int bridging_table_size_status(const struct bt_mesh_model *model, bt_mesh_msg_ack_ctx_rx(&cli->ack_ctx); } - if (cli->cb && cli->cb->bridging_table_size_status) { - cli->cb->bridging_table_size_status(cli, ctx->addr, size); + if (cli->cb && cli->cb->table_size_status) { + cli->cb->table_size_status(cli, ctx->addr, size); } return 0; } const struct bt_mesh_model_op _bt_mesh_brg_cfg_cli_op[] = { - {OP_SUBNET_BRIDGE_STATUS, BT_MESH_LEN_EXACT(1), subnet_bridge_status}, - {OP_BRIDGING_TABLE_STATUS, BT_MESH_LEN_EXACT(9), bridging_table_status}, - {OP_BRIDGED_SUBNETS_LIST, BT_MESH_LEN_MIN(3), bridged_subnets_list}, - {OP_BRIDGING_TABLE_LIST, BT_MESH_LEN_MIN(6), bridging_table_list}, - {OP_BRIDGING_TABLE_SIZE_STATUS, BT_MESH_LEN_EXACT(2), bridging_table_size_status}, + {OP_SUBNET_BRIDGE_STATUS, BT_MESH_LEN_EXACT(1), bridge_status}, + {OP_BRIDGING_TABLE_STATUS, BT_MESH_LEN_EXACT(9), table_status}, + {OP_BRIDGED_SUBNETS_LIST, BT_MESH_LEN_MIN(3), subnets_list}, + {OP_BRIDGING_TABLE_LIST, BT_MESH_LEN_MIN(6), table_list}, + {OP_BRIDGING_TABLE_SIZE_STATUS, BT_MESH_LEN_EXACT(2), table_size_status}, BT_MESH_MODEL_OP_END, }; @@ -202,8 +201,7 @@ const struct bt_mesh_model_cb _bt_mesh_brg_cfg_cli_cb = { .init = brg_cfg_cli_init, }; -int bt_mesh_brg_cfg_cli_subnet_bridge_get(uint16_t net_idx, uint16_t addr, - enum bt_mesh_subnet_bridge_state *status) +int bt_mesh_brg_cfg_cli_get(uint16_t net_idx, uint16_t addr, enum bt_mesh_brg_cfg_state *status) { BT_MESH_MODEL_BUF_DEFINE(msg, OP_SUBNET_BRIDGE_GET, 0); struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr); @@ -219,9 +217,8 @@ int bt_mesh_brg_cfg_cli_subnet_bridge_get(uint16_t net_idx, uint16_t addr, return bt_mesh_msg_ackd_send(cli->model, &ctx, &msg, !status ? NULL : &rsp_ctx); } -int bt_mesh_brg_cfg_cli_subnet_bridge_set(uint16_t net_idx, uint16_t addr, - enum bt_mesh_subnet_bridge_state val, - enum bt_mesh_subnet_bridge_state *status) +int bt_mesh_brg_cfg_cli_set(uint16_t net_idx, uint16_t addr, enum bt_mesh_brg_cfg_state val, + enum bt_mesh_brg_cfg_state *status) { BT_MESH_MODEL_BUF_DEFINE(msg, OP_SUBNET_BRIDGE_SET, 1); struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr); @@ -238,7 +235,7 @@ int bt_mesh_brg_cfg_cli_subnet_bridge_set(uint16_t net_idx, uint16_t addr, return bt_mesh_msg_ackd_send(cli->model, &ctx, &msg, !status ? NULL : &rsp_ctx); } -int bt_mesh_brg_cfg_cli_bridging_table_size_get(uint16_t net_idx, uint16_t addr, uint16_t *size) +int bt_mesh_brg_cfg_cli_table_size_get(uint16_t net_idx, uint16_t addr, uint16_t *size) { BT_MESH_MODEL_BUF_DEFINE(msg, OP_BRIDGING_TABLE_SIZE_GET, 0); struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr); @@ -254,9 +251,9 @@ int bt_mesh_brg_cfg_cli_bridging_table_size_get(uint16_t net_idx, uint16_t addr, return bt_mesh_msg_ackd_send(cli->model, &ctx, &msg, !size ? NULL : &rsp_ctx); } -int bt_mesh_brg_cfg_cli_bridging_table_add(uint16_t net_idx, uint16_t addr, - struct bt_mesh_bridging_table_entry *entry, - struct bt_mesh_bridging_table_status *rsp) +int bt_mesh_brg_cfg_cli_table_add(uint16_t net_idx, uint16_t addr, + struct bt_mesh_brg_cfg_table_entry *entry, + struct bt_mesh_brg_cfg_table_status *rsp) { BT_MESH_MODEL_BUF_DEFINE(msg, OP_BRIDGING_TABLE_ADD, 8); struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr); @@ -292,9 +289,9 @@ int bt_mesh_brg_cfg_cli_bridging_table_add(uint16_t net_idx, uint16_t addr, return bt_mesh_msg_ackd_send(cli->model, &ctx, &msg, !rsp ? NULL : &rsp_ctx); } -int bt_mesh_brg_cfg_cli_bridging_table_remove(uint16_t net_idx, uint16_t addr, uint16_t net_idx1, - uint16_t net_idx2, uint16_t addr1, uint16_t addr2, - struct bt_mesh_bridging_table_status *rsp) +int bt_mesh_brg_cfg_cli_table_remove(uint16_t net_idx, uint16_t addr, uint16_t net_idx1, + uint16_t net_idx2, uint16_t addr1, uint16_t addr2, + struct bt_mesh_brg_cfg_table_status *rsp) { BT_MESH_MODEL_BUF_DEFINE(msg, OP_BRIDGING_TABLE_REMOVE, 7); struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr); @@ -321,10 +318,9 @@ int bt_mesh_brg_cfg_cli_bridging_table_remove(uint16_t net_idx, uint16_t addr, u return bt_mesh_msg_ackd_send(cli->model, &ctx, &msg, !rsp ? NULL : &rsp_ctx); } -int bt_mesh_brg_cfg_cli_bridged_subnets_get(uint16_t net_idx, uint16_t addr, - struct bt_mesh_filter_netkey filter_net_idx, - uint8_t start_idx, - struct bt_mesh_bridged_subnets_list *rsp) +int bt_mesh_brg_cfg_cli_subnets_get(uint16_t net_idx, uint16_t addr, + struct bt_mesh_brg_cfg_filter_netkey filter_net_idx, + uint8_t start_idx, struct bt_mesh_brg_cfg_subnets_list *rsp) { BT_MESH_MODEL_BUF_DEFINE(msg, OP_BRIDGED_SUBNETS_GET, 3); struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr); @@ -342,9 +338,9 @@ int bt_mesh_brg_cfg_cli_bridged_subnets_get(uint16_t net_idx, uint16_t addr, return bt_mesh_msg_ackd_send(cli->model, &ctx, &msg, !rsp ? NULL : &rsp_ctx); } -int bt_mesh_brg_cfg_cli_bridging_table_get(uint16_t net_idx, uint16_t addr, uint16_t net_idx1, - uint16_t net_idx2, uint16_t start_idx, - struct bt_mesh_bridging_table_list *rsp) +int bt_mesh_brg_cfg_cli_table_get(uint16_t net_idx, uint16_t addr, uint16_t net_idx1, + uint16_t net_idx2, uint16_t start_idx, + struct bt_mesh_brg_cfg_table_list *rsp) { BT_MESH_MODEL_BUF_DEFINE(msg, OP_BRIDGING_TABLE_GET, 5); struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr); diff --git a/subsys/bluetooth/mesh/brg_cfg_srv.c b/subsys/bluetooth/mesh/brg_cfg_srv.c index 7492caf3771..d622ebf48a2 100644 --- a/subsys/bluetooth/mesh/brg_cfg_srv.c +++ b/subsys/bluetooth/mesh/brg_cfg_srv.c @@ -40,7 +40,7 @@ static int subnet_bridge_set(const struct bt_mesh_model *model, struct bt_mesh_m { uint8_t enable = net_buf_simple_pull_u8(buf); - if (enable > BT_MESH_SUBNET_BRIDGE_ENABLED) { + if (enable > BT_MESH_BRG_CFG_ENABLED) { return -EINVAL; } @@ -52,7 +52,7 @@ static int subnet_bridge_set(const struct bt_mesh_model *model, struct bt_mesh_m static void bridging_table_status_send(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, uint8_t status, - struct bt_mesh_bridging_table_entry *entry) + struct bt_mesh_brg_cfg_table_entry *entry) { BT_MESH_MODEL_BUF_DEFINE(msg, OP_BRIDGING_TABLE_STATUS, 9); @@ -76,7 +76,7 @@ static bool netkey_check(uint16_t net_idx1, uint16_t net_idx2) static int bridging_table_add(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf) { - struct bt_mesh_bridging_table_entry entry; + struct bt_mesh_brg_cfg_table_entry entry; uint8_t status = STATUS_SUCCESS; int err; @@ -99,7 +99,7 @@ static int bridging_table_add(const struct bt_mesh_model *model, struct bt_mesh_ static int bridging_table_remove(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf) { - struct bt_mesh_bridging_table_entry entry; + struct bt_mesh_brg_cfg_table_entry entry; uint8_t status = STATUS_SUCCESS; int err; @@ -135,7 +135,7 @@ static int bridged_subnets_get(const struct bt_mesh_model *model, struct bt_mesh return -EINVAL; } - struct bt_mesh_filter_netkey filter_net_idx; + struct bt_mesh_brg_cfg_filter_netkey filter_net_idx; filter_net_idx.filter = net_idx_filter & BIT_MASK(2); filter_net_idx.net_idx = (net_idx_filter >> 4) & BIT_MASK(12); diff --git a/subsys/bluetooth/mesh/shell/brg_cfg.c b/subsys/bluetooth/mesh/shell/brg_cfg.c index 43ab3e0b157..cefaaa47035 100644 --- a/subsys/bluetooth/mesh/shell/brg_cfg.c +++ b/subsys/bluetooth/mesh/shell/brg_cfg.c @@ -14,43 +14,43 @@ static int cmd_subnet_bridge_get(const struct shell *sh, size_t argc, char *argv[]) { - enum bt_mesh_subnet_bridge_state rsp; + enum bt_mesh_brg_cfg_state rsp; int err; - err = bt_mesh_brg_cfg_cli_subnet_bridge_get(bt_mesh_shell_target_ctx.net_idx, - bt_mesh_shell_target_ctx.dst, &rsp); + err = bt_mesh_brg_cfg_cli_get(bt_mesh_shell_target_ctx.net_idx, + bt_mesh_shell_target_ctx.dst, &rsp); if (err) { shell_error(sh, "Failed to send Subnet Bridge Get (err %d)", err); return -ENOEXEC; } shell_print(sh, "Subnet Bridge State: %s", - (rsp == BT_MESH_SUBNET_BRIDGE_ENABLED) ? "Enabled" : "Disabled"); + (rsp == BT_MESH_BRG_CFG_ENABLED) ? "Enabled" : "Disabled"); return 0; } static int cmd_subnet_bridge_set(const struct shell *sh, size_t argc, char *argv[]) { - enum bt_mesh_subnet_bridge_state set, rsp; + enum bt_mesh_brg_cfg_state set, rsp; int err = 0; - set = shell_strtobool(argv[1], 0, &err) ? BT_MESH_SUBNET_BRIDGE_ENABLED - : BT_MESH_SUBNET_BRIDGE_DISABLED; + set = shell_strtobool(argv[1], 0, &err) ? BT_MESH_BRG_CFG_ENABLED + : BT_MESH_BRG_CFG_DISABLED; if (err) { shell_warn(sh, "Unable to parse input string argument"); return err; } - err = bt_mesh_brg_cfg_cli_subnet_bridge_set(bt_mesh_shell_target_ctx.net_idx, - bt_mesh_shell_target_ctx.dst, set, &rsp); + err = bt_mesh_brg_cfg_cli_set(bt_mesh_shell_target_ctx.net_idx, + bt_mesh_shell_target_ctx.dst, set, &rsp); if (err) { shell_error(sh, "Failed to send Subnet Bridge Set (err %d)", err); return -ENOEXEC; } shell_print(sh, "Subnet Bridge State: %s", - (rsp == BT_MESH_SUBNET_BRIDGE_ENABLED) ? "Enabled" : "Disabled"); + (rsp == BT_MESH_BRG_CFG_ENABLED) ? "Enabled" : "Disabled"); return 0; } @@ -59,8 +59,8 @@ static int cmd_bridging_table_size_get(const struct shell *sh, size_t argc, char uint16_t rsp; int err; - err = bt_mesh_brg_cfg_cli_bridging_table_size_get(bt_mesh_shell_target_ctx.net_idx, - bt_mesh_shell_target_ctx.dst, &rsp); + err = bt_mesh_brg_cfg_cli_table_size_get(bt_mesh_shell_target_ctx.net_idx, + bt_mesh_shell_target_ctx.dst, &rsp); if (err) { shell_error(sh, "Failed to send Bridging Table Size Get (err %d)", err); return -ENOEXEC; @@ -72,8 +72,8 @@ static int cmd_bridging_table_size_get(const struct shell *sh, size_t argc, char static int cmd_bridging_table_add(const struct shell *sh, size_t argc, char *argv[]) { - struct bt_mesh_bridging_table_entry entry; - struct bt_mesh_bridging_table_status rsp; + struct bt_mesh_brg_cfg_table_entry entry; + struct bt_mesh_brg_cfg_table_status rsp; int err = 0; entry.directions = shell_strtoul(argv[1], 0, &err); @@ -86,8 +86,8 @@ static int cmd_bridging_table_add(const struct shell *sh, size_t argc, char *arg return err; } - err = bt_mesh_brg_cfg_cli_bridging_table_add(bt_mesh_shell_target_ctx.net_idx, - bt_mesh_shell_target_ctx.dst, &entry, &rsp); + err = bt_mesh_brg_cfg_cli_table_add(bt_mesh_shell_target_ctx.net_idx, + bt_mesh_shell_target_ctx.dst, &entry, &rsp); if (err) { shell_error(sh, "Failed to send Bridging Table Add (err %d)", err); return -ENOEXEC; @@ -104,7 +104,7 @@ static int cmd_bridging_table_add(const struct shell *sh, size_t argc, char *arg static int cmd_bridging_table_remove(const struct shell *sh, size_t argc, char *argv[]) { uint16_t net_idx1, net_idx2, addr1, addr2; - struct bt_mesh_bridging_table_status rsp; + struct bt_mesh_brg_cfg_table_status rsp; int err = 0; net_idx1 = shell_strtoul(argv[1], 0, &err); @@ -116,9 +116,9 @@ static int cmd_bridging_table_remove(const struct shell *sh, size_t argc, char * return err; } - err = bt_mesh_brg_cfg_cli_bridging_table_remove(bt_mesh_shell_target_ctx.net_idx, - bt_mesh_shell_target_ctx.dst, net_idx1, - net_idx2, addr1, addr2, &rsp); + err = bt_mesh_brg_cfg_cli_table_remove(bt_mesh_shell_target_ctx.net_idx, + bt_mesh_shell_target_ctx.dst, net_idx1, net_idx2, + addr1, addr2, &rsp); if (err) { shell_error(sh, "Failed to send Bridging Table Remove (err %d)", err); return -ENOEXEC; @@ -134,9 +134,9 @@ static int cmd_bridging_table_remove(const struct shell *sh, size_t argc, char * static int cmd_bridged_subnets_get(const struct shell *sh, size_t argc, char *argv[]) { - struct bt_mesh_filter_netkey filter_net_idx; + struct bt_mesh_brg_cfg_filter_netkey filter_net_idx; uint8_t start_idx; - struct bt_mesh_bridged_subnets_list rsp = { + struct bt_mesh_brg_cfg_subnets_list rsp = { .list = NET_BUF_SIMPLE(CONFIG_BT_MESH_BRG_TABLE_ITEMS_MAX * 3), }; int err = 0; @@ -151,9 +151,9 @@ static int cmd_bridged_subnets_get(const struct shell *sh, size_t argc, char *ar return err; } - err = bt_mesh_brg_cfg_cli_bridged_subnets_get(bt_mesh_shell_target_ctx.net_idx, - bt_mesh_shell_target_ctx.dst, filter_net_idx, - start_idx, &rsp); + err = bt_mesh_brg_cfg_cli_subnets_get(bt_mesh_shell_target_ctx.net_idx, + bt_mesh_shell_target_ctx.dst, filter_net_idx, + start_idx, &rsp); if (err) { shell_error(sh, "Failed to send Bridged Subnets Get (err %d)", err); return -ENOEXEC; @@ -180,7 +180,7 @@ static int cmd_bridged_subnets_get(const struct shell *sh, size_t argc, char *ar static int cmd_bridging_table_get(const struct shell *sh, size_t argc, char *argv[]) { uint16_t net_idx1, net_idx2, start_idx; - struct bt_mesh_bridging_table_list rsp = { + struct bt_mesh_brg_cfg_table_list rsp = { .list = NET_BUF_SIMPLE(CONFIG_BT_MESH_BRG_TABLE_ITEMS_MAX * 5), }; int err = 0; @@ -195,9 +195,9 @@ static int cmd_bridging_table_get(const struct shell *sh, size_t argc, char *arg return err; } - err = bt_mesh_brg_cfg_cli_bridging_table_get(bt_mesh_shell_target_ctx.net_idx, - bt_mesh_shell_target_ctx.dst, net_idx1, - net_idx2, start_idx, &rsp); + err = bt_mesh_brg_cfg_cli_table_get(bt_mesh_shell_target_ctx.net_idx, + bt_mesh_shell_target_ctx.dst, net_idx1, net_idx2, + start_idx, &rsp); if (err) { shell_error(sh, "Failed to send Bridging Table Get (err %d)", err); return -ENOEXEC; diff --git a/tests/bluetooth/tester/src/btp_mesh.c b/tests/bluetooth/tester/src/btp_mesh.c index efd1d4c3584..2830d52556b 100644 --- a/tests/bluetooth/tester/src/btp_mesh.c +++ b/tests/bluetooth/tester/src/btp_mesh.c @@ -2086,10 +2086,10 @@ static uint8_t models_metadata_get(const void *cmd, uint16_t cmd_len, static uint8_t subnet_bridge_get(const void *cmd, uint16_t cmd_len, void *rsp, uint16_t *rsp_len) { const struct btp_mesh_subnet_bridge_get_cmd *cp = cmd; - enum bt_mesh_subnet_bridge_state state; + enum bt_mesh_brg_cfg_state state; int err; - err = bt_mesh_brg_cfg_cli_subnet_bridge_get(net.net_idx, sys_le16_to_cpu(cp->addr), &state); + err = bt_mesh_brg_cfg_cli_get(net.net_idx, sys_le16_to_cpu(cp->addr), &state); if (err) { LOG_ERR("err=%d", err); return BTP_STATUS_FAILED; @@ -2103,13 +2103,12 @@ static uint8_t subnet_bridge_get(const void *cmd, uint16_t cmd_len, void *rsp, u static uint8_t subnet_bridge_set(const void *cmd, uint16_t cmd_len, void *rsp, uint16_t *rsp_len) { const struct btp_mesh_subnet_bridge_set_cmd *cp = cmd; - enum bt_mesh_subnet_bridge_state state; + enum bt_mesh_brg_cfg_state state; int err; state = cp->val; - err = bt_mesh_brg_cfg_cli_subnet_bridge_set(net.net_idx, sys_le16_to_cpu(cp->addr), state, - &state); + err = bt_mesh_brg_cfg_cli_set(net.net_idx, sys_le16_to_cpu(cp->addr), state, &state); if (err) { LOG_ERR("err=%d", err); return BTP_STATUS_FAILED; @@ -2123,8 +2122,8 @@ static uint8_t subnet_bridge_set(const void *cmd, uint16_t cmd_len, void *rsp, u static uint8_t bridging_table_add(const void *cmd, uint16_t cmd_len, void *rsp, uint16_t *rsp_len) { const struct btp_mesh_bridging_table_add_cmd *cp = cmd; - struct bt_mesh_bridging_table_entry entry; - struct bt_mesh_bridging_table_status rp; + struct bt_mesh_brg_cfg_table_entry entry; + struct bt_mesh_brg_cfg_table_status rp; int err; LOG_DBG(""); @@ -2135,8 +2134,7 @@ static uint8_t bridging_table_add(const void *cmd, uint16_t cmd_len, void *rsp, entry.addr1 = sys_le16_to_cpu(cp->addr1); entry.addr2 = sys_le16_to_cpu(cp->addr2); - err = bt_mesh_brg_cfg_cli_bridging_table_add(net_key_idx, sys_le16_to_cpu(cp->addr), &entry, - &rp); + err = bt_mesh_brg_cfg_cli_table_add(net_key_idx, sys_le16_to_cpu(cp->addr), &entry, &rp); if (err) { LOG_ERR("err=%d", err); return BTP_STATUS_FAILED; @@ -2149,12 +2147,12 @@ static uint8_t bridging_table_remove(const void *cmd, uint16_t cmd_len, void *rs uint16_t *rsp_len) { const struct btp_mesh_bridging_table_remove_cmd *cp = cmd; - struct bt_mesh_bridging_table_status rp; + struct bt_mesh_brg_cfg_table_status rp; int err; LOG_DBG(""); - err = bt_mesh_brg_cfg_cli_bridging_table_remove( + err = bt_mesh_brg_cfg_cli_table_remove( net_key_idx, sys_le16_to_cpu(cp->addr), sys_le16_to_cpu(cp->net_idx1), sys_le16_to_cpu(cp->net_idx2), sys_le16_to_cpu(cp->addr1), sys_le16_to_cpu(cp->addr2), &rp); @@ -2170,8 +2168,8 @@ static uint8_t bridging_table_remove(const void *cmd, uint16_t cmd_len, void *rs static uint8_t bridged_subnets_get(const void *cmd, uint16_t cmd_len, void *rsp, uint16_t *rsp_len) { const struct btp_mesh_bridged_subnets_get_cmd *cp = cmd; - struct bt_mesh_filter_netkey filter_net_idx; - struct bt_mesh_bridged_subnets_list rp; + struct bt_mesh_brg_cfg_filter_netkey filter_net_idx; + struct bt_mesh_brg_cfg_subnets_list rp; int err; LOG_DBG(""); @@ -2184,8 +2182,8 @@ static uint8_t bridged_subnets_get(const void *cmd, uint16_t cmd_len, void *rsp, filter_net_idx.filter = cp->filter; filter_net_idx.net_idx = sys_le16_to_cpu(cp->net_idx); - err = bt_mesh_brg_cfg_cli_bridged_subnets_get(net_key_idx, sys_le16_to_cpu(cp->addr), - filter_net_idx, cp->start_idx, &rp); + err = bt_mesh_brg_cfg_cli_subnets_get(net_key_idx, sys_le16_to_cpu(cp->addr), + filter_net_idx, cp->start_idx, &rp); if (err) { LOG_ERR("err=%d", err); return BTP_STATUS_FAILED; @@ -2197,7 +2195,7 @@ static uint8_t bridged_subnets_get(const void *cmd, uint16_t cmd_len, void *rsp, static uint8_t bridging_table_get(const void *cmd, uint16_t cmd_len, void *rsp, uint16_t *rsp_len) { const struct btp_mesh_bridging_table_get_cmd *cp = cmd; - struct bt_mesh_bridging_table_list rp; + struct bt_mesh_brg_cfg_table_list rp; int err; LOG_DBG(""); @@ -2207,7 +2205,7 @@ static uint8_t bridging_table_get(const void *cmd, uint16_t cmd_len, void *rsp, */ rp.list = NULL; - err = bt_mesh_brg_cfg_cli_bridging_table_get( + err = bt_mesh_brg_cfg_cli_table_get( net_key_idx, sys_le16_to_cpu(cp->addr), sys_le16_to_cpu(cp->net_idx1), sys_le16_to_cpu(cp->net_idx2), sys_le16_to_cpu(cp->start_idx), &rp); if (err) { @@ -2227,8 +2225,7 @@ static uint8_t bridging_table_size_get(const void *cmd, uint16_t cmd_len, void * LOG_DBG(""); - err = bt_mesh_brg_cfg_cli_bridging_table_size_get(net_key_idx, sys_le16_to_cpu(cp->addr), - &size); + err = bt_mesh_brg_cfg_cli_table_size_get(net_key_idx, sys_le16_to_cpu(cp->addr), &size); if (err) { LOG_ERR("err=%d", err); return BTP_STATUS_FAILED; diff --git a/tests/bsim/bluetooth/mesh/src/test_brg.c b/tests/bsim/bluetooth/mesh/src/test_brg.c index 279bed1767b..5c82c4dce74 100644 --- a/tests/bsim/bluetooth/mesh/src/test_brg.c +++ b/tests/bsim/bluetooth/mesh/src/test_brg.c @@ -202,8 +202,8 @@ static void tester_setup(void) static void bridge_entry_add(uint16_t src, uint16_t dst, uint16_t net_idx1, uint16_t net_idx2, uint8_t dir) { - struct bt_mesh_bridging_table_entry entry; - struct bt_mesh_bridging_table_status rsp; + struct bt_mesh_brg_cfg_table_entry entry; + struct bt_mesh_brg_cfg_table_status rsp; int err; entry.directions = dir; @@ -212,7 +212,7 @@ static void bridge_entry_add(uint16_t src, uint16_t dst, uint16_t net_idx1, uint entry.addr1 = src; entry.addr2 = dst; - err = bt_mesh_brg_cfg_cli_bridging_table_add(0, BRIDGE_ADDR, &entry, &rsp); + err = bt_mesh_brg_cfg_cli_table_add(0, BRIDGE_ADDR, &entry, &rsp); if (err || rsp.status || rsp.entry.directions != dir || rsp.entry.net_idx1 != net_idx1 || rsp.entry.net_idx2 != net_idx2 || rsp.entry.addr1 != src || rsp.entry.addr2 != dst) { FAIL("Bridging table add failed (err %d) (status %u)", err, rsp.status); @@ -222,10 +222,10 @@ static void bridge_entry_add(uint16_t src, uint16_t dst, uint16_t net_idx1, uint static void bridge_entry_remove(uint16_t src, uint16_t dst, uint16_t net_idx1, uint16_t net_idx2) { - struct bt_mesh_bridging_table_status rsp; + struct bt_mesh_brg_cfg_table_status rsp; - ASSERT_OK(bt_mesh_brg_cfg_cli_bridging_table_remove(0, BRIDGE_ADDR, net_idx1, net_idx2, src, - dst, &rsp)); + ASSERT_OK(bt_mesh_brg_cfg_cli_table_remove(0, BRIDGE_ADDR, net_idx1, net_idx2, src, dst, + &rsp)); if (rsp.status) { FAIL("Bridging table remove failed (status %u)", rsp.status); return; @@ -247,9 +247,8 @@ static void tester_bridge_configure(int subnets) } } - ASSERT_OK(bt_mesh_brg_cfg_cli_subnet_bridge_set(0, BRIDGE_ADDR, - BT_MESH_SUBNET_BRIDGE_ENABLED, &status)); - if (status != BT_MESH_SUBNET_BRIDGE_ENABLED) { + ASSERT_OK(bt_mesh_brg_cfg_cli_set(0, BRIDGE_ADDR, BT_MESH_BRG_CFG_ENABLED, &status)); + if (status != BT_MESH_BRG_CFG_ENABLED) { FAIL("Subnet bridge set failed (status %u)", status); return; } @@ -333,14 +332,14 @@ struct bridged_addresses_entry { static void bridge_table_verify(uint16_t net_idx1, uint16_t net_idx2, uint16_t start_idx, struct bridged_addresses_entry *list, size_t list_len) { - struct bt_mesh_bridging_table_list rsp = { + struct bt_mesh_brg_cfg_table_list rsp = { .list = NET_BUF_SIMPLE(BT_MESH_RX_SDU_MAX), }; net_buf_simple_init(rsp.list, 0); - ASSERT_OK(bt_mesh_brg_cfg_cli_bridging_table_get(0, BRIDGE_ADDR, net_idx1, net_idx2, - start_idx, &rsp)); + ASSERT_OK( + bt_mesh_brg_cfg_cli_table_get(0, BRIDGE_ADDR, net_idx1, net_idx2, start_idx, &rsp)); ASSERT_EQUAL(rsp.status, 0); ASSERT_EQUAL(rsp.net_idx1, net_idx1); ASSERT_EQUAL(rsp.net_idx2, net_idx2); @@ -472,7 +471,7 @@ static void test_tester_simple(void) /* Adding devices to bridge table */ for (int i = 0; i < REMOTE_NODES; i++) { bridge_entry_add(PROV_ADDR, DEVICE_ADDR_START + i, 0, i + 1, - BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY); + BT_MESH_BRG_CFG_DIR_TWOWAY); } for (int i = 0; i < REMOTE_NODES; i++) { @@ -489,9 +488,8 @@ static void test_tester_simple(void) LOG_INF("Step 2: Disabling bridging..."); - err = bt_mesh_brg_cfg_cli_subnet_bridge_set(0, BRIDGE_ADDR, BT_MESH_SUBNET_BRIDGE_DISABLED, - &status); - if (err || status != BT_MESH_SUBNET_BRIDGE_DISABLED) { + err = bt_mesh_brg_cfg_cli_set(0, BRIDGE_ADDR, BT_MESH_BRG_CFG_DISABLED, &status); + if (err || status != BT_MESH_BRG_CFG_DISABLED) { FAIL("Subnet bridge set failed (err %d) (status %u)", err, status); return; } @@ -506,9 +504,8 @@ static void test_tester_simple(void) } LOG_INF("Step3: Enabling bridging..."); - err = bt_mesh_brg_cfg_cli_subnet_bridge_set(0, BRIDGE_ADDR, BT_MESH_SUBNET_BRIDGE_ENABLED, - &status); - if (err || status != BT_MESH_SUBNET_BRIDGE_ENABLED) { + err = bt_mesh_brg_cfg_cli_set(0, BRIDGE_ADDR, BT_MESH_BRG_CFG_ENABLED, &status); + if (err || status != BT_MESH_BRG_CFG_ENABLED) { FAIL("Subnet bridge set failed (err %d) (status %u)", err, status); return; } @@ -554,7 +551,7 @@ static void test_tester_table_state_change(void) ASSERT_EQUAL(err, -EAGAIN); /* DATA and GET messages should reach Device 1, but STATUS message won't be received. */ - bridge_entry_add(PROV_ADDR, DEVICE_ADDR_START, 0, 1, BT_MESH_SUBNET_BRIDGE_DIR_ONEWAY); + bridge_entry_add(PROV_ADDR, DEVICE_ADDR_START, 0, 1, BT_MESH_BRG_CFG_DIR_ONEWAY); ASSERT_OK(send_data(DEVICE_ADDR_START, 0xAA)); @@ -569,19 +566,17 @@ static void test_tester_table_state_change(void) /* Adding a reverse entry. This should be added to the bridge table as a separate entry as * the addresses and net keys indexs are provided in the opposite order. */ - bridge_entry_add(DEVICE_ADDR_START, PROV_ADDR, 1, 0, BT_MESH_SUBNET_BRIDGE_DIR_ONEWAY); - bridge_table_verify( - 0, 1, 0, - (struct bridged_addresses_entry[]){ - {PROV_ADDR, DEVICE_ADDR_START, BT_MESH_SUBNET_BRIDGE_DIR_ONEWAY}, - }, - 1); - bridge_table_verify( - 1, 0, 0, - (struct bridged_addresses_entry[]){ - {DEVICE_ADDR_START, PROV_ADDR, BT_MESH_SUBNET_BRIDGE_DIR_ONEWAY}, - }, - 1); + bridge_entry_add(DEVICE_ADDR_START, PROV_ADDR, 1, 0, BT_MESH_BRG_CFG_DIR_ONEWAY); + bridge_table_verify(0, 1, 0, + (struct bridged_addresses_entry[]){ + {PROV_ADDR, DEVICE_ADDR_START, BT_MESH_BRG_CFG_DIR_ONEWAY}, + }, + 1); + bridge_table_verify(1, 0, 0, + (struct bridged_addresses_entry[]){ + {DEVICE_ADDR_START, PROV_ADDR, BT_MESH_BRG_CFG_DIR_ONEWAY}, + }, + 1); k_sleep(K_SECONDS(1)); @@ -596,13 +591,12 @@ static void test_tester_table_state_change(void) * tester should still receive STATUS message. */ bridge_entry_remove(DEVICE_ADDR_START, PROV_ADDR, 1, 0); - bridge_entry_add(PROV_ADDR, DEVICE_ADDR_START, 0, 1, BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY); - bridge_table_verify( - 0, 1, 0, - (struct bridged_addresses_entry[]){ - {PROV_ADDR, DEVICE_ADDR_START, BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY}, - }, - 1); + bridge_entry_add(PROV_ADDR, DEVICE_ADDR_START, 0, 1, BT_MESH_BRG_CFG_DIR_TWOWAY); + bridge_table_verify(0, 1, 0, + (struct bridged_addresses_entry[]){ + {PROV_ADDR, DEVICE_ADDR_START, BT_MESH_BRG_CFG_DIR_TWOWAY}, + }, + 1); bridge_table_verify(1, 0, 0, NULL, 0); ASSERT_OK(send_get(DEVICE_ADDR_START)); @@ -651,7 +645,7 @@ static void test_tester_net_key_remove(void) /* Adding devices to bridge table */ for (int i = 0; i < REMOTE_NODES; i++) { bridge_entry_add(PROV_ADDR, DEVICE_ADDR_START + i, 0, i + 1, - BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY); + BT_MESH_BRG_CFG_DIR_TWOWAY); } ASSERT_OK(send_data(DEVICE_ADDR_START, 0xAA)); @@ -667,21 +661,20 @@ static void test_tester_net_key_remove(void) err = k_sem_take(&status_msg_recvd_sem, K_SECONDS(5)); ASSERT_EQUAL(err, -EAGAIN); - bridge_table_verify( - 0, 2, 0, - (struct bridged_addresses_entry[]){ - {PROV_ADDR, DEVICE_ADDR_START + 1, BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY}, - }, - 1); + bridge_table_verify(0, 2, 0, + (struct bridged_addresses_entry[]){ + {PROV_ADDR, DEVICE_ADDR_START + 1, BT_MESH_BRG_CFG_DIR_TWOWAY}, + }, + 1); /* Bridging Table Get message will return Invalid NetKey Index error because Subnet 1 is * removed. */ - struct bt_mesh_bridging_table_list rsp = { + struct bt_mesh_brg_cfg_table_list rsp = { .list = NULL, }; - ASSERT_OK(bt_mesh_brg_cfg_cli_bridging_table_get(0, BRIDGE_ADDR, 0, 1, 0, &rsp)); + ASSERT_OK(bt_mesh_brg_cfg_cli_table_get(0, BRIDGE_ADDR, 0, 1, 0, &rsp)); ASSERT_EQUAL(rsp.status, 4); PASS(); @@ -699,8 +692,8 @@ static void test_tester_persistence(void) LOG_INF("Already provisioned, skipping provisioning"); - ASSERT_OK(bt_mesh_brg_cfg_cli_subnet_bridge_get(0, BRIDGE_ADDR, &status)); - if (status != BT_MESH_SUBNET_BRIDGE_ENABLED) { + ASSERT_OK(bt_mesh_brg_cfg_cli_get(0, BRIDGE_ADDR, &status)); + if (status != BT_MESH_BRG_CFG_ENABLED) { FAIL("Subnet bridge set failed (status %u)", status); return; } @@ -708,30 +701,30 @@ static void test_tester_persistence(void) bridge_table_verify( 0, 1, 0, (struct bridged_addresses_entry[]){ - {PROV_ADDR, DEVICE_ADDR_START, BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY}, + {PROV_ADDR, DEVICE_ADDR_START, BT_MESH_BRG_CFG_DIR_TWOWAY}, }, 1); - bridge_table_verify(0, 2, 0, - (struct bridged_addresses_entry[]){ - {PROV_ADDR, DEVICE_ADDR_START + 1, - BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY}, - }, - 1); + bridge_table_verify( + 0, 2, 0, + (struct bridged_addresses_entry[]){ + {PROV_ADDR, DEVICE_ADDR_START + 1, BT_MESH_BRG_CFG_DIR_TWOWAY}, + }, + 1); bridge_table_verify( 1, 0, 0, (struct bridged_addresses_entry[]){ - {DEVICE_ADDR_START, PROV_ADDR, BT_MESH_SUBNET_BRIDGE_DIR_ONEWAY}, + {DEVICE_ADDR_START, PROV_ADDR, BT_MESH_BRG_CFG_DIR_ONEWAY}, }, 1); - bridge_table_verify(2, 0, 0, - (struct bridged_addresses_entry[]){ - {DEVICE_ADDR_START + 1, PROV_ADDR, - BT_MESH_SUBNET_BRIDGE_DIR_ONEWAY}, - }, - 1); + bridge_table_verify( + 2, 0, 0, + (struct bridged_addresses_entry[]){ + {DEVICE_ADDR_START + 1, PROV_ADDR, BT_MESH_BRG_CFG_DIR_ONEWAY}, + }, + 1); } else { tester_setup(); @@ -744,9 +737,9 @@ static void test_tester_persistence(void) /* Adding devices to bridge table */ for (int i = 0; i < REMOTE_NODES; i++) { bridge_entry_add(PROV_ADDR, DEVICE_ADDR_START + i, 0, i + 1, - BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY); + BT_MESH_BRG_CFG_DIR_TWOWAY); bridge_entry_add(DEVICE_ADDR_START + i, PROV_ADDR, i + 1, 0, - BT_MESH_SUBNET_BRIDGE_DIR_ONEWAY); + BT_MESH_BRG_CFG_DIR_ONEWAY); } k_sleep(K_SECONDS(CONFIG_BT_MESH_STORE_TIMEOUT)); @@ -839,7 +832,7 @@ static void test_tester_ivu(void) /* Adding devices to bridge table */ for (int i = 0; i < REMOTE_NODES; i++) { bridge_entry_add(PROV_ADDR, DEVICE_ADDR_START + i, 0, i + 1, - BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY); + BT_MESH_BRG_CFG_DIR_TWOWAY); } for (int i = 0; i < REMOTE_NODES; i++) { From f9907a701e744647472ba0d19bcb8ec4c8e17482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Reierstad?= Date: Wed, 23 Oct 2024 09:35:57 +0200 Subject: [PATCH 4/8] [nrf fromtree] Bluetooth: Mesh: Remove duplicate brg declaration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removes duplicate declaration of the bridging direction, keeping the one in the public header file. Signed-off-by: Håvard Reierstad (cherry picked from commit 0fe6d34f8a49da81c5b9c2b9d324122a169c38a5) Signed-off-by: Håvard Reierstad --- include/zephyr/bluetooth/mesh/brg_cfg.h | 4 ++-- subsys/bluetooth/mesh/brg_cfg.c | 4 ++-- subsys/bluetooth/mesh/brg_cfg.h | 15 ++------------- tests/bluetooth/mesh/brg/src/main.c | 5 +++++ 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/include/zephyr/bluetooth/mesh/brg_cfg.h b/include/zephyr/bluetooth/mesh/brg_cfg.h index a488fed09c5..754ecc9e3e4 100644 --- a/include/zephyr/bluetooth/mesh/brg_cfg.h +++ b/include/zephyr/bluetooth/mesh/brg_cfg.h @@ -28,9 +28,9 @@ enum bt_mesh_brg_cfg_state { BT_MESH_BRG_CFG_ENABLED, }; -/* Briding from Addr1 to Addr2. */ +/* Bridging from Addr1 to Addr2. */ #define BT_MESH_BRG_CFG_DIR_ONEWAY 1 -/* Bidirectional briging between Addr1 and Addr2. */ +/* Bidirectional bridging between Addr1 and Addr2. */ #define BT_MESH_BRG_CFG_DIR_TWOWAY 2 /** Bridging Table state entry corresponding to a entry in the Bridging Table. */ diff --git a/subsys/bluetooth/mesh/brg_cfg.c b/subsys/bluetooth/mesh/brg_cfg.c index 9c90773faef..112d2fe0a3e 100644 --- a/subsys/bluetooth/mesh/brg_cfg.c +++ b/subsys/bluetooth/mesh/brg_cfg.c @@ -224,8 +224,8 @@ static bool netkey_check(uint16_t net_idx1, uint16_t net_idx2) return bt_mesh_subnet_get(net_idx1) && bt_mesh_subnet_get(net_idx2); } -int bt_mesh_brg_cfg_tbl_add(enum bt_mesh_brg_cfg_dir direction, uint16_t net_idx1, - uint16_t net_idx2, uint16_t addr1, uint16_t addr2, uint8_t *status) +int bt_mesh_brg_cfg_tbl_add(uint8_t direction, uint16_t net_idx1, uint16_t net_idx2, uint16_t addr1, + uint16_t addr2, uint8_t *status) { /* Sanity checks */ if (!BT_MESH_ADDR_IS_UNICAST(addr1) || net_idx1 == net_idx2 || addr1 == addr2 || diff --git a/subsys/bluetooth/mesh/brg_cfg.h b/subsys/bluetooth/mesh/brg_cfg.h index af8cc5adc0f..4deddd05c1b 100644 --- a/subsys/bluetooth/mesh/brg_cfg.h +++ b/subsys/bluetooth/mesh/brg_cfg.h @@ -13,17 +13,6 @@ #define BT_MESH_BRG_CFG_NKEY_PRHB_FLT_MASK 0x000C -enum bt_mesh_brg_cfg_dir { - /* Value is prohibited. */ - BT_MESH_BRG_CFG_DIR_PROHIBITED = 0, - /* Briging from Addr1 to Addr2. */ - BT_MESH_BRG_CFG_DIR_ONEWAY = 1, - /* Briging to/from Addr1 from/to Addr2. */ - BT_MESH_BRG_CFG_DIR_TWOWAY = 2, - /* Values above these are prohibited. */ - BT_MESH_BRG_CFG_DIR_MAX = 3, -}; - #define BT_MESH_BRG_CFG_NETIDX_NOMATCH 0xFFFF /* One row of the bridging table */ @@ -50,8 +39,8 @@ int bt_mesh_brg_cfg_tbl_reset(void); int bt_mesh_brg_cfg_tbl_get(const struct bt_mesh_brg_cfg_row **rows); -int bt_mesh_brg_cfg_tbl_add(enum bt_mesh_brg_cfg_dir direction, uint16_t net_idx1, - uint16_t net_idx2, uint16_t addr1, uint16_t addr2, uint8_t *status); +int bt_mesh_brg_cfg_tbl_add(uint8_t direction, uint16_t net_idx1, uint16_t net_idx2, uint16_t addr1, + uint16_t addr2, uint8_t *status); int bt_mesh_brg_cfg_tbl_remove(uint16_t net_idx1, uint16_t net_idx2, uint16_t addr1, uint16_t addr2, uint8_t *status); diff --git a/tests/bluetooth/mesh/brg/src/main.c b/tests/bluetooth/mesh/brg/src/main.c index 65cf5424012..2b98722e402 100644 --- a/tests/bluetooth/mesh/brg/src/main.c +++ b/tests/bluetooth/mesh/brg/src/main.c @@ -293,6 +293,11 @@ ZTEST(bt_mesh_brg_cfg, test_brg_tbl_pending_store) bt_mesh_brg_cfg_pending_store(); } +/* Value is prohibited. */ +#define BT_MESH_BRG_CFG_DIR_PROHIBITED 0 +/* Values above and including this is prohibited. */ +#define BT_MESH_BRG_CFG_DIR_MAX 3 + /* Test if invalid entries are not added to the table. */ ZTEST(bt_mesh_brg_cfg, test_tbl_add_invalid_ip) { From 617c8ba5b5b80cdab5b0f8c75238560a8570c09e Mon Sep 17 00:00:00 2001 From: Ingar Kulbrandstad Date: Wed, 23 Oct 2024 09:35:57 +0200 Subject: [PATCH 5/8] [nrf fromtree] Bluetooth: Mesh: Fix out of bounds write MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix of the subnet bridging table function to only compact the table if elements has been removed, and fixing the compact function to compact the table if several elemnts has been removed at the same time. Fixes zephyrproject-rtos#78794 Signed-off-by: Ingar Kulbrandstad (cherry picked from commit b32eb0d2b2c7c3cd5e4e2b9acdf6cac7f26712a0) Signed-off-by: Håvard Reierstad --- subsys/bluetooth/mesh/brg_cfg.c | 72 +++++++++++-------- tests/bluetooth/mesh/brg/src/main.c | 105 ++++++++++++++++++++++++++++ 2 files changed, 147 insertions(+), 30 deletions(-) diff --git a/subsys/bluetooth/mesh/brg_cfg.c b/subsys/bluetooth/mesh/brg_cfg.c index 112d2fe0a3e..58d1aada550 100644 --- a/subsys/bluetooth/mesh/brg_cfg.c +++ b/subsys/bluetooth/mesh/brg_cfg.c @@ -33,18 +33,18 @@ enum { }; static ATOMIC_DEFINE(brg_cfg_flags, BRG_CFG_FLAGS_COUNT); -static void brg_tbl_compact(void) +/* Compact the bridge table for all removed entries, input is first removed entry */ +static void brg_tbl_compact(int j) { - int j = 0; - - for (int k = 0; k < bt_mesh_brg_cfg_row_cnt; k++) { + for (int k = j; k < bt_mesh_brg_cfg_row_cnt; k++) { if (brg_tbl[k].direction != 0) { brg_tbl[j] = brg_tbl[k]; j++; } } - memset(&brg_tbl[j], 0, sizeof(brg_tbl[j])); - bt_mesh_brg_cfg_row_cnt--; + + memset(&brg_tbl[j], 0, sizeof(brg_tbl[j]) * (bt_mesh_brg_cfg_row_cnt - j)); + bt_mesh_brg_cfg_row_cnt = j; } /* Set function for initializing bridging enable state from value stored in settings. */ @@ -167,21 +167,30 @@ void bt_mesh_brg_cfg_pending_store(void) */ static void brg_tbl_netkey_removed_evt(struct bt_mesh_subnet *sub, enum bt_mesh_key_evt evt) { + int first_removed = -1; + if (evt != BT_MESH_KEY_DELETED) { return; } - for (int i = 0; i < CONFIG_BT_MESH_BRG_TABLE_ITEMS_MAX; i++) { - if (brg_tbl[i].direction && - (brg_tbl[i].net_idx1 == sub->net_idx || brg_tbl[i].net_idx2 == sub->net_idx)) { - memset(&brg_tbl[i], 0, sizeof(brg_tbl[i])); - brg_tbl_compact(); + for (int i = 0; i < bt_mesh_brg_cfg_row_cnt; i++) { + if (brg_tbl[i].net_idx1 == sub->net_idx || brg_tbl[i].net_idx2 == sub->net_idx) { + /* Setting direction to 0, entry will be cleared in brg_tbl_compact. */ + brg_tbl[i].direction = 0; + if (first_removed == -1) { + first_removed = i; + } } } - if (IS_ENABLED(CONFIG_BT_SETTINGS)) { - atomic_set_bit(brg_cfg_flags, TABLE_UPDATED); - bt_mesh_settings_store_schedule(BT_MESH_SETTINGS_BRG_PENDING); + if (first_removed != -1) { + /* Compact when all rows have been deleted. */ + brg_tbl_compact(first_removed); + + if (IS_ENABLED(CONFIG_BT_SETTINGS)) { + atomic_set_bit(brg_cfg_flags, TABLE_UPDATED); + bt_mesh_settings_store_schedule(BT_MESH_SETTINGS_BRG_PENDING); + } } } @@ -263,7 +272,7 @@ int bt_mesh_brg_cfg_tbl_add(uint8_t direction, uint16_t net_idx1, uint16_t net_i } /* Empty element, is the current table row counter */ - if (bt_mesh_brg_cfg_row_cnt == CONFIG_BT_MESH_BRG_TABLE_ITEMS_MAX) { + if (bt_mesh_brg_cfg_row_cnt >= CONFIG_BT_MESH_BRG_TABLE_ITEMS_MAX) { *status = STATUS_INSUFF_RESOURCES; return 0; } @@ -306,7 +315,7 @@ void bt_mesh_brg_cfg_tbl_foreach_subnet(uint16_t src, uint16_t dst, uint16_t net int bt_mesh_brg_cfg_tbl_remove(uint16_t net_idx1, uint16_t net_idx2, uint16_t addr1, uint16_t addr2, uint8_t *status) { - bool store = false; + int first_removed = -1; /* Sanity checks */ if ((!BT_MESH_ADDR_IS_UNICAST(addr1) && addr1 != BT_MESH_ADDR_UNASSIGNED) || @@ -334,26 +343,29 @@ int bt_mesh_brg_cfg_tbl_remove(uint16_t net_idx1, uint16_t net_idx2, uint16_t ad for (int i = 0; i < bt_mesh_brg_cfg_row_cnt; i++) { /* Match according to remove behavior in Section 4.4.9.2.2 of MshPRT_v1.1 */ - if (brg_tbl[i].direction) { - if (!(brg_tbl[i].net_idx1 == net_idx1 && brg_tbl[i].net_idx2 == net_idx2)) { - continue; - } + if (!(brg_tbl[i].net_idx1 == net_idx1 && brg_tbl[i].net_idx2 == net_idx2)) { + continue; + } - if ((brg_tbl[i].addr1 == addr1 && brg_tbl[i].addr2 == addr2) || - (addr2 == BT_MESH_ADDR_UNASSIGNED && brg_tbl[i].addr1 == addr1) || - (addr1 == BT_MESH_ADDR_UNASSIGNED && brg_tbl[i].addr2 == addr2)) { - memset(&brg_tbl[i], 0, sizeof(brg_tbl[i])); - store = true; + if ((brg_tbl[i].addr1 == addr1 && brg_tbl[i].addr2 == addr2) || + (addr2 == BT_MESH_ADDR_UNASSIGNED && brg_tbl[i].addr1 == addr1) || + (addr1 == BT_MESH_ADDR_UNASSIGNED && brg_tbl[i].addr2 == addr2)) { + /* Setting direction to 0, entry will be cleared in brg_tbl_compact. */ + brg_tbl[i].direction = 0; + if (first_removed == -1) { + first_removed = i; } } } - /* Compact when all rows have been deleted. */ - brg_tbl_compact(); + if (first_removed != -1) { + /* Compact when all rows have been deleted. */ + brg_tbl_compact(first_removed); - if (IS_ENABLED(CONFIG_BT_SETTINGS) && store) { - atomic_set_bit(brg_cfg_flags, TABLE_UPDATED); - bt_mesh_settings_store_schedule(BT_MESH_SETTINGS_BRG_PENDING); + if (IS_ENABLED(CONFIG_BT_SETTINGS)) { + atomic_set_bit(brg_cfg_flags, TABLE_UPDATED); + bt_mesh_settings_store_schedule(BT_MESH_SETTINGS_BRG_PENDING); + } } *status = STATUS_SUCCESS; diff --git a/tests/bluetooth/mesh/brg/src/main.c b/tests/bluetooth/mesh/brg/src/main.c index 2b98722e402..e9ae46fff7f 100644 --- a/tests/bluetooth/mesh/brg/src/main.c +++ b/tests/bluetooth/mesh/brg/src/main.c @@ -218,6 +218,111 @@ ZTEST(bt_mesh_brg_cfg, test_basic_functionality_storage) } } +static void check_bt_mesh_brg_cfg_tbl_multiple_delete(int expect_left) +{ + uint8_t status; + int err; + int n; + const struct bt_mesh_brg_cfg_row *brg_tbl; + + n = bt_mesh_brg_cfg_tbl_get(&brg_tbl); + zassert_equal(n, TEST_VECT_SZ - 1); + + ztest_expect_value(bt_mesh_settings_store_schedule, flag, BT_MESH_SETTINGS_BRG_PENDING); + err = bt_mesh_brg_cfg_tbl_remove(test_vector[1].net_idx1, test_vector[1].net_idx2, + test_vector[1].addr1, BT_MESH_ADDR_UNASSIGNED, &status); + zassert_equal(err, 0); + + n = bt_mesh_brg_cfg_tbl_get(&brg_tbl); + zassert_equal(n, expect_left); + + for (int i = 0; i < n; i++) { + zassert_true(brg_tbl[i].net_idx1 == test_vector[0].net_idx1); + zassert_true(brg_tbl[i].net_idx2 == test_vector[0].net_idx2); + zassert_true(brg_tbl[i].addr1 == test_vector[0].addr1); + zassert_true(brg_tbl[i].addr2 == test_vector[i * 2].addr2); + } +} + +ZTEST(bt_mesh_brg_cfg, test_removal_multiple_entries) +{ + check_bt_mesh_brg_cfg_tbl_reset(); + + uint8_t status; + int err; + + /* Test removal of every second entry */ + for (int i = 0; i < TEST_VECT_SZ - 1; i++) { + ztest_expect_value(bt_mesh_settings_store_schedule, flag, + BT_MESH_SETTINGS_BRG_PENDING); + err = bt_mesh_brg_cfg_tbl_add(test_vector[i].direction, test_vector[i % 2].net_idx1, + test_vector[i % 2].net_idx2, test_vector[i % 2].addr1, + test_vector[i].addr2, &status); + zassert_equal(err, 0); + zassert_equal(status, STATUS_SUCCESS); + } + + check_bt_mesh_brg_cfg_tbl_multiple_delete((TEST_VECT_SZ - 1) / 2); + check_bt_mesh_brg_cfg_tbl_reset(); + + /* Test removal of all entries, except first */ + for (int i = 0; i < TEST_VECT_SZ - 1; i++) { + ztest_expect_value(bt_mesh_settings_store_schedule, flag, + BT_MESH_SETTINGS_BRG_PENDING); + if (i == 0) { + err = bt_mesh_brg_cfg_tbl_add(test_vector[i].direction, + test_vector[i].net_idx1, + test_vector[i].net_idx2, test_vector[i].addr1, + test_vector[i].addr2, &status); + } else { + err = bt_mesh_brg_cfg_tbl_add(test_vector[i].direction, + test_vector[1].net_idx1, + test_vector[1].net_idx2, test_vector[1].addr1, + test_vector[i].addr2, &status); + } + zassert_equal(err, 0); + zassert_equal(status, STATUS_SUCCESS); + } + + check_bt_mesh_brg_cfg_tbl_multiple_delete(1); + check_bt_mesh_brg_cfg_tbl_reset(); + + /* Test removal of all entries, except last */ + for (int i = TEST_VECT_SZ - 2; i >= 0; i--) { + ztest_expect_value(bt_mesh_settings_store_schedule, flag, + BT_MESH_SETTINGS_BRG_PENDING); + if (i == 0) { + err = bt_mesh_brg_cfg_tbl_add(test_vector[i].direction, + test_vector[i].net_idx1, + test_vector[i].net_idx2, test_vector[i].addr1, + test_vector[i].addr2, &status); + } else { + err = bt_mesh_brg_cfg_tbl_add(test_vector[i].direction, + test_vector[1].net_idx1, + test_vector[1].net_idx2, test_vector[1].addr1, + test_vector[i].addr2, &status); + } + zassert_equal(err, 0); + zassert_equal(status, STATUS_SUCCESS); + } + + check_bt_mesh_brg_cfg_tbl_multiple_delete(1); + check_bt_mesh_brg_cfg_tbl_reset(); + + /* Test removal of all entries */ + for (int i = 0; i < TEST_VECT_SZ - 1; i++) { + ztest_expect_value(bt_mesh_settings_store_schedule, flag, + BT_MESH_SETTINGS_BRG_PENDING); + err = bt_mesh_brg_cfg_tbl_add(test_vector[i].direction, test_vector[1].net_idx1, + test_vector[1].net_idx2, test_vector[1].addr1, + test_vector[i].addr2, &status); + zassert_equal(err, 0); + zassert_equal(status, STATUS_SUCCESS); + } + + check_bt_mesh_brg_cfg_tbl_multiple_delete(0); +} + static void pending_store_enable_create_expectations(bool *enable_val) { if (*enable_val) { From 57e12b59802639d3ce97327e4b992d01c89c1729 Mon Sep 17 00:00:00 2001 From: Lingao Meng Date: Wed, 23 Oct 2024 09:35:57 +0200 Subject: [PATCH 6/8] [nrf fromtree] Bluetooth: Mesh: Refine Mesh store logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move flag&handler to structure, not only save some flash size but also make code more readable. Signed-off-by: Lingao Meng (cherry picked from commit 664c087d558d9a918ebe2b16e08713287aa2f5c2) Signed-off-by: Håvard Reierstad --- subsys/bluetooth/mesh/rpl.c | 5 ++ subsys/bluetooth/mesh/rpl.h | 1 + subsys/bluetooth/mesh/settings.c | 116 ++++++++++--------------------- 3 files changed, 43 insertions(+), 79 deletions(-) diff --git a/subsys/bluetooth/mesh/rpl.c b/subsys/bluetooth/mesh/rpl.c index 213ed7d4479..581c94771c8 100644 --- a/subsys/bluetooth/mesh/rpl.c +++ b/subsys/bluetooth/mesh/rpl.c @@ -404,3 +404,8 @@ void bt_mesh_rpl_pending_store(uint16_t addr) (void)memset(&replay_list[last - shift + 1], 0, sizeof(struct bt_mesh_rpl) * shift); } } + +void bt_mesh_rpl_pending_store_all_nodes(void) +{ + bt_mesh_rpl_pending_store(BT_MESH_ADDR_ALL_NODES); +} diff --git a/subsys/bluetooth/mesh/rpl.h b/subsys/bluetooth/mesh/rpl.h index 39395bb25d1..6dbe4796033 100644 --- a/subsys/bluetooth/mesh/rpl.h +++ b/subsys/bluetooth/mesh/rpl.h @@ -26,3 +26,4 @@ bool bt_mesh_rpl_check(struct bt_mesh_net_rx *rx, struct bt_mesh_rpl **match, bo void bt_mesh_rpl_clear(void); void bt_mesh_rpl_update(struct bt_mesh_rpl *rpl, struct bt_mesh_net_rx *rx); +void bt_mesh_rpl_pending_store_all_nodes(void); diff --git a/subsys/bluetooth/mesh/settings.c b/subsys/bluetooth/mesh/settings.c index 5c9e03693bc..6bd651c7493 100644 --- a/subsys/bluetooth/mesh/settings.c +++ b/subsys/bluetooth/mesh/settings.c @@ -184,86 +184,44 @@ static void store_pending(struct k_work *work) { LOG_DBG(""); - if (atomic_test_and_clear_bit(pending_flags, BT_MESH_SETTINGS_RPL_PENDING)) { - bt_mesh_rpl_pending_store(BT_MESH_ADDR_ALL_NODES); - } - - if (atomic_test_and_clear_bit(pending_flags, - BT_MESH_SETTINGS_NET_KEYS_PENDING)) { - bt_mesh_subnet_pending_store(); - } - - if (atomic_test_and_clear_bit(pending_flags, - BT_MESH_SETTINGS_APP_KEYS_PENDING)) { - bt_mesh_app_key_pending_store(); - } - - if (atomic_test_and_clear_bit(pending_flags, - BT_MESH_SETTINGS_NET_PENDING)) { - bt_mesh_net_pending_net_store(); - } - - if (atomic_test_and_clear_bit(pending_flags, - BT_MESH_SETTINGS_IV_PENDING)) { - bt_mesh_net_pending_iv_store(); - } - - if (atomic_test_and_clear_bit(pending_flags, - BT_MESH_SETTINGS_SEQ_PENDING)) { - bt_mesh_net_pending_seq_store(); - } - - if (atomic_test_and_clear_bit(pending_flags, - BT_MESH_SETTINGS_DEV_KEY_CAND_PENDING)) { - bt_mesh_net_pending_dev_key_cand_store(); - } - - if (atomic_test_and_clear_bit(pending_flags, - BT_MESH_SETTINGS_HB_PUB_PENDING)) { - bt_mesh_hb_pub_pending_store(); - } - - if (atomic_test_and_clear_bit(pending_flags, - BT_MESH_SETTINGS_CFG_PENDING)) { - bt_mesh_cfg_pending_store(); - } - - if (atomic_test_and_clear_bit(pending_flags, - BT_MESH_SETTINGS_COMP_PENDING)) { - bt_mesh_comp_data_pending_clear(); - } - - if (atomic_test_and_clear_bit(pending_flags, - BT_MESH_SETTINGS_MOD_PENDING)) { - bt_mesh_model_pending_store(); - } - - if (atomic_test_and_clear_bit(pending_flags, - BT_MESH_SETTINGS_VA_PENDING)) { - bt_mesh_va_pending_store(); - } - - if (IS_ENABLED(CONFIG_BT_MESH_CDB) && - atomic_test_and_clear_bit(pending_flags, - BT_MESH_SETTINGS_CDB_PENDING)) { - bt_mesh_cdb_pending_store(); - } - - if (IS_ENABLED(CONFIG_BT_MESH_OD_PRIV_PROXY_SRV) && - atomic_test_and_clear_bit(pending_flags, - BT_MESH_SETTINGS_SRPL_PENDING)) { - bt_mesh_srpl_pending_store(); - } - - if (IS_ENABLED(CONFIG_BT_MESH_PROXY_SOLICITATION) && - atomic_test_and_clear_bit(pending_flags, - BT_MESH_SETTINGS_SSEQ_PENDING)) { - bt_mesh_sseq_pending_store(); - } + static const struct { + void (*handler)(void); + } handlers[BT_MESH_SETTINGS_FLAG_COUNT] = { + [BT_MESH_SETTINGS_RPL_PENDING] = { bt_mesh_rpl_pending_store_all_nodes }, + [BT_MESH_SETTINGS_NET_KEYS_PENDING] = { bt_mesh_subnet_pending_store }, + [BT_MESH_SETTINGS_APP_KEYS_PENDING] = { bt_mesh_app_key_pending_store }, + [BT_MESH_SETTINGS_NET_PENDING] = { bt_mesh_net_pending_net_store }, + [BT_MESH_SETTINGS_IV_PENDING] = { bt_mesh_net_pending_iv_store }, + [BT_MESH_SETTINGS_SEQ_PENDING] = { bt_mesh_net_pending_seq_store }, + [BT_MESH_SETTINGS_DEV_KEY_CAND_PENDING] = { + bt_mesh_net_pending_dev_key_cand_store }, + [BT_MESH_SETTINGS_HB_PUB_PENDING] = { bt_mesh_hb_pub_pending_store }, + [BT_MESH_SETTINGS_CFG_PENDING] = { bt_mesh_cfg_pending_store }, + [BT_MESH_SETTINGS_COMP_PENDING] = { bt_mesh_comp_data_pending_clear }, + [BT_MESH_SETTINGS_MOD_PENDING] = { bt_mesh_model_pending_store }, + [BT_MESH_SETTINGS_VA_PENDING] = { bt_mesh_va_pending_store }, + [BT_MESH_SETTINGS_CDB_PENDING] = { + IS_ENABLED(CONFIG_BT_MESH_CDB) ? + bt_mesh_cdb_pending_store : NULL }, + [BT_MESH_SETTINGS_SRPL_PENDING] = { + IS_ENABLED(CONFIG_BT_MESH_OD_PRIV_PROXY_SRV) ? + bt_mesh_srpl_pending_store : NULL }, + [BT_MESH_SETTINGS_SSEQ_PENDING] = { + IS_ENABLED(CONFIG_BT_MESH_PROXY_SOLICITATION) ? + bt_mesh_sseq_pending_store : NULL }, + [BT_MESH_SETTINGS_BRG_PENDING] = { + IS_ENABLED(CONFIG_BT_MESH_BRG_CFG_SRV) ? + bt_mesh_brg_cfg_pending_store : NULL }, + }; + + for (int i = 0; i < ARRAY_SIZE(handlers); i++) { + if (!handlers[i].handler) { + continue; + } - if (IS_ENABLED(CONFIG_BT_MESH_BRG_CFG_SRV) && - atomic_test_and_clear_bit(pending_flags, BT_MESH_SETTINGS_BRG_PENDING)) { - bt_mesh_brg_cfg_pending_store(); + if (atomic_test_and_clear_bit(pending_flags, i)) { + handlers[i].handler(); + } } } From 68487b3ba420a137f789e8f0c9753ca2f769ba77 Mon Sep 17 00:00:00 2001 From: Lingao Meng Date: Wed, 23 Oct 2024 09:35:57 +0200 Subject: [PATCH 7/8] [nrf fromtree] Bluetooth: Mesh: Fixes after proxy advertising unable to send messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When Proxy advertising or PB-GATT Advertising Enabled and use a same advertising sets. As adv\_start will call multi HCI Command will cause syswork_q yield. At same time, if another thread(BT RX) all schedule\_send will cause unable send mesh message, because ADV\_FLAG\_ACTIVE was be set, but ADV\_FLAG\_PROXY not set currentlly. Add ADV\_FLAG\_SCHEDULE\_PENDING indicate mesh buf has been pendings but not scheduled, so when proxy advertising enable, let's take again, as we can't break or terminated adv\_start, so we must waiting proxy advertising enabled. But after https://github.com/zephyrproject-rtos/zephyr/pull/68558 The `k_work_is_pending` always true in `send_pending_adv`, which cause unable to send more mesh message until more mesh message comming Signed-off-by: Lingao Meng (cherry picked from commit 537d2159816e203dcbc4dc3ae4e7ad248cd28569) Signed-off-by: Håvard Reierstad --- subsys/bluetooth/mesh/adv_ext.c | 43 ++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index 03d2cbb7ea3..39e6ce87759 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -266,6 +266,28 @@ static const char * const adv_tag_to_str[] = { [BT_MESH_ADV_TAG_PROV] = "prov adv", }; +static bool schedule_send_with_mask(struct bt_mesh_ext_adv *ext_adv, int ignore_mask) +{ + if (atomic_test_and_clear_bit(ext_adv->flags, ADV_FLAG_PROXY)) { + atomic_clear_bit(ext_adv->flags, ADV_FLAG_PROXY_START); + (void)bt_le_ext_adv_stop(ext_adv->instance); + + atomic_clear_bit(ext_adv->flags, ADV_FLAG_ACTIVE); + } + + if (atomic_test_bit(ext_adv->flags, ADV_FLAG_ACTIVE)) { + atomic_set_bit(ext_adv->flags, ADV_FLAG_SCHEDULE_PENDING); + return false; + } else if ((~ignore_mask) & k_work_busy_get(&ext_adv->work)) { + return false; + } + + atomic_clear_bit(ext_adv->flags, ADV_FLAG_SCHEDULE_PENDING); + k_work_submit(&ext_adv->work); + + return true; +} + static void send_pending_adv(struct k_work *work) { struct bt_mesh_ext_adv *ext_adv; @@ -339,30 +361,13 @@ static void send_pending_adv(struct k_work *work) } if (atomic_test_and_clear_bit(ext_adv->flags, ADV_FLAG_SCHEDULE_PENDING)) { - schedule_send(ext_adv); + schedule_send_with_mask(ext_adv, K_WORK_RUNNING); } } static bool schedule_send(struct bt_mesh_ext_adv *ext_adv) { - if (atomic_test_and_clear_bit(ext_adv->flags, ADV_FLAG_PROXY)) { - atomic_clear_bit(ext_adv->flags, ADV_FLAG_PROXY_START); - (void)bt_le_ext_adv_stop(ext_adv->instance); - - atomic_clear_bit(ext_adv->flags, ADV_FLAG_ACTIVE); - } - - if (atomic_test_bit(ext_adv->flags, ADV_FLAG_ACTIVE)) { - atomic_set_bit(ext_adv->flags, ADV_FLAG_SCHEDULE_PENDING); - return false; - } else if (k_work_is_pending(&ext_adv->work)) { - return false; - } - - atomic_clear_bit(ext_adv->flags, ADV_FLAG_SCHEDULE_PENDING); - k_work_submit(&ext_adv->work); - - return true; + return schedule_send_with_mask(ext_adv, 0); } void bt_mesh_adv_gatt_update(void) From 73ea7248855c93acf8745d5fb755be8363a1bcf6 Mon Sep 17 00:00:00 2001 From: alperen sener Date: Wed, 23 Oct 2024 09:35:58 +0200 Subject: [PATCH 8/8] [nrf fromtree] tests: bluetooth: tester: Add nrf54l15dk and remove nrf54l15pdk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename the config files according to nrf54l15dk. Signed-off-by: alperen sener (cherry picked from commit a5010504bc71d5f3fa8ccc86a2b335920e560cf0) Signed-off-by: Håvard Reierstad --- ...15pdk_nrf54l15_cpuapp.conf => nrf54l15dk_nrf54l15_cpuapp.conf} | 0 ...nrf54l15_cpuapp.overlay => nrf54l15dk_nrf54l15_cpuapp.overlay} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename tests/bluetooth/tester/boards/{nrf54l15pdk_nrf54l15_cpuapp.conf => nrf54l15dk_nrf54l15_cpuapp.conf} (100%) rename tests/bluetooth/tester/boards/{nrf54l15pdk_nrf54l15_cpuapp.overlay => nrf54l15dk_nrf54l15_cpuapp.overlay} (100%) diff --git a/tests/bluetooth/tester/boards/nrf54l15pdk_nrf54l15_cpuapp.conf b/tests/bluetooth/tester/boards/nrf54l15dk_nrf54l15_cpuapp.conf similarity index 100% rename from tests/bluetooth/tester/boards/nrf54l15pdk_nrf54l15_cpuapp.conf rename to tests/bluetooth/tester/boards/nrf54l15dk_nrf54l15_cpuapp.conf diff --git a/tests/bluetooth/tester/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/bluetooth/tester/boards/nrf54l15dk_nrf54l15_cpuapp.overlay similarity index 100% rename from tests/bluetooth/tester/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay rename to tests/bluetooth/tester/boards/nrf54l15dk_nrf54l15_cpuapp.overlay