Date: Sat, 23 Dec 2000 23:25:01 -0600 From: seebs@plethora.net (Peter Seebach) To: freebsd-mobile@freebsd.org Subject: if_wi trivial improvements Message-ID: <200012240525.XAA16279@guild.plethora.net>
next in thread | raw e-mail | index | archive | help
I've got a couple of things I'd like to contribute, but at least one of them is apparently not applicable. Under NetBSD, there's a file called "pcmciadevs" which is compiled into the kernel to identify devices. I think this is "pccard.conf" under FreeBSD, so this may already be handled... I added entries for the D-Link and Linksys cards to if_wi.c in NetBSD, and that fixes some of the trouble. Anyway, I've established that some of the delays don't need to be as long as they are, and I've improved (IMHO) the logic so that the long delay needed for an init command is less of an anomaly; wi_cmd shouldn't ever return ETIMEDOUT now. I have not "fixed" the xmit error/device timeout problems. I have isolated them, and I have found a workaround. The workaround is "use an access point". The bug is apparently unique to ad-hoc mode. I found a Linux driver with a comment in the source "Prism 2 doesn't quite support ad-hoc mode", but I can't find any support for this. It may just need a workaround. In the mean time, I have established that, at least under NetBSD, they go away if you run with an access point. I haven't been able to get encryption to work, but I haven't tried all that hard. Anyway, here's a trivial patch that improves performance probing the card; it replaces a .1-.2 second delay with a much shorter one. I also shortened the 10ms busy-loop delay to 10us, because 10ms*65,536 iterations is ten *MINUTES* of total kernel death. :( These patches are from "FreeBSD 4.1 with wi.patch applied". (wi.patch is in ~wpaul, but don't ask him about it, he'll kill you.) *** if_wi.c.orig Sat Dec 23 15:01:49 2000 --- if_wi.c Sat Dec 23 15:02:25 2000 *************** *** 618,624 **** if (!(CSR_READ_2(sc, WI_COMMAND) & WI_CMD_BUSY)) { break; } ! DELAY(10*1000); /* 10 m sec */ } if (i == WI_TIMEOUT) { --- 618,624 ---- if (!(CSR_READ_2(sc, WI_COMMAND) & WI_CMD_BUSY)) { break; } ! DELAY(10); /* 10 m sec */ } if (i == WI_TIMEOUT) { *************** *** 648,653 **** --- 648,655 ---- return(EIO); break; } + if (cmd == WI_CMD_INI) + DELAY(100); } if (i == WI_TIMEOUT) *************** *** 659,670 **** static void wi_reset(sc) struct wi_softc *sc; { - #ifdef foo - wi_cmd(sc, WI_CMD_INI, 0); - DELAY(100000); - wi_cmd(sc, WI_CMD_INI, 0); - #endif - DELAY(100000); if (wi_cmd(sc, WI_CMD_INI, 0)) device_printf(sc->dev, "init failed\n"); CSR_WRITE_2(sc, WI_INT_EN, 0); --- 661,666 ---- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-mobile" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200012240525.XAA16279>