From patchwork Sat Dec 5 14:07:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 7775551 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3EF57BEEE1 for ; Sat, 5 Dec 2015 14:07:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 63514204E3 for ; Sat, 5 Dec 2015 14:07:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 80AD720499 for ; Sat, 5 Dec 2015 14:07:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752631AbbLEOHI (ORCPT ); Sat, 5 Dec 2015 09:07:08 -0500 Received: from static.88-198-24-112.clients.your-server.de ([88.198.24.112]:35545 "EHLO nbd.name" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752289AbbLEOHH (ORCPT ); Sat, 5 Dec 2015 09:07:07 -0500 Received: by nf-2.local (Postfix, from userid 501) id 1C9C9116B841F; Sat, 5 Dec 2015 15:07:03 +0100 (CET) From: Felix Fietkau To: linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net Subject: [RFC] mac80211: ignore AP power level when tx power type is "fixed" Date: Sat, 5 Dec 2015 15:07:03 +0100 Message-Id: <1449324423-99589-1-git-send-email-nbd@openwrt.org> X-Mailer: git-send-email 2.2.2 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In some cases a user might want to connect to a far away access point, which announces a low tx power limit. Using the AP's power limit can make the connection significantly more unstable or even impossible, and mac80211 currently provides no way to disable this behavior. To fix this, use the currently unused distinction between limited and fixed tx power to decide whether a remote AP's power limit should be accepted. Signed-off-by: Felix Fietkau --- net/mac80211/iface.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index d6a1a46..f3ee9ab 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -61,7 +61,8 @@ bool __ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata) if (sdata->user_power_level != IEEE80211_UNSET_POWER_LEVEL) power = min(power, sdata->user_power_level); - if (sdata->ap_power_level != IEEE80211_UNSET_POWER_LEVEL) + if (sdata->ap_power_level != IEEE80211_UNSET_POWER_LEVEL && + sdata->vif.bss_conf.txpower_type != NL80211_TX_POWER_FIXED) power = min(power, sdata->ap_power_level); if (power != sdata->vif.bss_conf.txpower) {