@@ -152,9 +152,9 @@ struct bt_att_tx_meta {
152
152
static struct bt_att_tx_meta_data tx_meta_data [CONFIG_BT_CONN_TX_MAX ];
153
153
K_FIFO_DEFINE (free_att_tx_meta_data );
154
154
155
- static struct bt_att_tx_meta_data * tx_meta_data_alloc (void )
155
+ static struct bt_att_tx_meta_data * tx_meta_data_alloc (k_timeout_t timeout )
156
156
{
157
- return k_fifo_get (& free_att_tx_meta_data , K_NO_WAIT );
157
+ return k_fifo_get (& free_att_tx_meta_data , timeout );
158
158
}
159
159
160
160
static inline void tx_meta_data_free (struct bt_att_tx_meta_data * data )
@@ -531,6 +531,7 @@ struct net_buf *bt_att_chan_create_pdu(struct bt_att_chan *chan, uint8_t op,
531
531
struct bt_att_hdr * hdr ;
532
532
struct net_buf * buf ;
533
533
struct bt_att_tx_meta_data * data ;
534
+ k_timeout_t timeout ;
534
535
535
536
if (len + sizeof (op ) > chan -> chan .tx .mtu ) {
536
537
BT_WARN ("ATT MTU exceeded, max %u, wanted %zu" ,
@@ -542,18 +543,19 @@ struct net_buf *bt_att_chan_create_pdu(struct bt_att_chan *chan, uint8_t op,
542
543
case ATT_RESPONSE :
543
544
case ATT_CONFIRMATION :
544
545
/* Use a timeout only when responding/confirming */
545
- buf = bt_l2cap_create_pdu_timeout ( NULL , 0 , BT_ATT_TIMEOUT ) ;
546
+ timeout = BT_ATT_TIMEOUT ;
546
547
break ;
547
548
default :
548
- buf = bt_l2cap_create_pdu ( NULL , 0 ) ;
549
+ timeout = K_FOREVER ;
549
550
}
550
551
552
+ buf = bt_l2cap_create_pdu_timeout (NULL , 0 , timeout );
551
553
if (!buf ) {
552
554
BT_ERR ("Unable to allocate buffer for op 0x%02x" , op );
553
555
return NULL ;
554
556
}
555
557
556
- data = tx_meta_data_alloc ();
558
+ data = tx_meta_data_alloc (timeout );
557
559
if (!data ) {
558
560
BT_WARN ("Unable to allocate ATT TX meta" );
559
561
net_buf_unref (buf );
0 commit comments