Skip to content

Commit e862ce3

Browse files
authored
Merge branch 'main' into OCT-3317-tmap-pts-cherry-pick
2 parents 9de30e5 + 24fec0c commit e862ce3

File tree

3 files changed

+18
-37
lines changed

3 files changed

+18
-37
lines changed

include/zephyr/net_buf.h

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,19 +1325,14 @@ int net_buf_id(const struct net_buf *buf);
13251325
/**
13261326
* @brief Allocate a new fixed buffer from a pool.
13271327
*
1328-
* @note Some types of data allocators do not support
1329-
* blocking (such as the HEAP type). In this case it's still possible
1330-
* for net_buf_alloc() to fail (return NULL) even if it was given
1331-
* K_FOREVER.
1332-
*
1333-
* @note The timeout value will be overridden to K_NO_WAIT if called from the
1334-
* system workqueue.
1335-
*
13361328
* @param pool Which pool to allocate the buffer from.
13371329
* @param timeout Affects the action taken should the pool be empty.
13381330
* If K_NO_WAIT, then return immediately. If K_FOREVER, then
13391331
* wait as long as necessary. Otherwise, wait until the specified
1340-
* timeout.
1332+
* timeout. Note that some types of data allocators do not support
1333+
* blocking (such as the HEAP type). In this case it's still possible
1334+
* for net_buf_alloc() to fail (return NULL) even if it was given
1335+
* K_FOREVER.
13411336
*
13421337
* @return New buffer or NULL if out of buffers.
13431338
*/
@@ -1365,20 +1360,15 @@ static inline struct net_buf * __must_check net_buf_alloc(struct net_buf_pool *p
13651360
/**
13661361
* @brief Allocate a new variable length buffer from a pool.
13671362
*
1368-
* @note Some types of data allocators do not support
1369-
* blocking (such as the HEAP type). In this case it's still possible
1370-
* for net_buf_alloc() to fail (return NULL) even if it was given
1371-
* K_FOREVER.
1372-
*
1373-
* @note The timeout value will be overridden to K_NO_WAIT if called from the
1374-
* system workqueue.
1375-
*
13761363
* @param pool Which pool to allocate the buffer from.
13771364
* @param size Amount of data the buffer must be able to fit.
13781365
* @param timeout Affects the action taken should the pool be empty.
13791366
* If K_NO_WAIT, then return immediately. If K_FOREVER, then
13801367
* wait as long as necessary. Otherwise, wait until the specified
1381-
* timeout.
1368+
* timeout. Note that some types of data allocators do not support
1369+
* blocking (such as the HEAP type). In this case it's still possible
1370+
* for net_buf_alloc() to fail (return NULL) even if it was given
1371+
* K_FOREVER.
13821372
*
13831373
* @return New buffer or NULL if out of buffers.
13841374
*/
@@ -1402,21 +1392,16 @@ struct net_buf * __must_check net_buf_alloc_len(struct net_buf_pool *pool,
14021392
* Allocate a new buffer from a pool, where the data pointer comes from the
14031393
* user and not from the pool.
14041394
*
1405-
* @note Some types of data allocators do not support
1406-
* blocking (such as the HEAP type). In this case it's still possible
1407-
* for net_buf_alloc() to fail (return NULL) even if it was given
1408-
* K_FOREVER.
1409-
*
1410-
* @note The timeout value will be overridden to K_NO_WAIT if called from the
1411-
* system workqueue.
1412-
*
14131395
* @param pool Which pool to allocate the buffer from.
14141396
* @param data External data pointer
14151397
* @param size Amount of data the pointed data buffer if able to fit.
14161398
* @param timeout Affects the action taken should the pool be empty.
14171399
* If K_NO_WAIT, then return immediately. If K_FOREVER, then
14181400
* wait as long as necessary. Otherwise, wait until the specified
1419-
* timeout.
1401+
* timeout. Note that some types of data allocators do not support
1402+
* blocking (such as the HEAP type). In this case it's still possible
1403+
* for net_buf_alloc() to fail (return NULL) even if it was given
1404+
* K_FOREVER.
14201405
*
14211406
* @return New buffer or NULL if out of buffers.
14221407
*/

lib/net_buf/buf.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,6 @@ struct net_buf *net_buf_alloc_len(struct net_buf_pool *pool, size_t size,
271271

272272
k_spin_unlock(&pool->lock, key);
273273

274-
if (!K_TIMEOUT_EQ(timeout, K_NO_WAIT) &&
275-
k_current_get() == k_work_queue_thread_get(&k_sys_work_q)) {
276-
LOG_DBG("Timeout discarded. No blocking in syswq");
277-
timeout = K_NO_WAIT;
278-
}
279-
280274
#if defined(CONFIG_NET_BUF_LOG) && (CONFIG_NET_BUF_LOG_LEVEL >= LOG_LEVEL_WRN)
281275
if (K_TIMEOUT_EQ(timeout, K_FOREVER)) {
282276
uint32_t ref = k_uptime_get_32();

subsys/bluetooth/mesh/Kconfig

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,12 @@ config BT_MESH_WORKQ_SYS
130130
refer to BT_MESH_ADV_STACK_SIZE for the recommended minimum.
131131

132132
When this option is enabled and the mesh tries to send a message,
133-
and the host ran out the HCI command buffers controlled by
134-
CONFIG_BT_BUF_CMD_TX_COUNT, the host returns -ENOBUFS immediately
135-
and the mesh drops the message transmission. To mitigate this
136-
issue, make sure to have sufficient number of HCI command buffers.
133+
and the host ran out of the HCI command buffers controlled by
134+
CONFIG_BT_BUF_CMD_TX_COUNT, the system work queue will be blocked
135+
until an HCI command buffer has been freed. This may cause a deadlock
136+
where the host cannot use the system workqueue to free the buffer
137+
that the mesh is waiting for. To mitigate this issue, make sure to
138+
have a sufficient number of HCI command buffers.
137139
When this option is enabled, the latency of sending mesh messages
138140
will be affected by other users on the system work queue, resulting in
139141
reduced reliability for sending mesh messages.

0 commit comments

Comments
 (0)