ral(4) diff

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

ral(4) diff

Tim van der Molen-3
I have the following ral(4):

ral0 at pci0 dev 13 function 0 "Ralink RT2561S" rev 0x00: irq 5, address 00:1d:7d:49:28:92
ral0: MAC/BBP RT2561C, RF RT2527

After a commit from August 2010 (see
http://marc.info/?l=openbsd-cvs&m=128095139804862) the ral stopped
working: clients could not associate with it in hostap mode and it could
not detect other APs with "ifconfig scan".

After a hint from damien@ I came up with the following diff which brings
back some of the code that was removed by the commit mentioned above.

damien@ suggested I post the diff here. If you have an RT2561 or RT2661,
please test it.

Regards,
Tim

Index: rt2661.c
===================================================================
RCS file: /cvs/src/sys/dev/ic/rt2661.c,v
retrieving revision 1.64
diff -p -u rt2661.c
--- rt2661.c 22 Feb 2011 20:05:03 -0000 1.64
+++ rt2661.c 10 Mar 2011 16:23:11 -0000
@@ -396,8 +396,10 @@ rt2661_suspend(void *xsc)
  struct rt2661_softc *sc = xsc;
  struct ifnet *ifp = &sc->sc_ic.ic_if;
 
- if (ifp->if_flags & IFF_RUNNING)
+ if (ifp->if_flags & IFF_RUNNING) {
  rt2661_stop(ifp, 1);
+ sc->sc_flags &= ~RT2661_FWLOADED;
+ }
 }
 
 void
@@ -2464,11 +2466,14 @@ rt2661_init(struct ifnet *ifp)
 
  rt2661_stop(ifp, 0);
 
- if (rt2661_load_microcode(sc) != 0) {
- printf("%s: could not load 8051 microcode\n",
-    sc->sc_dev.dv_xname);
- rt2661_stop(ifp, 1);
- return EIO;
+ if (!(sc->sc_flags & RT2661_FWLOADED)) {
+ if (rt2661_load_microcode(sc) != 0) {
+ printf("%s: could not load 8051 microcode\n",
+    sc->sc_dev.dv_xname);
+ rt2661_stop(ifp, 1);
+ return EIO;
+ }
+ sc->sc_flags |= RT2661_FWLOADED;
  }
 
  /* initialize Tx rings */
@@ -2631,7 +2636,7 @@ rt2661_stop(struct ifnet *ifp, int disable)
  if (disable && sc->sc_disable != NULL) {
  if (sc->sc_flags & RT2661_ENABLED) {
  (*sc->sc_disable)(sc);
- sc->sc_flags &= ~RT2661_ENABLED;
+ sc->sc_flags &= ~(RT2661_ENABLED | RT2661_FWLOADED);
  }
  }
 }
Index: rt2661var.h
===================================================================
RCS file: /cvs/src/sys/dev/ic/rt2661var.h,v
retrieving revision 1.13
diff -p -u rt2661var.h
--- rt2661var.h 7 Sep 2010 16:21:42 -0000 1.13
+++ rt2661var.h 10 Mar 2011 16:23:11 -0000
@@ -110,6 +110,7 @@ struct rt2661_softc {
 #define RT2661_ENABLED (1 << 0)
 #define RT2661_UPDATE_SLOT (1 << 1)
 #define RT2661_SET_SLOTTIME (1 << 2)
+#define RT2661_FWLOADED (1 << 3)
 
  int sc_tx_timer;

Reply | Threaded
Open this post in threaded view
|

Re: ral(4) diff

Laurent Ghigonis-2
On Thu, Mar 10, 2011 at 10:07:09PM +0100, Tim van der Molen wrote:
> I have the following ral(4):
>
> ral0 at pci0 dev 13 function 0 "Ralink RT2561S" rev 0x00: irq 5, address
00:1d:7d:49:28:92

> ral0: MAC/BBP RT2561C, RF RT2527
>
> After a commit from August 2010 (see
> http://marc.info/?l=openbsd-cvs&m=128095139804862) the ral stopped
> working: clients could not associate with it in hostap mode and it could
> not detect other APs with "ifconfig scan".
>
> After a hint from damien@ I came up with the following diff which brings
> back some of the code that was removed by the commit mentioned above.
>
> damien@ suggested I post the diff here. If you have an RT2561 or RT2661,
> please test it.

I have the same card as you, and your patch fixes it.

Previously it would only obey the first ifconfig command after boot,
now it works normaly.

Thank you :)


OpenBSD 4.9-current (GENERIC) #18: Fri Mar 11 17:35:48 CET 2011
    [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC
real mem = 1071841280 (1022MB)
avail mem = 1029304320 (981MB)
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.3 @ 0xf0520 (61 entries)
bios0: vendor American Megatrends Inc. version "1004.002" date 08/03/2004
bios0: ASUSTeK Computer Inc. K8V-X
acpi0 at bios0: rev 2
acpi0: sleep states S0 S1 S3 S4 S5
acpi0: tables DSDT FACP OEMB
acpi0: wakeup devices PCI0(S4) PS2K(S4) PS2M(S4) UAR1(S4) AC97(S4) USB1(S4)
USB2(S4) USB3(S4) USB4(S4) EHCI(S4) PWRB(S4) SLPB(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpiprt0 at acpi0: bus 0 (PCI0)
acpicpu0 at acpi0: PSS
acpibtn0 at acpi0: PWRB
acpibtn1 at acpi0: SLPB
cpu0 at mainbus0: (uniprocessor)
cpu0: AMD Athlon(tm) 64 Processor 2800+, 1802.57 MHz
cpu0:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUS
H,MMX,FXSR,SSE,SSE2,NXE,MMXX,LONG,3DNOW2,3DNOW
cpu0: 64KB 64b/line 2-way I-cache, 64KB 64b/line 2-way D-cache, 512KB 64b/line
16-way L2 cache
cpu0: ITLB 32 4KB entries fully associative, 8 4MB entries fully associative
cpu0: DTLB 32 4KB entries fully associative, 8 4MB entries fully associative
cpu0: AMD errata 89, 97 present, BIOS upgrade may be required
cpu0: Cool'n'Quiet K8 1802 MHz: speeds: 1800 1000 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "VIA K8HTB Host" rev 0x01
agp at pchb0 not configured
ppb0 at pci0 dev 1 function 0 "VIA K8HTB AGP" rev 0x00
pci1 at ppb0 bus 1
vga1 at pci1 dev 0 function 0 "NVIDIA GeForce2 MX" rev 0xb2
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
rl0 at pci0 dev 9 function 0 "Realtek 8139" rev 0x10: irq 11, address
00:08:a1:88:39:c2
rlphy0 at rl0 phy 0: RTL internal PHY
skc0 at pci0 dev 10 function 0 "Marvell Yukon 88E8001/8003/8010" rev 0x13,
Yukon Lite rev. A3 (0x7): irq 10
sk0 at skc0 port A: address 00:11:2f:b4:a4:31
eephy0 at sk0 phy 0: 88E1011 Gigabit PHY, rev. 5
ral0 at pci0 dev 11 function 0 "Ralink RT2561S" rev 0x00: irq 11, address
00:08:d3:28:16:ad
ral0: MAC/BBP RT2561C, RF RT2527
ral1 at pci0 dev 12 function 0 "Ralink RT2561S" rev 0x00: irq 10, address
00:08:d3:28:a5:21
ral1: MAC/BBP RT2561C, RF RT2527
emu0 at pci0 dev 13 function 0 "Creative Labs SoundBlaster Live" rev 0x07: irq
5
ac97: codec id 0x54524123 (TriTech Microelectronics TR28602)
audio0 at emu0
"Creative Labs PCI Gameport Joystick" rev 0x07 at pci0 dev 13 function 1 not
configured
ral2 at pci0 dev 14 function 0 "Ralink RT2561S" rev 0x00: irq 3, address
00:08:d3:28:d6:e4
ral2: MAC/BBP RT2561C, RF RT2527
pciide0 at pci0 dev 15 function 0 "VIA VT6420 SATA" rev 0x80: DMA
pciide0: using irq 10 for native-PCI interrupt
wd0 at pciide0 channel 0 drive 0: <WDC WD740GD-00FLA2>
wd0: 16-sector PIO, LBA48, 70911MB, 145226112 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 6
wd1 at pciide0 channel 1 drive 0: <WDC WD3200KS-00PFB0>
wd1: 16-sector PIO, LBA48, 305245MB, 625142448 sectors
wd1(pciide0:1:0): using PIO mode 4, Ultra-DMA mode 6
pciide1 at pci0 dev 15 function 1 "VIA VT82C571 IDE" rev 0x06: ATA133, channel
0 configured to compatibility, channel 1 configured to compatibility
atapiscsi0 at pciide1 channel 0 drive 1
scsibus0 at atapiscsi0: 2 targets
cd0 at scsibus0 targ 0 lun 0: <PHILIPS, DVD8801, NW02> ATAPI 5/cdrom
removable
cd0(pciide1:0:1): using PIO mode 4, Ultra-DMA mode 2
pciide1: channel 1 disabled (no drives)
uhci0 at pci0 dev 16 function 0 "VIA VT83C572 USB" rev 0x81: irq 11
uhci1 at pci0 dev 16 function 1 "VIA VT83C572 USB" rev 0x81: irq 11
uhci2 at pci0 dev 16 function 2 "VIA VT83C572 USB" rev 0x81: irq 10
uhci3 at pci0 dev 16 function 3 "VIA VT83C572 USB" rev 0x81: irq 10
ehci0 at pci0 dev 16 function 4 "VIA VT6202 USB" rev 0x86: irq 5
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "VIA EHCI root hub" rev 2.00/1.00 addr 1
viapm0 at pci0 dev 17 function 0 "VIA VT8237 ISA" rev 0x00
iic0 at viapm0
iic0: addr 0x4a 00=3f 01=03 02=7f 03=07 05=30 06=c0 07=90 08=3f 09=03 0a=7f
0b=07 0d=30 0e=c0 0f=90 10=3f 11=03 12=7f 13=07 15=30 16=c0 17=90 18=3f 19=03
1a=7f 1b=07 1d=30 1e=c0 1f=90 20=3f 21=03 22=7f 23=07 25=30 26=c0 27=90 28=3f
29=03 2a=7f 2b=07 2d=30 2e=c0 2f=90 30=3f 31=03 32=7f 33=07 35=30 36=c0 37=90
38=3f 39=03 3a=7f 3b=07 3d=30 3e=c0 3f=90 40=3f 41=03 42=7f 43=07 45=30 46=c0
47=90 48=3f 49=03 4a=7f 4b=07 4d=30 4e=c0 4f=90 50=3f 51=03 52=7f 53=07 55=30
56=c0 57=90 58=3f 59=03 5a=7f 5b=07 5d=30 5e=c0 5f=90 60=3f 61=03 62=7f 63=07
65=30 66=c0 67=90 68=3f 69=03 6a=7f 6b=07 6d=30 6e=c0 6f=90 70=3f 71=03 72=7f
73=07 75=30 76=c0 77=90 78=3f 79=03 7a=7f 7b=07 7d=30 7e=c0 7f=90 80=3f 81=03
82=7f 83=07 85=30 86=c0 87=90 88=3f 89=03 8a=7f 8b=07 8d=30 8e=c0 8f=90 90=3f
91=03 92=7f 93=07 95=30 96=c0 97=90 98=3f 99=03 9a=7f 9b=07 9d=30 9e=c0 9f=90
a0=3f a1=03 a2=7f a3=07 a5=30 a6=c0 a7=90 a8=3f a9=03 aa=7f ab=07 ad=30 ae=c0
af=90 b0=3f b1=03 b2=7f b3=07 b5=30 b6=c0 b7=90 b8=3f b9=03 ba=7f bb=07 bd=30
be=c0 bf=90 c0=3f c1=03 c2=7f c3=07 c5=30 c6=c0 c7=90 c8=3f c9=03 ca=7f cb=07
cd=30 ce=c0 cf=90 d0=3f d1=03 d2=7f d3=07 d5=30 d6=c0 d7=90 d8=3f d9=03 da=7f
db=07 dd=30 de=c0 df=90 e0=3f e1=03 e2=7f e3=07 e5=30 e6=c0 e7=90 e8=3f e9=03
ea=7f eb=07 ed=30 ee=c0 ef=90 f0=3f f1=03 f2=7f f3=07 f5=30 f6=c0 f7=90 f8=3f
f9=03 fa=7f fb=07 fd=30 fe=c0 ff=90 words 00=3fff 01=03ff 02=7fff 03=07ff
04=00ff 05=30ff 06=c0ff 07=90ff
spdmem0 at iic0 addr 0x50: 512MB DDR SDRAM non-parity PC3200CL3.0
spdmem1 at iic0 addr 0x51: 512MB DDR SDRAM non-parity PC3200CL3.0
pchb1 at pci0 dev 24 function 0 "AMD AMD64 0Fh HyperTransport" rev 0x00
pchb2 at pci0 dev 24 function 1 "AMD AMD64 0Fh Address Map" rev 0x00
pchb3 at pci0 dev 24 function 2 "AMD AMD64 0Fh DRAM Cfg" rev 0x00
kate0 at pci0 dev 24 function 3 "AMD AMD64 0Fh Misc Cfg" rev 0x00
usb1 at uhci0: USB revision 1.0
uhub1 at usb1 "VIA UHCI root hub" rev 1.00/1.00 addr 1
usb2 at uhci1: USB revision 1.0
uhub2 at usb2 "VIA UHCI root hub" rev 1.00/1.00 addr 1
usb3 at uhci2: USB revision 1.0
uhub3 at usb3 "VIA UHCI root hub" rev 1.00/1.00 addr 1
usb4 at uhci3: USB revision 1.0
uhub4 at usb4 "VIA UHCI root hub" rev 1.00/1.00 addr 1
isa0 at mainbus0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
pckbc0 at isa0 port 0x60/5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pms0 at pckbc0 (aux slot)
pckbc0: using irq 12 for aux slot
wsmouse0 at pms0 mux 0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
lpt0 at isa0 port 0x378/4 irq 7
wbsio0 at isa0 port 0x2e/2: W83697HF rev 0x12
lm1 at wbsio0 port 0x290/8: W83697HF
fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
fd0 at fdc0 drive 0: 1.44MB 80 cyl, 2 head, 18 sec
mtrr: Pentium Pro MTRR support
rum0 at uhub0 port 3 "Ralink 802.11 bg WLAN" rev 2.00/0.01 addr 2
rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528, address 00:1f:1f:42:ea:b1
run0 at uhub0 port 4 "Ralink 802.11 n WLAN" rev 2.00/1.01 addr 3
run0: MAC/BBP RT3070 (rev 0x0201), RF RT3020 (MIMO 1T1R), address
00:c0:ca:36:b9:1b
vscsi0 at root
scsibus1 at vscsi0: 256 targets
softraid0 at root
root on wd0a swap on wd0b dump on wd0b

Reply | Threaded
Open this post in threaded view
|

Re: ral(4) diff

Igor Zinovik-3
In reply to this post by Tim van der Molen-3
On Mar 10, Tim van der Molen wrote:

> I have the following ral(4):
>
> ral0 at pci0 dev 13 function 0 "Ralink RT2561S" rev 0x00: irq 5, address 00:1d:7d:49:28:92
> ral0: MAC/BBP RT2561C, RF RT2527
>
> After a commit from August 2010 (see
> http://marc.info/?l=openbsd-cvs&m=128095139804862) the ral stopped
> working: clients could not associate with it in hostap mode and it could
> not detect other APs with "ifconfig scan".
>
> After a hint from damien@ I came up with the following diff which brings
> back some of the code that was removed by the commit mentioned above.
>
> damien@ suggested I post the diff here. If you have an RT2561 or RT2661,
> please test it.

My ral(4) was running fine without this diff.  After i applied it
nothing changed, it is working normally.  Clients still can connect to my AP.

ral0 at pci2 dev 10 function 0 "Ralink RT2561S" rev 0x00: irq 11, address 00:11:6b:35:03:d5
ral0: MAC/BBP RT2661B, RF RT2527

Reply | Threaded
Open this post in threaded view
|

Re: ral(4) diff

Sviatoslav Chagaev-3
In reply to this post by Tim van der Molen-3
On Thu, 10 Mar 2011 22:07:09 +0100
Tim van der Molen <[hidden email]> wrote:

> I have the following ral(4):
>
> ral0 at pci0 dev 13 function 0 "Ralink RT2561S" rev 0x00: irq 5, address 00:1d:7d:49:28:92
> ral0: MAC/BBP RT2561C, RF RT2527
>
> After a commit from August 2010 (see
> http://marc.info/?l=openbsd-cvs&m=128095139804862) the ral stopped
> working: clients could not associate with it in hostap mode and it could
> not detect other APs with "ifconfig scan".
>
> After a hint from damien@ I came up with the following diff which brings
> back some of the code that was removed by the commit mentioned above.
>
> damien@ suggested I post the diff here. If you have an RT2561 or RT2661,
> please test it.
>
> Regards,
> Tim
>

Without the patch: after boot I type `ifconfig ral0 scan`, it outputs
the list of detected APs. All subsequent `ifconfig` commands have no
effect, including turning on 'monitor' and 'hostap'. Also, during or
shortly after the second `ifconfig ral0 scan`, a kernel message appears
saying "ral0: device timeout".

With the patch: everything works as expected, including hostap mode.

OpenBSD 4.9-current (GENERIC) #1: Sun Mar 13 01:07:58 EET 2011
    [hidden email]:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Intel Pentium III ("GenuineIntel" 686-class) 862 MHz
cpu0: FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PSE36,MMX,FXSR,SSE
real mem  = 266891264 (254MB)
avail mem = 252387328 (240MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 03/11/02, BIOS32 rev. 0 @ 0xfd880, SMBIOS rev. 2.31 @ 0xefda0 (77 entries)
bios0: vendor FUJITSU SIEMENS // Phoenix Technologies Ltd. version "4.06  Rev. 1.10.1215" date 03/11/2002
bios0: FUJITSU SIEMENS SCENIC xS/SCOVERY xS
apm0 at bios0: Power Management spec V1.2
apm0: AC on, battery charge unknown
acpi at bios0 function 0x0 not configured
pcibios0 at bios0: rev 2.1 @ 0xfd880/0x780
pcibios0: PCI IRQ Routing Table rev 1.0 @ 0xfdf20/192 (10 entries)
pcibios0: PCI Interrupt Router at 000:31:0 ("Intel 82371FB ISA" rev 0x00)
pcibios0: PCI bus #1 is the last bus
bios0: ROM list: 0xc0000/0xc000! 0xcc000/0x1000! 0xcd000/0x4000!
cpu0 at mainbus0: (uniprocessor)
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 "Intel 82815 Host" rev 0x04
vga1 at pci0 dev 2 function 0 "Intel 82815 Video" rev 0x04
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
intagp0 at vga1
agp0 at intagp0: aperture at 0xf8000000, size 0x4000000
ppb0 at pci0 dev 30 function 0 "Intel 82801BA Hub-to-PCI" rev 0x05
pci1 at ppb0 bus 1
fxp0 at pci1 dev 8 function 0 "Intel 82562" rev 0x03, i82562: irq 15, address 00:30:05:17:e5:c6
inphy0 at fxp0 phy 1: i82562EM 10/100 PHY, rev. 0
sis0 at pci1 dev 9 function 0 "SiS 900 10/100BaseTX" rev 0x02: irq 11, address 00:06:4f:0e:94:ed
ukphy0 at sis0 phy 0: Generic IEEE 802.3u media interface, rev. 0: OUI 0x000760, model 0x0000
ral0 at pci1 dev 11 function 0 "Ralink RT2561S" rev 0x00: irq 9, address 00:0e:2e:4e:77:f1
ral0: MAC/BBP RT2561C, RF RT2527
ichpcib0 at pci0 dev 31 function 0 "Intel 82801BA LPC" rev 0x05: 24-bit timer at 3579545Hz
pciide0 at pci0 dev 31 function 1 "Intel 82801BA IDE" rev 0x05: DMA, channel 0 wired to compatibility, channel 1 wired to compatibility
wd0 at pciide0 channel 0 drive 0: <SAMSUNG SP0802N>
wd0: 16-sector PIO, LBA48, 76351MB, 156368016 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 5
pciide0: channel 1 ignored (disabled)
uhci0 at pci0 dev 31 function 2 "Intel 82801BA USB" rev 0x05: irq 9
ichiic0 at pci0 dev 31 function 3 "Intel 82801BA SMBus" rev 0x05: irq 5
iic0 at ichiic0
spdmem0 at iic0 addr 0x55: 128MB SDRAM non-parity PC133CL2
spdmem1 at iic0 addr 0x56: 128MB SDRAM non-parity PC133CL3
uhci1 at pci0 dev 31 function 4 "Intel 82801BA USB" rev 0x05: irq 11
auich0 at pci0 dev 31 function 5 "Intel 82801BA AC97" rev 0x05: irq 5, ICH2 AC97
ac97: codec id 0x41445360 (Analog Devices AD1885)
ac97: codec features headphone, Analog Devices Phat Stereo
audio0 at auich0
isa0 at ichpcib0
isadma0 at isa0
pckbc0 at isa0 port 0x60/5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
usb0 at uhci0: USB revision 1.0
uhub0 at usb0 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb1 at uhci1: USB revision 1.0
uhub1 at usb1 "Intel UHCI root hub" rev 1.00/1.00 addr 1
biomask 7ffd netmask fffd ttymask ffff
mtrr: Pentium Pro MTRR support
vscsi0 at root
scsibus0 at vscsi0: 256 targets
softraid0 at root
root on wd0a swap on wd0b dump on wd0b