Return-path: Received: from mail-px0-f174.google.com ([209.85.212.174]:47972 "EHLO mail-px0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751178Ab1BOHsk convert rfc822-to-8bit (ORCPT ); Tue, 15 Feb 2011 02:48:40 -0500 Received: by pxi15 with SMTP id 15so957570pxi.19 for ; Mon, 14 Feb 2011 23:48:40 -0800 (PST) From: Sujith MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Message-ID: <19802.12231.153988.383897@gargle.gargle.HOWL> Date: Tue, 15 Feb 2011 13:18:23 +0530 To: Vivek Natarajan Cc: linville@tuxdriver.net, linux-wireless@vger.kernel.org, johannes@sipsolutions.net Subject: Re: [RFC v2 1/2] mac80211: Fix a race on enabling power save. In-Reply-To: References: <1297750589-15465-1-git-send-email-vnatarajan@atheros.com> <19802.10321.400306.871734@gargle.gargle.HOWL> Sender: linux-wireless-owner@vger.kernel.org List-ID: Vivek Natarajan wrote: > On Tue, Feb 15, 2011 at 12:46 PM, Sujith wrote: > > Vivek Natarajan wrote: > >> ?void ieee80211_dynamic_ps_timer(unsigned long data) > >> diff --git a/net/mac80211/status.c b/net/mac80211/status.c > >> index 010a559..51caa0d 100644 > >> --- a/net/mac80211/status.c > >> +++ b/net/mac80211/status.c > >> @@ -315,7 +315,10 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) > >> ? ? ? ? ? (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) && > >> ? ? ? ? ? !(info->flags & IEEE80211_TX_CTL_INJECTED) && > >> ? ? ? ? ? local->ps_sdata && !(local->scanning)) { > >> - ? ? ? ? ? ? if (info->flags & IEEE80211_TX_STAT_ACK) { > >> + ? ? ? ? ? ? if ((info->flags & IEEE80211_TX_STAT_ACK) && > >> + ? ? ? ? ? ? ? ?(local->ps_sdata->u.mgd.flags & IEEE80211_STA_PS_PENDING)) { > >> + ? ? ? ? ? ? ? ? ? ? ieee80211_stop_queues_by_reason(&local->hw, > >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? IEEE80211_QUEUE_STOP_REASON_PS); > > > > I am not too familiar with the PS code, but why are the queues being stopped > > after the nullfunc frame has been sent out and acked ? And it is a bit unclear why > > the new flag IEEE80211_STA_PS_PENDING is required at all... Can't IEEE80211_STA_NULLFUNC_ACKED > > be used to fix this race ? > > The new flag is required to prevent mac80211 to go into power save if > a frame is sent during the interval of sending nullfunc frame and > receiving ack for that. The queues are stopped to avoid sending any > frame between the interval of receiving ack and setting CONF_PS and it > mainly addresses the race that Johannes pointed out in the previous > version. Well ok, I still don't grok the details, though. :) Sujith