Subject: Re: ralink wireless drivers
To: None <tech-net@netbsd.org>
From: FUKAUMI Naoki <fun@naobsd.org>
List: tech-net
Date: 07/10/2005 15:42:29
This is a multi-part message in MIME format.
--Multipart=_Sun__10_Jul_2005_15_42_29_+0900_Lej3xS31v+4J3noA
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
On Sun, 10 Jul 2005 02:08:42 +0900
FUKAUMI Naoki <fun@naobsd.org> wrote:
> On Tue, 5 Jul 2005 03:24:19 +0900
> FUKAUMI Naoki <fun@naobsd.org> wrote:
>
> > > Thanks a lot - I'll commit this in a minute.
> >
> > Thanks. I made some new patches. I'll send it later. (maybe tomorrow)
>
> New patch attached. Changes are
>
> Enable WEP (software engine).
> Add support for WPA[12].
> Print modes and rates.
> Add new devices.
> (Product names are from http://damien.bergamini.free.fr/ral/list.html)
> And some small changes and bug fixes.
>
> Please commit it.
umm... I forgot to attach my patch;)
> > > Unfortunately I don't have more success connecting to
> > > the wireless networks in reach than before.
> >
> > I get same result with ral at pci. Sometimes I can connect (link UP)
> > to AP very soon, but sometimes I can't. I must do `ifconfig ral0 down
> > up' several times.
> >
> > ral at usb has no problem.
>
> This problem is still occured with ral@pci. ral@usb works fine.
If wlan AP broadcast SSID, I can connect to AP soon with ral@pci.
> And panic() problem (send large data, e.g. traceroute foobar 4096) is
> still occured if WEP enabled. (both ral@pci and ral@usb)
Regards.
--
FUKAUMI Naoki
--Multipart=_Sun__10_Jul_2005_15_42_29_+0900_Lej3xS31v+4J3noA
Content-Type: text/plain;
name="ral_ural_20050709.txt"
Content-Disposition: attachment;
filename="ral_ural_20050709.txt"
Content-Transfer-Encoding: 7bit
Index: sys/dev/ic/ral.c
===================================================================
RCS file: /home/fun/cvsroot/NetBSD/src/sys/dev/ic/ral.c,v
retrieving revision 1.3
diff -u -r1.3 ral.c
--- sys/dev/ic/ral.c 6 Jul 2005 23:44:15 -0000 1.3
+++ sys/dev/ic/ral.c 9 Jul 2005 14:30:18 -0000
@@ -1,5 +1,6 @@
/* $NetBSD: ral.c,v 1.3 2005/07/06 23:44:15 dyoung Exp $ */
-/* $OpenBSD: ral.c,v 1.55 2005/06/20 18:25:10 damien Exp $ */
+/* $OpenBSD: ral.c,v 1.56 2005/07/02 23:14:42 brad Exp $ */
+/* $FreeBSD: src/sys/dev/ral/if_ral.c,v 1.8 2005/07/08 19:33:42 damien Exp $ */
/*-
* Copyright (c) 2005
@@ -29,7 +30,6 @@
#include "bpfilter.h"
#include <sys/param.h>
-#include <sys/reboot.h>
#include <sys/sockio.h>
#include <sys/sysctl.h>
#include <sys/mbuf.h>
@@ -90,6 +90,8 @@
struct ral_rx_ring *);
static struct ieee80211_node *ral_node_alloc(
struct ieee80211_node_table *);
+static int ral_key_alloc(struct ieee80211com *,
+ const struct ieee80211_key *);
static int ral_media_change(struct ifnet *);
static void ral_next_scan(void *);
static void ral_iter_func(void *, struct ieee80211_node *);
@@ -395,7 +397,7 @@
/* set device capabilities */
ic->ic_caps = IEEE80211_C_MONITOR | IEEE80211_C_IBSS |
IEEE80211_C_HOSTAP | IEEE80211_C_SHPREAMBLE | IEEE80211_C_SHSLOT |
- IEEE80211_C_PMGT | IEEE80211_C_TXPMGT | IEEE80211_C_WEP;
+ IEEE80211_C_PMGT | IEEE80211_C_TXPMGT | IEEE80211_C_WPA;
if (sc->rf_rev == RAL_RF_5222) {
/* set supported .11a rates */
@@ -450,6 +452,7 @@
/* override state transition machine */
sc->sc_newstate = ic->ic_newstate;
ic->ic_newstate = ral_newstate;
+ ic->ic_crypto.cs_key_alloc = ral_key_alloc;
ieee80211_media_init(ic, ral_media_change, ieee80211_media_status);
#if NBPFILTER > 0
@@ -465,8 +468,7 @@
sc->sc_txtap.wt_ihdr.it_present = htole32(RAL_TX_RADIOTAP_PRESENT);
#endif
- if (boothowto & AB_VERBOSE)
- ieee80211_announce(ic);
+ ieee80211_announce(ic);
return 0;
@@ -812,6 +814,15 @@
}
static int
+ral_key_alloc(struct ieee80211com *ic, const struct ieee80211_key *k)
+{
+ if (k >= ic->ic_nw_keys && k < &ic->ic_nw_keys[IEEE80211_WEP_NKID])
+ return k - ic->ic_nw_keys;
+
+ return IEEE80211_KEYIX_NONE;
+}
+
+static int
ral_media_change(struct ifnet *ifp)
{
int error;
@@ -1582,6 +1593,7 @@
desc->physaddr = htole32(physaddr);
desc->wme = htole16(RAL_LOGCWMAX(8) | RAL_LOGCWMIN(3) | RAL_AIFSN(2));
+ desc->wme |= htole16(RAL_IVOFFSET(sizeof (struct ieee80211_frame)));
/*
* Fill PLCP fields.
@@ -2040,8 +2052,10 @@
bpf_mtap(ifp->if_bpf, m0);
#endif
m0 = ieee80211_encap(ic, m0, ni);
- if (m0 == NULL)
+ if (m0 == NULL) {
+ ieee80211_free_node(ni);
continue;
+ }
#if NBPFILTER > 0
if (ic->ic_rawbpf != NULL)
bpf_mtap(ic->ic_rawbpf, m0);
@@ -2726,6 +2740,10 @@
ieee80211_new_state(ic, IEEE80211_S_INIT, -1);
+ sc->sc_tx_timer = 0;
+ ifp->if_timer = 0;
+ ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+
/* abort Tx */
RAL_WRITE(sc, RAL_TXCSR0, RAL_ABORT_TX);
@@ -2749,8 +2767,4 @@
/* for CardBus, power down the socket */
if (disable && sc->sc_disable != NULL)
(*sc->sc_disable)(sc);
-
- sc->sc_tx_timer = 0;
- ifp->if_timer = 0;
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
}
Index: sys/dev/usb/if_ural.c
===================================================================
RCS file: /home/fun/cvsroot/NetBSD/src/sys/dev/usb/if_ural.c,v
retrieving revision 1.3
diff -u -r1.3 if_ural.c
--- sys/dev/usb/if_ural.c 6 Jul 2005 23:44:17 -0000 1.3
+++ sys/dev/usb/if_ural.c 9 Jul 2005 14:30:19 -0000
@@ -1,5 +1,6 @@
/* $NetBSD: if_ural.c,v 1.3 2005/07/06 23:44:17 dyoung Exp $ */
-/* $OpenBSD: if_ral.c,v 1.36 2005/06/20 18:54:59 damien Exp $ */
+/* $OpenBSD: if_ral.c,v 1.38 2005/07/07 08:33:22 jsg Exp $ */
+/* $FreeBSD: src/sys/dev/usb/if_ural.c,v 1.9 2005/07/08 19:19:06 damien Exp $ */
/*-
* Copyright (c) 2005
@@ -88,21 +89,33 @@
{ USB_VENDOR_ASUSTEK, USB_PRODUCT_ASUSTEK_WL167G },
{ USB_VENDOR_ASUSTEK, USB_PRODUCT_RALINK_RT2570 },
{ USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F5D7050 },
- { USB_VENDOR_CISCOLINKSYS, USB_PRODUCT_CISCOLINKSYS_WUSB54G },
- { USB_VENDOR_CISCOLINKSYS, USB_PRODUCT_CISCOLINKSYS_WUSB54GP },
+ { USB_VENDOR_CISCOLINKSYS, USB_PRODUCT_CISCOLINKSYS_WUSB54G },
+ { USB_VENDOR_CISCOLINKSYS, USB_PRODUCT_CISCOLINKSYS_WUSB54GP },
{ USB_VENDOR_CONCEPTRONIC, USB_PRODUCT_CONCEPTRONIC_C54RU },
{ USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWLG122 },
+ { USB_VENDOR_GIGABYTE, USB_PRODUCT_GIGABYTE_GNWBKG },
+ { USB_VENDOR_GUILLEMOT, USB_PRODUCT_GUILLEMOT_HWGUSB254 },
{ USB_VENDOR_MELCO, USB_PRODUCT_MELCO_KG54 },
{ USB_VENDOR_MELCO, USB_PRODUCT_MELCO_KG54AI },
+ { USB_VENDOR_MELCO, USB_PRODUCT_MELCO_KG54YB },
+ { USB_VENDOR_MSI, USB_PRODUCT_MSI_MS6861 },
+ { USB_VENDOR_MSI, USB_PRODUCT_MSI_MS6865 },
+ { USB_VENDOR_MSI, USB_PRODUCT_MSI_MS6869 },
{ USB_VENDOR_RALINK, USB_PRODUCT_RALINK_RT2570 },
{ USB_VENDOR_RALINK, USB_PRODUCT_RALINK_RT2570_2 },
+ { USB_VENDOR_RALINK, USB_PRODUCT_RALINK_RT2570_3 },
{ USB_VENDOR_SMC, USB_PRODUCT_SMC_2862WG },
+ { USB_VENDOR_SURECOM, USB_PRODUCT_SURECOM_EP9001G },
+ { USB_VENDOR_VTECH, USB_PRODUCT_VTECH_RT2570 },
+ { USB_VENDOR_ZINWELL, USB_PRODUCT_ZINWELL_ZWXG261 },
};
Static int ural_alloc_tx_list(struct ural_softc *);
Static void ural_free_tx_list(struct ural_softc *);
Static int ural_alloc_rx_list(struct ural_softc *);
Static void ural_free_rx_list(struct ural_softc *);
+Static int ural_key_alloc(struct ieee80211com *,
+ const struct ieee80211_key *);
Static int ural_media_change(struct ifnet *);
Static void ural_next_scan(void *);
Static void ural_task(void *);
@@ -421,7 +434,7 @@
/* set device capabilities */
ic->ic_caps = IEEE80211_C_MONITOR | IEEE80211_C_IBSS |
IEEE80211_C_HOSTAP | IEEE80211_C_SHPREAMBLE | IEEE80211_C_SHSLOT |
- IEEE80211_C_PMGT | IEEE80211_C_TXPMGT | IEEE80211_C_WEP;
+ IEEE80211_C_PMGT | IEEE80211_C_TXPMGT | IEEE80211_C_WPA;
if (sc->rf_rev == RAL_RF_5222) {
/* set supported .11a rates */
@@ -474,6 +487,7 @@
/* override state transition machine */
sc->sc_newstate = ic->ic_newstate;
ic->ic_newstate = ural_newstate;
+ ic->ic_crypto.cs_key_alloc = ural_key_alloc;
ieee80211_media_init(ic, ural_media_change, ieee80211_media_status);
#if NBPFILTER > 0
@@ -489,6 +503,8 @@
sc->sc_txtap.wt_ihdr.it_present = htole32(RAL_TX_RADIOTAP_PRESENT);
#endif
+ ieee80211_announce(ic);
+
usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev,
USBDEV(sc->sc_dev));
@@ -665,6 +681,15 @@
}
Static int
+ural_key_alloc(struct ieee80211com *ic, const struct ieee80211_key *k)
+{
+ if (k >= ic->ic_nw_keys && k < &ic->ic_nw_keys[IEEE80211_WEP_NKID])
+ return k - ic->ic_nw_keys;
+
+ return IEEE80211_KEYIX_NONE;
+}
+
+Static int
ural_media_change(struct ifnet *ifp)
{
int error;
@@ -1045,6 +1070,7 @@
desc->flags |= htole32(RAL_TX_OFDM);
desc->wme = htole16(RAL_LOGCWMAX(5) | RAL_LOGCWMIN(3) | RAL_AIFSN(2));
+ desc->wme |= htole16(RAL_IVOFFSET(sizeof (struct ieee80211_frame)));
/*
* Fill PLCP fields.
@@ -1356,8 +1382,10 @@
bpf_mtap(ifp->if_bpf, m0);
#endif
m0 = ieee80211_encap(ic, m0, ni);
- if (m0 == NULL)
+ if (m0 == NULL) {
+ ieee80211_free_node(ni);
continue;
+ }
#if NBPFILTER > 0
if (ic->ic_rawbpf != NULL)
bpf_mtap(ic->ic_rawbpf, m0);
@@ -2004,9 +2032,6 @@
/* clear statistic registers (STA_CSR0 to STA_CSR10) */
ural_read_multi(sc, RAL_STA_CSR0, sta, sizeof sta);
- /* set default sensitivity */
- ural_bbp_write(sc, 17, 0x48);
-
ural_set_txantenna(sc, 1);
ural_set_rxantenna(sc, 1);
@@ -2018,8 +2043,8 @@
*/
for (i = 0; i < IEEE80211_WEP_NKID; i++) {
wk = &ic->ic_nw_keys[i];
- ural_write_multi(sc, RAL_SEC_CSR0 + i * IEEE80211_KEYBUF_SIZE,
- wk->wk_key, IEEE80211_KEYBUF_SIZE);
+ ural_write_multi(sc, wk->wk_keyix * IEEE80211_KEYBUF_SIZE +
+ RAL_SEC_CSR0, wk->wk_key, IEEE80211_KEYBUF_SIZE);
}
/*
@@ -2103,6 +2128,10 @@
ieee80211_new_state(ic, IEEE80211_S_INIT, -1);
+ sc->sc_tx_timer = 0;
+ ifp->if_timer = 0;
+ ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+
/* disable Rx */
ural_write(sc, RAL_TXRX_CSR2, RAL_DISABLE_RX);
@@ -2110,10 +2139,6 @@
ural_write(sc, RAL_MAC_CSR1, RAL_RESET_ASIC | RAL_RESET_BBP);
ural_write(sc, RAL_MAC_CSR1, 0);
- sc->sc_tx_timer = 0;
- ifp->if_timer = 0;
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
-
if (sc->sc_rx_pipeh != NULL) {
usbd_abort_pipe(sc->sc_rx_pipeh);
usbd_close_pipe(sc->sc_rx_pipeh);
Index: sys/dev/usb/usbdevs
===================================================================
RCS file: /home/fun/cvsroot/NetBSD/src/sys/dev/usb/usbdevs,v
retrieving revision 1.406
diff -u -r1.406 usbdevs
--- sys/dev/usb/usbdevs 7 Jul 2005 09:58:23 -0000 1.406
+++ sys/dev/usb/usbdevs 9 Jul 2005 14:30:19 -0000
@@ -259,6 +259,7 @@
vendor DIGITALSTREAM 0x074e Digital Stream
vendor AUREAL 0x0755 Aureal Semiconductor
vendor MIDIMAN 0x0763 Midiman
+vendor SURECOM 0x0769 Surecom Technology
vendor LINKSYS2 0x077b Linksys
vendor GRIFFIN 0x077d Griffin Technology
vendor SANDISK 0x0781 SanDisk
@@ -390,7 +391,9 @@
vendor PILOTECH 0x0eaf Pilotech
vendor EGALAX 0x0eef eGalax
vendor AIRPRIME 0x0f3d AirPrime, Incorporated
+vendor VTECH 0x0f88 VTech
vendor QUALCOMM 0x1004 Qualcomm
+vendor GIGABYTE 0x1044 GIGABYTE
vendor MOTOROLA 0x1063 Motorola
vendor CCYU 0x1065 CCYU Technology
vendor PLX 0x10b5 PLX
@@ -436,6 +439,7 @@
vendor DELL 0x413c Dell
vendor AVERATEC 0x50c2 Averatec
vendor ONSPEC2 0x55aa OnSpec Electronic Inc.
+vendor ZINWELL 0x5a57 Zinwell
vendor SITECOM 0x6189 Sitecom
vendor INTEL 0x8086 Intel
vendor HP2 0xf003 Hewlett Packard
@@ -901,6 +905,9 @@
product GENESYS GL641USB2IDE_2 0x0701 GL641USB USB-IDE Bridge
product GENESYS GL641USB2IDE 0x0702 GL641USB USB-IDE Bridge
+/* GIGABYTE products */
+product GIGABYTE GNWBKG 0x8007 GN-WBKG
+
/* GoHubs products */
product GOHUBS GOCOM232 0x1001 GoCOM232 Serial converter
@@ -916,6 +923,7 @@
/* Guillemot Corporation */
product GUILLEMOT DALEADER 0xa300 DA Leader
+product GUILLEMOT HWGUSB254 0xe000 HWGUSB2-54 WLAN
/* Hagiwara products */
product HAGIWARA FGSM 0x0002 FlashGate SmartMedia Card Reader
@@ -1255,6 +1263,7 @@
product MELCO KS11G 0x0027 WLI-USB-KS11G USB-wlan
product MELCO LUAU2KTX 0x003d LUA-U2-KTX Ethernet
product MELCO KB11 0x0044 WLI-USB-KB11 WLAN
+product MELCO KG54YB 0x005e WLI-U2-KG54-YB WLAN
product MELCO KG54 0x0066 WLI-U2-KG54 WLAN
product MELCO KG54AI 0x006d WLI-U2-KG54-AI WLAN
@@ -1263,6 +1272,9 @@
/* Micro Star International products */
product MSI BLUETOOTH 0x1967 Bluetooth USB Adapter
+product MSI MS6861 0x6861 MS-6861
+product MSI MS6865 0x6865 MS-6865
+product MSI MS6869 0x6869 MS-6869
/* Micronet Communications products */
product MICRONET SP128AR 0x0003 SP128AR EtherFast
@@ -1327,9 +1339,6 @@
product MOTOROLA2 T720C 0x2822 T720c
product MOTOROLA2 A920 0x4002 A920
-/* Micro Star International products */
-product MSI BT_DONGLE 0x1967 Bluetooth USB dongle
-
/* MultiTech products */
product MULTITECH ATLAS 0xf101 MT5634ZBA-USB modem
@@ -1557,6 +1566,7 @@
/* Ralink Technology products */
product RALINK RT2570 0x1706 RT2570
product RALINK RT2570_2 0x2570 RT2570
+product RALINK RT2570_3 0x9020 RT2570
/* RATOC Systems products */
product RATOC REXUSB60 0xb000 USB serial REX-USB60
@@ -1747,6 +1757,9 @@
/* XXX The above is a North American PC style keyboard possibly */
product SUN MOUSE 0x0100 Type 6 USB mouse
+/* Surecom Technology products */
+product SURECOM EP9001G 0x11f3 EP-9001-g
+
/* Susteen products */
product SUSTEEN DCU10 0x0528 USB Cable
@@ -1854,6 +1867,9 @@
/* Vodafone products */
product VODAFONE MC3G 0x5000 Mobile Connect 3G datacard
+/* VTech products */
+product VTECH RT2570 0x3012 RT2570
+
/* Wacom products */
product WACOM CT0405U 0x0000 CT-0405-U Tablet
product WACOM GRAPHIRE 0x0010 Graphire
@@ -1897,6 +1913,9 @@
/* Z-Com products */
product ZCOM 725 0x0002 725/726 Prism2.5 WLAN
+/* Zinwell products */
+product ZINWELL ZWXG261 0x0260 ZWX-G261
+
/* Zoom Telephonics, Inc. products */
product ZOOM 2986L 0x9700 2986L Fax modem
--Multipart=_Sun__10_Jul_2005_15_42_29_+0900_Lej3xS31v+4J3noA--