usb/107642: [patch]Ralink Technology RT2501USB/RT2601USB chipset
driver
Valery V.Chikalov
valera at chikalov.dp.ua
Sun Apr 29 13:25:10 UTC 2007
Kevin Lo wrote:
> Valery V.Chikalov wrote:
>> The following reply was made to PR usb/107642; it has been noted by GNATS.
>>
>> From: "Valery V.Chikalov" <valera at chikalov.dp.ua>
>> To: bug-followup at FreeBSD.org, valera at chikalov.dp.ua
>> Cc:
>> Subject: Re: usb/107642: [patch]Ralink Technology RT2501USB/RT2601USB chipset
>> driver
>> Date: Sun, 22 Apr 2007 11:32:18 +0300
>>
>> This is a multi-part message in MIME format.
>> --------------030900090303000507070905
>> Content-Type: text/plain; charset=UTF-8
>> Content-Transfer-Encoding: 7bit
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> if_rum(4) for 7.0-CURRENT
>>
>> replaced amrr_* functions by "standard" ones already existed in
>> net80211/ieee80211_amrr.c
>>
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.5 (MingW32)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>>
>> iD8DBQFGKx14760S3kDvEC4RAn8PAKCn990QJE0wZRKcwdxAZ61MY0JRgACeI2W5
>> ZosSlh6pIqi7JdZ5Wi1BUYc=
>> =LvWZ
>> -----END PGP SIGNATURE-----
>
> Hi Valery,
>
> I guess you wasn't aware that I've already ported rum(4) to FreeBSD.
> The patch is available at: http://people.freebsd.org/~kevlo/patch-rum
> Maybe you can test my patch? Thanks.
>
> Kevin
>
>
Hi, Kevin,
Your driver not working for me. Fortunately, the errors that I see
exactly the same which i fight when I made my driver.
$ uname -a
FreeBSD tiger.novakom.dp.ua 7.0-CURRENT FreeBSD 7.0-CURRENT #6: Sun Apr
29 13:58:48 EEST 2007
root at tiger.novakom.dp.ua:/usr/obj/usr/src/sys/TIGER64 amd64
$ sysctl kern.osreldate
kern.osreldate: 700037
cvsup'ed 29.04.2007
kernel with:
makeoptions DEBUG=-g
options KDB
options DDB
options INVARIANTS
options INVARIANT_SUPPORT
options WITNESS
At first, when I make kldload if_rum, I get kernel panic.
But I cant get saved core, as ddb just hangs during "call doadump"
So I add
#define RUM_LOCK(sc) do { ((sc) = (sc)); mtx_lock(&Giant); } while
(0)
#define RUM_UNLOCK(sc) mtx_unlock(&Giant)
in if_rumvar.h
I spend a lot of time in attempts get rid of Giant ant always got only
panics.
After that I get hangs,
which i resolved by modifying rum_ioctl:
- RUM_LOCK(sc);
-
switch (cmd) {
case SIOCSIFFLAGS:
if (ifp->if_flags & IFF_UP) {
- if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+ if (ifp->if_drv_flags & IFF_DRV_RUNNING){
+ RUM_LOCK(sc);
rum_update_promisc(sc);
- else
+ RUM_UNLOCK(sc);
+ } else {
+ RUM_LOCK(sc);
rum_init(sc);
+ RUM_UNLOCK(sc);
+ }
} else {
- if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+ if (ifp->if_drv_flags & IFF_DRV_RUNNING){
+ RUM_LOCK(sc);
rum_stop(sc);
+ RUM_UNLOCK(sc);
+ }
}
break;
default:
@@ -1488,12 +1501,13 @@
if (error == ENETRESET) {
if ((ifp->if_flags & IFF_UP) &&
(ifp->if_drv_flags & IFF_DRV_RUNNING) &&
- (ic->ic_roaming != IEEE80211_ROAMING_MANUAL))
- rum_init(sc);
+ (ic->ic_roaming != IEEE80211_ROAMING_MANUAL)){
+ RUM_LOCK(sc);
+ rum_init(sc);
+ RUM_UNLOCK(sc);
+ }
error = 0;
}
-
- RUM_UNLOCK(sc);
After that changes at first glance driver is working, but I getting the
panic during "high load", for example trying to get by ftp relatively
big file (about 200Mb)
at this time I can even get the saved kernel coredump, so I can give
your more information if you wish.
And the next changes (I know it looks ugly), made the driver working.
In function rum_start:
+ static int fbusy = 0;
+
+ if (fbusy) return;
+
+ fbusy = 1;
for (;;) {
IF_POLL(&ic->ic_mgtq, m0);
@@ -1439,6 +1444,8 @@
sc->sc_tx_timer = 5;
callout_reset(&sc->watchdog_ch, hz, rum_watchdog, sc);
}
+
+ fbusy = 0;
I'm sure you can make the "right" patches which resolves this issues.
Valery.
-------------- next part --------------
--- if_rum.c.orig Sun Apr 29 15:32:28 2007
+++ if_rum.c Sun Apr 29 15:26:22 2007
@@ -1376,6 +1376,11 @@
struct ieee80211_node *ni;
struct mbuf *m0;
struct ether_header *eh;
+ static int fbusy = 0;
+
+ if (fbusy) return;
+
+ fbusy = 1;
for (;;) {
IF_POLL(&ic->ic_mgtq, m0);
@@ -1439,6 +1444,8 @@
sc->sc_tx_timer = 5;
callout_reset(&sc->watchdog_ch, hz, rum_watchdog, sc);
}
+
+ fbusy = 0;
}
static void
@@ -1467,18 +1474,24 @@
struct ieee80211com *ic = &sc->sc_ic;
int error = 0;
- RUM_LOCK(sc);
-
switch (cmd) {
case SIOCSIFFLAGS:
if (ifp->if_flags & IFF_UP) {
- if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+ if (ifp->if_drv_flags & IFF_DRV_RUNNING){
+ RUM_LOCK(sc);
rum_update_promisc(sc);
- else
+ RUM_UNLOCK(sc);
+ } else {
+ RUM_LOCK(sc);
rum_init(sc);
+ RUM_UNLOCK(sc);
+ }
} else {
- if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+ if (ifp->if_drv_flags & IFF_DRV_RUNNING){
+ RUM_LOCK(sc);
rum_stop(sc);
+ RUM_UNLOCK(sc);
+ }
}
break;
default:
@@ -1488,12 +1501,13 @@
if (error == ENETRESET) {
if ((ifp->if_flags & IFF_UP) &&
(ifp->if_drv_flags & IFF_DRV_RUNNING) &&
- (ic->ic_roaming != IEEE80211_ROAMING_MANUAL))
- rum_init(sc);
+ (ic->ic_roaming != IEEE80211_ROAMING_MANUAL)){
+ RUM_LOCK(sc);
+ rum_init(sc);
+ RUM_UNLOCK(sc);
+ }
error = 0;
}
-
- RUM_UNLOCK(sc);
return error;
}
-------------- next part --------------
--- if_rumvar.h.orig Sun Apr 29 15:32:28 2007
+++ if_rumvar.h Sun Apr 29 15:19:42 2007
@@ -152,6 +152,6 @@
#define RUM_LOCK(sc) mtx_lock(&(sc)->sc_mtx)
#define RUM_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx)
#else
-#define RUM_LOCK(sc)
-#define RUM_UNLOCK(sc)
+#define RUM_LOCK(sc) do { ((sc) = (sc)); mtx_lock(&Giant); } while (0)
+#define RUM_UNLOCK(sc) mtx_unlock(&Giant)
#endif
More information about the freebsd-usb
mailing list