提交 2338a7e0 编写于 作者: J Johan Hedberg

Bluetooth: Rename L2CAP_CHAN_CONN_FIX_A2MP to L2CAP_CHAN_FIXED

There's no reason why A2MP should need or deserve its on channel type.
Instead we should be able to group all fixed CID users under a single
channel type and reuse as much code as possible for them. Where CID
specific exceptions are needed the chan-scid value can be used.

This patch renames the current A2MP channel type to a generic one and
thereby paves the way to allow converting ATT and SMP (and any future
fixed channel protocols) to use the new channel type.
Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
上级 03a0c5d6
...@@ -651,7 +651,7 @@ struct l2cap_user { ...@@ -651,7 +651,7 @@ struct l2cap_user {
#define L2CAP_CHAN_RAW 1 #define L2CAP_CHAN_RAW 1
#define L2CAP_CHAN_CONN_LESS 2 #define L2CAP_CHAN_CONN_LESS 2
#define L2CAP_CHAN_CONN_ORIENTED 3 #define L2CAP_CHAN_CONN_ORIENTED 3
#define L2CAP_CHAN_CONN_FIX_A2MP 4 #define L2CAP_CHAN_FIXED 4
/* ----- L2CAP socket info ----- */ /* ----- L2CAP socket info ----- */
#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) #define l2cap_pi(sk) ((struct l2cap_pinfo *) sk)
......
...@@ -235,7 +235,7 @@ static int a2mp_discover_rsp(struct amp_mgr *mgr, struct sk_buff *skb, ...@@ -235,7 +235,7 @@ static int a2mp_discover_rsp(struct amp_mgr *mgr, struct sk_buff *skb,
BT_DBG("chan %p state %s", chan, BT_DBG("chan %p state %s", chan,
state_to_string(chan->state)); state_to_string(chan->state));
if (chan->chan_type == L2CAP_CHAN_CONN_FIX_A2MP) if (chan->scid == L2CAP_CID_A2MP)
continue; continue;
l2cap_chan_lock(chan); l2cap_chan_lock(chan);
...@@ -726,7 +726,11 @@ static struct l2cap_chan *a2mp_chan_open(struct l2cap_conn *conn, bool locked) ...@@ -726,7 +726,11 @@ static struct l2cap_chan *a2mp_chan_open(struct l2cap_conn *conn, bool locked)
BT_DBG("chan %p", chan); BT_DBG("chan %p", chan);
chan->chan_type = L2CAP_CHAN_CONN_FIX_A2MP; chan->chan_type = L2CAP_CHAN_FIXED;
chan->scid = L2CAP_CID_A2MP;
chan->dcid = L2CAP_CID_A2MP;
chan->omtu = L2CAP_A2MP_DEFAULT_MTU;
chan->imtu = L2CAP_A2MP_DEFAULT_MTU;
chan->flush_to = L2CAP_DEFAULT_FLUSH_TO; chan->flush_to = L2CAP_DEFAULT_FLUSH_TO;
chan->ops = &a2mp_chan_ops; chan->ops = &a2mp_chan_ops;
......
...@@ -519,11 +519,8 @@ void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan) ...@@ -519,11 +519,8 @@ void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan)
chan->omtu = L2CAP_DEFAULT_MTU; chan->omtu = L2CAP_DEFAULT_MTU;
break; break;
case L2CAP_CHAN_CONN_FIX_A2MP: case L2CAP_CHAN_FIXED:
chan->scid = L2CAP_CID_A2MP; /* Caller will set CID and CID specific MTU values */
chan->dcid = L2CAP_CID_A2MP;
chan->omtu = L2CAP_A2MP_DEFAULT_MTU;
chan->imtu = L2CAP_A2MP_DEFAULT_MTU;
break; break;
default: default:
...@@ -571,7 +568,7 @@ void l2cap_chan_del(struct l2cap_chan *chan, int err) ...@@ -571,7 +568,7 @@ void l2cap_chan_del(struct l2cap_chan *chan, int err)
chan->conn = NULL; chan->conn = NULL;
if (chan->chan_type != L2CAP_CHAN_CONN_FIX_A2MP) if (chan->scid != L2CAP_CID_A2MP)
hci_conn_drop(conn->hcon); hci_conn_drop(conn->hcon);
if (mgr && mgr->bredr_chan == chan) if (mgr && mgr->bredr_chan == chan)
...@@ -1310,7 +1307,7 @@ static void l2cap_send_disconn_req(struct l2cap_chan *chan, int err) ...@@ -1310,7 +1307,7 @@ static void l2cap_send_disconn_req(struct l2cap_chan *chan, int err)
__clear_ack_timer(chan); __clear_ack_timer(chan);
} }
if (chan->chan_type == L2CAP_CHAN_CONN_FIX_A2MP) { if (chan->scid == L2CAP_CID_A2MP) {
l2cap_state_change(chan, BT_DISCONN); l2cap_state_change(chan, BT_DISCONN);
return; return;
} }
...@@ -1508,7 +1505,7 @@ static void l2cap_conn_ready(struct l2cap_conn *conn) ...@@ -1508,7 +1505,7 @@ static void l2cap_conn_ready(struct l2cap_conn *conn)
l2cap_chan_lock(chan); l2cap_chan_lock(chan);
if (chan->chan_type == L2CAP_CHAN_CONN_FIX_A2MP) { if (chan->scid == L2CAP_CID_A2MP) {
l2cap_chan_unlock(chan); l2cap_chan_unlock(chan);
continue; continue;
} }
...@@ -7245,7 +7242,7 @@ int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt) ...@@ -7245,7 +7242,7 @@ int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
BT_DBG("chan %p scid 0x%4.4x state %s", chan, chan->scid, BT_DBG("chan %p scid 0x%4.4x state %s", chan, chan->scid,
state_to_string(chan->state)); state_to_string(chan->state));
if (chan->chan_type == L2CAP_CHAN_CONN_FIX_A2MP) { if (chan->scid == L2CAP_CID_A2MP) {
l2cap_chan_unlock(chan); l2cap_chan_unlock(chan);
continue; continue;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册