Skip to content

Commit da9acbc

Browse files
PavelVPVfabiobaltieri
authored andcommitted
Revert "Bluetooth: host: Send host num completes as early as possible"
This reverts commit 147ee3d. Signed-off-by: Pavel Vasilyev <[email protected]>
1 parent f2f036f commit da9acbc

File tree

4 files changed

+5
-33
lines changed

4 files changed

+5
-33
lines changed

subsys/bluetooth/host/conn.c

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -388,12 +388,11 @@ void bt_conn_reset_rx_state(struct bt_conn *conn)
388388
conn->rx = NULL;
389389
}
390390

391-
static void bt_acl_recv(struct bt_conn *conn, struct net_buf *buf, uint8_t flags)
391+
static void bt_acl_recv(struct bt_conn *conn, struct net_buf *buf,
392+
uint8_t flags)
392393
{
393394
uint16_t acl_total_len;
394395

395-
bt_acl_set_ncp_sent(buf, false);
396-
397396
/* Check packet boundary flags */
398397
switch (flags) {
399398
case BT_ACL_START:
@@ -405,7 +404,7 @@ static void bt_acl_recv(struct bt_conn *conn, struct net_buf *buf, uint8_t flags
405404
LOG_DBG("First, len %u final %u", buf->len,
406405
(buf->len < sizeof(uint16_t)) ? 0 : sys_get_le16(buf->data));
407406

408-
conn->rx = net_buf_ref(buf);
407+
conn->rx = buf;
409408
break;
410409
case BT_ACL_CONT:
411410
if (!conn->rx) {
@@ -435,6 +434,7 @@ static void bt_acl_recv(struct bt_conn *conn, struct net_buf *buf, uint8_t flags
435434
}
436435

437436
net_buf_add_mem(conn->rx, buf->data, buf->len);
437+
net_buf_unref(buf);
438438
break;
439439
default:
440440
/* BT_ACL_START_NO_FLUSH and BT_ACL_COMPLETE are not allowed on
@@ -451,26 +451,16 @@ static void bt_acl_recv(struct bt_conn *conn, struct net_buf *buf, uint8_t flags
451451
/* Still not enough data received to retrieve the L2CAP header
452452
* length field.
453453
*/
454-
bt_send_one_host_num_completed_packets(conn->handle);
455-
bt_acl_set_ncp_sent(buf, true);
456-
net_buf_unref(buf);
457-
458454
return;
459455
}
460456

461457
acl_total_len = sys_get_le16(conn->rx->data) + sizeof(struct bt_l2cap_hdr);
462458

463459
if (conn->rx->len < acl_total_len) {
464460
/* L2CAP frame not complete. */
465-
bt_send_one_host_num_completed_packets(conn->handle);
466-
bt_acl_set_ncp_sent(buf, true);
467-
net_buf_unref(buf);
468-
469461
return;
470462
}
471463

472-
net_buf_unref(buf);
473-
474464
if ((conn->type != BT_CONN_TYPE_BR) && (conn->rx->len > acl_total_len)) {
475465
LOG_ERR("ACL len mismatch (%u > %u)", conn->rx->len, acl_total_len);
476466
bt_conn_reset_rx_state(conn);
@@ -481,8 +471,6 @@ static void bt_acl_recv(struct bt_conn *conn, struct net_buf *buf, uint8_t flags
481471
buf = conn->rx;
482472
conn->rx = NULL;
483473

484-
__ASSERT(buf->ref == 1, "buf->ref %d", buf->ref);
485-
486474
LOG_DBG("Successfully parsed %u byte L2CAP packet", buf->len);
487475
if (IS_ENABLED(CONFIG_BT_CLASSIC) && (conn->type == BT_CONN_TYPE_BR)) {
488476
bt_br_acl_recv(conn, buf, true);

subsys/bluetooth/host/conn_internal.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,7 @@ struct bt_conn_tx {
210210

211211
struct acl_data {
212212
/* Index into the bt_conn storage array */
213-
uint8_t index;
214-
215-
/** Host has already sent a Host Number of Completed Packets
216-
* for this buffer.
217-
*/
218-
bool host_ncp_sent;
213+
uint8_t index;
219214

220215
/** ACL connection handle */
221216
uint16_t handle;

subsys/bluetooth/host/hci_core.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,6 @@ static void handle_vs_event(uint8_t event, struct net_buf *buf,
254254
/* Other possible errors are handled by handle_event_common function */
255255
}
256256

257-
void bt_acl_set_ncp_sent(struct net_buf *packet, bool value)
258-
{
259-
acl(packet)->host_ncp_sent = value;
260-
}
261-
262257
void bt_send_one_host_num_completed_packets(uint16_t handle)
263258
{
264259
if (!IS_ENABLED(CONFIG_BT_HCI_ACL_FLOW_CONTROL)) {
@@ -307,10 +302,6 @@ void bt_hci_host_num_completed_packets(struct net_buf *buf)
307302

308303
net_buf_destroy(buf);
309304

310-
if (acl(buf)->host_ncp_sent) {
311-
return;
312-
}
313-
314305
/* Do nothing if controller to host flow control is not supported */
315306
if (!BT_CMD_TEST(bt_dev.supported_commands, 10, 5)) {
316307
return;

subsys/bluetooth/host/hci_core.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,5 +582,3 @@ int bt_hci_le_read_max_data_len(uint16_t *tx_octets, uint16_t *tx_time);
582582
bool bt_drv_quirk_no_auto_dle(void);
583583

584584
void bt_tx_irq_raise(void);
585-
void bt_send_one_host_num_completed_packets(uint16_t handle);
586-
void bt_acl_set_ncp_sent(struct net_buf *packet, bool value);

0 commit comments

Comments
 (0)