> > Right. This completely solves the race, there's a possible scheme > > where > > the host notifies the firmware of powersave status changes which will > > still help because this can be made faster than the TX queues, but > > still > > leaves a small window. That was hypothetical though, I guess nobody > > implements such a scheme. > > Maybe to your surprise, the iwlwifi firmware implemented this. I thought you just said the firmware follows the powersave transitions by itself (by looking at the frames)? In my hypothetical scheme the driver/stack notifies the firmware about them. > Right. Sorry if my previous "drain queue" comment is misleading, I > actually mean "begin to send until there are no frames to the target STA > in the h/w queues". So my "drain queue" is per DA. Right. > With the STA sleep -> wake state controlled by mac80211, I think we can > avoid the hw callbacks and handle all these in mac80211. What we do is > we add an atomic hw_pending_count in sta_info. We increase the count for > every successfull ops->tx() and decrease it in ieee80211_tx_status > (whatever success or fail). When mac80211 decides to switch STA state > from sleep to wake (and send host command to firmware), it must wait > until hw_pending_count is zero. (BTW, wait here is not accurate. We > actually handled this asynchronously). Hmm, yes, good point, much simpler. johannes
Attachment:
signature.asc
Description: This is a digitally signed message part