Bluetooth: RFCOMM: Init buffer for outgoing signalling packets
Buffer size is currently set as rfcomm min mtu Change-Id: Ie8fd3f1cef9d6d9b62d5aca272f0030181175460 Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
This commit is contained in:
parent
d0504ffc34
commit
a816142687
|
@ -46,10 +46,17 @@
|
|||
#define RFCOMM_CHANNEL_START 0x01
|
||||
#define RFCOMM_CHANNEL_END 0x1e
|
||||
|
||||
#define RFCOMM_MIN_MTU BT_RFCOMM_SIG_MIN_MTU
|
||||
#define RFCOMM_DEFAULT_MTU 127
|
||||
|
||||
static struct bt_rfcomm_server *servers;
|
||||
|
||||
/* Pool for outgoing RFCOMM control packets, min MTU is 23 */
|
||||
static struct nano_fifo rfcomm_session;
|
||||
static NET_BUF_POOL(rfcomm_session_pool, CONFIG_BLUETOOTH_MAX_CONN,
|
||||
BT_RFCOMM_BUF_SIZE(RFCOMM_MIN_MTU), &rfcomm_session, NULL,
|
||||
BT_BUF_USER_DATA_MIN);
|
||||
|
||||
#define RFCOMM_SESSION(_ch) CONTAINER_OF(_ch, \
|
||||
struct bt_rfcomm_session, br_chan.chan)
|
||||
|
||||
|
@ -143,5 +150,6 @@ void bt_rfcomm_init(void)
|
|||
.accept = rfcomm_accept,
|
||||
};
|
||||
|
||||
net_buf_pool_init(rfcomm_session_pool);
|
||||
bt_l2cap_br_server_register(&server);
|
||||
}
|
||||
|
|
|
@ -33,5 +33,19 @@ enum {
|
|||
BT_RFCOMM_STATE_INIT,
|
||||
};
|
||||
|
||||
struct bt_rfcomm_hdr {
|
||||
uint8_t address;
|
||||
uint8_t control;
|
||||
uint8_t length;
|
||||
} __packed;
|
||||
|
||||
#define BT_RFCOMM_SIG_MIN_MTU 23
|
||||
|
||||
/* Helper to calculate needed outgoing buffer size */
|
||||
#define BT_RFCOMM_BUF_SIZE(mtu) (CONFIG_BLUETOOTH_HCI_SEND_RESERVE + \
|
||||
sizeof(struct bt_hci_acl_hdr) + \
|
||||
sizeof(struct bt_l2cap_hdr) + \
|
||||
sizeof(struct bt_rfcomm_hdr) + (mtu))
|
||||
|
||||
/* Initialize RFCOMM signal layer */
|
||||
void bt_rfcomm_init(void);
|
||||
|
|
Loading…
Reference in a new issue