Bluetooth: h5: Drop out of sync packet

We might get out of sync packet because of race collision, drop it.

Change-Id: Ic84a760199df1520dc7a95383972f9ec428c7fde
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This commit is contained in:
Andrei Emeltchenko 2015-12-16 14:16:33 +02:00 committed by Anas Nashif
commit 960e1380b2

View file

@ -516,8 +516,6 @@ void bt_uart_isr(void *unused)
remaining--;
}
BT_DBG("Read SLIP header");
if (!remaining) {
remaining = H5_HDR_LEN(hdr);
type = H5_HDR_PKT_TYPE(hdr);
@ -591,6 +589,19 @@ void bt_uart_isr(void *unused)
BT_DBG("Received full packet: type %u", type);
/* Check when full packet is received, it can be done
* when parsing packet header but we need to receive
* full packet anyway to clear UART.
*/
if (H5_HDR_RELIABLE(hdr) &&
H5_HDR_SEQ(hdr) != h5.tx_ack) {
BT_ERR("Seq expected %u got %u. Drop packet",
h5.tx_ack, H5_HDR_SEQ(hdr));
/* TODO: Reset rx */
break;
}
h5_process_complete_packet(buf, type, hdr);
break;
}