From patchwork Fri Apr 27 05:30:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamizh chelvam X-Patchwork-Id: 10367439 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CC9716038F for ; Fri, 27 Apr 2018 05:30:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE530292FB for ; Fri, 27 Apr 2018 05:30:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B2DC4292FF; Fri, 27 Apr 2018 05:30:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 38760292FB for ; Fri, 27 Apr 2018 05:30:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757428AbeD0Fab (ORCPT ); Fri, 27 Apr 2018 01:30:31 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:52812 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757423AbeD0Fa2 (ORCPT ); Fri, 27 Apr 2018 01:30:28 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 2E57B60807; Fri, 27 Apr 2018 05:30:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524807028; bh=wZIoqzyPZ130sX1RcoLM+QrbeAmnHdxiYhESAPuAYXk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CzV+++WeLl2G3JsFpkvont4s+sxrZG0FbzrapyBvC5Cs0JNDrpBEKcN8ryW+nqUWh eNOp8zDB6Nzbl7IUkoUpo6oZyfK7VG5Gr+E1BsbWgHMxplih/inqWvF5DFyTZip3ld b63Xd7tD5YgFtbsFVrzY5wKS/jrjA9sKSJ4yNsyQ= Received: from che-swdbs-01.qca.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: tamizhr@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 5E18060310; Fri, 27 Apr 2018 05:30:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524807027; bh=wZIoqzyPZ130sX1RcoLM+QrbeAmnHdxiYhESAPuAYXk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P4KNqufDPAMYGvYPXWH7PvHwvUtjoQIKH4LdLw1YNyNkTTvTZAnY1Be/LqVdQYWuG ss34HaV9NVMWRBZmCBUt5a0k5BeFvLr5pz5diYofSDwKlZKwjy0U5B/LIzyDuTe6iA jF4hWEk4aAVPcR6CEUU+SLk8FJRsL5g7IiYnqnj8= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 5E18060310 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=tamizhr@codeaurora.org From: Tamizh chelvam To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Tamizh chelvam Subject: [RFCv2 5/6] mac80211: Add support to configure txrate threshold for station Date: Fri, 27 Apr 2018 11:00:35 +0530 Message-Id: <1524807036-28056-6-git-send-email-tamizhr@codeaurora.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1524807036-28056-1-git-send-email-tamizhr@codeaurora.org> References: <1524807036-28056-1-git-send-email-tamizhr@codeaurora.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch add support to configure station specific low and high txrate thresholds using ieee80211_set_sta_mon_txrate_config API. This configuration is used for tracking the txrate for connected stations. Signed-off-by: Tamizh chelvam --- net/mac80211/cfg.c | 35 +++++++++++++++++++++++++++++++++++ net/mac80211/sta_info.h | 5 +++++ 2 files changed, 40 insertions(+) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 0e2047c..ba2555d 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -3778,6 +3778,40 @@ static int ieee80211_set_sta_mon_rssi_range_confg(struct wiphy *wiphy, return 0; } +static int ieee80211_set_sta_mon_txrate_config(struct wiphy *wiphy, + struct net_device *dev, + const u8 *peer, + u32 low_txrate_thold, + u32 high_txrate_thold) +{ + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); + struct sta_info *sta; + + if (sdata->vif.type == NL80211_IFTYPE_AP && + !wiphy_ext_feature_isset(sdata->local->hw.wiphy, + NL80211_EXT_FEATURE_STA_MON_TXRATE_CONFIG)) + return -EOPNOTSUPP; + + mutex_lock(&sdata->local->sta_mtx); + + sta = sta_info_get_bss(sdata, peer); + if (!sta) { + mutex_unlock(&sdata->local->sta_mtx); + return -ENOENT; + } + + if (sta->txrate_low == low_txrate_thold && + sta->txrate_high == high_txrate_thold) + goto unlock; + + sta->txrate_low = low_txrate_thold; + sta->txrate_high = high_txrate_thold; + +unlock: + mutex_unlock(&sdata->local->sta_mtx); + return 0; +} + const struct cfg80211_ops mac80211_config_ops = { .add_virtual_intf = ieee80211_add_iface, .del_virtual_intf = ieee80211_del_iface, @@ -3873,4 +3907,5 @@ static int ieee80211_set_sta_mon_rssi_range_confg(struct wiphy *wiphy, .tx_control_port = ieee80211_tx_control_port, .set_sta_mon_rssi_config = ieee80211_set_sta_mon_rssi_config, .set_sta_mon_rssi_range_config = ieee80211_set_sta_mon_rssi_range_confg, + .set_sta_mon_txrate_config = ieee80211_set_sta_mon_txrate_config, }; diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index 1599973..c73d010 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h @@ -496,6 +496,8 @@ struct ieee80211_sta_rx_stats { * @count_rx_signal: Number of data frames used in averaging station signal. * This can be used to avoid generating less reliable station rssi cross * events that would be based only on couple of received frames. + * @txrate_low: TXRATE lower threshold for a station to monitor + * @txrate_high: TXRATE upper threshold for a station to monitor */ struct sta_info { /* General information, mostly static */ @@ -603,6 +605,9 @@ struct sta_info { int last_sta_mon_event_signal; unsigned int count_rx_signal; + u32 txrate_low; + u32 txrate_high; + /* keep last! */ struct ieee80211_sta sta; };