From patchwork Thu Apr 7 14:29:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammed Shafi Shajakhan X-Patchwork-Id: 8773491 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 8C784C0553 for ; Thu, 7 Apr 2016 14:30:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9CD3A20251 for ; Thu, 7 Apr 2016 14:30:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A511320172 for ; Thu, 7 Apr 2016 14:30:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752539AbcDGOaB (ORCPT ); Thu, 7 Apr 2016 10:30:01 -0400 Received: from wolverine02.qualcomm.com ([199.106.114.251]:21694 "EHLO wolverine02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751089AbcDGOaA (ORCPT ); Thu, 7 Apr 2016 10:30:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qti.qualcomm.com; i=@qti.qualcomm.com; q=dns/txt; s=qcdkim; t=1460039400; x=1491575400; h=from:to:cc:subject:date:message-id:mime-version; bh=F5zYd2zGo2G4sczAKQzLVT4diIsefE5k+cWVEY6fZnY=; b=Pyg9Tgs4iHbyXgsLljhapucqktVecCYHDexdmA0+/psE+t8jhobMi6ZC /rmwGkRKmGlNsi6N1+5ARAHhWrLF3+zDd7gaN0ZQPYGq4IHF4qSNhzn9r R53eV3g0dJdmZe6QQVnxuUp59GKi5BMoPNNrbD+XpsUtiyY9GrO/FR2/p g=; X-IronPort-AV: E=Sophos;i="5.24,449,1455004800"; d="scan'208";a="278137498" Received: from ironmsg03-l-new.qualcomm.com (HELO Ironmsg03-L.qualcomm.com) ([10.53.140.110]) by wolverine02.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 07 Apr 2016 07:29:59 -0700 X-IronPort-AV: E=McAfee;i="5700,7163,8128"; a="1125974968" Received: from nasanexm01c.na.qualcomm.com ([10.85.0.83]) by Ironmsg03-L.qualcomm.com with ESMTP/TLS/RC4-SHA; 07 Apr 2016 07:29:58 -0700 Received: from aphydexm01b.ap.qualcomm.com (10.252.127.11) by NASANEXM01C.na.qualcomm.com (10.85.0.83) with Microsoft SMTP Server (TLS) id 15.0.1130.7; Thu, 7 Apr 2016 07:29:57 -0700 Received: from qcmail1.qualcomm.com (10.80.80.8) by aphydexm01b.ap.qualcomm.com (10.252.127.11) with Microsoft SMTP Server (TLS) id 15.0.1130.7; Thu, 7 Apr 2016 19:59:49 +0530 Received: by qcmail1.qualcomm.com (sSMTP sendmail emulation); Thu, 07 Apr 2016 19:59:35 +0530 From: Mohammed Shafi Shajakhan To: Johannes Berg CC: , Mohammed Shafi Shajakhan Subject: [PATCH v4] cfg80211/nl80211: Add support for NL80211_STA_INFO_RX_DURATION Date: Thu, 7 Apr 2016 19:59:34 +0530 Message-ID: <1460039374-5338-1-git-send-email-mohammed@qti.qualcomm.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: NASANEXM01G.na.qualcomm.com (10.85.0.33) To aphydexm01b.ap.qualcomm.com (10.252.127.11) 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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable 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 From: Mohammed Shafi Shajakhan Add support for new netlink attribute 'NL80211_STA_INFO_RX_DURATION'. 'NL80211_STA_INFO_RX_DURATION' accounts for aggregate PPDU duration in microseconds for all the frames from a peer. Drivers can fill 'rx_duration' field and set the flag 'NL80211_STA_INFO_RX_DURATION'. 'rx_duration' will give an idea about the total time spent by our peer with each of its connected peers. Also extend 'PUT_SINFO' for supporting rx_duration field Signed-off-by: Mohammed Shafi Shajakhan --- include/net/cfg80211.h | 4 +++- include/uapi/linux/nl80211.h | 3 +++ net/wireless/nl80211.c | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 0bbfbf3..e0fe16e 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -1063,11 +1063,12 @@ struct cfg80211_tid_stats { * @rx_beacon: number of beacons received from this peer * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received * from this peer + * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs. */ struct station_info { - u32 filled; + u64 filled; u32 connected_time; u32 inactive_time; u64 rx_bytes; @@ -1106,6 +1107,7 @@ struct station_info { u32 expected_throughput; u64 rx_beacon; + u64 rx_duration; u8 rx_beacon_signal_avg; struct cfg80211_tid_stats pertid[IEEE80211_NUM_TIDS + 1]; }; diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index b2a8d8c..e11559f 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -2482,6 +2482,8 @@ enum nl80211_sta_bss_param { * TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames; * each one of those is again nested with &enum nl80211_tid_stats * attributes carrying the actual values. + * @NL80211_STA_INFO_RX_DURATION: aggregate PPDU duration(usecs) for all the + * frames from a peer * @__NL80211_STA_INFO_AFTER_LAST: internal * @NL80211_STA_INFO_MAX: highest possible station info attribute */ @@ -2518,6 +2520,7 @@ enum nl80211_sta_info { NL80211_STA_INFO_BEACON_RX, NL80211_STA_INFO_BEACON_SIGNAL_AVG, NL80211_STA_INFO_TID_STATS, + NL80211_STA_INFO_RX_DURATION, /* keep last */ __NL80211_STA_INFO_AFTER_LAST, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index d6c6449..3969d10 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -3753,7 +3753,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, goto nla_put_failure; #define PUT_SINFO(attr, memb, type) do { \ - if (sinfo->filled & BIT(NL80211_STA_INFO_ ## attr) && \ + if (sinfo->filled & (1ULL << NL80211_STA_INFO_ ## attr) && \ nla_put_ ## type(msg, NL80211_STA_INFO_ ## attr, \ sinfo->memb)) \ goto nla_put_failure; \ @@ -3779,6 +3779,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, PUT_SINFO(LLID, llid, u16); PUT_SINFO(PLID, plid, u16); PUT_SINFO(PLINK_STATE, plink_state, u8); + PUT_SINFO(RX_DURATION, rx_duration, u64); switch (rdev->wiphy.signal_type) { case CFG80211_SIGNAL_TYPE_MBM: