From df327eeb580fe55abdaf53d23d635902607f657d Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Sun, 21 Nov 2021 12:23:19 +1000 Subject: [PATCH] net: buf: `POOL_FIXED_DEFINE` explicit user data Update the macro prototype to explicitly require the length of the desired user data. Update all in-tree usage of this macro. Signed-off-by: Jordan Yates --- include/net/buf.h | 34 +++++++++---------- samples/bluetooth/central_iso/src/main.c | 2 +- samples/bluetooth/iso_broadcast/src/main.c | 2 +- .../iso_broadcast_benchmark/src/broadcaster.c | 2 +- .../iso_connected_benchmark/src/main.c | 2 +- subsys/bluetooth/audio/otc.c | 4 +-- subsys/bluetooth/host/buf.c | 8 ++--- subsys/bluetooth/host/conn.c | 2 +- subsys/bluetooth/host/hci_core.c | 2 +- subsys/bluetooth/host/hci_raw.c | 8 ++--- subsys/bluetooth/host/hfp_hf.c | 2 +- subsys/bluetooth/host/iso.c | 6 ++-- subsys/bluetooth/host/l2cap.c | 2 +- subsys/bluetooth/host/l2cap_br.c | 2 +- subsys/bluetooth/host/sdp.c | 2 +- subsys/bluetooth/mesh/friend.c | 2 +- subsys/bluetooth/services/ots/ots_l2cap.c | 4 +-- subsys/bluetooth/shell/bredr.c | 4 +-- subsys/bluetooth/shell/iso.c | 4 +-- subsys/bluetooth/shell/l2cap.c | 4 +-- subsys/bluetooth/shell/rfcomm.c | 2 +- subsys/net/ip/net_pkt.c | 4 +-- subsys/net/lib/capture/capture.c | 2 +- subsys/usb/class/audio/audio.c | 2 +- .../edtt_ble_test_app/hci_test_app/src/main.c | 4 +-- tests/bluetooth/tester/src/l2cap.c | 2 +- tests/net/buf/src/main.c | 2 +- tests/net/net_pkt/src/main.c | 4 +-- 28 files changed, 60 insertions(+), 60 deletions(-) diff --git a/include/net/buf.h b/include/net/buf.h index 5eb6163fe71..56869475954 100644 --- a/include/net/buf.h +++ b/include/net/buf.h @@ -1133,24 +1133,24 @@ extern const struct net_buf_data_cb net_buf_fixed_cb; * @param _name Name of the pool variable. * @param _count Number of buffers in the pool. * @param _data_size Maximum data payload per buffer. + * @param _ud_size User data space to reserve per buffer. * @param _destroy Optional destroy callback when buffer is freed. */ -#define NET_BUF_POOL_FIXED_DEFINE(_name, _count, _data_size, _destroy) \ - _NET_BUF_ARRAY_DEFINE(_name, _count, CONFIG_NET_BUF_USER_DATA_SIZE); \ - static uint8_t __noinit net_buf_data_##_name[_count][_data_size]; \ - static const struct net_buf_pool_fixed net_buf_fixed_##_name = { \ - .data_size = _data_size, \ - .data_pool = (uint8_t *)net_buf_data_##_name, \ - }; \ - static const struct net_buf_data_alloc net_buf_fixed_alloc_##_name = {\ - .cb = &net_buf_fixed_cb, \ - .alloc_data = (void *)&net_buf_fixed_##_name, \ - }; \ - static struct net_buf_pool _name __net_buf_align \ - __in_section(_net_buf_pool, static, _name) = \ - NET_BUF_POOL_INITIALIZER(_name, &net_buf_fixed_alloc_##_name, \ - _net_buf_##_name, _count, \ - CONFIG_NET_BUF_USER_DATA_SIZE, \ +#define NET_BUF_POOL_FIXED_DEFINE(_name, _count, _data_size, _ud_size, _destroy) \ + _NET_BUF_ARRAY_DEFINE(_name, _count, _ud_size); \ + static uint8_t __noinit net_buf_data_##_name[_count][_data_size]; \ + static const struct net_buf_pool_fixed net_buf_fixed_##_name = { \ + .data_size = _data_size, \ + .data_pool = (uint8_t *)net_buf_data_##_name, \ + }; \ + static const struct net_buf_data_alloc net_buf_fixed_alloc_##_name = { \ + .cb = &net_buf_fixed_cb, \ + .alloc_data = (void *)&net_buf_fixed_##_name, \ + }; \ + static struct net_buf_pool _name __net_buf_align \ + __in_section(_net_buf_pool, static, _name) = \ + NET_BUF_POOL_INITIALIZER(_name, &net_buf_fixed_alloc_##_name, \ + _net_buf_##_name, _count, _ud_size, \ _destroy) /** @cond INTERNAL_HIDDEN */ @@ -1217,7 +1217,7 @@ extern const struct net_buf_data_cb net_buf_var_cb; */ #define NET_BUF_POOL_DEFINE(_name, _count, _size, _ud_size, _destroy) \ BUILD_ASSERT(_ud_size <= CONFIG_NET_BUF_USER_DATA_SIZE); \ - NET_BUF_POOL_FIXED_DEFINE(_name, _count, _size, _destroy) + NET_BUF_POOL_FIXED_DEFINE(_name, _count, _size, _ud_size, _destroy) /** * @brief Looks up a pool based on its ID. diff --git a/samples/bluetooth/central_iso/src/main.c b/samples/bluetooth/central_iso/src/main.c index e557eb741e0..40b3ac618dd 100644 --- a/samples/bluetooth/central_iso/src/main.c +++ b/samples/bluetooth/central_iso/src/main.c @@ -23,7 +23,7 @@ static void start_scan(void); static struct bt_conn *default_conn; static struct k_work_delayable iso_send_work; static struct bt_iso_chan iso_chan; -NET_BUF_POOL_FIXED_DEFINE(tx_pool, 1, BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU), +NET_BUF_POOL_FIXED_DEFINE(tx_pool, 1, BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU), 8, NULL); /** diff --git a/samples/bluetooth/iso_broadcast/src/main.c b/samples/bluetooth/iso_broadcast/src/main.c index 7343cc862b0..2f82bce28b1 100644 --- a/samples/bluetooth/iso_broadcast/src/main.c +++ b/samples/bluetooth/iso_broadcast/src/main.c @@ -12,7 +12,7 @@ #define BIS_ISO_CHAN_COUNT 1 NET_BUF_POOL_FIXED_DEFINE(bis_tx_pool, BIS_ISO_CHAN_COUNT, - BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU), NULL); + BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU), 8, NULL); static K_SEM_DEFINE(sem_big_cmplt, 0, 1); static K_SEM_DEFINE(sem_big_term, 0, 1); diff --git a/samples/bluetooth/iso_broadcast_benchmark/src/broadcaster.c b/samples/bluetooth/iso_broadcast_benchmark/src/broadcaster.c index 795c3718db6..d79a6731c9a 100644 --- a/samples/bluetooth/iso_broadcast_benchmark/src/broadcaster.c +++ b/samples/bluetooth/iso_broadcast_benchmark/src/broadcaster.c @@ -24,7 +24,7 @@ LOG_MODULE_REGISTER(iso_broadcast_broadcaster, LOG_LEVEL_DBG); #define DEFAULT_BIS_COUNT CONFIG_BT_ISO_MAX_CHAN NET_BUF_POOL_FIXED_DEFINE(bis_tx_pool, CONFIG_BT_ISO_TX_BUF_COUNT, - BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU), NULL); + BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU), 8, NULL); static K_SEM_DEFINE(sem_big_complete, 0, 1); static K_SEM_DEFINE(sem_big_term, 0, 1); diff --git a/samples/bluetooth/iso_connected_benchmark/src/main.c b/samples/bluetooth/iso_connected_benchmark/src/main.c index c3e067140bb..dfcb93b7a9d 100644 --- a/samples/bluetooth/iso_connected_benchmark/src/main.c +++ b/samples/bluetooth/iso_connected_benchmark/src/main.c @@ -59,7 +59,7 @@ static uint32_t iso_send_count; static struct bt_iso_cig *cig; NET_BUF_POOL_FIXED_DEFINE(tx_pool, 1, BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU), - NULL); + 8, NULL); static uint8_t iso_data[CONFIG_BT_ISO_TX_MTU]; static K_SEM_DEFINE(sem_adv, 0, 1); diff --git a/subsys/bluetooth/audio/otc.c b/subsys/bluetooth/audio/otc.c index 70cbaea93ba..4fa6f0d442e 100644 --- a/subsys/bluetooth/audio/otc.c +++ b/subsys/bluetooth/audio/otc.c @@ -34,7 +34,7 @@ #define OTS_CLIENT_INST_COUNT 1 NET_BUF_POOL_FIXED_DEFINE(ots_c_read_queue, 1, - sizeof(struct bt_gatt_read_params), NULL); + sizeof(struct bt_gatt_read_params), 8, NULL); #define OTS_WORK(_w) CONTAINER_OF(_w, struct otc_instance_t, work) @@ -49,7 +49,7 @@ static void l2cap_disconnected(struct bt_l2cap_chan *chan); #define CREDITS 10 #define DATA_MTU (BT_OTC_MAX_WRITE_SIZE * CREDITS) -NET_BUF_POOL_FIXED_DEFINE(otc_l2cap_pool, 1, DATA_MTU, NULL); +NET_BUF_POOL_FIXED_DEFINE(otc_l2cap_pool, 1, DATA_MTU, 8, NULL); struct l2ch { struct k_delayed_work recv_work; diff --git a/subsys/bluetooth/host/buf.c b/subsys/bluetooth/host/buf.c index f75585ebec3..8171502d2fb 100644 --- a/subsys/bluetooth/host/buf.c +++ b/subsys/bluetooth/host/buf.c @@ -35,12 +35,12 @@ * Having a dedicated pool for it ensures that exhaustion of the RX pool * cannot block the delivery of this priority event. */ -NET_BUF_POOL_FIXED_DEFINE(num_complete_pool, 1, NUM_COMLETE_EVENT_SIZE, NULL); +NET_BUF_POOL_FIXED_DEFINE(num_complete_pool, 1, NUM_COMLETE_EVENT_SIZE, 8, NULL); #endif /* CONFIG_BT_CONN || CONFIG_BT_ISO */ #if defined(CONFIG_BT_BUF_EVT_DISCARDABLE_COUNT) NET_BUF_POOL_FIXED_DEFINE(discardable_pool, CONFIG_BT_BUF_EVT_DISCARDABLE_COUNT, - BT_BUF_EVT_SIZE(CONFIG_BT_BUF_EVT_DISCARDABLE_SIZE), + BT_BUF_EVT_SIZE(CONFIG_BT_BUF_EVT_DISCARDABLE_SIZE), 8, NULL); #endif /* CONFIG_BT_BUF_EVT_DISCARDABLE_COUNT */ @@ -50,12 +50,12 @@ NET_BUF_POOL_DEFINE(acl_in_pool, CONFIG_BT_BUF_ACL_RX_COUNT, sizeof(struct acl_data), bt_hci_host_num_completed_packets); NET_BUF_POOL_FIXED_DEFINE(evt_pool, CONFIG_BT_BUF_EVT_RX_COUNT, - BT_BUF_EVT_RX_SIZE, + BT_BUF_EVT_RX_SIZE, 8, NULL); #else #define BT_BUF_RX_COUNT MAX(CONFIG_BT_BUF_EVT_RX_COUNT, CONFIG_BT_BUF_ACL_RX_COUNT) NET_BUF_POOL_FIXED_DEFINE(hci_rx_pool, BT_BUF_RX_COUNT, - BT_BUF_RX_SIZE, + BT_BUF_RX_SIZE, 8, NULL); #endif /* CONFIG_BT_HCI_ACL_FLOW_CONTROL */ diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index 9b80c05ceba..031abdadd45 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -68,7 +68,7 @@ NET_BUF_POOL_DEFINE(acl_tx_pool, CONFIG_BT_L2CAP_TX_BUF_COUNT, * another buffer from the acl_tx_pool would result in a deadlock. */ NET_BUF_POOL_FIXED_DEFINE(frag_pool, CONFIG_BT_L2CAP_TX_FRAG_COUNT, - BT_BUF_ACL_SIZE(CONFIG_BT_BUF_ACL_TX_SIZE), NULL); + BT_BUF_ACL_SIZE(CONFIG_BT_BUF_ACL_TX_SIZE), 8, NULL); #endif /* CONFIG_BT_L2CAP_TX_FRAG_COUNT > 0 */ diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index dd56f08c088..d8ff225437e 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -128,7 +128,7 @@ void bt_hci_cmd_state_set_init(struct net_buf *buf, */ #define CMD_BUF_SIZE MAX(BT_BUF_EVT_RX_SIZE, BT_BUF_CMD_TX_SIZE) NET_BUF_POOL_FIXED_DEFINE(hci_cmd_pool, CONFIG_BT_BUF_CMD_TX_COUNT, - CMD_BUF_SIZE, NULL); + CMD_BUF_SIZE, 8, NULL); struct event_handler { uint8_t event; diff --git a/subsys/bluetooth/host/hci_raw.c b/subsys/bluetooth/host/hci_raw.c index 18ffe98c10c..7036e23cd01 100644 --- a/subsys/bluetooth/host/hci_raw.c +++ b/subsys/bluetooth/host/hci_raw.c @@ -40,14 +40,14 @@ static uint8_t raw_mode; #define BT_BUF_RX_COUNT MAX(CONFIG_BT_BUF_EVT_RX_COUNT, CONFIG_BT_BUF_ACL_RX_COUNT) NET_BUF_POOL_FIXED_DEFINE(hci_rx_pool, BT_BUF_RX_COUNT, - BT_BUF_RX_SIZE, NULL); + BT_BUF_RX_SIZE, 8, NULL); NET_BUF_POOL_FIXED_DEFINE(hci_cmd_pool, CONFIG_BT_BUF_CMD_TX_COUNT, - BT_BUF_CMD_SIZE(CONFIG_BT_BUF_CMD_TX_SIZE), NULL); + BT_BUF_CMD_SIZE(CONFIG_BT_BUF_CMD_TX_SIZE), 8, NULL); NET_BUF_POOL_FIXED_DEFINE(hci_acl_pool, CONFIG_BT_BUF_ACL_TX_COUNT, - BT_BUF_ACL_SIZE(CONFIG_BT_BUF_ACL_TX_SIZE), NULL); + BT_BUF_ACL_SIZE(CONFIG_BT_BUF_ACL_TX_SIZE), 8, NULL); #if defined(CONFIG_BT_ISO) NET_BUF_POOL_FIXED_DEFINE(hci_iso_pool, CONFIG_BT_ISO_TX_BUF_COUNT, - BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU), NULL); + BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU), 8, NULL); #endif /* CONFIG_BT_ISO */ struct bt_dev_raw bt_dev; diff --git a/subsys/bluetooth/host/hfp_hf.c b/subsys/bluetooth/host/hfp_hf.c index 20b755a5f53..dfe6d01408f 100644 --- a/subsys/bluetooth/host/hfp_hf.c +++ b/subsys/bluetooth/host/hfp_hf.c @@ -33,7 +33,7 @@ struct bt_hfp_hf_cb *bt_hf; NET_BUF_POOL_FIXED_DEFINE(hf_pool, CONFIG_BT_MAX_CONN + 1, - BT_RFCOMM_BUF_SIZE(BT_HF_CLIENT_MAX_PDU), NULL); + BT_RFCOMM_BUF_SIZE(BT_HF_CLIENT_MAX_PDU), 8, NULL); static struct bt_hfp_hf bt_hfp_hf_pool[CONFIG_BT_MAX_CONN]; diff --git a/subsys/bluetooth/host/iso.c b/subsys/bluetooth/host/iso.c index ae37ef1f07e..b7c59746bd8 100644 --- a/subsys/bluetooth/host/iso.c +++ b/subsys/bluetooth/host/iso.c @@ -28,7 +28,7 @@ #if defined(CONFIG_BT_ISO_UNICAST) || defined(CONFIG_BT_ISO_SYNC_RECEIVER) NET_BUF_POOL_FIXED_DEFINE(iso_rx_pool, CONFIG_BT_ISO_RX_BUF_COUNT, - CONFIG_BT_ISO_RX_MTU, NULL); + CONFIG_BT_ISO_RX_MTU, 8, NULL); static struct bt_iso_recv_info iso_info_data[CONFIG_BT_ISO_RX_BUF_COUNT]; #define iso_info(buf) (&iso_info_data[net_buf_id(buf)]) @@ -36,11 +36,11 @@ static struct bt_iso_recv_info iso_info_data[CONFIG_BT_ISO_RX_BUF_COUNT]; #if defined(CONFIG_BT_ISO_UNICAST) || defined(CONFIG_BT_ISO_BROADCAST) NET_BUF_POOL_FIXED_DEFINE(iso_tx_pool, CONFIG_BT_ISO_TX_BUF_COUNT, - BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU), NULL); + BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU), 8, NULL); #if CONFIG_BT_ISO_TX_FRAG_COUNT > 0 NET_BUF_POOL_FIXED_DEFINE(iso_frag_pool, CONFIG_BT_ISO_TX_FRAG_COUNT, - BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU), NULL); + BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU), 8, NULL); #endif /* CONFIG_BT_ISO_TX_FRAG_COUNT > 0 */ #endif /* CONFIG_BT_ISO_UNICAST || CONFIG_BT_ISO_BROADCAST */ diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index c065b3f95f1..5aa608ccf7e 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -59,7 +59,7 @@ NET_BUF_POOL_FIXED_DEFINE(disc_pool, 1, BT_L2CAP_BUF_SIZE( sizeof(struct bt_l2cap_sig_hdr) + sizeof(struct bt_l2cap_disconn_req)), - NULL); + 8, NULL); #define L2CAP_ECRED_CHAN_MAX 5 diff --git a/subsys/bluetooth/host/l2cap_br.c b/subsys/bluetooth/host/l2cap_br.c index 8e027120972..c2d4f7f3d4f 100644 --- a/subsys/bluetooth/host/l2cap_br.c +++ b/subsys/bluetooth/host/l2cap_br.c @@ -77,7 +77,7 @@ static sys_slist_t br_servers; /* Pool for outgoing BR/EDR signaling packets, min MTU is 48 */ NET_BUF_POOL_FIXED_DEFINE(br_sig_pool, CONFIG_BT_MAX_CONN, - BT_L2CAP_BUF_SIZE(L2CAP_BR_MIN_MTU), NULL); + BT_L2CAP_BUF_SIZE(L2CAP_BR_MIN_MTU), 8, NULL); /* BR/EDR L2CAP signalling channel specific context */ struct bt_l2cap_br { diff --git a/subsys/bluetooth/host/sdp.c b/subsys/bluetooth/host/sdp.c index 526186eed25..f25aea61873 100644 --- a/subsys/bluetooth/host/sdp.c +++ b/subsys/bluetooth/host/sdp.c @@ -70,7 +70,7 @@ static struct bt_sdp bt_sdp_pool[CONFIG_BT_MAX_CONN]; /* Pool for outgoing SDP packets */ NET_BUF_POOL_FIXED_DEFINE(sdp_pool, CONFIG_BT_MAX_CONN, - BT_L2CAP_BUF_SIZE(SDP_MTU), NULL); + BT_L2CAP_BUF_SIZE(SDP_MTU), 8, NULL); #define SDP_CLIENT_CHAN(_ch) CONTAINER_OF(_ch, struct bt_sdp_client, chan.chan) diff --git a/subsys/bluetooth/mesh/friend.c b/subsys/bluetooth/mesh/friend.c index 20459d626c3..895f144266c 100644 --- a/subsys/bluetooth/mesh/friend.c +++ b/subsys/bluetooth/mesh/friend.c @@ -50,7 +50,7 @@ struct friend_pdu_info { }; NET_BUF_POOL_FIXED_DEFINE(friend_buf_pool, FRIEND_BUF_COUNT, - BT_MESH_ADV_DATA_SIZE, NULL); + BT_MESH_ADV_DATA_SIZE, 8, NULL); static struct friend_adv { uint16_t app_idx; diff --git a/subsys/bluetooth/services/ots/ots_l2cap.c b/subsys/bluetooth/services/ots/ots_l2cap.c index 8c441c4be99..2f6e4affc0c 100644 --- a/subsys/bluetooth/services/ots/ots_l2cap.c +++ b/subsys/bluetooth/services/ots/ots_l2cap.c @@ -28,11 +28,11 @@ LOG_MODULE_DECLARE(bt_ots, CONFIG_BT_OTS_LOG_LEVEL); NET_BUF_POOL_FIXED_DEFINE(ot_chan_tx_pool, 1, - BT_L2CAP_SDU_BUF_SIZE(CONFIG_BT_OTS_L2CAP_CHAN_TX_MTU), + BT_L2CAP_SDU_BUF_SIZE(CONFIG_BT_OTS_L2CAP_CHAN_TX_MTU), 8, NULL); #if (CONFIG_BT_OTS_L2CAP_CHAN_RX_MTU > BT_L2CAP_SDU_RX_MTU) -NET_BUF_POOL_FIXED_DEFINE(ot_chan_rx_pool, 1, CONFIG_BT_OTS_L2CAP_CHAN_RX_MTU, +NET_BUF_POOL_FIXED_DEFINE(ot_chan_rx_pool, 1, CONFIG_BT_OTS_L2CAP_CHAN_RX_MTU, 8, NULL); #endif diff --git a/subsys/bluetooth/shell/bredr.c b/subsys/bluetooth/shell/bredr.c index f6e1b71b040..bc73752c6d3 100644 --- a/subsys/bluetooth/shell/bredr.c +++ b/subsys/bluetooth/shell/bredr.c @@ -38,11 +38,11 @@ static struct bt_conn *pairing_conn; #define DATA_BREDR_MTU 48 -NET_BUF_POOL_FIXED_DEFINE(data_pool, 1, DATA_BREDR_MTU, NULL); +NET_BUF_POOL_FIXED_DEFINE(data_pool, 1, DATA_BREDR_MTU, 8, NULL); #define SDP_CLIENT_USER_BUF_LEN 512 NET_BUF_POOL_FIXED_DEFINE(sdp_client_pool, CONFIG_BT_MAX_CONN, - SDP_CLIENT_USER_BUF_LEN, NULL); + SDP_CLIENT_USER_BUF_LEN, 8, NULL); static int cmd_auth_pincode(const struct shell *sh, size_t argc, char *argv[]) diff --git a/subsys/bluetooth/shell/iso.c b/subsys/bluetooth/shell/iso.c index 610767e0b16..defcd56dc67 100644 --- a/subsys/bluetooth/shell/iso.c +++ b/subsys/bluetooth/shell/iso.c @@ -73,7 +73,7 @@ struct bt_iso_chan iso_chan = { static struct bt_iso_cig *cig; -NET_BUF_POOL_FIXED_DEFINE(tx_pool, 1, BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU), +NET_BUF_POOL_FIXED_DEFINE(tx_pool, 1, BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU), 8, NULL); static int iso_accept(const struct bt_iso_accept_info *info, @@ -349,7 +349,7 @@ static struct bt_iso_chan *bis_channels[BIS_ISO_CHAN_COUNT] = { &bis_iso_chan }; #if defined(CONFIG_BT_ISO_BROADCASTER) NET_BUF_POOL_FIXED_DEFINE(bis_tx_pool, BIS_ISO_CHAN_COUNT, - BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU), NULL); + BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU), 8, NULL); static int cmd_broadcast(const struct shell *sh, size_t argc, char *argv[]) { diff --git a/subsys/bluetooth/shell/l2cap.c b/subsys/bluetooth/shell/l2cap.c index 69a34ac04cf..44c0850df9f 100644 --- a/subsys/bluetooth/shell/l2cap.c +++ b/subsys/bluetooth/shell/l2cap.c @@ -39,8 +39,8 @@ #define L2CAP_POLICY_16BYTE_KEY 0x02 NET_BUF_POOL_FIXED_DEFINE(data_tx_pool, 1, - BT_L2CAP_SDU_BUF_SIZE(DATA_MTU), NULL); -NET_BUF_POOL_FIXED_DEFINE(data_rx_pool, 1, DATA_MTU, NULL); + BT_L2CAP_SDU_BUF_SIZE(DATA_MTU), 8, NULL); +NET_BUF_POOL_FIXED_DEFINE(data_rx_pool, 1, DATA_MTU, 8, NULL); static uint8_t l2cap_policy; static struct bt_conn *l2cap_allowlist[CONFIG_BT_MAX_CONN]; diff --git a/subsys/bluetooth/shell/rfcomm.c b/subsys/bluetooth/shell/rfcomm.c index b642e50f6cf..58eafd9746c 100644 --- a/subsys/bluetooth/shell/rfcomm.c +++ b/subsys/bluetooth/shell/rfcomm.c @@ -33,7 +33,7 @@ #define DATA_MTU 48 -NET_BUF_POOL_FIXED_DEFINE(pool, 1, DATA_MTU, NULL); +NET_BUF_POOL_FIXED_DEFINE(pool, 1, DATA_MTU, 8, NULL); static struct bt_sdp_attribute spp_attrs[] = { BT_SDP_NEW_SERVICE, diff --git a/subsys/net/ip/net_pkt.c b/subsys/net/ip/net_pkt.c index 78ba4c337ce..a134c395025 100644 --- a/subsys/net/ip/net_pkt.c +++ b/subsys/net/ip/net_pkt.c @@ -119,9 +119,9 @@ K_MEM_SLAB_DEFINE(tx_pkts, sizeof(struct net_pkt), CONFIG_NET_PKT_TX_COUNT, 4); #if defined(CONFIG_NET_BUF_FIXED_DATA_SIZE) NET_BUF_POOL_FIXED_DEFINE(rx_bufs, CONFIG_NET_BUF_RX_COUNT, - CONFIG_NET_BUF_DATA_SIZE, NULL); + CONFIG_NET_BUF_DATA_SIZE, 4, NULL); NET_BUF_POOL_FIXED_DEFINE(tx_bufs, CONFIG_NET_BUF_TX_COUNT, - CONFIG_NET_BUF_DATA_SIZE, NULL); + CONFIG_NET_BUF_DATA_SIZE, 4, NULL); #else /* !CONFIG_NET_BUF_FIXED_DATA_SIZE */ diff --git a/subsys/net/lib/capture/capture.c b/subsys/net/lib/capture/capture.c index 2d2308ff292..18315b55c02 100644 --- a/subsys/net/lib/capture/capture.c +++ b/subsys/net/lib/capture/capture.c @@ -42,7 +42,7 @@ NET_PKT_SLAB_DEFINE(capture_pkts, CONFIG_NET_CAPTURE_PKT_COUNT); #if defined(CONFIG_NET_BUF_FIXED_DATA_SIZE) NET_BUF_POOL_FIXED_DEFINE(capture_bufs, CONFIG_NET_CAPTURE_BUF_COUNT, - CONFIG_NET_BUF_DATA_SIZE, NULL); + CONFIG_NET_BUF_DATA_SIZE, 4, NULL); #else NET_BUF_POOL_VAR_DEFINE(capture_bufs, CONFIG_NET_CAPTURE_BUF_COUNT, CONFIG_NET_BUF_DATA_POOL_SIZE, 4, NULL); diff --git a/subsys/usb/class/audio/audio.c b/subsys/usb/class/audio/audio.c index 7a3a5975e58..77fc26261df 100644 --- a/subsys/usb/class/audio/audio.c +++ b/subsys/usb/class/audio/audio.c @@ -940,7 +940,7 @@ void usb_audio_register(const struct device *dev, DUMMY_API) #define DEFINE_BUF_POOL(name, size) \ - NET_BUF_POOL_FIXED_DEFINE(name, 5, size, net_buf_destroy) + NET_BUF_POOL_FIXED_DEFINE(name, 5, size, 4, net_buf_destroy) #define UNIDIR_DEVICE(dev, i, out_pool, in_size, it_type, ot_type, cb, addr) \ UTIL_EXPAND( \ diff --git a/tests/bluetooth/bsim_bt/edtt_ble_test_app/hci_test_app/src/main.c b/tests/bluetooth/bsim_bt/edtt_ble_test_app/hci_test_app/src/main.c index 50daf5fc2d9..114027c5b24 100644 --- a/tests/bluetooth/bsim_bt/edtt_ble_test_app/hci_test_app/src/main.c +++ b/tests/bluetooth/bsim_bt/edtt_ble_test_app/hci_test_app/src/main.c @@ -153,11 +153,11 @@ static void echo(uint16_t size) } } -NET_BUF_POOL_FIXED_DEFINE(event_pool, 32, BT_BUF_RX_SIZE + 4, NULL); +NET_BUF_POOL_FIXED_DEFINE(event_pool, 32, BT_BUF_RX_SIZE + 4, 4, NULL); static K_FIFO_DEFINE(event_queue); static K_FIFO_DEFINE(rx_queue); NET_BUF_POOL_FIXED_DEFINE(data_pool, CONFIG_BT_CTLR_RX_BUFFERS + 14, - BT_BUF_ACL_SIZE(CONFIG_BT_BUF_ACL_TX_SIZE) + 4, NULL); + BT_BUF_ACL_SIZE(CONFIG_BT_BUF_ACL_TX_SIZE) + 4, 4, NULL); static K_FIFO_DEFINE(data_queue); /** diff --git a/tests/bluetooth/tester/src/l2cap.c b/tests/bluetooth/tester/src/l2cap.c index 1246f43100a..ea032abade6 100644 --- a/tests/bluetooth/tester/src/l2cap.c +++ b/tests/bluetooth/tester/src/l2cap.c @@ -26,7 +26,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #define CHANNELS 2 #define SERVERS 1 -NET_BUF_POOL_FIXED_DEFINE(data_pool, CHANNELS, DATA_BUF_SIZE, NULL); +NET_BUF_POOL_FIXED_DEFINE(data_pool, CHANNELS, DATA_BUF_SIZE, 8, NULL); static bool authorize_flag; static uint8_t req_keysize; diff --git a/tests/net/buf/src/main.c b/tests/net/buf/src/main.c index 274b4403224..deec5aa1bbd 100644 --- a/tests/net/buf/src/main.c +++ b/tests/net/buf/src/main.c @@ -64,7 +64,7 @@ static void fixed_destroy(struct net_buf *buf); static void var_destroy(struct net_buf *buf); NET_BUF_POOL_HEAP_DEFINE(bufs_pool, 10, 0, buf_destroy); -NET_BUF_POOL_FIXED_DEFINE(fixed_pool, 10, 128, fixed_destroy); +NET_BUF_POOL_FIXED_DEFINE(fixed_pool, 10, 128, 0, fixed_destroy); NET_BUF_POOL_VAR_DEFINE(var_pool, 10, 1024, 0, var_destroy); static void buf_destroy(struct net_buf *buf) diff --git a/tests/net/net_pkt/src/main.c b/tests/net/net_pkt/src/main.c index ae33155c26d..a3b8bd2c8c0 100644 --- a/tests/net/net_pkt/src/main.c +++ b/tests/net/net_pkt/src/main.c @@ -791,7 +791,7 @@ void test_net_pkt_clone(void) net_pkt_unref(cloned_pkt); } -NET_BUF_POOL_FIXED_DEFINE(test_net_pkt_headroom_pool, 4, 2, NULL); +NET_BUF_POOL_FIXED_DEFINE(test_net_pkt_headroom_pool, 4, 2, 4, NULL); void test_net_pkt_headroom(void) { struct net_pkt *pkt; @@ -867,7 +867,7 @@ void test_net_pkt_headroom(void) net_pkt_unref(pkt); } -NET_BUF_POOL_FIXED_DEFINE(test_net_pkt_headroom_copy_pool, 2, 4, NULL); +NET_BUF_POOL_FIXED_DEFINE(test_net_pkt_headroom_copy_pool, 2, 4, 4, NULL); void test_net_pkt_headroom_copy(void) { struct net_pkt *pkt_src;