All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 0/5 v2] prioritizing data over HCI
@ 2011-08-17 13:22 Luiz Augusto von Dentz
  2011-08-17 13:23 ` [RFC 1/5 v2] Bluetooth: make use of connection number to optimize the scheduler Luiz Augusto von Dentz
                   ` (4 more replies)
  0 siblings, 5 replies; 23+ messages in thread
From: Luiz Augusto von Dentz @ 2011-08-17 13:22 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This incorporate some suggestions like removal of fixed amount of queues in
favor of one per L2CAP channel using HCI Channel abstraction (hci_chan) so
packet order is maintained, SCO/ESCO packets are no longer affected and
some other minor things like promoting starving channels directly to
maximum possible priority (6).

Priorities are unchanged, so anything bigger than 6 requires extra
capabilities and are meant for guaranteed channels or time critical packets
e.g. RFCOMM commands.

In addition to that I decide to maintain the queue per hci_conn so hci_chan
is only created when L2CAP connection completes.

Luiz Augusto von Dentz (5):
  Bluetooth: make use of connection number to optimize the scheduler
  Bluetooth: set skbuffer priority based on L2CAP socket priority
  Bluetooth: make use sk_priority to priritize RFCOMM packets
  Bluetooth: prioritizing data over HCI
  Bluetooth: recalculate priorities when channels are starving

 include/net/bluetooth/hci_core.h |   61 +++++++++
 include/net/bluetooth/l2cap.h    |    4 +-
 net/bluetooth/hci_conn.c         |   59 +++++++++
 net/bluetooth/hci_core.c         |  256 +++++++++++++++++++++++++++++++++++---
 net/bluetooth/l2cap_core.c       |   52 ++++++--
 net/bluetooth/l2cap_sock.c       |    2 +-
 net/bluetooth/rfcomm/core.c      |   51 +++++---
 net/bluetooth/rfcomm/sock.c      |    2 +
 8 files changed, 437 insertions(+), 50 deletions(-)

-- 
1.7.6


^ permalink raw reply	[flat|nested] 23+ messages in thread
* [RFC 1/5 v3] Bluetooth: set skbuffer priority based on L2CAP socket priority
@ 2011-09-12 17:00 Luiz Augusto von Dentz
  2011-09-12 17:00 ` [RFC 3/5 v2] Bluetooth: make use sk_priority to priritize RFCOMM packets Luiz Augusto von Dentz
  0 siblings, 1 reply; 23+ messages in thread
From: Luiz Augusto von Dentz @ 2011-09-12 17:00 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This uses SO_PRIORITY to set the skbuffer priority field

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
 include/net/bluetooth/hci_core.h |    3 +++
 include/net/bluetooth/l2cap.h    |    3 ++-
 net/bluetooth/l2cap_core.c       |   27 ++++++++++++++++++++-------
 net/bluetooth/l2cap_sock.c       |    2 +-
 4 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index e2ba4d6..0742828 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -32,6 +32,9 @@
 #define HCI_PROTO_L2CAP	0
 #define HCI_PROTO_SCO	1
 
+/* HCI priority */
+#define HCI_PRIO_MAX	7
+
 /* HCI Core structures */
 struct inquiry_data {
 	bdaddr_t	bdaddr;
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 4f34ad2..f018e5d 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -511,7 +511,8 @@ struct l2cap_chan *l2cap_chan_create(struct sock *sk);
 void l2cap_chan_close(struct l2cap_chan *chan, int reason);
 void l2cap_chan_destroy(struct l2cap_chan *chan);
 int l2cap_chan_connect(struct l2cap_chan *chan);
-int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len);
+int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len,
+								u32 priority);
 void l2cap_chan_busy(struct l2cap_chan *chan, int busy);
 
 #endif /* __L2CAP_H */
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index b3bdb48..0b6e1ae 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -556,6 +556,7 @@ static void l2cap_send_cmd(struct l2cap_conn *conn, u8 ident, u8 code, u16 len,
 		flags = ACL_START;
 
 	bt_cb(skb)->force_active = BT_POWER_FORCE_ACTIVE_ON;
+	skb->priority = HCI_PRIO_MAX;
 
 	hci_send_acl(conn->hcon, skb, flags);
 }
@@ -1245,7 +1246,8 @@ void l2cap_do_send(struct l2cap_chan *chan, struct sk_buff *skb)
 	struct hci_conn *hcon = chan->conn->hcon;
 	u16 flags;
 
-	BT_DBG("chan %p, skb %p len %d", chan, skb, skb->len);
+	BT_DBG("chan %p, skb %p len %d priority %u", chan, skb, skb->len,
+							skb->priority);
 
 	if (!chan->flushable && lmp_no_flush_capable(hcon->hdev))
 		flags = ACL_START_NO_FLUSH;
@@ -1451,6 +1453,8 @@ static inline int l2cap_skbuff_fromiovec(struct sock *sk, struct msghdr *msg, in
 		if (memcpy_fromiovec(skb_put(*frag, count), msg->msg_iov, count))
 			return -EFAULT;
 
+		(*frag)->priority = skb->priority;
+
 		sent += count;
 		len  -= count;
 
@@ -1460,7 +1464,9 @@ static inline int l2cap_skbuff_fromiovec(struct sock *sk, struct msghdr *msg, in
 	return sent;
 }
 
-struct sk_buff *l2cap_create_connless_pdu(struct l2cap_chan *chan, struct msghdr *msg, size_t len)
+static struct sk_buff *l2cap_create_connless_pdu(struct l2cap_chan *chan,
+						struct msghdr *msg, size_t len,
+						u32 priority)
 {
 	struct sock *sk = chan->sk;
 	struct l2cap_conn *conn = chan->conn;
@@ -1468,7 +1474,7 @@ struct sk_buff *l2cap_create_connless_pdu(struct l2cap_chan *chan, struct msghdr
 	int err, count, hlen = L2CAP_HDR_SIZE + 2;
 	struct l2cap_hdr *lh;
 
-	BT_DBG("sk %p len %d", sk, (int)len);
+	BT_DBG("sk %p len %d priority %u", sk, (int)len, priority);
 
 	count = min_t(unsigned int, (conn->mtu - hlen), len);
 	skb = bt_skb_send_alloc(sk, count + hlen,
@@ -1476,6 +1482,8 @@ struct sk_buff *l2cap_create_connless_pdu(struct l2cap_chan *chan, struct msghdr
 	if (!skb)
 		return ERR_PTR(err);
 
+	skb->priority = priority;
+
 	/* Create L2CAP header */
 	lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE);
 	lh->cid = cpu_to_le16(chan->dcid);
@@ -1490,7 +1498,9 @@ struct sk_buff *l2cap_create_connless_pdu(struct l2cap_chan *chan, struct msghdr
 	return skb;
 }
 
-struct sk_buff *l2cap_create_basic_pdu(struct l2cap_chan *chan, struct msghdr *msg, size_t len)
+static struct sk_buff *l2cap_create_basic_pdu(struct l2cap_chan *chan,
+						struct msghdr *msg, size_t len,
+						u32 priority)
 {
 	struct sock *sk = chan->sk;
 	struct l2cap_conn *conn = chan->conn;
@@ -1506,6 +1516,8 @@ struct sk_buff *l2cap_create_basic_pdu(struct l2cap_chan *chan, struct msghdr *m
 	if (!skb)
 		return ERR_PTR(err);
 
+	skb->priority = priority;
+
 	/* Create L2CAP header */
 	lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE);
 	lh->cid = cpu_to_le16(chan->dcid);
@@ -1610,7 +1622,8 @@ int l2cap_sar_segment_sdu(struct l2cap_chan *chan, struct msghdr *msg, size_t le
 	return size;
 }
 
-int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len)
+int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len,
+								u32 priority)
 {
 	struct sk_buff *skb;
 	u16 control;
@@ -1618,7 +1631,7 @@ int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len)
 
 	/* Connectionless channel */
 	if (chan->chan_type == L2CAP_CHAN_CONN_LESS) {
-		skb = l2cap_create_connless_pdu(chan, msg, len);
+		skb = l2cap_create_connless_pdu(chan, msg, len, priority);
 		if (IS_ERR(skb))
 			return PTR_ERR(skb);
 
@@ -1633,7 +1646,7 @@ int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len)
 			return -EMSGSIZE;
 
 		/* Create a basic PDU */
-		skb = l2cap_create_basic_pdu(chan, msg, len);
+		skb = l2cap_create_basic_pdu(chan, msg, len, priority);
 		if (IS_ERR(skb))
 			return PTR_ERR(skb);
 
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 61f1f62..7fb0404 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -706,7 +706,7 @@ static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct ms
 		return -ENOTCONN;
 	}
 
-	err = l2cap_chan_send(chan, msg, len);
+	err = l2cap_chan_send(chan, msg, len, sk->sk_priority);
 
 	release_sock(sk);
 	return err;
-- 
1.7.6.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2011-09-21 11:20 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-17 13:22 [RFC 0/5 v2] prioritizing data over HCI Luiz Augusto von Dentz
2011-08-17 13:23 ` [RFC 1/5 v2] Bluetooth: make use of connection number to optimize the scheduler Luiz Augusto von Dentz
2011-08-24 20:16   ` Gustavo Padovan
2011-08-17 13:23 ` [RFC 2/5 v2] Bluetooth: set skbuffer priority based on L2CAP socket priority Luiz Augusto von Dentz
2011-08-24 19:37   ` Gustavo Padovan
2011-08-24 21:27     ` Luiz Augusto von Dentz
2011-08-25  0:18       ` Gustavo Padovan
2011-08-17 13:23 ` [RFC 3/5 v2] Bluetooth: make use sk_priority to priritize RFCOMM packets Luiz Augusto von Dentz
2011-08-17 13:23 ` [RFC 4/5 v2] Bluetooth: prioritizing data over HCI Luiz Augusto von Dentz
2011-08-24 20:04   ` Gustavo Padovan
2011-08-24 21:53     ` Luiz Augusto von Dentz
2011-08-25  0:26       ` Gustavo Padovan
2011-08-17 13:23 ` [RFC 5/5 v2] Bluetooth: recalculate priorities when channels are starving Luiz Augusto von Dentz
2011-09-12 17:00 [RFC 1/5 v3] Bluetooth: set skbuffer priority based on L2CAP socket priority Luiz Augusto von Dentz
2011-09-12 17:00 ` [RFC 3/5 v2] Bluetooth: make use sk_priority to priritize RFCOMM packets Luiz Augusto von Dentz
2011-09-19 21:45   ` Gustavo Padovan
2011-09-20  9:10     ` Luiz Augusto von Dentz
2011-09-20 13:04     ` Marcel Holtmann
2011-09-20 13:46       ` tim.howes
2011-09-20 14:34       ` Luiz Augusto von Dentz
2011-09-20 15:11         ` Marcel Holtmann
2011-09-20 16:06           ` Luiz Augusto von Dentz
2011-09-20 16:59             ` Gustavo Padovan
2011-09-21 11:20               ` Luiz Augusto von Dentz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.