summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authordsainty <dsainty@NetBSD.org>2004-01-04 05:47:43 +0000
committerdsainty <dsainty@NetBSD.org>2004-01-04 05:47:43 +0000
commit232d10895360b095791552dc88aff68057d2a03b (patch)
treee1d283d7f2615720d682eac65cc60e139d6ec5c3 /sys/dev
parentea1feca1de15858d9483f026d99eefc577fe0a1e (diff)
Kill the flow control interface. Bluetooth devices are not equipped to deal
with flow control being applied. It is simpler and no more problematic to accept the data and drop it if we hit a resource limit than to expect the Bluetooth device to do anything about it (which it won't).
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/bluetooth/bluetooth.h41
-rw-r--r--sys/dev/usb/ubt.c44
2 files changed, 24 insertions, 61 deletions
diff --git a/sys/dev/bluetooth/bluetooth.h b/sys/dev/bluetooth/bluetooth.h
index d1915a2a18c..330cad05a1a 100644
--- a/sys/dev/bluetooth/bluetooth.h
+++ b/sys/dev/bluetooth/bluetooth.h
@@ -1,4 +1,4 @@
-/* $NetBSD: bluetooth.h,v 1.4 2003/07/08 10:06:29 itojun Exp $ */
+/* $NetBSD: bluetooth.h,v 1.5 2004/01/04 05:47:43 dsainty Exp $ */
/*
* Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@@ -42,9 +42,24 @@ struct btframe_buffer;
struct btframe_channel {
/*
* Allocate and transmit a buffer for transmission to
- * Bluetooth device
+ * Bluetooth device.
+ */
+
+ /*
+ * bt_alloc() allocates a buffer suitable for passing to
+ * bt_send() on this channel. The required buffer size should
+ * be passed in, and the method returns a pointer to the
+ * buffer space, and a handle for the buffer to be passed to
+ * bt_send(). Returns NULL on error (invalid size, or
+ * allocation error).
*/
u_int8_t* (*bt_alloc)(void*, size_t, struct btframe_buffer **);
+
+ /*
+ * bt_send() sends the data stored in the given buffer with
+ * the given size. Returns zero on success, or a standard
+ * error number on failure.
+ */
int (*bt_send)(void*, struct btframe_buffer *, size_t);
};
@@ -57,25 +72,8 @@ struct btframe_methods {
struct btframe_channel bt_acldata;
struct btframe_channel bt_scodata;
+ /* Raise SPL to a level that will prevent callbacks */
int (*bt_splraise)(void);
-
- /*
- * Attempt to activate flow control. The driver MAY be able
- * to block certain events, but it isn't guaranteed, and even
- * blocked events may still be delivered if one was in
- * progress at the time.
- *
- *
- * In addition, it is possible for an error to occur
- * unblocking an event.
- *
- * Returns bit map of post-operation blocked/unblocked events.
- */
-#define BT_CBBLOCK_EVENT 1
-#define BT_CBBLOCK_ACL_DATA 2
-#define BT_CBBLOCK_SCO_DATA 4
- unsigned int (*bt_blockcb)(void *, unsigned int);
- unsigned int (*bt_unblockcb)(void *, unsigned int);
};
struct btframe_callback_methods {
@@ -93,9 +91,6 @@ struct bt_attach_args {
int bt_print(void *aux, const char *pnp);
-#define splbt spltty
-#define IPL_BT IPL_TTY
-
#define BTGETW(x) (((u_int8_t const*)(x))[0] | ((u_int8_t const*)(x))[1] << 8)
/* HCI interface constants */
diff --git a/sys/dev/usb/ubt.c b/sys/dev/usb/ubt.c
index b520da0bdc7..e0e1c95370b 100644
--- a/sys/dev/usb/ubt.c
+++ b/sys/dev/usb/ubt.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ubt.c,v 1.9 2004/01/02 02:36:25 dsainty Exp $ */
+/* $NetBSD: ubt.c,v 1.10 2004/01/04 05:47:43 dsainty Exp $ */
/*
* Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ubt.c,v 1.9 2004/01/02 02:36:25 dsainty Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubt.c,v 1.10 2004/01/04 05:47:43 dsainty Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -107,8 +107,6 @@ struct ubt_softc {
struct device *sc_child;
struct btframe_callback_methods const *sc_cb;
- unsigned int sc_blocked;
-
int sc_refcnt;
char sc_dying;
};
@@ -126,8 +124,6 @@ static u_int8_t* ubt_alloc_scodata(void*, size_t, struct btframe_buffer**);
static int ubt_send_scodata(void*, struct btframe_buffer*, size_t);
static int ubt_splraise(void);
-static unsigned int ubt_blockcb(void *h, unsigned int cbblocks);
-static unsigned int ubt_unblockcb(void *h, unsigned int cbblocks);
static void ubt_event_cb(usbd_xfer_handle, usbd_private_handle, usbd_status);
static void ubt_aclrd_cb(usbd_xfer_handle, usbd_private_handle, usbd_status);
@@ -138,7 +134,7 @@ static struct btframe_methods const ubt_methods = {
{ubt_alloc_control, ubt_send_control},
{ubt_alloc_acldata, ubt_send_acldata},
{ubt_alloc_scodata, ubt_send_scodata},
- ubt_splraise, ubt_blockcb, ubt_unblockcb
+ ubt_splraise
};
USB_DECLARE_DRIVER(ubt);
@@ -651,7 +647,7 @@ ubt_aclrd_request(struct ubt_softc *sc)
usbd_errstr(status)));
sc->sc_aclrd_running = 0;
- sc->sc_blocked |= BT_CBBLOCK_ACL_DATA;
+ /* XXX now what!? */
}
static void
@@ -674,37 +670,9 @@ ubt_aclrd_cb(usbd_xfer_handle xfer, usbd_private_handle h, usbd_status status)
sc->sc_cb->bt_recvacldata(sc->sc_child, buf, (size_t)size);
- /* Re-issue the request if not blocked */
- if (!sc->sc_dying && !(sc->sc_blocked & BT_CBBLOCK_ACL_DATA))
- ubt_aclrd_request(sc);
-}
-
-static unsigned int
-ubt_blockcb(void *h, unsigned int cbblocks)
-{
- struct ubt_softc *sc = h;
-
- sc->sc_blocked |= (cbblocks & BT_CBBLOCK_ACL_DATA);
-
- return sc->sc_blocked;
-}
-
-static unsigned int
-ubt_unblockcb(void *h, unsigned int cbblocks)
-{
- struct ubt_softc *sc = h;
- unsigned int oblocks, changes;
-
- oblocks = sc->sc_blocked;
- sc->sc_blocked = oblocks & ~cbblocks;
-
- changes = oblocks & cbblocks;
-
- if (changes & BT_CBBLOCK_ACL_DATA)
- /* Re-issue the request if action un-blocked reads */
+ /* Re-issue the request */
+ if (!sc->sc_dying)
ubt_aclrd_request(sc);
-
- return sc->sc_blocked;
}
static int