# Ralink RT2800 driver



## ZmAY (Jan 15, 2011)

`# pciconf -lv`


```
none4@pci0:3:0:0:	class=0x028000 card=0x1453103c chip=0x30901814 rev=0x00 hdr=0x00
    vendor     = 'Ralink Technology, Corp.'
    class      = network
```

Is there any way to get this wireless working in 8.1?


----------



## bschmidt (Jan 17, 2011)

Afaik, no one is currently working on a driver for the newer PCI-based Ralink chipsets.


----------



## ZmAY (Feb 25, 2011)

Ok, I decided not to wait for this driver. Can someone recommend me WNIC for laptop, which has good support in FreeBSD?


----------



## eirnym (Feb 26, 2011)

In any case you can try ndis(4) way to use this hardware.


----------



## ZmAY (Feb 28, 2011)

No luck with ndis, and btw. card is Ralink RT3090, integrated on the motherboard. x(


----------



## richardpl (Feb 28, 2011)

Give more useful info:
What you did and what happened and what you expected to happen. Please provide useful details.


----------



## ZmAY (Mar 1, 2011)

I have this notebook - link

Wireless network card is integrated on motherboard, Ralink RT3090. There is no native driver for FreeBSD 8.1 generic amd64, which i use.

What i tried is:
- Downloaded driver from http://h10025.www1.hp.com/ewfrf/wc/softwareDownloadIndex?cc=us&lc=en&dlc=en&softwareitem=ob-84771-1
- and tried with ndis, but after i compile and try to kldload module, i get exec format error


----------



## richardpl (Mar 1, 2011)

ZmAY said:
			
		

> - and tried with ndis, but after i compile and try to kldload module, i get exec format error



What exactly you did with ndisgen, are you using right source (kernel and world and source are in sync?).

Also note that 8.1 have broken amd64 support for NDIS, use at least 8.2


----------



## ZmAY (Mar 2, 2011)

Ok, to report some things..
- I upgraded to 8.2
- ndis then worked


```
# ifconfig wlan0 scan
SSID/MESH ID    BSSID              CHAN RATE   S:N     INT CAPS
Belkin_Pre-...  00:11:50:22:b4:16    1   54M -87:-96  100 E   
Kerberos        00:1e:e5:64:ff:43    6   54M -46:-96  100 EP   RSN
Amis9790242072  00:26:44:55:c5:c0    6   54M -89:-96  100 EP   WPA
brenkus         02:30:b4:a9:1c:80    7   54M -88:-96  100 EPS 
brenkus_1       02:30:b4:a9:1c:81    7   54M -86:-96  100 EPS  RSN
MSI             00:13:d3:7f:92:b1   11   54M -82:-96  200 ES  
hafner          00:1d:7e:55:ec:5d   11   54M -88:-96  100 EPS  WPA
```

I tried all possible versions, WEP, WPA, WPA2, without security. In some cases I could obtain IP address by running dhcp, but no data could be transferred.

Now I am trying to connect to my home network, which is Kerberos, WPA2.

/etc/wpa_supplicant.conf

```
network={
ssid="Kerberos"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP WEP104 WEP40
psk="xxxxxxx"
priority=2
}
```

then I try manually with
[cmd=]# wpa_supplicant -dd -i wlan0 -c /etc/wpa_supplicant.conf[/cmd]

and get 


```
Initializing interface 'wlan0' conf '/etc/wpa_supplicant.conf' driver 'default' ctrl_interface 'N/A' bridge 'N/A'
Configuration file '/etc/wpa_supplicant.conf' -> '/etc/wpa_supplicant.conf'
Reading configuration file '/etc/wpa_supplicant.conf'
Line: 1 - start of a new network block
ssid - hexdump_ascii(len=8):
     4b 65 72 62 65 72 6f 73                           Kerberos        
proto: 0x2
key_mgmt: 0x2
pairwise: 0x18
group: 0x1e
PSK (ASCII passphrase) - hexdump_ascii(len=11): [REMOVED]
priority=2 (0x2)
PSK (from passphrase) - hexdump(len=32): [REMOVED]
Priority group 2
   id=0 ssid='Kerberos'
Initializing interface (2) 'wlan0'
Own MAC address: e0:2a:82:18:a8:26
wpa_driver_bsd_set_wpa: enabled=1
wpa_driver_bsd_set_wpa_internal: wpa=3 privacy=1
wpa_driver_bsd_del_key: keyidx=0
wpa_driver_bsd_del_key: keyidx=1
wpa_driver_bsd_del_key: keyidx=2
wpa_driver_bsd_del_key: keyidx=3
wpa_driver_bsd_set_countermeasures: enabled=0
wpa_driver_bsd_set_drop_unencrypted: enabled=1
RSN: flushing PMKID list in the driver
Setting scan request: 0 sec 100000 usec
EAPOL: SUPP_PAE entering state DISCONNECTED
EAPOL: KEY_RX entering state NO_KEY_RECEIVE
EAPOL: SUPP_BE entering state INITIALIZE
EAP: EAP entering state DISABLED
Added interface wlan0
State: DISCONNECTED -> SCANNING
Starting AP scan (broadcast SSID)
Trying to get current scan results first without requesting a new scan to speed up initial association
Received 0 bytes of scan results (0 BSSes)
Scan results: 0
Cached scan results are empty - not posting
Selecting BSS from priority group 2
Try to find WPA-enabled AP
Try to find non-WPA AP
No suitable AP found.
Setting scan request: 0 sec 0 usec
Starting AP scan (broadcast SSID)
EAPOL: disable timer tick
Received 0 bytes of scan results (4 BSSes)
Scan results: 4
CTRL-EVENT-SCAN-RESULTS 
Selecting BSS from priority group 2
Try to find WPA-enabled AP
0: 00:1e:e5:64:ff:43 ssid='Kerberos' wpa_ie_len=0 rsn_ie_len=20 caps=0x11
   selected based on RSN IE
   selected WPA AP 00:1e:e5:64:ff:43 ssid='Kerberos'
Trying to associate with 00:1e:e5:64:ff:43 (SSID='Kerberos' freq=2437 MHz)
Cancelling scan request
WPA: clearing own WPA/RSN IE
Automatic auth_alg selection: 0x1
wpa_driver_bsd_set_auth_alg alg 0x1 authmode 1
RSN: using IEEE 802.11i/D9.0
WPA: Selected cipher suites: group 8 pairwise 8 key_mgmt 2 proto 2
WPA: clearing AP WPA IE
WPA: set AP RSN IE - hexdump(len=22): 30 14 01 00 00 0f ac 02 01 00 00 0f ac 02 01 00 00 0f ac 02 00 00
WPA: using GTK TKIP
WPA: using PTK TKIP
WPA: using KEY_MGMT WPA-PSK
WPA: Set own WPA IE default - hexdump(len=22): 30 14 01 00 00 0f ac 02 01 00 00 0f ac 02 01 00 00 0f ac 02 00 00
No keys have been configured - skip key clearing
wpa_driver_bsd_set_drop_unencrypted: enabled=1
State: SCANNING -> ASSOCIATING
wpa_driver_bsd_associate: ssid 'Kerberos' wpa ie len 22 pairwise 2 group 2 key mgmt 1
wpa_driver_bsd_associate: set PRIVACY 1
Setting authentication timeout: 10 sec 0 usec
EAPOL: External notification - EAP success=0
EAPOL: External notification - EAP fail=0
EAPOL: External notification - portControl=Auto
RSN: Ignored PMKID candidate without preauth flag
Authentication with 00:1e:e5:64:ff:43 timed out.
Added BSSID 00:1e:e5:64:ff:43 into blacklist
No keys have been configured - skip key clearing
State: ASSOCIATING -> DISCONNECTED
EAPOL: External notification - portEnabled=0
EAPOL: External notification - portValid=0
EAPOL: External notification - EAP success=0
Setting scan request: 0 sec 0 usec
State: DISCONNECTED -> SCANNING
Starting AP scan (broadcast SSID)
Received 0 bytes of scan results (4 BSSes)
Scan results: 4
CTRL-EVENT-SCAN-RESULTS 
Selecting BSS from priority group 2
Try to find WPA-enabled AP
0: 00:1e:e5:64:ff:43 ssid='Kerberos' wpa_ie_len=0 rsn_ie_len=20 caps=0x11
   selected based on RSN IE
   selected WPA AP 00:1e:e5:64:ff:43 ssid='Kerberos'
Trying to associate with 00:1e:e5:64:ff:43 (SSID='Kerberos' freq=2437 MHz)
Cancelling scan request
WPA: clearing own WPA/RSN IE
Automatic auth_alg selection: 0x1
wpa_driver_bsd_set_auth_alg alg 0x1 authmode 1
RSN: using IEEE 802.11i/D9.0
WPA: Selected cipher suites: group 8 pairwise 8 key_mgmt 2 proto 2
WPA: clearing AP WPA IE
WPA: set AP RSN IE - hexdump(len=22): 30 14 01 00 00 0f ac 02 01 00 00 0f ac 02 01 00 00 0f ac 02 00 00
WPA: using GTK TKIP
WPA: using PTK TKIP
WPA: using KEY_MGMT WPA-PSK
WPA: Set own WPA IE default - hexdump(len=22): 30 14 01 00 00 0f ac 02 01 00 00 0f ac 02 01 00 00 0f ac 02 00 00
No keys have been configured - skip key clearing
wpa_driver_bsd_set_drop_unencrypted: enabled=1
State: SCANNING -> ASSOCIATING
wpa_driver_bsd_associate: ssid 'Kerberos' wpa ie len 22 pairwise 2 group 2 key mgmt 1
wpa_driver_bsd_associate: set PRIVACY 1
Setting authentication timeout: 10 sec 0 usec
EAPOL: External notification - EAP success=0
EAPOL: External notification - EAP fail=0
EAPOL: External notification - portControl=Auto
RSN: Ignored PMKID candidate without preauth flag
^CCTRL-EVENT-TERMINATING - signal 2 received
Removing interface wlan0
State: ASSOCIATING -> DISCONNECTED
No keys have been configured - skip key clearing
EAPOL: External notification - portEnabled=0
EAPOL: External notification - portValid=0
wpa_driver_bsd_set_wpa: enabled=0
wpa_driver_bsd_set_wpa_internal: wpa=0 privacy=0
ioctl[SIOCS80211, op 26, arg 0x0]: Operation not supported
Failed to disable WPA in the driver.
wpa_driver_bsd_set_drop_unencrypted: enabled=0
wpa_driver_bsd_set_countermeasures: enabled=0
No keys have been configured - skip key clearing
Removed BSSID 00:1e:e5:64:ff:43 from blacklist (clear)
Cancelling scan request
```

I also tried with WEP, WPA, WPA2, without security. In some cases I got IP by running dhcp, but that was it, no data could be transferred.


----------



## richardpl (Mar 3, 2011)

When manually running wpa_supplicant you should use *-D ndis* switch to use ndis driver, because bsd driver(default one) in NDISulator is not yet completely usable (only wep actually works in 100% cases).

What happens if you run ndis_events(8) before running wpa_supplicant (with ndis driver)?

In some scenarios ndis_events makes authentication possible...

Does OPEN (no encryption at all) works?


----------



## ZmAY (Mar 3, 2011)

http://pastebin.com/PmLt1vsA


----------



## richardpl (Mar 3, 2011)

> 0: 00:XX:XX:XX:XX:XX ssid='Kerberos' wpa_ie_len=0 rsn_ie_len=20 caps=0x411
> skip - no WPA/RSN proto match



For some reasons wpa_supplicant thinks your setup/configuration is wrong, it probably *is* wrong.

What you get with `% ifconfig wlan0 list scan`?


----------



## ZmAY (Mar 4, 2011)

```
# ifconfig wlan0 list scan
SSID/MESH ID    BSSID              CHAN RATE   S:N     INT CAPS
Kerberos        00:1e:e5:64:ff:43    6   54M -46:-96  100 EP   RSN
brenkus         02:30:b4:a9:1c:80    7   54M -90:-96  100 EPS 
brenkus_1       02:30:b4:a9:1c:81    7   54M -89:-96  100 EPS  RSN
hafner          00:1d:7e:55:ec:5d   11   54M -89:-96  100 EPS  WPA
default         00:1f:1f:23:43:ac   11   54M -88:-96  100 EP   MESHCONF MESHCONF HTCAP WPA WPS
Belkin_Pre-...  00:11:50:22:b4:16    1   54M -86:-96  100 E
```


```
# cat /etc/wpa_supplicant.conf 

network={
ssid="Kerberos"
pairwise=TKIP
group=TKIP
proto=WPA
key_mgmt=WPA-PSK
psk="xxxxxx"
}
```

I tried different versions od wpa_supplicant.conf. If i try with open network here is the result:


```
# cat /etc/wpa_supplicant.conf
network={
ssid="Kerberos"
key_mgmt=NONE
}
```

link

I am also watching device list on router, my laptop connects, but in like 3s disconnects, and loops.


----------



## richardpl (Mar 4, 2011)

Your wpa_supplicant configuration is obviously wrong: you use wpa but AP use rsn (wpa2). Try with minimal configuration: less lines better.

Is ndis_events(8) run in background? (ndis driver depends on this)
Can you disable power save in AP?

For open network you do not need to use wpa_supplicant. Just use ifconfig(8) directly.


----------



## ZmAY (Mar 4, 2011)

Ok, i now succeeded to connect with WPA and without security. But problem is, that i can reach only local network, if i type http://www.google.com or any other, no page is shown.

report


----------



## richardpl (Mar 4, 2011)

Is AP running dhcp? Did you run dhclient? Is static or dynamic address in use?
Read FreeBSD handbook for more info.


----------



## ZmAY (Mar 4, 2011)

AP is running DHCP, i did run dhclient and i obtained address, i added default route, dynamic address.


----------



## richardpl (Mar 4, 2011)

Give me output of ifconfig and /etc/resolv.conf


----------



## ZmAY (Mar 4, 2011)

```
1.
      # ifconfig
   2.
      re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
   3.
              options=389b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_UCAST,WOL_MCAST,WOL_MAGIC>
   4.
              ether 68:b5:99:62:18:73
   5.
              inet6 fe80::6ab5:99ff:fe62:1873%re0 prefixlen 64 scopeid 0x1
   6.
              inet 89.212.66.30 netmask 0xffff0000 broadcast 89.212.255.255
   7.
              nd6 options=3<PERFORMNUD,ACCEPT_RTADV>
   8.
              media: Ethernet autoselect (100baseTX <full-duplex>)
   9.
              status: active
  10.
      ndis0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 2290
  11.
              ether e0:2a:82:18:a8:26
  12.
              media: IEEE 802.11 Wireless Ethernet autoselect mode 11g
  13.
              status: associated
  14.
      lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
  15.
              options=3<RXCSUM,TXCSUM>
  16.
              inet 127.0.0.1 netmask 0xff000000
  17.
              inet6 ::1 prefixlen 128
  18.
              inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
  19.
              nd6 options=3<PERFORMNUD,ACCEPT_RTADV>
  20.
      gif0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> metric 0 mtu 1280
  21.
              tunnel inet 89.212.66.30 --> 216.66.80.90
  22.
              inet6 fe80::6ab5:99ff:fe62:1873%gif0 prefixlen 64 scopeid 0x4
  23.
              inet6 2001:470:27:61e::2 --> 2001:470:27:61e::1 prefixlen 128
  24.
              nd6 options=3<PERFORMNUD,ACCEPT_RTADV>
  25.
              options=1<ACCEPT_REV_ETHIP_VER>
  26.
      wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
  27.
              ether e0:2a:82:18:a8:26
  28.
              inet6 fe80::e22a:82ff:fe18:a826%wlan0 prefixlen 64 scopeid 0x5
  29.
              inet 172.30.1.127 netmask 0xffffff00 broadcast 172.30.1.255
  30.
              nd6 options=3<PERFORMNUD,ACCEPT_RTADV>
  31.
              media: IEEE 802.11 Wireless Ethernet OFDM/54Mbps mode 11g
  32.
              status: associated
  33.
              ssid Kerberos channel 6 (2437 MHz 11g) bssid 00:1e:e5:64:ff:43
  34.
              country US authmode WPA privacy OFF txpower 0 bmiss 7 mcastrate 9
  35.
              mgmtrate 9 scanvalid 60 protmode CTS roaming MANUAL bintval 0
  36.
       
  37.
       
  38.
       
  39.
       
  40.
      # cat /etc/resolv.conf
  41.
      search t-2.net
  42.
      nameserver 84.255.209.79
  43.
      nameserver 84.255.210.79
```


----------



## ZmAY (Mar 4, 2011)

link


----------



## richardpl (Mar 4, 2011)

I doubt you can use re0 stuff at same time with wlan0 without some extra work (bridge, etc.).

Put re0 down and try again with dhclient on wlan0.


----------



## ZmAY (Mar 4, 2011)

It is working now yes, but not good. Pages are opening slowly or acually not, need to go to the same address like 3, 4 times before is shown... but signal is good?


----------



## richardpl (Mar 4, 2011)

Is it just resolving slowly or data transfer is slow? Is it still slow if you disable encryption on AP and client?

If you want to pick more advanced stuff (newer NDISulator), check https://github.com/richardpl/NDISulator pick stable branch. You will need FreeBSD source (pick right source, you should already have it - same one you are currently using - 8.2 RELEASE) and just rebuild and reinstall ndis modules and regenerate miniport driver.

On already mentioned link is Wiki page with some more documentation.


----------



## ZmAY (Mar 4, 2011)

http://pastebin.com/pv4ACjHp


----------



## richardpl (Mar 4, 2011)

I already said to use stable branch. master branch is for CURRENT - you are not using CURRENT.


----------



## ZmAY (Mar 4, 2011)

Ok, i did what u said, but there is no difference. Resolving works fine but data transfer is slow, with or without encryption. Page is resolved in a second, but then it will not transfer or really slow.


----------



## richardpl (Mar 4, 2011)

How big is CPU usage when uploading/downloading? Give output of `% vmstat -m | grep ndis`.
What happens if you change country and txpower: ifconfig(8)?


----------



## ZmAY (Mar 4, 2011)

```
# vmstat -m | grep ndis
    ndis_subr   756  2377K       -    83796  16,64,128,256,512,1024,2048,4096
ndis_ntoskrnl   193    15K       -      330  16,32,64,128,256,512,1024
    ndis_kern   450    14K       -      450  16,32,64
  ndis_windrv   395    50K       -      395  64,128,512
     ndis_dev     1     1K       -    13757  16,32,64,256,512,2048
```


```
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether e0:2a:82:18:a8:26
	inet6 fe80::e22a:82ff:fe18:a826%wlan0 prefixlen 64 scopeid 0x5 
	inet 172.30.1.127 netmask 0xffffff00 broadcast 172.30.1.255
	nd6 options=3<PERFORMNUD,ACCEPT_RTADV>
	media: IEEE 802.11 Wireless Ethernet autoselect mode 11b
	status: associated
	ssid Kerberos channel 6 (2437 MHz 11b) bssid 00:1e:e5:64:ff:43
	regdomain ETSI country SI authmode OPEN privacy OFF txpower 19.5
	bmiss 7 mcastrate 11 mgmtrate 11 scanvalid 60 roaming MANUAL
```

It needed some time to start download, but then it was constant download without connection loss, full speed all the time (working without encryption now).
No difference after i changed country and txpower.


----------



## ZmAY (Mar 7, 2011)

If i browse/download in LAN everything works fine, quick, problem is only outside world. Maybe is something wrong with router settings, but on the other hand all other devices work without any problems. I must try also on some other network, so far tested only on my home network.


----------



## richardpl (Mar 8, 2011)

Try to disable ip6 and see if that helps, also disable this nd6 stuff (don't know what that means).


----------



## ZmAY (Mar 8, 2011)

nah, no difference, i found one guy on #freebsd, he will check the driver, i will let you know if he finds anything..


```
[Mon Mar 7 2011] [18:44:42]    from the if_ral man page what you may actually be experiencing is:
[Mon Mar 7 2011] [18:44:43]	     The transmit speed is user-selectable or can be adapted automatically by
[Mon Mar 7 2011] [18:44:44]	     the driver depending on the received signal strength and on the number of
[Mon Mar 7 2011] [18:44:44] 	     hardware transmission retries.
[Mon Mar 7 2011] [18:45:53]	     so being that its used with NDIS it is probably factoring alot into what your seeing

[Mon Mar 7 2011] [18:49:07]          its possible that the card is acting in a way not controlled by the 
driver ``adapted automatically'' and it may be doing it irresponsibly.
```


----------



## ZmAY (Mar 10, 2011)

Still waiting that guy to check the driver.. Meanwhile, do you have any other idea, richardpl?


----------



## richardpl (Mar 10, 2011)

There is nothing I can think of which could cause stuff like this. Are you sure that transfers in LAN are really fast?
Give output when pinging your AP. Try to disable powersave on client and AP (see manual of ifconfig(8)).

You are not only one with this issue, in both cases APs are using FreeBSD drivers (not ath(4)) but bad ral(4) and rum(4) they really do not support powersave stuff.


----------



## ZmAY (Mar 12, 2011)

```
308 packets transmitted, 202 packets received, 34.4% packet loss
round-trip min/avg/max/stddev = 0.730/0.899/8.297/0.671 ms
```

Powersave disabled - no difference. That about working fast in LAN was just coinsidence, i tried again and it was also working really slow.

Ok I give up, won't bother anymore, thanks for trying.


----------



## richardpl (Mar 12, 2011)

One last thing. If client CPU is multi-core try to disable SMP: 
	
	



```
kern.smp.disabled=1
```
 into /boot/loader.conf, reboot and see if it helps.


----------



## ZmAY (Mar 12, 2011)

Excellent, that solved the thing. Now it works as it should. Thank you !


----------

