/*******************************************************************************
*
- * Function l2c_fcr_adj_our_req_options
- *
- * Description Validates and sets up the FCR options passed in from
- * L2CA_ConfigReq based on remote device's features.
- *
- * Returns true if no errors, Otherwise false
- *
- ******************************************************************************/
-bool l2c_fcr_adj_our_req_options(tL2C_CCB* p_ccb, tL2CAP_CFG_INFO* p_cfg) {
- CHECK(p_ccb != NULL);
- CHECK(p_cfg != NULL);
-
- tL2CAP_FCR_OPTS* p_fcr = &p_cfg->fcr;
-
- if (p_fcr->mode != p_ccb->p_rcb->ertm_info.preferred_mode) {
- L2CAP_TRACE_WARNING(
- "l2c_fcr_adj_our_req_options - preferred_mode (%d), does not match "
- "mode (%d)",
- p_ccb->p_rcb->ertm_info.preferred_mode, p_fcr->mode);
-
- /* The preferred mode is passed in through tL2CAP_ERTM_INFO, so override
- * this one */
- p_fcr->mode = p_ccb->p_rcb->ertm_info.preferred_mode;
- }
-
- /* If upper layer did not request eRTM mode, BASIC must be used */
- if (p_ccb->p_rcb->ertm_info.preferred_mode == L2CAP_FCR_BASIC_MODE) {
- if (p_cfg->fcr_present && p_fcr->mode != L2CAP_FCR_BASIC_MODE) {
- L2CAP_TRACE_WARNING(
- "l2c_fcr_adj_our_req_options (mode %d): ERROR: No FCR options set "
- "using BASIC mode",
- p_fcr->mode);
- }
- p_fcr->mode = L2CAP_FCR_BASIC_MODE;
- }
-
- /* Process the FCR options if initial channel bring-up (not a reconfig
- *request)
- ** Determine initial channel mode to try based on our options and remote's
- *features
- */
- if (p_cfg->fcr_present && !(p_ccb->config_done & RECONFIG_FLAG)) {
- /* We need to have at least one mode type common with the peer */
- if (!l2c_fcr_chk_chan_modes(p_ccb)) {
- /* Two channels have incompatible supported types */
- l2cu_disconnect_chnl(p_ccb);
- return (false);
- }
-
- /* Basic is the only common channel mode between the two devices */
- else if (p_ccb->p_rcb->ertm_info.preferred_mode == L2CAP_FCR_BASIC_MODE) {
- /* We only want to try Basic, so bypass sending the FCR options entirely
- */
- p_cfg->fcr_present = false;
- p_cfg->fcs_present = false; /* Illegal to use FCS option in basic mode */
- p_cfg->ext_flow_spec_present =
- false; /* Illegal to use extended flow spec in basic mode */
- }
-
- /* We have at least one non-basic mode available
- * Override mode from available mode options based on preference, if needed
- */
- else {
- /* If peer does not support ERTM, try BASIC (will support this if made it
- * here in the code) */
- if (p_fcr->mode == L2CAP_FCR_ERTM_MODE &&
- !(p_ccb->p_rcb->ertm_info.preferred_mode & L2CAP_FCR_BASIC_MODE)) {
- L2CAP_TRACE_DEBUG(
- "L2C CFG: mode is ERTM, but peer does not support; Try BASIC");
- p_fcr->mode = L2CAP_FCR_BASIC_MODE;
- }
- }
-
- if (p_fcr->mode != L2CAP_FCR_BASIC_MODE) {
- /* MTU must be smaller than buffer size */
- if ((p_cfg->mtu_present) && (p_cfg->mtu > p_ccb->max_rx_mtu)) {
- L2CAP_TRACE_WARNING("L2CAP - MTU: %u larger than buf size: %u",
- p_cfg->mtu, p_ccb->max_rx_mtu);
- return (false);
- }
-
- /* application want to use the default MPS */
- if (p_fcr->mps == L2CAP_DEFAULT_ERM_MPS) {
- p_fcr->mps = L2CAP_MPS_OVER_BR_EDR;
- }
- /* MPS must be less than MTU */
- else if (p_fcr->mps > p_ccb->max_rx_mtu) {
- L2CAP_TRACE_WARNING("L2CAP - MPS %u invalid MTU: %u", p_fcr->mps,
- p_ccb->max_rx_mtu);
- return (false);
- }
-
- /* We always initially read into the HCI buffer pool, so make sure it fits
- */
- if (p_fcr->mps > (L2CAP_MTU_SIZE - L2CAP_MAX_HEADER_FCS))
- p_fcr->mps = L2CAP_MTU_SIZE - L2CAP_MAX_HEADER_FCS;
- } else {
- p_cfg->fcs_present = false; /* Illegal to use FCS option in basic mode */
- p_cfg->ext_flow_spec_present =
- false; /* Illegal to use extended flow spec in basic mode */
- }
-
- p_ccb->our_cfg.fcr = *p_fcr;
- } else /* Not sure how to send a reconfiguration(??) should fcr be included?
- */
- {
- p_ccb->our_cfg.fcr_present = false;
- }
-
- return (true);
-}
-
-/*******************************************************************************
- *
* Function l2c_fcr_adj_monitor_retran_timeout
*
* Description Overrides monitor/retrans timer value based on controller
#define LE_DYNAMIC_PSM_END 0x00FF
#define LE_DYNAMIC_PSM_RANGE (LE_DYNAMIC_PSM_END - LE_DYNAMIC_PSM_START + 1)
-/* Bitmask to skip over Broadcom feature reserved (ID) to avoid sending two
- successive ID values, '0' id only or both */
-#define L2CAP_ADJ_BRCM_ID 0x1
-#define L2CAP_ADJ_ZERO_ID 0x2
-#define L2CAP_ADJ_ID 0x3
-
/* Return values for l2cu_process_peer_cfg_req() */
#define L2CAP_PEER_CFG_UNACCEPTABLE 0
#define L2CAP_PEER_CFG_OK 1
tBT_TRANSPORT transport;
bool is_transport_br_edr() const { return transport == BT_TRANSPORT_BR_EDR; }
bool is_transport_ble() const { return transport == BT_TRANSPORT_LE; }
- bool is_transport_valid() const {
- return is_transport_ble() || is_transport_br_edr();
- }
uint8_t initiating_phys; // LE PHY used for connection initiation
tBLE_ADDR_TYPE ble_addr_type;
extern tL2C_CCB* l2cu_find_ccb_by_cid(tL2C_LCB* p_lcb, uint16_t local_cid);
extern tL2C_CCB* l2cu_find_ccb_by_remote_cid(tL2C_LCB* p_lcb,
uint16_t remote_cid);
-extern void l2cu_adj_id(tL2C_LCB* p_lcb, uint8_t adj_mask);
extern bool l2c_is_cmd_rejected(uint8_t cmd_code, uint8_t id, tL2C_LCB* p_lcb);
extern void l2cu_send_peer_cmd_reject(tL2C_LCB* p_lcb, uint16_t reason,
/* Configuration negotiation */
extern uint8_t l2c_fcr_chk_chan_modes(tL2C_CCB* p_ccb);
-extern bool l2c_fcr_adj_our_req_options(tL2C_CCB* p_ccb,
- tL2CAP_CFG_INFO* p_cfg);
+
extern void l2c_fcr_adj_our_rsp_options(tL2C_CCB* p_ccb,
tL2CAP_CFG_INFO* p_peer_cfg);
extern bool l2c_fcr_renegotiate_chan(tL2C_CCB* p_ccb, tL2CAP_CFG_INFO* p_cfg);