Bluetooth: L2CAP: Mark finishing CoC configuration on BR/EDR

When each side involved in getting configured L2CAP CoC channel on
BR/EDR transport aggrees on configuration contract regarding in/out MTU,
set proper context flags to start prepare finalize config process.

Change-Id: Ic821ea3b961442be758ad4e2d91b2d812e2a54b5
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
This commit is contained in:
Arkadiusz Lichwa 2016-07-08 18:13:25 +02:00
commit 22bdf50615
2 changed files with 15 additions and 0 deletions

View file

@ -45,6 +45,7 @@
extern "C" {
#endif
#include <atomic.h>
#include <misc/nano_work.h>
#include <bluetooth/buf.h>
#include <bluetooth/conn.h>
@ -137,6 +138,7 @@ struct bt_l2cap_br_chan {
struct bt_l2cap_br_endpoint rx;
/** Channel Transmission Endpoint */
struct bt_l2cap_br_endpoint tx;
atomic_t flags[1];
};
/** @brief L2CAP Channel operations structure. */

View file

@ -59,6 +59,12 @@
*/
#define L2CAP_FEAT_FIXED_CHAN_MASK 0x00000080
/* Auxiliary L2CAP CoC flags making channel context */
enum {
L2CAP_FLAG_LCONF_DONE, /* local config accepted by remote */
L2CAP_FLAG_RCONF_DONE, /* remote config accepted by local */
};
static struct bt_l2cap_server *br_servers;
static struct bt_l2cap_fixed_chan *br_channels;
@ -623,6 +629,7 @@ static void l2cap_br_conf_rsp(struct bt_l2cap_br *l2cap, uint8_t ident,
switch (result) {
case BT_L2CAP_CONF_SUCCESS:
BT_DBG("local MTU %u", BR_CHAN(chan)->rx.mtu);
atomic_set_bit(BR_CHAN(chan)->flags, L2CAP_FLAG_LCONF_DONE);
break;
default:
/* currently disconnect channel on non success result */
@ -824,6 +831,12 @@ send_rsp:
hdr->len = sys_cpu_to_le16(buf->len - sizeof(*hdr));
bt_l2cap_send(conn, BT_L2CAP_CID_BR_SIG, buf);
if (result != BT_L2CAP_CONF_SUCCESS) {
return;
}
atomic_set_bit(BR_CHAN(chan)->flags, L2CAP_FLAG_RCONF_DONE);
}
static struct bt_l2cap_br_chan *l2cap_br_remove_tx_cid(struct bt_conn *conn,