hci: implement ENABLE_LE_LIMIT_ACL_FRAGMENT_BY_MAX_OCTETS

This commit is contained in:
Matthias Ringwald 2020-04-29 14:20:14 +02:00
parent af1b7cdc1f
commit 0f3b27c545
4 changed files with 24 additions and 3 deletions

View File

@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added
- GAP: gap_set_allow_role_switch allows to prevent role switch in outgoing classic ACL connections
- example: hog_boot_host_demo implement an HID-over-GATT Boot Host that supports keyboard and mouse
- hci: add ENABLE_LE_LIMIT_ACL_FRAGMENT_BY_MAX_OCTETS that forces fragmentation of ACL-LE packets to fit into over-the-air packet
### Changed
- Broadcom/Cypress: wait 300 ms after PatchRAM update in hci.c to assert Controller is ready

View File

@ -97,6 +97,7 @@ ENABLE_L2CAP_ENHANCED_RETRANSMISSION_MODE | Enable L2CAP Enhanced Retransmission
ENABLE_HCI_CONTROLLER_TO_HOST_FLOW_CONTROL | Enable HCI Controller to Host Flow Control, see below
ENABLE_CC256X_BAUDRATE_CHANGE_FLOWCONTROL_BUG_WORKAROUND | Enable workaround for bug in CC256x Flow Control during baud rate change, see chipset docs.
ENABLE_CYPRESS_BAUDRATE_CHANGE_FLOWCONTROL_BUG_WORKAROUND | Enable workaround for bug in CYW2070x Flow Control during baud rate change, similar to CC256x.
ENABLE_LE_LIMIT_ACL_FRAGMENT_BY_MAX_OCTETS | Force HCI to fragment ACL-LE packets to fit into over-the-air packet
ENABLE_TLV_FLASH_EXPLICIT_DELETE_FIELD | Enable use of explicit delete field in TLV Flash implemenation - required when flash value cannot be overwritten with zero
ENABLE_CONTROLLER_WARM_BOOT | Enable stack startup without power cycle (if supported/possible)
ENABLE_SEGGER_RTT | Use SEGGER RTT for console output and packet log, see [additional options](#sec:rttConfiguration)

View File

@ -211,7 +211,10 @@ static hci_connection_t * create_connection_for_bd_addr_and_type(bd_addr_t addr,
conn->le_con_parameter_update_state = CON_PARAMETER_UPDATE_NONE;
#ifdef ENABLE_BLE
conn->le_phy_update_all_phys = 0xff;
#endif
#endif
#ifdef ENABLE_LE_LIMIT_ACL_FRAGMENT_BY_MAX_OCTETS
conn->le_max_tx_octets = 27;
#endif
btstack_linked_list_add(&hci_stack->connections, (btstack_linked_item_t *) conn);
return conn;
}
@ -649,8 +652,11 @@ static int hci_send_acl_packet_fragments(hci_connection_t *connection){
max_acl_data_packet_length = hci_stack->le_data_packets_length;
}
// testing: reduce buffer to minimum
// max_acl_data_packet_length = 52;
#ifdef ENABLE_LE_LIMIT_ACL_FRAGMENT_BY_MAX_OCTETS
if (hci_is_le_connection(connection)){
max_acl_data_packet_length = connection->le_max_tx_octets;
}
#endif
log_debug("hci_send_acl_packet_fragments entered");
@ -2600,6 +2606,15 @@ static void event_handler(uint8_t *packet, int size){
}
}
break;
#ifdef ENABLE_LE_LIMIT_ACL_FRAGMENT_BY_MAX_OCTETS
case HCI_SUBEVENT_LE_DATA_LENGTH_CHANGE:
handle = hci_subevent_le_data_length_change_get_connection_handle(packet);
conn = hci_connection_for_handle(handle);
if (conn) {
conn->le_max_tx_octets = hci_subevent_le_data_length_change_get_max_tx_octets(packet);
}
break;
#endif
default:
break;
}

View File

@ -566,6 +566,10 @@ typedef struct {
// LE Security Manager
sm_connection_t sm_connection;
#ifdef ENABLE_LE_LIMIT_ACL_FRAGMENT_BY_MAX_OCTETS
uint16_t le_max_tx_octets;
#endif
// ATT Server
att_server_t att_server;
#endif