Bluetooth: use bit operation on conf_state
Instead of making the bit operations manually, we now use set_bit, test_bit, etc. Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
This commit is contained in:
Родитель
7fbec224cf
Коммит
c1360a1cf3
|
@ -324,7 +324,7 @@ struct l2cap_chan {
|
||||||
__u16 monitor_timeout;
|
__u16 monitor_timeout;
|
||||||
__u16 mps;
|
__u16 mps;
|
||||||
|
|
||||||
__u8 conf_state;
|
unsigned long conf_state;
|
||||||
__u16 conn_state;
|
__u16 conn_state;
|
||||||
|
|
||||||
__u8 next_tx_seq;
|
__u8 next_tx_seq;
|
||||||
|
@ -424,14 +424,16 @@ struct l2cap_pinfo {
|
||||||
struct l2cap_chan *chan;
|
struct l2cap_chan *chan;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define L2CAP_CONF_REQ_SENT 0x01
|
enum {
|
||||||
#define L2CAP_CONF_INPUT_DONE 0x02
|
CONF_REQ_SENT,
|
||||||
#define L2CAP_CONF_OUTPUT_DONE 0x04
|
CONF_INPUT_DONE,
|
||||||
#define L2CAP_CONF_MTU_DONE 0x08
|
CONF_OUTPUT_DONE,
|
||||||
#define L2CAP_CONF_MODE_DONE 0x10
|
CONF_MTU_DONE,
|
||||||
#define L2CAP_CONF_CONNECT_PEND 0x20
|
CONF_MODE_DONE,
|
||||||
#define L2CAP_CONF_NO_FCS_RECV 0x40
|
CONF_CONNECT_PEND,
|
||||||
#define L2CAP_CONF_STATE2_DEVICE 0x80
|
CONF_NO_FCS_RECV,
|
||||||
|
CONF_STATE2_DEVICE,
|
||||||
|
};
|
||||||
|
|
||||||
#define L2CAP_CONF_MAX_CONF_REQ 2
|
#define L2CAP_CONF_MAX_CONF_REQ 2
|
||||||
#define L2CAP_CONF_MAX_CONF_RSP 2
|
#define L2CAP_CONF_MAX_CONF_RSP 2
|
||||||
|
|
|
@ -381,8 +381,8 @@ static void l2cap_chan_del(struct l2cap_chan *chan, int err)
|
||||||
} else
|
} else
|
||||||
sk->sk_state_change(sk);
|
sk->sk_state_change(sk);
|
||||||
|
|
||||||
if (!(chan->conf_state & L2CAP_CONF_OUTPUT_DONE &&
|
if (!(test_bit(CONF_OUTPUT_DONE, &chan->conf_state) &&
|
||||||
chan->conf_state & L2CAP_CONF_INPUT_DONE))
|
test_bit(CONF_INPUT_DONE, &chan->conf_state)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
skb_queue_purge(&chan->tx_q);
|
skb_queue_purge(&chan->tx_q);
|
||||||
|
@ -633,7 +633,7 @@ static inline void l2cap_send_rr_or_rnr(struct l2cap_chan *chan, u16 control)
|
||||||
|
|
||||||
static inline int __l2cap_no_conn_pending(struct l2cap_chan *chan)
|
static inline int __l2cap_no_conn_pending(struct l2cap_chan *chan)
|
||||||
{
|
{
|
||||||
return !(chan->conf_state & L2CAP_CONF_CONNECT_PEND);
|
return !test_bit(CONF_CONNECT_PEND, &chan->conf_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void l2cap_do_start(struct l2cap_chan *chan)
|
static void l2cap_do_start(struct l2cap_chan *chan)
|
||||||
|
@ -651,7 +651,7 @@ static void l2cap_do_start(struct l2cap_chan *chan)
|
||||||
req.psm = chan->psm;
|
req.psm = chan->psm;
|
||||||
|
|
||||||
chan->ident = l2cap_get_ident(conn);
|
chan->ident = l2cap_get_ident(conn);
|
||||||
chan->conf_state |= L2CAP_CONF_CONNECT_PEND;
|
set_bit(CONF_CONNECT_PEND, &chan->conf_state);
|
||||||
|
|
||||||
l2cap_send_cmd(conn, chan->ident, L2CAP_CONN_REQ,
|
l2cap_send_cmd(conn, chan->ident, L2CAP_CONN_REQ,
|
||||||
sizeof(req), &req);
|
sizeof(req), &req);
|
||||||
|
@ -740,10 +740,9 @@ static void l2cap_conn_start(struct l2cap_conn *conn)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!l2cap_mode_supported(chan->mode,
|
if (!l2cap_mode_supported(chan->mode, conn->feat_mask)
|
||||||
conn->feat_mask)
|
&& test_bit(CONF_STATE2_DEVICE,
|
||||||
&& chan->conf_state &
|
&chan->conf_state)) {
|
||||||
L2CAP_CONF_STATE2_DEVICE) {
|
|
||||||
/* l2cap_chan_close() calls list_del(chan)
|
/* l2cap_chan_close() calls list_del(chan)
|
||||||
* so release the lock */
|
* so release the lock */
|
||||||
read_unlock_bh(&conn->chan_lock);
|
read_unlock_bh(&conn->chan_lock);
|
||||||
|
@ -757,7 +756,7 @@ static void l2cap_conn_start(struct l2cap_conn *conn)
|
||||||
req.psm = chan->psm;
|
req.psm = chan->psm;
|
||||||
|
|
||||||
chan->ident = l2cap_get_ident(conn);
|
chan->ident = l2cap_get_ident(conn);
|
||||||
chan->conf_state |= L2CAP_CONF_CONNECT_PEND;
|
set_bit(CONF_CONNECT_PEND, &chan->conf_state);
|
||||||
|
|
||||||
l2cap_send_cmd(conn, chan->ident, L2CAP_CONN_REQ,
|
l2cap_send_cmd(conn, chan->ident, L2CAP_CONN_REQ,
|
||||||
sizeof(req), &req);
|
sizeof(req), &req);
|
||||||
|
@ -788,13 +787,13 @@ static void l2cap_conn_start(struct l2cap_conn *conn)
|
||||||
l2cap_send_cmd(conn, chan->ident, L2CAP_CONN_RSP,
|
l2cap_send_cmd(conn, chan->ident, L2CAP_CONN_RSP,
|
||||||
sizeof(rsp), &rsp);
|
sizeof(rsp), &rsp);
|
||||||
|
|
||||||
if (chan->conf_state & L2CAP_CONF_REQ_SENT ||
|
if (test_bit(CONF_REQ_SENT, &chan->conf_state) ||
|
||||||
rsp.result != L2CAP_CR_SUCCESS) {
|
rsp.result != L2CAP_CR_SUCCESS) {
|
||||||
bh_unlock_sock(sk);
|
bh_unlock_sock(sk);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
chan->conf_state |= L2CAP_CONF_REQ_SENT;
|
set_bit(CONF_REQ_SENT, &chan->conf_state);
|
||||||
l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ,
|
l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ,
|
||||||
l2cap_build_conf_req(chan, buf), buf);
|
l2cap_build_conf_req(chan, buf), buf);
|
||||||
chan->num_conf_req++;
|
chan->num_conf_req++;
|
||||||
|
@ -1917,7 +1916,7 @@ static int l2cap_build_conf_req(struct l2cap_chan *chan, void *data)
|
||||||
switch (chan->mode) {
|
switch (chan->mode) {
|
||||||
case L2CAP_MODE_STREAMING:
|
case L2CAP_MODE_STREAMING:
|
||||||
case L2CAP_MODE_ERTM:
|
case L2CAP_MODE_ERTM:
|
||||||
if (chan->conf_state & L2CAP_CONF_STATE2_DEVICE)
|
if (test_bit(CONF_STATE2_DEVICE, &chan->conf_state))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* fall through */
|
/* fall through */
|
||||||
|
@ -1964,7 +1963,7 @@ done:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (chan->fcs == L2CAP_FCS_NONE ||
|
if (chan->fcs == L2CAP_FCS_NONE ||
|
||||||
chan->conf_state & L2CAP_CONF_NO_FCS_RECV) {
|
test_bit(CONF_NO_FCS_RECV, &chan->conf_state)) {
|
||||||
chan->fcs = L2CAP_FCS_NONE;
|
chan->fcs = L2CAP_FCS_NONE;
|
||||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_FCS, 1, chan->fcs);
|
l2cap_add_conf_opt(&ptr, L2CAP_CONF_FCS, 1, chan->fcs);
|
||||||
}
|
}
|
||||||
|
@ -1987,7 +1986,7 @@ done:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (chan->fcs == L2CAP_FCS_NONE ||
|
if (chan->fcs == L2CAP_FCS_NONE ||
|
||||||
chan->conf_state & L2CAP_CONF_NO_FCS_RECV) {
|
test_bit(CONF_NO_FCS_RECV, &chan->conf_state)) {
|
||||||
chan->fcs = L2CAP_FCS_NONE;
|
chan->fcs = L2CAP_FCS_NONE;
|
||||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_FCS, 1, chan->fcs);
|
l2cap_add_conf_opt(&ptr, L2CAP_CONF_FCS, 1, chan->fcs);
|
||||||
}
|
}
|
||||||
|
@ -2039,7 +2038,7 @@ static int l2cap_parse_conf_req(struct l2cap_chan *chan, void *data)
|
||||||
|
|
||||||
case L2CAP_CONF_FCS:
|
case L2CAP_CONF_FCS:
|
||||||
if (val == L2CAP_FCS_NONE)
|
if (val == L2CAP_FCS_NONE)
|
||||||
chan->conf_state |= L2CAP_CONF_NO_FCS_RECV;
|
set_bit(CONF_NO_FCS_RECV, &chan->conf_state);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2059,7 +2058,7 @@ static int l2cap_parse_conf_req(struct l2cap_chan *chan, void *data)
|
||||||
switch (chan->mode) {
|
switch (chan->mode) {
|
||||||
case L2CAP_MODE_STREAMING:
|
case L2CAP_MODE_STREAMING:
|
||||||
case L2CAP_MODE_ERTM:
|
case L2CAP_MODE_ERTM:
|
||||||
if (!(chan->conf_state & L2CAP_CONF_STATE2_DEVICE)) {
|
if (!test_bit(CONF_STATE2_DEVICE, &chan->conf_state)) {
|
||||||
chan->mode = l2cap_select_mode(rfc.mode,
|
chan->mode = l2cap_select_mode(rfc.mode,
|
||||||
chan->conn->feat_mask);
|
chan->conn->feat_mask);
|
||||||
break;
|
break;
|
||||||
|
@ -2092,14 +2091,14 @@ done:
|
||||||
result = L2CAP_CONF_UNACCEPT;
|
result = L2CAP_CONF_UNACCEPT;
|
||||||
else {
|
else {
|
||||||
chan->omtu = mtu;
|
chan->omtu = mtu;
|
||||||
chan->conf_state |= L2CAP_CONF_MTU_DONE;
|
set_bit(CONF_MTU_DONE, &chan->conf_state);
|
||||||
}
|
}
|
||||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_MTU, 2, chan->omtu);
|
l2cap_add_conf_opt(&ptr, L2CAP_CONF_MTU, 2, chan->omtu);
|
||||||
|
|
||||||
switch (rfc.mode) {
|
switch (rfc.mode) {
|
||||||
case L2CAP_MODE_BASIC:
|
case L2CAP_MODE_BASIC:
|
||||||
chan->fcs = L2CAP_FCS_NONE;
|
chan->fcs = L2CAP_FCS_NONE;
|
||||||
chan->conf_state |= L2CAP_CONF_MODE_DONE;
|
set_bit(CONF_MODE_DONE, &chan->conf_state);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case L2CAP_MODE_ERTM:
|
case L2CAP_MODE_ERTM:
|
||||||
|
@ -2116,7 +2115,7 @@ done:
|
||||||
rfc.monitor_timeout =
|
rfc.monitor_timeout =
|
||||||
le16_to_cpu(L2CAP_DEFAULT_MONITOR_TO);
|
le16_to_cpu(L2CAP_DEFAULT_MONITOR_TO);
|
||||||
|
|
||||||
chan->conf_state |= L2CAP_CONF_MODE_DONE;
|
set_bit(CONF_MODE_DONE, &chan->conf_state);
|
||||||
|
|
||||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC,
|
l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC,
|
||||||
sizeof(rfc), (unsigned long) &rfc);
|
sizeof(rfc), (unsigned long) &rfc);
|
||||||
|
@ -2129,7 +2128,7 @@ done:
|
||||||
|
|
||||||
chan->remote_mps = le16_to_cpu(rfc.max_pdu_size);
|
chan->remote_mps = le16_to_cpu(rfc.max_pdu_size);
|
||||||
|
|
||||||
chan->conf_state |= L2CAP_CONF_MODE_DONE;
|
set_bit(CONF_MODE_DONE, &chan->conf_state);
|
||||||
|
|
||||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC,
|
l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC,
|
||||||
sizeof(rfc), (unsigned long) &rfc);
|
sizeof(rfc), (unsigned long) &rfc);
|
||||||
|
@ -2144,7 +2143,7 @@ done:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == L2CAP_CONF_SUCCESS)
|
if (result == L2CAP_CONF_SUCCESS)
|
||||||
chan->conf_state |= L2CAP_CONF_OUTPUT_DONE;
|
set_bit(CONF_OUTPUT_DONE, &chan->conf_state);
|
||||||
}
|
}
|
||||||
rsp->scid = cpu_to_le16(chan->dcid);
|
rsp->scid = cpu_to_le16(chan->dcid);
|
||||||
rsp->result = cpu_to_le16(result);
|
rsp->result = cpu_to_le16(result);
|
||||||
|
@ -2186,7 +2185,7 @@ static int l2cap_parse_conf_rsp(struct l2cap_chan *chan, void *rsp, int len, voi
|
||||||
if (olen == sizeof(rfc))
|
if (olen == sizeof(rfc))
|
||||||
memcpy(&rfc, (void *)val, olen);
|
memcpy(&rfc, (void *)val, olen);
|
||||||
|
|
||||||
if ((chan->conf_state & L2CAP_CONF_STATE2_DEVICE) &&
|
if (test_bit(CONF_STATE2_DEVICE, &chan->conf_state) &&
|
||||||
rfc.mode != chan->mode)
|
rfc.mode != chan->mode)
|
||||||
return -ECONNREFUSED;
|
return -ECONNREFUSED;
|
||||||
|
|
||||||
|
@ -2248,10 +2247,9 @@ void __l2cap_connect_rsp_defer(struct l2cap_chan *chan)
|
||||||
l2cap_send_cmd(conn, chan->ident,
|
l2cap_send_cmd(conn, chan->ident,
|
||||||
L2CAP_CONN_RSP, sizeof(rsp), &rsp);
|
L2CAP_CONN_RSP, sizeof(rsp), &rsp);
|
||||||
|
|
||||||
if (chan->conf_state & L2CAP_CONF_REQ_SENT)
|
if (test_and_set_bit(CONF_REQ_SENT, &chan->conf_state))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
chan->conf_state |= L2CAP_CONF_REQ_SENT;
|
|
||||||
l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ,
|
l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ,
|
||||||
l2cap_build_conf_req(chan, buf), buf);
|
l2cap_build_conf_req(chan, buf), buf);
|
||||||
chan->num_conf_req++;
|
chan->num_conf_req++;
|
||||||
|
@ -2433,10 +2431,10 @@ sendresp:
|
||||||
L2CAP_INFO_REQ, sizeof(info), &info);
|
L2CAP_INFO_REQ, sizeof(info), &info);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chan && !(chan->conf_state & L2CAP_CONF_REQ_SENT) &&
|
if (chan && !test_bit(CONF_REQ_SENT, &chan->conf_state) &&
|
||||||
result == L2CAP_CR_SUCCESS) {
|
result == L2CAP_CR_SUCCESS) {
|
||||||
u8 buf[128];
|
u8 buf[128];
|
||||||
chan->conf_state |= L2CAP_CONF_REQ_SENT;
|
set_bit(CONF_REQ_SENT, &chan->conf_state);
|
||||||
l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ,
|
l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ,
|
||||||
l2cap_build_conf_req(chan, buf), buf);
|
l2cap_build_conf_req(chan, buf), buf);
|
||||||
chan->num_conf_req++;
|
chan->num_conf_req++;
|
||||||
|
@ -2477,20 +2475,18 @@ static inline int l2cap_connect_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hd
|
||||||
l2cap_state_change(chan, BT_CONFIG);
|
l2cap_state_change(chan, BT_CONFIG);
|
||||||
chan->ident = 0;
|
chan->ident = 0;
|
||||||
chan->dcid = dcid;
|
chan->dcid = dcid;
|
||||||
chan->conf_state &= ~L2CAP_CONF_CONNECT_PEND;
|
clear_bit(CONF_CONNECT_PEND, &chan->conf_state);
|
||||||
|
|
||||||
if (chan->conf_state & L2CAP_CONF_REQ_SENT)
|
if (test_and_set_bit(CONF_REQ_SENT, &chan->conf_state))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
chan->conf_state |= L2CAP_CONF_REQ_SENT;
|
|
||||||
|
|
||||||
l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ,
|
l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ,
|
||||||
l2cap_build_conf_req(chan, req), req);
|
l2cap_build_conf_req(chan, req), req);
|
||||||
chan->num_conf_req++;
|
chan->num_conf_req++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case L2CAP_CR_PEND:
|
case L2CAP_CR_PEND:
|
||||||
chan->conf_state |= L2CAP_CONF_CONNECT_PEND;
|
set_bit(CONF_CONNECT_PEND, &chan->conf_state);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -2512,14 +2508,12 @@ static inline int l2cap_connect_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hd
|
||||||
|
|
||||||
static inline void set_default_fcs(struct l2cap_chan *chan)
|
static inline void set_default_fcs(struct l2cap_chan *chan)
|
||||||
{
|
{
|
||||||
struct l2cap_pinfo *pi = l2cap_pi(chan->sk);
|
|
||||||
|
|
||||||
/* FCS is enabled only in ERTM or streaming mode, if one or both
|
/* FCS is enabled only in ERTM or streaming mode, if one or both
|
||||||
* sides request it.
|
* sides request it.
|
||||||
*/
|
*/
|
||||||
if (chan->mode != L2CAP_MODE_ERTM && chan->mode != L2CAP_MODE_STREAMING)
|
if (chan->mode != L2CAP_MODE_ERTM && chan->mode != L2CAP_MODE_STREAMING)
|
||||||
chan->fcs = L2CAP_FCS_NONE;
|
chan->fcs = L2CAP_FCS_NONE;
|
||||||
else if (!(pi->chan->conf_state & L2CAP_CONF_NO_FCS_RECV))
|
else if (!test_bit(CONF_NO_FCS_RECV, &chan->conf_state))
|
||||||
chan->fcs = L2CAP_FCS_CRC16;
|
chan->fcs = L2CAP_FCS_CRC16;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2586,10 +2580,10 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr
|
||||||
/* Reset config buffer. */
|
/* Reset config buffer. */
|
||||||
chan->conf_len = 0;
|
chan->conf_len = 0;
|
||||||
|
|
||||||
if (!(chan->conf_state & L2CAP_CONF_OUTPUT_DONE))
|
if (!test_bit(CONF_OUTPUT_DONE, &chan->conf_state))
|
||||||
goto unlock;
|
goto unlock;
|
||||||
|
|
||||||
if (chan->conf_state & L2CAP_CONF_INPUT_DONE) {
|
if (test_bit(CONF_INPUT_DONE, &chan->conf_state)) {
|
||||||
set_default_fcs(chan);
|
set_default_fcs(chan);
|
||||||
|
|
||||||
l2cap_state_change(chan, BT_CONNECTED);
|
l2cap_state_change(chan, BT_CONNECTED);
|
||||||
|
@ -2604,9 +2598,8 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr
|
||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(chan->conf_state & L2CAP_CONF_REQ_SENT)) {
|
if (!test_and_set_bit(CONF_REQ_SENT, &chan->conf_state)) {
|
||||||
u8 buf[64];
|
u8 buf[64];
|
||||||
chan->conf_state |= L2CAP_CONF_REQ_SENT;
|
|
||||||
l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ,
|
l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ,
|
||||||
l2cap_build_conf_req(chan, buf), buf);
|
l2cap_build_conf_req(chan, buf), buf);
|
||||||
chan->num_conf_req++;
|
chan->num_conf_req++;
|
||||||
|
@ -2679,9 +2672,9 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr
|
||||||
if (flags & 0x01)
|
if (flags & 0x01)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
chan->conf_state |= L2CAP_CONF_INPUT_DONE;
|
set_bit(CONF_INPUT_DONE, &chan->conf_state);
|
||||||
|
|
||||||
if (chan->conf_state & L2CAP_CONF_OUTPUT_DONE) {
|
if (test_bit(CONF_OUTPUT_DONE, &chan->conf_state)) {
|
||||||
set_default_fcs(chan);
|
set_default_fcs(chan);
|
||||||
|
|
||||||
l2cap_state_change(chan, BT_CONNECTED);
|
l2cap_state_change(chan, BT_CONNECTED);
|
||||||
|
@ -4203,7 +4196,7 @@ static int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chan->conf_state & L2CAP_CONF_CONNECT_PEND) {
|
if (test_bit(CONF_CONNECT_PEND, &chan->conf_state)) {
|
||||||
bh_unlock_sock(sk);
|
bh_unlock_sock(sk);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -4222,7 +4215,7 @@ static int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
|
||||||
req.psm = chan->psm;
|
req.psm = chan->psm;
|
||||||
|
|
||||||
chan->ident = l2cap_get_ident(conn);
|
chan->ident = l2cap_get_ident(conn);
|
||||||
chan->conf_state |= L2CAP_CONF_CONNECT_PEND;
|
set_bit(CONF_CONNECT_PEND, &chan->conf_state);
|
||||||
|
|
||||||
l2cap_send_cmd(conn, chan->ident,
|
l2cap_send_cmd(conn, chan->ident,
|
||||||
L2CAP_CONN_REQ, sizeof(req), &req);
|
L2CAP_CONN_REQ, sizeof(req), &req);
|
||||||
|
|
|
@ -512,7 +512,7 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __us
|
||||||
chan->mode = opts.mode;
|
chan->mode = opts.mode;
|
||||||
switch (chan->mode) {
|
switch (chan->mode) {
|
||||||
case L2CAP_MODE_BASIC:
|
case L2CAP_MODE_BASIC:
|
||||||
chan->conf_state &= ~L2CAP_CONF_STATE2_DEVICE;
|
clear_bit(CONF_STATE2_DEVICE, &chan->conf_state);
|
||||||
break;
|
break;
|
||||||
case L2CAP_MODE_ERTM:
|
case L2CAP_MODE_ERTM:
|
||||||
case L2CAP_MODE_STREAMING:
|
case L2CAP_MODE_STREAMING:
|
||||||
|
@ -891,7 +891,7 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent)
|
||||||
chan->omtu = 0;
|
chan->omtu = 0;
|
||||||
if (!disable_ertm && sk->sk_type == SOCK_STREAM) {
|
if (!disable_ertm && sk->sk_type == SOCK_STREAM) {
|
||||||
chan->mode = L2CAP_MODE_ERTM;
|
chan->mode = L2CAP_MODE_ERTM;
|
||||||
chan->conf_state |= L2CAP_CONF_STATE2_DEVICE;
|
set_bit(CONF_STATE2_DEVICE, &chan->conf_state);
|
||||||
} else {
|
} else {
|
||||||
chan->mode = L2CAP_MODE_BASIC;
|
chan->mode = L2CAP_MODE_BASIC;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче