Re: Support power saving with athn(4) in host AP mode

2012-11-12 Thread Uwe Werler
-Ursprüngliche Nachricht-
An: tech@openbsd.org; 
Von:Uwe Werler 
Gesendet:   Mo 12.11.2012 15:32
Betreff:Re: Support power saving with athn(4) in host AP mode
> > Further testing would be welcome.  Even if you don't use clients with
> > power saving enabled.  So if you're running an athn(4) based AP,
> > please give this a spin.
> > 
> 
> Runs like a charme with snapshot from 2012-11-11. Tried Windows 7, Android 
> ICS, 
> IPhone 3S, OpenBSD 4.7 and 5.2, Ubuntu 10.
> 
> Thank You Mark for the excellent work!
> 
> I replaced my existing AP with OpenBSD + Alix now and I'm happy.
> 
> 

add: I use a Wistron DNMA92 (miniPCI) / AR9280

athn0 at pci0 dev 12 function 0 "Atheros AR9280" rev 0x01: irq 9
athn0: AR9280 rev 2 (2T2R), ROM rev 21, address a8:54:b2:3d:fd:a0



Re: Support power saving with athn(4) in host AP mode

2012-11-12 Thread Uwe Werler
> Further testing would be welcome.  Even if you don't use clients with
> power saving enabled.  So if you're running an athn(4) based AP,
> please give this a spin.
> 

Runs like a charme with snapshot from 2012-11-11. Tried Windows 7, Android ICS, 
IPhone 3S, OpenBSD 4.7 and 5.2, Ubuntu 10.

Thank You Mark for the excellent work!

I replaced my existing AP with OpenBSD + Alix now and I'm happy.



Re: Support power saving with athn(4) in host AP mode

2012-10-09 Thread Marko Saarela
On 22.8.2012 12:52, Marko Saarela wrote:
> On 18.8.2012 11:40, Mark Kettenis wrote:
>> Further testing would be welcome.  Even if you don't use clients with
>> power saving enabled.  So if you're running an athn(4) based AP,
>> please give this a spin.
> 
> Been testing this for two days and everything seems to work like a 
> charm. Testing done with two clients, a Windows 7 laptop (Intel Wifi 
> Link 1000 BGN wlan adapter) and with an iPhone 4S (iOS 5.1.1). 
> Previously I could barely have http connections with the laptop (ssh 
> not working) and the iPhone wouldn't connect to the AP at all. Now I 
> have no problems at all using either device. Thanks for making this
> possible!

After some further testing it seems the Windows 7 laptop has issues from
time to time. Most often they appear with power saving set to maximum. I
also bought a new toy, the new iPad, and I've had some annoying issues
with it. The iPad works fine after authenticating, but when I try to use
it again after it has slept for some time I am unable to connect to the
AP. (The iPad shows as "connected" but nothing seems to get through.)
Only cure was to bring the athn interface down and up again on the AP.

Then I noticed Nathanael Rensen's patch on the mailing list (
http://marc.info/?l=openbsd-tech&m=134884569621114 ). The IEEE802.11
parts looked worth trying and what do you know - the problems I had were
solved.

Thanks for the hard work guys! I'll report back if I encounter any more
issues.

Marko



Re: Support power saving with athn(4) in host AP mode

2012-09-10 Thread Peter Kay
It's working reasonably well here, but there's glitches with Android
devices. After a while they either say the AP is 'out of range' or 'saved'
with the non functional option to connect. That's with both an Androided
ICS HP Touchpad and a Sony Ericcson Xperia Pro with latest official ICS.

Sadly the net is not particularly forthcoming with whether this is
ultimately an access point or Android issue. Windows works fine.

I also had one complete wireless failure, but that could easily have been
another issue/hardware, as I managed to pull out the power cable when
fitting a video cable to check the console..

athn0 at pci0 dev 15 function 0 "Atheros AR5416" rev 0x01: irq 3
athn0: MAC AR5416 rev 2, RF AR2133 (3T2R), ROM rev 5, address ...

Cheers - this is much appreciated!

Peter

On 10 September 2012 19:21, Jan Stary  wrote:

> On Aug 18 10:40:23, Mark Kettenis wrote:
> > Finally got annoyed enough that my MacBook running OS X (don't ask)
> > didn't work too well on my OpenBSD AP at home.  The reason is the
> > following caveat listed in the athn(4) man page:
> >
> >  Host AP mode doesn't support power saving.  Clients attempting to
> use
> >  power saving mode may experience significant packet loss (disabling
> power
> >  saving on the client will fix this).
>
> Same here.
>
> > Unfortunately Steve doesn't allow you to disable power saving.  So
> > here is a diff to make athn(4) in host AP mode handle clients that use
> > power saving.  The Mac is much happier now.
> >
> > Further testing would be welcome.  Even if you don't use clients with
> > power saving enabled.  So if you're running an athn(4) based AP,
> > please give this a spin.
>
> This diff seems to be in the tree already, and in the snapshots,
> so I upgraded my i386 AP to current, and indeed, the connections
> from my macbook via wifi no longer die out.
>
> Thank you!
>
> Jan



Re: Support power saving with athn(4) in host AP mode

2012-09-10 Thread Jan Stary
On Aug 18 10:40:23, Mark Kettenis wrote:
> Finally got annoyed enough that my MacBook running OS X (don't ask)
> didn't work too well on my OpenBSD AP at home.  The reason is the
> following caveat listed in the athn(4) man page:
> 
>  Host AP mode doesn't support power saving.  Clients attempting to use
>  power saving mode may experience significant packet loss (disabling power
>  saving on the client will fix this).

Same here.

> Unfortunately Steve doesn't allow you to disable power saving.  So
> here is a diff to make athn(4) in host AP mode handle clients that use
> power saving.  The Mac is much happier now.
> 
> Further testing would be welcome.  Even if you don't use clients with
> power saving enabled.  So if you're running an athn(4) based AP,
> please give this a spin.

This diff seems to be in the tree already, and in the snapshots,
so I upgraded my i386 AP to current, and indeed, the connections
from my macbook via wifi no longer die out.

Thank you!

Jan



Re: Support power saving with athn(4) in host AP mode

2012-08-22 Thread Marko Saarela
On 18.8.2012 11:40, Mark Kettenis wrote:
> Further testing would be welcome.  Even if you don't use clients with
> power saving enabled.  So if you're running an athn(4) based AP,
> please give this a spin.

Been testing this for two days and everything seems to work like a 
charm. Testing done with two clients, a Windows 7 laptop (Intel Wifi 
Link 1000 BGN wlan adapter) and with an iPhone 4S (iOS 5.1.1). 
Previously I could barely have http connections with the laptop (ssh 
not working) and the iPhone wouldn't connect to the AP at all. Now I 
have no problems at all using either device. Thanks for making this
possible!

Dmesg follows.

OpenBSD 5.2-current (GENERIC) #1: Mon Aug 20 17:45:48 EEST 2012
ma...@pluto.my.domain:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Geode(TM) Integrated Processor by AMD PCS ("AuthenticAMD" 586-class) 499 
MHz
cpu0: FPU,DE,PSE,TSC,MSR,CX8,SEP,PGE,CMOV,CFLUSH,MMX,MMXX,3DNOW2,3DNOW
real mem  = 267976704 (255MB)
avail mem = 252686336 (240MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 11/05/08, BIOS32 rev. 0 @ 0xfd088
pcibios0 at bios0: rev 2.1 @ 0xf/0x1
pcibios0: pcibios_get_intr_routing - function not supported
pcibios0: PCI IRQ Routing information unavailable.
pcibios0: PCI bus #0 is the last bus
bios0: ROM list: 0xe/0xa800
cpu0 at mainbus0: (uniprocessor)
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 1 function 0 "AMD Geode LX" rev 0x33
glxsb0 at pci0 dev 1 function 2 "AMD Geode LX Crypto" rev 0x00: RNG AES
vr0 at pci0 dev 9 function 0 "VIA VT6105M RhineIII" rev 0x96: irq 10, address 
00:0d:b9:28:8a:94
ukphy0 at vr0 phy 1: Generic IEEE 802.3u media interface, rev. 3: OUI 0x004063, 
model 0x0034
vr1 at pci0 dev 10 function 0 "VIA VT6105M RhineIII" rev 0x96: irq 11, address 
00:0d:b9:28:8a:95
ukphy1 at vr1 phy 1: Generic IEEE 802.3u media interface, rev. 3: OUI 0x004063, 
model 0x0034
vr2 at pci0 dev 11 function 0 "VIA VT6105M RhineIII" rev 0x96: irq 15, address 
00:0d:b9:28:8a:96
ukphy2 at vr2 phy 1: Generic IEEE 802.3u media interface, rev. 3: OUI 0x004063, 
model 0x0034
athn0 at pci0 dev 12 function 0 "Atheros AR9280" rev 0x01: irq 9
athn0: AR9280 rev 2 (2T2R), ROM rev 21, address 30:14:4a:15:b7:99
glxpcib0 at pci0 dev 15 function 0 "AMD CS5536 ISA" rev 0x03: rev 3, 32-bit 
3579545Hz timer, watchdog, gpio, i2c
gpio0 at glxpcib0: 32 pins
iic0 at glxpcib0
maxtmp0 at iic0 addr 0x4c: lm86
pciide0 at pci0 dev 15 function 2 "AMD CS5536 IDE" rev 0x01: DMA, channel 0 
wired to compatibility, channel 1 wired to compatibility
wd0 at pciide0 channel 0 drive 0: 
wd0: 1-sector PIO, LBA, 3823MB, 7831152 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 4
pciide0: channel 1 ignored (disabled)
ohci0 at pci0 dev 15 function 4 "AMD CS5536 USB" rev 0x02: irq 12, version 1.0, 
legacy support
ehci0 at pci0 dev 15 function 5 "AMD CS5536 USB" rev 0x02: irq 12
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "AMD EHCI root hub" rev 2.00/1.00 addr 1
isa0 at glxpcib0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
com0: console
com1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
usb1 at ohci0: USB revision 1.0
uhub1 at usb1 "AMD OHCI root hub" rev 1.00/1.00 addr 1
mtrr: K6-family MTRR support (2 registers)
nvram: invalid checksum
vscsi0 at root
scsibus0 at vscsi0: 256 targets
softraid0 at root
scsibus1 at softraid0: 256 targets
root on wd0a (6fb7de0bdf1eb17d.a) swap on wd0b dump on wd0b
clock: unknown CMOS layout



Support power saving with athn(4) in host AP mode

2012-08-18 Thread Mark Kettenis
Finally got annoyed enough that my MacBook running OS X (don't ask)
didn't work too well on my OpenBSD AP at home.  The reason is the
following caveat listed in the athn(4) man page:

 Host AP mode doesn't support power saving.  Clients attempting to use
 power saving mode may experience significant packet loss (disabling power
 saving on the client will fix this).

Unfortunately Steve doesn't allow you to disable power saving.  So
here is a diff to make athn(4) in host AP mode handle clients that use
power saving.  The Mac is much happier now.

Further testing would be welcome.  Even if you don't use clients with
power saving enabled.  So if you're running an athn(4) based AP,
please give this a spin.

Thanks,

Mark

P.S. As you can see from the diff, power saving support in the OpenBSD
802.11 network stack is pretty much complete, needing only a one-line
fix.  This means that adding power saving support for oher wireless
drivers shouldn't be too difficult.  If you're interested in a
particular driver and willing to ship hardware, please contact me.


Index: net80211/ieee80211_node.c
===
RCS file: /cvs/src/sys/net80211/ieee80211_node.c,v
retrieving revision 1.71
diff -u -p -r1.71 ieee80211_node.c
--- net80211/ieee80211_node.c   18 Jul 2012 13:24:28 -  1.71
+++ net80211/ieee80211_node.c   17 Aug 2012 21:54:39 -
@@ -204,6 +204,9 @@ ieee80211_node_lateattach(struct ifnet *
ni->ni_chan = IEEE80211_CHAN_ANYC;
ic->ic_bss = ieee80211_ref_node(ni);
ic->ic_txpower = IEEE80211_TXPOWER_MAX;
+#ifndef IEEE80211_STA_ONLY
+   IFQ_SET_MAXLEN(&ni->ni_savedq, IEEE80211_PS_MAX_QUEUE);
+#endif
 }
 
 void
Index: dev/ic/ar5008.c
===
RCS file: /cvs/src/sys/dev/ic/ar5008.c,v
retrieving revision 1.20
diff -u -p -r1.20 ar5008.c
--- dev/ic/ar5008.c 19 Jun 2011 00:27:34 -  1.20
+++ dev/ic/ar5008.c 17 Aug 2012 21:54:41 -
@@ -1053,6 +1053,8 @@ int
 ar5008_swba_intr(struct athn_softc *sc)
 {
struct ieee80211com *ic = &sc->sc_ic;
+   struct ifnet *ifp = &ic->ic_if;
+   struct ieee80211_node *ni = ic->ic_bss;
struct athn_tx_buf *bf = sc->bcnbuf;
struct ieee80211_frame *wh;
struct ar_tx_desc *ds;
@@ -1060,6 +1062,11 @@ ar5008_swba_intr(struct athn_softc *sc)
uint8_t ridx, hwrate;
int error, totlen;
 
+   if (ic->ic_tim_mcast_pending &&
+   IF_IS_EMPTY(&ni->ni_savedq) &&
+   SIMPLEQ_EMPTY(&sc->txq[ATHN_QID_CAB].head))
+   ic->ic_tim_mcast_pending = 0;
+
if (ic->ic_dtim_count == 0)
ic->ic_dtim_count = ic->ic_dtim_period - 1;
else
@@ -1133,6 +1140,26 @@ ar5008_swba_intr(struct athn_softc *sc)
 
AR_WRITE(sc, AR_QTXDP(ATHN_QID_BEACON), bf->bf_daddr);
 
+   for(;;) {
+   if (SIMPLEQ_EMPTY(&sc->txbufs))
+   break;
+
+   IF_DEQUEUE(&ni->ni_savedq, m);
+   if (m == NULL)
+   break;
+   if (!IF_IS_EMPTY(&ni->ni_savedq)) {
+   /* more queued frames, set the more data bit */
+   wh = mtod(m, struct ieee80211_frame *);
+   wh->i_fc[1] |= IEEE80211_FC1_MORE_DATA;
+   }
+   
+   if (sc->ops.tx(sc, m, ni, ATHN_TXFLAG_CAB) != 0) {
+   ieee80211_release_node(ic, ni);
+   ifp->if_oerrors++;
+   break;
+   }
+   }
+
/* Kick Tx. */
AR_WRITE(sc, AR_Q_TXE, 1 << ATHN_QID_BEACON);
AR_WRITE_BARRIER(sc);
@@ -1285,6 +1312,8 @@ ar5008_tx(struct athn_softc *sc, struct 
qid = athn_ac2qid[ieee80211_up_to_ac(ic, tid)];
} else if (type == AR_FRAME_TYPE_PSPOLL) {
qid = ATHN_QID_PSPOLL;
+   } else if (txflags & ATHN_TXFLAG_CAB) {
+   qid = ATHN_QID_CAB;
} else
qid = ATHN_QID_AC_BE;
txq = &sc->txq[qid];
Index: dev/ic/ar9003.c
===
RCS file: /cvs/src/sys/dev/ic/ar9003.c,v
retrieving revision 1.22
diff -u -p -r1.22 ar9003.c
--- dev/ic/ar9003.c 1 Jan 2011 13:44:42 -   1.22
+++ dev/ic/ar9003.c 17 Aug 2012 21:54:42 -
@@ -1183,6 +1183,8 @@ int
 ar9003_swba_intr(struct athn_softc *sc)
 {
struct ieee80211com *ic = &sc->sc_ic;
+   struct ifnet *ifp = &ic->ic_if;
+   struct ieee80211_node *ni = ic->ic_bss;
struct athn_tx_buf *bf = sc->bcnbuf;
struct ieee80211_frame *wh;
struct ar_tx_desc *ds;
@@ -1191,6 +1193,11 @@ ar9003_swba_intr(struct athn_softc *sc)
uint8_t ridx, hwrate;
int error, totlen;
 
+   if (ic->ic_tim_mcast_pending &&
+   IF_IS_EMPTY(&ni->ni_savedq) &&
+   SIMPLEQ_EMPTY(&sc->txq[ATHN_QID_CAB].head))
+   ic->ic_ti