Linux bluetooth development
 help / color / mirror / Atom feed
From: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
To: linux-bluetooth@vger.kernel.org
Cc: Ville Tervo <ville.tervo@nokia.com>
Subject: [bluetooth-next -v2 08/24] Bluetooth: Treat LE and ACL links separately on timeout
Date: Thu, 10 Feb 2011 22:38:53 -0300	[thread overview]
Message-ID: <1297388349-14878-9-git-send-email-vinicius.gomes@openbossa.org> (raw)
In-Reply-To: <1297388349-14878-8-git-send-email-vinicius.gomes@openbossa.org>

From: Ville Tervo <ville.tervo@nokia.com>

Separate LE and ACL timeouts. Othervise ACL connections
on non LE hw will time out after 45 secs.

Signed-off-by: Ville Tervo <ville.tervo@nokia.com>
---
 net/bluetooth/hci_core.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 9296053..173bebd 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1711,19 +1711,19 @@ static inline struct hci_conn *hci_low_sent(struct hci_dev *hdev, __u8 type, int
 	return conn;
 }
 
-static inline void hci_acl_tx_to(struct hci_dev *hdev)
+static inline void hci_link_tx_to(struct hci_dev *hdev, __u8 type)
 {
 	struct hci_conn_hash *h = &hdev->conn_hash;
 	struct list_head *p;
 	struct hci_conn  *c;
 
-	BT_ERR("%s ACL tx timeout", hdev->name);
+	BT_ERR("%s link tx timeout", hdev->name);
 
 	/* Kill stalled connections */
 	list_for_each(p, &h->list) {
 		c = list_entry(p, struct hci_conn, list);
-		if (c->type == ACL_LINK && c->sent) {
-			BT_ERR("%s killing stalled ACL connection %s",
+		if (c->type == type && c->sent) {
+			BT_ERR("%s killing stalled connection %s",
 				hdev->name, batostr(&c->dst));
 			hci_acl_disconn(c, 0x13);
 		}
@@ -1742,7 +1742,7 @@ static inline void hci_sched_acl(struct hci_dev *hdev)
 		/* ACL tx timeout must be longer than maximum
 		 * link supervision timeout (40.9 seconds) */
 		if (!hdev->acl_cnt && time_after(jiffies, hdev->acl_last_tx + HZ * 45))
-			hci_acl_tx_to(hdev);
+			hci_link_tx_to(hdev, ACL_LINK);
 	}
 
 	while (hdev->acl_cnt && (conn = hci_low_sent(hdev, ACL_LINK, &quote))) {
@@ -1812,9 +1812,9 @@ static inline void hci_sched_le(struct hci_dev *hdev)
 	if (!test_bit(HCI_RAW, &hdev->flags)) {
 		/* LE tx timeout must be longer than maximum
 		 * link supervision timeout (40.9 seconds) */
-		if (!hdev->le_cnt &&
+		if (!hdev->le_cnt && hdev->le_pkts &&
 				time_after(jiffies, hdev->le_last_tx + HZ * 45))
-			hci_acl_tx_to(hdev);
+			hci_link_tx_to(hdev, LE_LINK);
 	}
 
 	cnt = hdev->le_pkts ? hdev->le_cnt : hdev->acl_cnt;
-- 
1.7.4


  reply	other threads:[~2011-02-11  1:38 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-11  1:38 [bluetooth-next -v2 00/24] Just Works SMP implementation Vinicius Costa Gomes
2011-02-11  1:38 ` [bluetooth-next -v2 01/24] Bluetooth: Add low energy commands and events Vinicius Costa Gomes
2011-02-11  1:38   ` [bluetooth-next -v2 02/24] Bluetooth: Add LE connect support Vinicius Costa Gomes
2011-02-11  1:38     ` [bluetooth-next -v2 03/24] Bluetooth: Use LE buffers for LE traffic Vinicius Costa Gomes
2011-02-11  1:38       ` [bluetooth-next -v2 04/24] Bluetooth: Add LE connection support to L2CAP Vinicius Costa Gomes
2011-02-11  1:38         ` [bluetooth-next -v2 05/24] Bluetooth: Add server socket support for LE connection Vinicius Costa Gomes
2011-02-11  1:38           ` [bluetooth-next -v2 06/24] Bluetooth: Do not send disconn comand over LE links Vinicius Costa Gomes
2011-02-11  1:38             ` [bluetooth-next -v2 07/24] Bluetooth: Fix initiated LE connections Vinicius Costa Gomes
2011-02-11  1:38               ` Vinicius Costa Gomes [this message]
2011-02-11  1:38                 ` [bluetooth-next -v2 09/24] Bluetooth: Add SMP command structures Vinicius Costa Gomes
2011-02-11  1:38                   ` [bluetooth-next -v2 10/24] Bluetooth: Implement the first SMP commands Vinicius Costa Gomes
2011-02-11  1:38                     ` [bluetooth-next -v2 11/24] Bluetooth: Start SMP procedure Vinicius Costa Gomes
2011-02-11  1:38                       ` [bluetooth-next -v2 12/24] Bluetooth: simple SMP pairing negotiation Vinicius Costa Gomes
2011-02-11  1:38                         ` [bluetooth-next -v2 13/24] Bluetooth: LE SMP Cryptoolbox functions Vinicius Costa Gomes
2011-02-11  1:38                           ` [bluetooth-next -v2 14/24] Bluetooth: Add support for using the crypto subsystem Vinicius Costa Gomes
2011-02-11  1:39                             ` [bluetooth-next -v2 15/24] Bluetooth: Add SMP confirmation structs Vinicius Costa Gomes
2011-02-11  1:39                               ` [bluetooth-next -v2 16/24] Bluetooth: Add SMP confirmation checks methods Vinicius Costa Gomes
2011-02-11  1:39                                 ` [bluetooth-next -v2 17/24] Bluetooth: Minor fix in SMP methods Vinicius Costa Gomes
2011-02-11  1:39                                   ` [bluetooth-next -v2 18/24] Bluetooth: Add support for LE Start Encryption Vinicius Costa Gomes
2011-02-11  1:39                                     ` [bluetooth-next -v2 19/24] Bluetooth: Add support for resuming socket when SMP is finished Vinicius Costa Gomes
2011-02-11  1:39                                       ` [bluetooth-next -v2 20/24] Bluetooth: Fix initial security level of LE links Vinicius Costa Gomes
2011-02-11  1:46                                       ` [bluetooth-next -v2 21/24] Bluetooth: Update the security level when link is encrypted Vinicius Costa Gomes
2011-02-11  1:46                                         ` [bluetooth-next -v2 22/24] Bluetooth: Add support for Pairing features exchange Vinicius Costa Gomes
2011-02-11  1:46                                           ` [bluetooth-next -v2 23/24] Bluetooth: Add support for SMP timeout Vinicius Costa Gomes
2011-02-11  1:46                                             ` [bluetooth-next -v2 24/24] Bluetooth: Add key size checks for SMP Vinicius Costa Gomes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1297388349-14878-9-git-send-email-vinicius.gomes@openbossa.org \
    --to=vinicius.gomes@openbossa.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=ville.tervo@nokia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox