Hi, After my previous mail about atheros's powersave help I thought about it a bit more. The basic problem this solves is the race condition between software noticing a station went to sleep and stopping to send frames to it. The software will obviously stop sending frames to that station right away, but there may be frames already pending in hardware/DMA fifos/queues. mac80211 contains code that assumes if a packet fails and the station is in powersave mode then this packet failed because of that, but that is obviously suboptimal because the packet will be transmitted even though the station is asleep. Hence the need for hardware/firmware help. For Atheros hardware, this seems to be implemented by having a hardware filter which (I guess) is software controlled. When the station goes to sleep you insert it into the filter and frames that already are in the (DMA) queue/fifo will be filtered instead of transmitted. This still leaves a small window for the race condition because of the processing delay in the stack. Unless of course the filter table is hardware controlled, but then it can only ever *insert* stations into the table, not delete them, it appears that the plan is to handle the delete step by the IEEE80211_TXCTL_CLEAR_DST_MASK tx control flag. Broadcom hardware, on the other hand, has a slightly more complicated scheme. All powersave transitions are registered by the firmware (!) in a hardware FIFO (really a ring buffer I think), the "power management queue". I'm not entirely sure how entries are deleted again, but IIUC they can only be deleted once there are no frames "in flight" for any powersave station any more. The atheros scheme seems to be implemented in mac80211, but I think we might also want to implement the Broadcom scheme. This could be done fully in the driver but that has a chance that the PS flags get out of sync between the firmware, driver and mac80211. To fix this, we'd have to export a new function to set/clear the PS flag (i.e. invoke ap_sta_ps_start/ap_sta_ps_end) on driver request rather than on received frames. Thoughts? johannes
Attachment:
signature.asc
Description: This is a digitally signed message part