Module Name:    src
Committed By:   zafer
Date:           Sat Mar 29 00:59:05 UTC 2014

Modified Files:
        src/sys/dev/usb: if_rum.c

Log Message:
Fix an issue with 11g beacon frames.
>From FreeBSD Rev. 226465
Makes 11g wep, wpa2 and hostap work again.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/usb/if_rum.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/if_rum.c
diff -u src/sys/dev/usb/if_rum.c:1.47 src/sys/dev/usb/if_rum.c:1.48
--- src/sys/dev/usb/if_rum.c:1.47	Tue Jan 22 12:40:42 2013
+++ src/sys/dev/usb/if_rum.c	Sat Mar 29 00:59:05 2014
@@ -1,5 +1,5 @@
 /*	$OpenBSD: if_rum.c,v 1.40 2006/09/18 16:20:20 damien Exp $	*/
-/*	$NetBSD: if_rum.c,v 1.47 2013/01/22 12:40:42 jmcneill Exp $	*/
+/*	$NetBSD: if_rum.c,v 1.48 2014/03/29 00:59:05 zafer Exp $	*/
 
 /*-
  * Copyright (c) 2005-2007 Damien Bergamini <damien.bergam...@free.fr>
@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_rum.c,v 1.47 2013/01/22 12:40:42 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rum.c,v 1.48 2014/03/29 00:59:05 zafer Exp $");
 
 #include <sys/param.h>
 #include <sys/sockio.h>
@@ -1476,17 +1476,22 @@ rum_write_multi(struct rum_softc *sc, ui
 {
 	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",
-		    device_xname(sc->sc_dev), 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, (char *)buf + offset);
+		if (error != 0) {
+			printf("%s: could not multi write MAC register: %s\n",
+			    device_xname(sc->sc_dev), usbd_errstr(error));
+		}
 	}
 }
 

Reply via email to