l2cap.c (ff3f1026e35eaaaef3ffc13e689964da83f80bc2) | l2cap.c (c54378f194de53c8fe357d7eb24bcd73a0915d81) |
---|---|
1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 3155 unchanged lines hidden (view full) --- 3164 switch(channel->mode){ 3165 case L2CAP_CHANNEL_MODE_ENHANCED_RETRANSMISSION: 3166 // Store remote config 3167 channel->remote_tx_window_size = command[pos+1]; 3168 channel->remote_max_transmit = command[pos+2]; 3169 channel->remote_retransmission_timeout_ms = little_endian_read_16(command, pos + 3); 3170 channel->remote_monitor_timeout_ms = little_endian_read_16(command, pos + 5); 3171 channel->remote_mps = little_endian_read_16(command, pos + 7); | 1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 3155 unchanged lines hidden (view full) --- 3164 switch(channel->mode){ 3165 case L2CAP_CHANNEL_MODE_ENHANCED_RETRANSMISSION: 3166 // Store remote config 3167 channel->remote_tx_window_size = command[pos+1]; 3168 channel->remote_max_transmit = command[pos+2]; 3169 channel->remote_retransmission_timeout_ms = little_endian_read_16(command, pos + 3); 3170 channel->remote_monitor_timeout_ms = little_endian_read_16(command, pos + 5); 3171 channel->remote_mps = little_endian_read_16(command, pos + 7); |
3172 { 3173 // limit remote mtu by our tx buffers. Include 2 bytes SDU Length 3174 uint16_t effective_mps = btstack_min(channel->local_mps, channel->remote_mps); 3175 uint16_t effective_num_buffers = btstack_min(channel->remote_tx_window_size, channel->num_tx_buffers); 3176 uint16_t effective_mtu = effective_mps * effective_num_buffers - 2; 3177 channel->remote_mtu = btstack_min( effective_mtu, channel->remote_mtu); 3178 } |
|
3172 log_info("FC&C config: tx window: %u, max transmit %u, retrans timeout %u, monitor timeout %u, mps %u", 3173 channel->remote_tx_window_size, 3174 channel->remote_max_transmit, 3175 channel->remote_retransmission_timeout_ms, 3176 channel->remote_monitor_timeout_ms, 3177 channel->remote_mps); 3178 // If ERTM mandatory, but remote doens't offer ERTM -> disconnect 3179 if (channel->ertm_mandatory && mode != L2CAP_CHANNEL_MODE_ENHANCED_RETRANSMISSION){ --- 2336 unchanged lines hidden --- | 3179 log_info("FC&C config: tx window: %u, max transmit %u, retrans timeout %u, monitor timeout %u, mps %u", 3180 channel->remote_tx_window_size, 3181 channel->remote_max_transmit, 3182 channel->remote_retransmission_timeout_ms, 3183 channel->remote_monitor_timeout_ms, 3184 channel->remote_mps); 3185 // If ERTM mandatory, but remote doens't offer ERTM -> disconnect 3186 if (channel->ertm_mandatory && mode != L2CAP_CHANNEL_MODE_ENHANCED_RETRANSMISSION){ --- 2336 unchanged lines hidden --- |