@@ -283,12 +283,11 @@ void bt_conn_reset_rx_state(struct bt_conn *conn)
283
283
conn -> rx = NULL ;
284
284
}
285
285
286
- static void bt_acl_recv (struct bt_conn * conn , struct net_buf * buf , uint8_t flags )
286
+ static void bt_acl_recv (struct bt_conn * conn , struct net_buf * buf ,
287
+ uint8_t flags )
287
288
{
288
289
uint16_t acl_total_len ;
289
290
290
- bt_acl_set_ncp_sent (buf , false);
291
-
292
291
/* Check packet boundary flags */
293
292
switch (flags ) {
294
293
case BT_ACL_START :
@@ -300,7 +299,7 @@ static void bt_acl_recv(struct bt_conn *conn, struct net_buf *buf, uint8_t flags
300
299
LOG_DBG ("First, len %u final %u" , buf -> len ,
301
300
(buf -> len < sizeof (uint16_t )) ? 0 : sys_get_le16 (buf -> data ));
302
301
303
- conn -> rx = net_buf_ref ( buf ) ;
302
+ conn -> rx = buf ;
304
303
break ;
305
304
case BT_ACL_CONT :
306
305
if (!conn -> rx ) {
@@ -330,6 +329,7 @@ static void bt_acl_recv(struct bt_conn *conn, struct net_buf *buf, uint8_t flags
330
329
}
331
330
332
331
net_buf_add_mem (conn -> rx , buf -> data , buf -> len );
332
+ net_buf_unref (buf );
333
333
break ;
334
334
default :
335
335
/* BT_ACL_START_NO_FLUSH and BT_ACL_COMPLETE are not allowed on
@@ -346,27 +346,17 @@ static void bt_acl_recv(struct bt_conn *conn, struct net_buf *buf, uint8_t flags
346
346
/* Still not enough data received to retrieve the L2CAP header
347
347
* length field.
348
348
*/
349
- bt_send_one_host_num_completed_packets (conn -> handle );
350
- bt_acl_set_ncp_sent (buf , true);
351
- net_buf_unref (buf );
352
-
353
349
return ;
354
350
}
355
351
356
352
acl_total_len = sys_get_le16 (conn -> rx -> data ) + sizeof (struct bt_l2cap_hdr );
357
353
358
354
if (conn -> rx -> len < acl_total_len ) {
359
355
/* L2CAP frame not complete. */
360
- bt_send_one_host_num_completed_packets (conn -> handle );
361
- bt_acl_set_ncp_sent (buf , true);
362
- net_buf_unref (buf );
363
-
364
356
return ;
365
357
}
366
358
367
- net_buf_unref (buf );
368
-
369
- if (conn -> rx -> len > acl_total_len ) {
359
+ if ((conn -> type != BT_CONN_TYPE_BR ) && (conn -> rx -> len > acl_total_len )) {
370
360
LOG_ERR ("ACL len mismatch (%u > %u)" , conn -> rx -> len , acl_total_len );
371
361
bt_conn_reset_rx_state (conn );
372
362
return ;
@@ -376,8 +366,6 @@ static void bt_acl_recv(struct bt_conn *conn, struct net_buf *buf, uint8_t flags
376
366
buf = conn -> rx ;
377
367
conn -> rx = NULL ;
378
368
379
- __ASSERT (buf -> ref == 1 , "buf->ref %d" , buf -> ref );
380
-
381
369
LOG_DBG ("Successfully parsed %u byte L2CAP packet" , buf -> len );
382
370
bt_l2cap_recv (conn , buf , true);
383
371
}
0 commit comments