Skip to content

Commit 1999946

Browse files
committed
Bluetooth: Mesh: Move proxy message size to kconfig
Add `BT_MESH_PROXY_MSG_LEN` to config proxy message length Signed-off-by: Lingao Meng <[email protected]>
1 parent 1a4b57e commit 1999946

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

subsys/bluetooth/mesh/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ config BT_MESH_PROXY
107107
config BT_MESH_GATT
108108
bool
109109

110+
config BT_MESH_PROXY_MSG_LEN
111+
int
112+
depends on BT_MESH_GATT
113+
default 66 if BT_MESH_PB_GATT
114+
default 33 if BT_MESH_GATT_PROXY
115+
110116
config BT_MESH_GATT_SERVER
111117
bool
112118
select BT_MESH_GATT

subsys/bluetooth/mesh/proxy_msg.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,7 @@
4848

4949
#define PDU_HDR(sar, type) (sar << 6 | (type & BIT_MASK(6)))
5050

51-
#define PB_GATT_BUF_LEN_MAX 66
52-
#define PROXY_BUF_LEN_MAX 30
53-
54-
#if defined(CONFIG_BT_MESH_PB_GATT)
55-
#define PROXY_MSG_BUF_LEN PB_GATT_BUF_LEN_MAX
56-
#else
57-
#define PROXY_MSG_BUF_LEN PROXY_BUF_LEN_MAX
58-
#endif
59-
60-
static uint8_t __noinit bufs[CONFIG_BT_MAX_CONN * PROXY_MSG_BUF_LEN];
51+
static uint8_t __noinit bufs[CONFIG_BT_MAX_CONN * CONFIG_BT_MESH_PROXY_MSG_LEN];
6152

6253
static struct bt_mesh_proxy_role roles[CONFIG_BT_MAX_CONN];
6354

@@ -202,8 +193,9 @@ static void proxy_msg_init(struct bt_mesh_proxy_role *role)
202193
}
203194

204195
net_buf_simple_init_with_data(&role->buf,
205-
&bufs[bt_conn_index(role->conn) * PROXY_MSG_BUF_LEN],
206-
PROXY_MSG_BUF_LEN);
196+
&bufs[bt_conn_index(role->conn) *
197+
CONFIG_BT_MESH_PROXY_MSG_LEN],
198+
CONFIG_BT_MESH_PROXY_MSG_LEN);
207199

208200
net_buf_simple_reset(&role->buf);
209201

0 commit comments

Comments
 (0)