From patchwork Thu Dec 31 13:37:35 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 70384 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 nBVDc0OB002529 for ; Thu, 31 Dec 2009 13:38:00 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752215AbZLaNh7 (ORCPT ); Thu, 31 Dec 2009 08:37:59 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752183AbZLaNh7 (ORCPT ); Thu, 31 Dec 2009 08:37:59 -0500 Received: from smtp.nokia.com ([192.100.122.233]:37596 "EHLO mgw-mx06.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751918AbZLaNh6 (ORCPT ); Thu, 31 Dec 2009 08:37:58 -0500 Received: from esebh106.NOE.Nokia.com (esebh106.ntc.nokia.com [172.21.138.213]) by mgw-mx06.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id nBVDbb4Z030270; Thu, 31 Dec 2009 15:37:38 +0200 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by esebh106.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 31 Dec 2009 15:37:37 +0200 Received: from mgw-sa02.ext.nokia.com ([147.243.1.48]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Thu, 31 Dec 2009 15:37:37 +0200 Received: from [127.0.1.1] (essapo-nirac253202.europe.nokia.com [10.162.253.202]) by mgw-sa02.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id nBVDbZ7r027084; Thu, 31 Dec 2009 15:37:36 +0200 Subject: [RFC PATCH v5 4/7] mac80211: check uapsd state for dynamic power save To: linux-wireless@vger.kernel.org From: Kalle Valo Cc: johannes@sipsolutions.net, a.young.jason@gmail.com Date: Thu, 31 Dec 2009 15:37:35 +0200 Message-ID: <20091231133735.29899.85614.stgit@tikku> In-Reply-To: <20091231133626.29899.95683.stgit@tikku> References: <20091231133626.29899.95683.stgit@tikku> User-Agent: StGit/0.15 MIME-Version: 1.0 X-OriginalArrivalTime: 31 Dec 2009 13:37:37.0230 (UTC) FILETIME=[6A677EE0:01CA8A1E] 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 32bbbc2..a782f4c 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);