Skip to content

Commit e94b91d

Browse files
PavelVPVcvinayak
authored andcommitted
Revert "Bluetooth: host: Send host num completes as early as possible"
This reverts commit 147ee3d. Signed-off-by: Pavel Vasilyev <[email protected]> (cherry picked from commit da9acbc) Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 3b0a51d commit e94b91d

File tree

4 files changed

+6
-35
lines changed

4 files changed

+6
-35
lines changed

subsys/bluetooth/host/conn.c

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -283,12 +283,11 @@ void bt_conn_reset_rx_state(struct bt_conn *conn)
283283
conn->rx = NULL;
284284
}
285285

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)
287288
{
288289
uint16_t acl_total_len;
289290

290-
bt_acl_set_ncp_sent(buf, false);
291-
292291
/* Check packet boundary flags */
293292
switch (flags) {
294293
case BT_ACL_START:
@@ -300,7 +299,7 @@ static void bt_acl_recv(struct bt_conn *conn, struct net_buf *buf, uint8_t flags
300299
LOG_DBG("First, len %u final %u", buf->len,
301300
(buf->len < sizeof(uint16_t)) ? 0 : sys_get_le16(buf->data));
302301

303-
conn->rx = net_buf_ref(buf);
302+
conn->rx = buf;
304303
break;
305304
case BT_ACL_CONT:
306305
if (!conn->rx) {
@@ -330,6 +329,7 @@ static void bt_acl_recv(struct bt_conn *conn, struct net_buf *buf, uint8_t flags
330329
}
331330

332331
net_buf_add_mem(conn->rx, buf->data, buf->len);
332+
net_buf_unref(buf);
333333
break;
334334
default:
335335
/* 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
346346
/* Still not enough data received to retrieve the L2CAP header
347347
* length field.
348348
*/
349-
bt_send_one_host_num_completed_packets(conn->handle);
350-
bt_acl_set_ncp_sent(buf, true);
351-
net_buf_unref(buf);
352-
353349
return;
354350
}
355351

356352
acl_total_len = sys_get_le16(conn->rx->data) + sizeof(struct bt_l2cap_hdr);
357353

358354
if (conn->rx->len < acl_total_len) {
359355
/* 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-
364356
return;
365357
}
366358

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)) {
370360
LOG_ERR("ACL len mismatch (%u > %u)", conn->rx->len, acl_total_len);
371361
bt_conn_reset_rx_state(conn);
372362
return;
@@ -376,8 +366,6 @@ static void bt_acl_recv(struct bt_conn *conn, struct net_buf *buf, uint8_t flags
376366
buf = conn->rx;
377367
conn->rx = NULL;
378368

379-
__ASSERT(buf->ref == 1, "buf->ref %d", buf->ref);
380-
381369
LOG_DBG("Successfully parsed %u byte L2CAP packet", buf->len);
382370
bt_l2cap_recv(conn, buf, true);
383371
}

subsys/bluetooth/host/conn_internal.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,7 @@ struct acl_data {
151151
struct bt_buf_data buf_data;
152152

153153
/* Index into the bt_conn storage array */
154-
uint8_t index;
155-
156-
/** Host has already sent a Host Number of Completed Packets
157-
* for this buffer.
158-
*/
159-
bool host_ncp_sent;
154+
uint8_t index;
160155

161156
/** ACL connection handle */
162157
uint16_t handle;

subsys/bluetooth/host/hci_core.c

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

200-
void bt_acl_set_ncp_sent(struct net_buf *packet, bool value)
201-
{
202-
acl(packet)->host_ncp_sent = value;
203-
}
204-
205200
void bt_send_one_host_num_completed_packets(uint16_t handle)
206201
{
207202
if (!IS_ENABLED(CONFIG_BT_HCI_ACL_FLOW_CONTROL)) {
@@ -240,10 +235,6 @@ void bt_hci_host_num_completed_packets(struct net_buf *buf)
240235

241236
net_buf_destroy(buf);
242237

243-
if (acl(buf)->host_ncp_sent) {
244-
return;
245-
}
246-
247238
/* Do nothing if controller to host flow control is not supported */
248239
if (!BT_CMD_TEST(bt_dev.supported_commands, 10, 5)) {
249240
return;

subsys/bluetooth/host/hci_core.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,3 @@ void bt_hci_le_df_cte_req_failed(struct net_buf *buf);
527527

528528
void bt_hci_le_per_adv_subevent_data_request(struct net_buf *buf);
529529
void bt_hci_le_per_adv_response_report(struct net_buf *buf);
530-
531-
void bt_send_one_host_num_completed_packets(uint16_t handle);
532-
void bt_acl_set_ncp_sent(struct net_buf *packet, bool value);

0 commit comments

Comments
 (0)