Bluetooth: Add bt_conn_init() API

This helps move the ACL_OUT buffer management into conn.c.

Change-Id: Ie5ef48e02eeef5077f433e42c1e2eba9bdb94f63
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2015-11-03 17:15:40 +02:00 committed by Anas Nashif
commit 32f5826a1b
5 changed files with 24 additions and 16 deletions

View file

@ -36,6 +36,7 @@
#include "l2cap_internal.h"
#include "keys.h"
#include "smp.h"
#include "att.h"
#if !defined(CONFIG_BLUETOOTH_DEBUG_CONN)
#undef BT_DBG
@ -767,3 +768,19 @@ uint8_t bt_conn_enc_key_size(struct bt_conn *conn)
{
return conn->keys ? conn->keys->enc_size : 0;
}
int bt_conn_init(void)
{
int err;
bt_att_init();
err = bt_smp_init();
if (err) {
return err;
}
bt_l2cap_init();
return 0;
}

View file

@ -120,4 +120,8 @@ void bt_conn_identity_resolved(struct bt_conn *conn);
/* Notify higher layers that connection security changed */
void bt_conn_security_changed(struct bt_conn *conn);
/* Initialize connection management */
int bt_conn_init(void);
#endif /* CONFIG_BLUETOOTH_SMP */

View file

@ -1609,7 +1609,7 @@ static int bt_init(void)
#if defined(CONFIG_BLUETOOTH_CONN)
if (!err) {
err = bt_l2cap_init();
err = bt_conn_init();
}
#endif /* CONFIG_BLUETOOTH_CONN */

View file

@ -33,8 +33,6 @@
#include "hci_core.h"
#include "conn_internal.h"
#include "l2cap_internal.h"
#include "att.h"
#include "smp.h"
#if !defined(CONFIG_BLUETOOTH_DEBUG_L2CAP)
#undef BT_DBG
@ -757,27 +755,16 @@ static int l2cap_accept(struct bt_conn *conn, struct bt_l2cap_chan **chan)
return -ENOMEM;
}
int bt_l2cap_init(void)
void bt_l2cap_init(void)
{
int err;
static struct bt_l2cap_fixed_chan chan = {
.cid = BT_L2CAP_CID_LE_SIG,
.accept = l2cap_accept,
};
bt_att_init();
err = bt_smp_init();
if (err) {
return err;
}
net_buf_pool_init(acl_out_pool);
bt_l2cap_fixed_chan_register(&chan);
return 0;
}
struct bt_l2cap_chan *bt_l2cap_lookup_tx_cid(struct bt_conn *conn,

View file

@ -140,7 +140,7 @@ void bt_l2cap_recv(struct bt_conn *conn, struct net_buf *buf);
int bt_l2cap_update_conn_param(struct bt_conn *conn);
/* Initialize L2CAP and supported channels */
int bt_l2cap_init(void);
void bt_l2cap_init(void);
/* Lookup channel by Transmission CID */
struct bt_l2cap_chan *bt_l2cap_lookup_tx_cid(struct bt_conn *conn,