Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 314461
b: refs/heads/master
c: 97e8e89
h: refs/heads/master
i:
  314459: 3bca485
v: v3
  • Loading branch information
Andrei Emeltchenko authored and Johan Hedberg committed Jun 5, 2012
1 parent 18c0100 commit 7c35292
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 416fa7527d6bf658e5517ea36d2de9270be2c11e
refs/heads/master: 97e8e89d2d8185b7644c9941636d3682eedc517b
4 changes: 4 additions & 0 deletions trunk/include/net/bluetooth/a2mp.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#ifndef __A2MP_H
#define __A2MP_H

#include <net/bluetooth/l2cap.h>

#define A2MP_FEAT_EXT 0x8000

struct amp_mgr {
Expand Down Expand Up @@ -118,5 +120,7 @@ struct a2mp_physlink_rsp {

void amp_mgr_get(struct amp_mgr *mgr);
int amp_mgr_put(struct amp_mgr *mgr);
struct l2cap_chan *a2mp_channel_create(struct l2cap_conn *conn,
struct sk_buff *skb);

#endif /* __A2MP_H */
16 changes: 16 additions & 0 deletions trunk/net/bluetooth/a2mp.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,3 +569,19 @@ static struct amp_mgr *amp_mgr_create(struct l2cap_conn *conn)

return mgr;
}

struct l2cap_chan *a2mp_channel_create(struct l2cap_conn *conn,
struct sk_buff *skb)
{
struct amp_mgr *mgr;

mgr = amp_mgr_create(conn);
if (!mgr) {
BT_ERR("Could not create AMP manager");
return NULL;
}

BT_DBG("mgr: %p chan %p", mgr, mgr->a2mp_chan);

return mgr->a2mp_chan;
}
19 changes: 15 additions & 4 deletions trunk/net/bluetooth/l2cap_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <net/bluetooth/hci_core.h>
#include <net/bluetooth/l2cap.h>
#include <net/bluetooth/smp.h>
#include <net/bluetooth/a2mp.h>

bool disable_ertm;

Expand Down Expand Up @@ -5132,10 +5133,20 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk

chan = l2cap_get_chan_by_scid(conn, cid);
if (!chan) {
BT_DBG("unknown cid 0x%4.4x", cid);
/* Drop packet and return */
kfree_skb(skb);
return 0;
if (cid == L2CAP_CID_A2MP) {
chan = a2mp_channel_create(conn, skb);
if (!chan) {
kfree_skb(skb);
return 0;
}

l2cap_chan_lock(chan);
} else {
BT_DBG("unknown cid 0x%4.4x", cid);
/* Drop packet and return */
kfree_skb(skb);
return 0;
}
}

BT_DBG("chan %p, len %d", chan, skb->len);
Expand Down

0 comments on commit 7c35292

Please sign in to comment.