From patchwork Mon Aug 31 20:59:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 7101661 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 95C56BEEC1 for ; Mon, 31 Aug 2015 21:01:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CD21C20585 for ; Mon, 31 Aug 2015 21:01:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D9D9920588 for ; Mon, 31 Aug 2015 21:01:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752019AbbHaVBP (ORCPT ); Mon, 31 Aug 2015 17:01:15 -0400 Received: from mail-la0-f47.google.com ([209.85.215.47]:35946 "EHLO mail-la0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751345AbbHaVBO (ORCPT ); Mon, 31 Aug 2015 17:01:14 -0400 Received: by labnh1 with SMTP id nh1so54597830lab.3 for ; Mon, 31 Aug 2015 14:01:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=FW59bNS8iLOVtlQ1xznVRnBxVRHMKNcfDC5t2vJK2Gc=; b=s2moRpeABoCNyg82uTTiem/DIlOZDygiPNhmOjOUyDv5pzo4ViK89rEJHAKO62yDoa wiVu+bdjAZdR5vqosQNKolPbefuktAbeq5ni6+FK8CqAVPCBRVz9eSL6GIkT2HdiHGUi 9UHlfkdS8T1fcUXFr7+XbBopt9VSk1Jha57szOZkkZgb1wBE69Czh6d7th71EX3HR99h rQc41AHnzcobcsITOMwYm4CLUmOe6OtIbj7cBMjwbRW0/47ZKWHkRaFyrFi5GpE5qSPL DOViPvCtvmfsyOuQgPJMNWur+HfIxMTvWYtbAY1RyDXCePp+ckPrNAS/v5+AVY36gz7/ 0R8w== X-Received: by 10.112.167.202 with SMTP id zq10mr11034449lbb.69.1441054872675; Mon, 31 Aug 2015 14:01:12 -0700 (PDT) Received: from linux-tdhb.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id rl3sm711371lbb.7.2015.08.31.14.01.11 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Aug 2015 14:01:11 -0700 (PDT) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: Johannes Berg Cc: linux-wireless@vger.kernel.org, =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Subject: [PATCH] nl80211: put current TX power in interface info Date: Mon, 31 Aug 2015 22:59:38 +0200 Message-Id: <1441054778-22499-1-git-send-email-zajec5@gmail.com> X-Mailer: git-send-email 1.8.4.5 MIME-Version: 1.0 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.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, 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 Many drivers implement reading current TX power (using either cfg80211 or ieee80211 op) but userspace can't get it using nl80211. Right now the only way to access it is to call some wext ioctl. Let's put TX power in interface info reply (callback is wdev specific) just like we do with current channel. To be consistent (e.g. NL80211_CMD_SET_WIPHY) let's use mBm as na unit. Signed-off-by: Rafa? Mi?ecki --- net/wireless/nl80211.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 5d8748b..a5d4e6f 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -2403,6 +2403,17 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag } } + if (rdev->ops->get_tx_power) { + int dbm, ret; + + ret = rdev_get_tx_power(rdev, wdev, &dbm); + if (ret == 0) { + if (nla_put_u32(msg, NL80211_ATTR_WIPHY_TX_POWER_LEVEL, + DBM_TO_MBM(dbm))) + goto nla_put_failure; + } + } + if (wdev->ssid_len) { if (nla_put(msg, NL80211_ATTR_SSID, wdev->ssid_len, wdev->ssid)) goto nla_put_failure;