public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Jui-Hao Chiang <windtracekimo@gmail.com>
To: bluez-devel@lists.sourceforge.net
Subject: Re: [Bluez-devel] [Patch] Flush Occurred Event
Date: Sat, 23 Aug 2008 21:13:13 +0000 (UTC)	[thread overview]
Message-ID: <loom.20080823T211230-83@post.gmane.org> (raw)
In-Reply-To: 1219522965.7591.482.camel@violet.holtmann.net

Hi, Marcel, please see if it is ok
Marcel Holtmann <marcel <at> holtmann.org> writes:

> 
> against 2.6.27-rc4 please and in unified diff format. I am not even
> going to bother reading context diffs.
> 
> Regards
> 
> Marcel

diff -ru orig/include/net/bluetooth/hci.h new/include/net/bluetooth/hci.h
--- orig/include/net/bluetooth/hci.h	2008-08-23 11:42:08.000000000 -0400
+++ new/include/net/bluetooth/hci.h	2008-08-23 11:44:22.000000000 -0400
@@ -682,6 +682,12 @@
 	__le16   opcode;
 } __attribute__ ((packed));
 
+#define HCI_EV_FLUSH_OCCURRED   0x11
+#define NUM_OF_FLUSH_PKT        0x1
+struct hci_ev_flush_occurred {
+        __le16   handle;
+} __attribute__ ((packed));
+
 #define HCI_EV_ROLE_CHANGE		0x12
 struct hci_ev_role_change {
 	__u8     status;
diff -ru orig/net/bluetooth/hci_event.c new/net/bluetooth/hci_event.c
--- orig/net/bluetooth/hci_event.c	2008-08-23 11:42:12.000000000 -0400
+++ new/net/bluetooth/hci_event.c	2008-08-23 11:50:36.000000000 -0400
@@ -1398,6 +1398,32 @@
 	hci_dev_unlock(hdev);
 }
 
+static inline void hci_flush_occurred_evt(struct hci_dev *hdev, struct sk_buff
*skb)
+{
+	struct hci_ev_flush_occurred *ev = (struct hci_ev_flush_occurred *) skb->data;
+	struct hci_conn *conn;
+	
+	tasklet_disable(&hdev->tx_task);
+
+	BT_DBG("handle is %x, skb->len %d\n", ev->handle, skb->len);	
+
+	conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle));
+
+	if (conn) {
+		atomic_sub(NUM_OF_FLUSH_PKT, &conn->sent);
+
+		if (conn->type == ACL_LINK) {
+			if ((hdev->acl_cnt += NUM_OF_FLUSH_PKT) > hdev->acl_pkts)
+				hdev->acl_cnt = hdev->acl_pkts;
+		}
+		BT_DBG("conn %p type %d hdev->acl_cnt %d conn->sent %d",
+			conn, conn->type, hdev->acl_cnt, atomic_read(&conn->sent));
+	}
+	hci_sched_tx(hdev);
+
+	tasklet_enable(&hdev->tx_task);
+}
+
 static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *skb)
 {
 	struct hci_ev_num_comp_pkts *ev = (void *) skb->data;
@@ -1894,6 +1920,10 @@
 		hci_remote_host_features_evt(hdev, skb);
 		break;
 
+	case HCI_EV_FLUSH_OCCURRED:
+		hci_flush_occurred_evt(hdev, skb);
+		break;	
+
 	default:
 		BT_DBG("%s event 0x%x", hdev->name, event);
 		break;


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

      reply	other threads:[~2008-08-23 21:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-22  2:41 [Bluez-devel] Problem automatic flush timeout Jui-Hao Chiang
2008-08-22 14:03 ` Jui-Hao Chiang
2008-08-23 19:33 ` [Bluez-devel] [Patch] Flush Occurred Event Jui-Hao Chiang
2008-08-23 20:22   ` Marcel Holtmann
2008-08-23 21:13     ` Jui-Hao Chiang [this message]

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=loom.20080823T211230-83@post.gmane.org \
    --to=windtracekimo@gmail.com \
    --cc=bluez-devel@lists.sourceforge.net \
    /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