summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorJasper Lievisse Adriaanse <jasper@cvs.openbsd.org>2011-10-26 17:31:55 +0000
committerJasper Lievisse Adriaanse <jasper@cvs.openbsd.org>2011-10-26 17:31:55 +0000
commite9500afcb6cfeba1014e881a1b7be22a505ae3a8 (patch)
treea6ce8eaaa4ec42269ffaed1d8b985bde671c4bf1 /sys/dev/usb
parent2db4e6b5a22a2835d31ccd404752fdbd5d180ea4 (diff)
apply a fix by Steven Chamberlain <steven@pyro.eu.org>, via freebsd:
Fix an issue with 11g beacon frames which looks to be a limitation on the largest multi-write size: == I looked further into the magic 88-byte threshold after which the bug occurs. It turns out that figure included the 24-byte tx_desc, and up to 64 bytes of beacon frame (header+data). rum_write_multi doesn't seem happy with writing >64 bytes at a time to the MAC register. If I break it up into separate calls (e.g. bytes 0-63, then bytes 64-65, written at the appropriate offset) I see the proper beacon frames being transmitted now. == tweak by miod@ ok deraadt@
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/if_rum.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/sys/dev/usb/if_rum.c b/sys/dev/usb/if_rum.c
index c561600d584..6d5b495dde4 100644
--- a/sys/dev/usb/if_rum.c
+++ b/sys/dev/usb/if_rum.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_rum.c,v 1.98 2011/07/03 15:47:17 matthew Exp $ */
+/* $OpenBSD: if_rum.c,v 1.99 2011/10/26 17:31:54 jasper Exp $ */
/*-
* Copyright (c) 2005-2007 Damien Bergamini <damien.bergamini@free.fr>
@@ -1486,17 +1486,22 @@ rum_write_multi(struct rum_softc *sc, uint16_t reg, void *buf, size_t len)
{
usb_device_request_t req;
usbd_status error;
+ int offset;
req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
req.bRequest = RT2573_WRITE_MULTI_MAC;
USETW(req.wValue, 0);
- USETW(req.wIndex, reg);
- USETW(req.wLength, len);
- error = usbd_do_request(sc->sc_udev, &req, buf);
- if (error != 0) {
- printf("%s: could not multi write MAC register: %s\n",
- sc->sc_dev.dv_xname, usbd_errstr(error));
+ /* write at most 64 bytes at a time */
+ for (offset = 0; offset < len; offset += 64) {
+ USETW(req.wIndex, reg + offset);
+ USETW(req.wLength, MIN(len - offset, 64));
+
+ error = usbd_do_request(sc->sc_udev, &req, buf + offset);
+ if (error != 0) {
+ printf("%s: could not multi write MAC register: %s\n",
+ sc->sc_dev.dv_xname, usbd_errstr(error));
+ }
}
}