OSDN Git Service

L2cap: Store MTU and ERTM info during registration
authorHansong Zhang <hsz@google.com>
Wed, 23 Sep 2020 22:38:40 +0000 (15:38 -0700)
committerHansong Zhang <hsz@google.com>
Thu, 24 Sep 2020 02:14:16 +0000 (19:14 -0700)
So that L2cap can auto respond to config req/rsp.

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

stack/l2cap/l2c_api.cc
stack/l2cap/l2c_int.h

index 739d299..d599098 100644 (file)
@@ -121,6 +121,8 @@ uint16_t L2CA_Register(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info,
   p_rcb->log_packets = enable_snoop;
   p_rcb->api = p_cb_info;
   p_rcb->real_psm = psm;
+  p_rcb->ertm_info = p_ertm_info == nullptr ? tL2CAP_ERTM_INFO{} : *p_ertm_info;
+  p_rcb->required_mtu = std::max<uint16_t>(required_mtu, L2CAP_DEFAULT_MTU);
 
   return (vpsm);
 }
index ce654d7..b2717c4 100644 (file)
@@ -201,6 +201,8 @@ typedef struct {
   uint16_t real_psm; /* This may be a dummy RCB for an o/b connection but */
                      /* this is the real PSM that we need to connect to */
   tL2CAP_APPL_INFO api;
+  tL2CAP_ERTM_INFO ertm_info;
+  uint16_t required_mtu;
 } tL2C_RCB;
 
 #define L2CAP_CBB_DEFAULT_DATA_RATE_BUFF_QUOTA 100