From owner-freebsd-mobile Tue Apr 9 6:28: 3 2002 Delivered-To: freebsd-mobile@freebsd.org Received: from pcs.dp.ua (a69.lanscom.net [212.3.111.69]) by hub.freebsd.org (Postfix) with ESMTP id A887237B416 for ; Tue, 9 Apr 2002 06:27:26 -0700 (PDT) Received: (from john@localhost) by pcs.dp.ua (8.11.6/8.11.6) id g39DR3D26997 for freebsd-mobile@FreeBSD.ORG; Tue, 9 Apr 2002 16:27:03 +0300 (EEST) (envelope-from john) Date: Tue, 9 Apr 2002 16:27:03 +0300 From: Eugene Perevyazko To: freebsd-mobile@FreeBSD.ORG Subject: wi tx-rate is set incorrectly with ifconfig Message-ID: <20020409162703.A26943@pcs.dp.ua> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="qDbXVdCdHGoSgWSk" Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-mobile@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org --qDbXVdCdHGoSgWSk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi there. Abstract: wi driver tx-rate for Lucent chipset is set incorrectly by ifconfig 'media DSx' option. To confirm: ifconfig wi0 media DS11 wicontrol wicontrol reports not 11 but most probably 2 Mbit/s Details: I've moved to setting all wi params with ifconfig through /etc/rc.conf some time ago just like that: ifconfig_wi0="inet 1.2.3.4 netmask 0xfffffff0 \ nwkey 1:key01,key02,key03,key04 media DS11 \ station MyFineBox ssid MyFineNet" Then noticed that wicontrol reports wrong tx-rate value. A glimpse at the source shows that code in wi_media_change() in if_wi.c: switch (IFM_SUBTYPE(sc->ifmedia.ifm_cur->ifm_media)) { case IFM_IEEE80211_DS1: sc->wi_tx_rate = 1; break; case IFM_IEEE80211_DS2: sc->wi_tx_rate = 2; break; case IFM_IEEE80211_DS5: sc->wi_tx_rate = 5; break; case IFM_IEEE80211_DS11: sc->wi_tx_rate = 11; break; case IFM_AUTO: sc->wi_tx_rate = 3; break; } Then those values are translated for Prism2 in wi_write_record() but go unchanged for Lucent. Poor me! The Prism2 gets those translated as: case WI_RID_TX_RATE: p2ltv.wi_type = WI_RID_TX_RATE; p2ltv.wi_len = 2; switch (ltv->wi_val) { case 1: p2ltv.wi_val = 1; break; case 2: p2ltv.wi_val = 2; break; case 3: p2ltv.wi_val = 15; break; case 5: p2ltv.wi_val = 4; break; case 6: p2ltv.wi_val = 3; break; case 7: p2ltv.wi_val = 7; break; case 11: p2ltv.wi_val = 8; break; default: return EINVAL; } ltv = &p2ltv; break; So I think that Lucent should get values translated the following way: switch (ltv->wi_val) { case 1: p2ltv.wi_val = 1; break;/* 1Mb/s fixed */ case 2: p2ltv.wi_val = 2; break;/* 2Mb/s fixed */ case 3: p2ltv.wi_val = 3; break;/* 11Mb/s auto */ case 5: p2ltv.wi_val = 4; break;/* 5.5Mb/s fixed */ case 6: p2ltv.wi_val = 6; break;/* 2Mb/s auto */ case 7: p2ltv.wi_val = 7; break;/* 5.5Mb/s auto */ case 11: p2ltv.wi_val = 5; break;/* 11Mb/s fixed */ default: return EINVAL; } (I deduced the values from man wicontrol) I've made a little patch and tried it. My Orinoco is happy now! :) The patch is attached. -- Eugene Perevyazko --qDbXVdCdHGoSgWSk Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="tx_rate.patch" *** if_wi.c.orig Tue Aug 28 09:21:14 2001 --- if_wi.c Tue Apr 9 15:39:13 2002 *************** *** 1045,1054 **** --- 1045,1070 ---- } return 0; } } } + else { /* not Prism, Lucent for ex. */ + switch (ltv->wi_type) { + case WI_RID_TX_RATE: + switch (ltv->wi_val) { + case 1: ltv->wi_val = 1; break; /* 1Mb/s fixed */ + case 2: ltv->wi_val = 2; break; /* 2Mb/s fixed */ + case 3: ltv->wi_val = 3; break; /* 11Mb/s auto */ + case 5: ltv->wi_val = 4; break; /* 5.5Mb/s fixed */ + case 6: ltv->wi_val = 6; break; /* 2Mb/s auto */ + case 7: ltv->wi_val = 7; break; /* 5.5Mb/s auto */ + case 11: ltv->wi_val = 5; break; /* 11Mb/s fixed */ + default: return EINVAL; + } + break; + } + } if (wi_seek(sc, ltv->wi_type, 0, WI_BAP1)) return(EIO); CSR_WRITE_2(sc, WI_DATA1, ltv->wi_len); --qDbXVdCdHGoSgWSk-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-mobile" in the body of the message