OSDN Git Service

L2cap: clean up flush timeout option
authorHansong Zhang <hsz@google.com>
Wed, 30 Sep 2020 23:30:40 +0000 (16:30 -0700)
committerHansong Zhang <hsz@google.com>
Thu, 1 Oct 2020 06:02:17 +0000 (23:02 -0700)
Seems that only one value is used.

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I6da78ec6108cb34316199fb16b52bacee6bf74a1

bta/av/bta_av_aact.cc
stack/include/avdt_api.h
stack/include/l2cdefs.h
stack/l2cap/l2c_api.cc
stack/l2cap/l2c_utils.cc

index c640389..9fe09ef 100644 (file)
@@ -1882,7 +1882,7 @@ void bta_av_str_stopped(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
     p_scb->co_started = false;
 
     p_scb->p_cos->stop(p_scb->hndl, p_scb->PeerAddress());
-    L2CA_SetFlushTimeout(p_scb->PeerAddress(), L2CAP_DEFAULT_FLUSH_TO);
+    L2CA_SetFlushTimeout(p_scb->PeerAddress(), L2CAP_NO_AUTOMATIC_FLUSH);
   }
 
   /* if q_info.a2dp_list is not empty, drop it now */
@@ -2513,7 +2513,7 @@ void bta_av_suspend_cfm(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
       p_scb->co_started = false;
       p_scb->p_cos->stop(p_scb->hndl, p_scb->PeerAddress());
     }
-    L2CA_SetFlushTimeout(p_scb->PeerAddress(), L2CAP_DEFAULT_FLUSH_TO);
+    L2CA_SetFlushTimeout(p_scb->PeerAddress(), L2CAP_NO_AUTOMATIC_FLUSH);
   }
 
   {
index b069bf8..52289f6 100644 (file)
@@ -477,7 +477,6 @@ class AvdtpStreamConfig {
         p_sink_data_cback(nullptr),
         p_report_cback(nullptr),
         mtu(0),
-        flush_to(0),
         tsep(0),
         media_type(0),
         nsc_mask(0) {}
@@ -489,7 +488,6 @@ class AvdtpStreamConfig {
     p_sink_data_cback = nullptr;
     p_report_cback = nullptr;
     mtu = 0;
-    flush_to = 0;
     tsep = 0;
     media_type = 0;
     nsc_mask = 0;
@@ -501,7 +499,6 @@ class AvdtpStreamConfig {
   tAVDT_SINK_DATA_CBACK* p_sink_data_cback;  // Sink data callback function
   tAVDT_REPORT_CBACK* p_report_cback;        // Report callback function
   uint16_t mtu;        // The L2CAP MTU of the transport channel
-  uint16_t flush_to;   // The L2CAP flush timeout of the transport channel
   uint8_t tsep;        // SEP type
   uint8_t media_type;  // Media type: AVDT_MEDIA_TYPE_*
   uint16_t nsc_mask;   // Nonsupported protocol command messages
index 14a55fc..ad3512d 100644 (file)
@@ -192,10 +192,8 @@ static_assert(L2CAP_CONN_OTHER_ERROR != L2CAP_CFG_FAILED_NO_REASON,
 /* Default values for configuration
 */
 #define L2CAP_NO_AUTOMATIC_FLUSH 0xFFFF
-#define L2CAP_NO_RETRANSMISSION 0x0001
 
 #define L2CAP_DEFAULT_MTU (672)
-#define L2CAP_DEFAULT_FLUSH_TO L2CAP_NO_AUTOMATIC_FLUSH
 #define L2CAP_DEFAULT_SERV_TYPE 1
 #define L2CAP_DEFAULT_TOKEN_RATE 0
 #define L2CAP_DEFAULT_BUCKET_SIZE 0
index 5e92ce9..5fbc9eb 100644 (file)
@@ -915,15 +915,6 @@ bool L2CA_SetFlushTimeout(const RawAddress& bd_addr,
   if (flush_timeout_in_ms == 0x0000 ||
       flush_timeout_in_ms == L2CAP_NO_AUTOMATIC_FLUSH) {
     flush_timeout_in_slots = 0x0;
-  } else if (flush_timeout_in_ms == L2CAP_NO_RETRANSMISSION) {
-    /* no retransmission */
-    /* not mandatory range for controller */
-    /* Packet is flushed before getting any ACK/NACK */
-    /* To do this, flush timeout should be 1 baseband slot */
-    flush_timeout_in_slots = 0x0001;
-  } else {
-    flush_timeout_in_slots =
-        ConvertMillisecondsToBasebandSlots(flush_timeout_in_ms);
   }
 
   if (RawAddress::kAny != bd_addr) {
index af2ff03..a94fabc 100644 (file)
@@ -1339,7 +1339,7 @@ tL2C_CCB* l2cu_allocate_ccb(tL2C_LCB* p_lcb, uint16_t cid) {
   memset(&p_ccb->peer_cfg, 0, sizeof(tL2CAP_CFG_INFO));
 
   /* Put in default values for local/peer configurations */
-  p_ccb->our_cfg.flush_to = p_ccb->peer_cfg.flush_to = L2CAP_DEFAULT_FLUSH_TO;
+  p_ccb->our_cfg.flush_to = p_ccb->peer_cfg.flush_to = L2CAP_NO_AUTOMATIC_FLUSH;
   p_ccb->our_cfg.mtu = p_ccb->peer_cfg.mtu = L2CAP_DEFAULT_MTU;
   p_ccb->our_cfg.qos.service_type = p_ccb->peer_cfg.qos.service_type =
       L2CAP_DEFAULT_SERV_TYPE;