From patchwork Wed Oct 2 07:43:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helmut Schaa X-Patchwork-Id: 2973241 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 40EE99F245 for ; Wed, 2 Oct 2013 07:43:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 146DC203A8 for ; Wed, 2 Oct 2013 07:43:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 079F82034E for ; Wed, 2 Oct 2013 07:43:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752916Ab3JBHnT (ORCPT ); Wed, 2 Oct 2013 03:43:19 -0400 Received: from mail-ea0-f169.google.com ([209.85.215.169]:60388 "EHLO mail-ea0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752875Ab3JBHnS (ORCPT ); Wed, 2 Oct 2013 03:43:18 -0400 Received: by mail-ea0-f169.google.com with SMTP id k11so190086eaj.0 for ; Wed, 02 Oct 2013 00:43:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=iHuWJOX5Xd3VYOvi+g/Wd34YgPAYnbxM7Pv2oQmy3q4=; b=SbRKqBX0lpiwggSseuOsSmk1l0Of8ONt/DPSZyr5DyLQFaQbiANurPYIxdYnAKbAsa oMcn8sTVOgsolh8w0KU1Rc100e1w9ddhS+2ZiKazDC/Xkj6yCYWUchNmY/heHdu6WxB7 31M5gSSAw5r3aYgXkNW/lHMvy9XgioZPR0OXPBv4DdbAFU9xzcBk/YM83AZyObcmdPLN 4fcKVLVsTNXwNNIdUhhV7Ly/TMF41Sar0mQe9Q0wdxE/AkXhNSY6IJW4W+N0I5wYqvXc F8hn8E7pxmOelysFPLZTepDPppuBL4J7PXO3nfxaT1HseRj6k2fe1pVecBviSa8aHODq 02CQ== X-Received: by 10.14.45.70 with SMTP id o46mr1482885eeb.19.1380699797034; Wed, 02 Oct 2013 00:43:17 -0700 (PDT) Received: from hschaa-desktop.site ([217.8.58.223]) by mx.google.com with ESMTPSA id h52sm791640eez.3.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 02 Oct 2013 00:43:15 -0700 (PDT) From: Helmut Schaa To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Helmut Schaa Subject: [PATCH] nl80211: Provide per channel maximum regulatory transmit power Date: Wed, 2 Oct 2013 09:43:09 +0200 Message-Id: <1380699789-3765-1-git-send-email-helmut.schaa@googlemail.com> X-Mailer: git-send-email 1.7.10.4 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 its not only required to know the maximum transmit power the hw is capable of. Instead, userspace (hostapd) might want to know the maximum transmit power as defined in the current regulatory domain (for example for 802.11d country IEs). Hence, provide that information to user space via nl80211. Signed-off-by: Helmut Schaa --- include/uapi/linux/nl80211.h | 3 +++ net/wireless/nl80211.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index fde2c02..6130278 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -2230,6 +2230,8 @@ enum nl80211_band_attr { * isn't possible * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number * currently defined + * @NL80211_FREQUENCY_ATTR_MAX_REG_TX_POWER: Maximum regulatory transmission + * power in mBm (100 * dBm). * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use */ enum nl80211_frequency_attr { @@ -2246,6 +2248,7 @@ enum nl80211_frequency_attr { NL80211_FREQUENCY_ATTR_NO_HT40_PLUS, NL80211_FREQUENCY_ATTR_NO_80MHZ, NL80211_FREQUENCY_ATTR_NO_160MHZ, + NL80211_FREQUENCY_ATTR_MAX_REG_TX_POWER, /* keep last */ __NL80211_FREQUENCY_ATTR_AFTER_LAST, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 626dc3b..7c22355 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -584,6 +584,10 @@ static int nl80211_msg_put_channel(struct sk_buff *msg, DBM_TO_MBM(chan->max_power))) goto nla_put_failure; + if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_MAX_REG_TX_POWER, + DBM_TO_MBM(chan->max_reg_power))) + goto nla_put_failure; + return 0; nla_put_failure: