* [PATCH 1/3] Bluetooth: Add L2CAP channel to skb private data
@ 2013-10-21 20:22 Gustavo Padovan
2013-10-21 20:22 ` [PATCH 2/3] Bluetooth: Use bt_cb(skb)->chan to send raw data back Gustavo Padovan
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Gustavo Padovan @ 2013-10-21 20:22 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Gustavo Padovan
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Adding the channel to the skb private data makes possible to us know which
channel the skb we have came from.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk
---
include/net/bluetooth/bluetooth.h | 1 +
net/bluetooth/l2cap_sock.c | 2 ++
2 files changed, 3 insertions(+)
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index bf2ddff..a707a02 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -282,6 +282,7 @@ struct bt_skb_cb {
__u8 incoming;
__u16 expect;
__u8 force_active;
+ struct l2cap_chan *chan;
struct l2cap_ctrl control;
struct hci_req_ctrl req;
bdaddr_t bdaddr;
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index a159b0e..cba3162 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -1174,6 +1174,8 @@ static struct sk_buff *l2cap_sock_alloc_skb_cb(struct l2cap_chan *chan,
if (!skb)
return ERR_PTR(err);
+ bt_cb(skb)->chan = chan;
+
return skb;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/3] Bluetooth: Use bt_cb(skb)->chan to send raw data back
2013-10-21 20:22 [PATCH 1/3] Bluetooth: Add L2CAP channel to skb private data Gustavo Padovan
@ 2013-10-21 20:22 ` Gustavo Padovan
2013-10-21 20:22 ` [PATCH 3/3] Bluetooth: Remove sk member from struct l2cap_chan Gustavo Padovan
2013-10-21 20:53 ` [PATCH 1/3] Bluetooth: Add L2CAP channel to skb private data Marcel Holtmann
2 siblings, 0 replies; 4+ messages in thread
From: Gustavo Padovan @ 2013-10-21 20:22 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Gustavo Padovan
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Instead of accessing skb->sk in L2CAP core we now compare the channel
a skb belongs to and not send it back if the channel is same. This change
removes another struct socket usage from L2CAP core.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
net/bluetooth/l2cap_core.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index bb6d35e..0cef677 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -2813,17 +2813,16 @@ static void l2cap_raw_recv(struct l2cap_conn *conn, struct sk_buff *skb)
mutex_lock(&conn->chan_lock);
list_for_each_entry(chan, &conn->chan_l, list) {
- struct sock *sk = chan->sk;
if (chan->chan_type != L2CAP_CHAN_RAW)
continue;
- /* Don't send frame to the socket it came from */
- if (skb->sk == sk)
+ /* Don't send frame to the channel it came from */
+ if (bt_cb(skb)->chan == chan)
continue;
+
nskb = skb_clone(skb, GFP_KERNEL);
if (!nskb)
continue;
-
if (chan->ops->recv(chan, nskb))
kfree_skb(nskb);
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 3/3] Bluetooth: Remove sk member from struct l2cap_chan
2013-10-21 20:22 [PATCH 1/3] Bluetooth: Add L2CAP channel to skb private data Gustavo Padovan
2013-10-21 20:22 ` [PATCH 2/3] Bluetooth: Use bt_cb(skb)->chan to send raw data back Gustavo Padovan
@ 2013-10-21 20:22 ` Gustavo Padovan
2013-10-21 20:53 ` [PATCH 1/3] Bluetooth: Add L2CAP channel to skb private data Marcel Holtmann
2 siblings, 0 replies; 4+ messages in thread
From: Gustavo Padovan @ 2013-10-21 20:22 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Gustavo Padovan
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
There is no access to chan->sk in L2CAP core now. This change marks the
end of the task of splitting L2CAP between Core and Socket, thus sk is now
gone from struct l2cap_chan.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
include/net/bluetooth/l2cap.h | 2 --
net/bluetooth/l2cap_sock.c | 2 --
2 files changed, 4 deletions(-)
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 3d922b9..5132990 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -435,8 +435,6 @@ struct l2cap_seq_list {
#define L2CAP_SEQ_LIST_TAIL 0x8000
struct l2cap_chan {
- struct sock *sk;
-
struct l2cap_conn *conn;
struct hci_conn *hs_hcon;
struct hci_chan *hs_hchan;
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index cba3162..7cc24d2 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -1374,8 +1374,6 @@ static struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock,
l2cap_chan_hold(chan);
- chan->sk = sk;
-
l2cap_pi(sk)->chan = chan;
return sk;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 1/3] Bluetooth: Add L2CAP channel to skb private data
2013-10-21 20:22 [PATCH 1/3] Bluetooth: Add L2CAP channel to skb private data Gustavo Padovan
2013-10-21 20:22 ` [PATCH 2/3] Bluetooth: Use bt_cb(skb)->chan to send raw data back Gustavo Padovan
2013-10-21 20:22 ` [PATCH 3/3] Bluetooth: Remove sk member from struct l2cap_chan Gustavo Padovan
@ 2013-10-21 20:53 ` Marcel Holtmann
2 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2013-10-21 20:53 UTC (permalink / raw)
To: Gustavo Padovan; +Cc: linux-bluetooth, Gustavo Padovan
Hi Gustavo,
> Adding the channel to the skb private data makes possible to us know which
> channel the skb we have came from.
>
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk
> ---
> include/net/bluetooth/bluetooth.h | 1 +
> net/bluetooth/l2cap_sock.c | 2 ++
> 2 files changed, 3 insertions(+)
all 3 patches have been applied bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-10-21 20:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-21 20:22 [PATCH 1/3] Bluetooth: Add L2CAP channel to skb private data Gustavo Padovan
2013-10-21 20:22 ` [PATCH 2/3] Bluetooth: Use bt_cb(skb)->chan to send raw data back Gustavo Padovan
2013-10-21 20:22 ` [PATCH 3/3] Bluetooth: Remove sk member from struct l2cap_chan Gustavo Padovan
2013-10-21 20:53 ` [PATCH 1/3] Bluetooth: Add L2CAP channel to skb private data Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox