From patchwork Tue Jan 12 08:42:53 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 72335 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o0C8hYk2006437 for ; Tue, 12 Jan 2010 08:43:35 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753583Ab0ALInd (ORCPT ); Tue, 12 Jan 2010 03:43:33 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753609Ab0ALInd (ORCPT ); Tue, 12 Jan 2010 03:43:33 -0500 Received: from smtp.nokia.com ([192.100.122.233]:44890 "EHLO mgw-mx06.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753571Ab0ALInc (ORCPT ); Tue, 12 Jan 2010 03:43:32 -0500 Received: from esebh105.NOE.Nokia.com (esebh105.ntc.nokia.com [172.21.138.211]) by mgw-mx06.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o0C8hDbV026955; Tue, 12 Jan 2010 10:43:13 +0200 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by esebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 12 Jan 2010 10:43:08 +0200 Received: from mgw-da01.ext.nokia.com ([147.243.128.24]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Tue, 12 Jan 2010 10:43:07 +0200 Received: from [127.0.1.1] (trdhcp21283.nmp.nokia.com [172.22.212.83]) by mgw-da01.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o0C8h3TB006689; Tue, 12 Jan 2010 10:43:04 +0200 Subject: [PATCH PATCH v6 4/7] mac80211: check uapsd state for dynamic power save To: linville@tuxdriver.com From: Kalle Valo Cc: linux-wireless@vger.kernel.org, johannes@sipsolutions.net, a.young.jason@gmail.com Date: Tue, 12 Jan 2010 10:42:53 +0200 Message-ID: <20100112084253.27492.77518.stgit@tikku> In-Reply-To: <20100112084059.27492.86738.stgit@tikku> References: <20100112084059.27492.86738.stgit@tikku> User-Agent: StGit/0.15 MIME-Version: 1.0 X-OriginalArrivalTime: 12 Jan 2010 08:43:07.0846 (UTC) FILETIME=[43967660:01CA9363] X-Nokia-AV: Clean Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index cf846a3..f2cbf9b 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -184,6 +184,7 @@ static ieee80211_tx_result debug_noinline ieee80211_tx_h_dynamic_ps(struct ieee80211_tx_data *tx) { struct ieee80211_local *local = tx->local; + struct ieee80211_if_managed *ifmgd; /* driver doesn't support power save */ if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS)) @@ -208,6 +209,30 @@ ieee80211_tx_h_dynamic_ps(struct ieee80211_tx_data *tx) if (local->quiescing) return TX_CONTINUE; + /* dynamic ps is supported only in managed mode */ + if (tx->sdata->vif.type != NL80211_IFTYPE_STATION) + return TX_CONTINUE; + + ifmgd = &tx->sdata->u.mgd; + + /* + * Don't wakeup from power save if u-apsd is enabled, voip ac has + * u-apsd enabled and the frame is in voip class. This effectively + * means that even if all access categories have u-apsd enabled, in + * practise u-apsd is only used with the voip ac. This is a + * workaround for the case when received voip class packets do not + * have correct qos tag for some reason, due the network or the + * peer application. + * + * Note: local->uapsd_queues access is racy here. If the value is + * changed via debugfs, user needs to reassociate manually to have + * everything in sync. + */ + if ((ifmgd->flags & IEEE80211_STA_UAPSD_ENABLED) + && (local->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VO) + && skb_get_queue_mapping(tx->skb) == 0) + return TX_CONTINUE; + if (local->hw.conf.flags & IEEE80211_CONF_PS) { ieee80211_stop_queues_by_reason(&local->hw, IEEE80211_QUEUE_STOP_REASON_PS);