Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp465834ybh; Wed, 18 Mar 2020 03:18:56 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuM/ViYj3Px0RSf6BMB5QaGOLh0kUSu2HOqb0t6UiluDz+C5Qas9L7DbBoIkDAMk1cN9QZy X-Received: by 2002:aca:d11:: with SMTP id 17mr2620434oin.128.1584526736563; Wed, 18 Mar 2020 03:18:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584526736; cv=none; d=google.com; s=arc-20160816; b=SXABK2UJnb2dOt/FsryhzqluayOgSf4+JExsdV7LmXHP7QudC8Ar5ZXf8tR2c0lI93 FBPW6W5qKT1UUoZ6++ewBxQT0orAtu3IZDfgDs2vcjhqwMERYjzQu7irfpvne8N32fwF rWcd3/P+c6j3PnTWCyLM+ijd6HPeQvyjZ8nKPWklxjwRzSwEkemldZBWdRYNsroxsylv m5FK/t2S3Oa6Ch6xnXGdpzA4zrTSiRldKTLZtg41QM0s2tjllwUQDlvD8XDI3H5eWXCo ethg0HhZyZt5ZZ/MDoJ1f3vcLx9fwVFU6ImxW6CehL3b1kWW4769fqNgyJ/5yJFA1N6X Wctg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature; bh=O0d05UCJjVD4xSTI3MM3+2mZGIiEeIDQjqFaMpz2WIo=; b=IsaDMSl6z6jNufm22kE00rrASohyi+oEqLBvKYsuNzgRLXfkLGO2k8P0kUlPLbJ7hY LE9YaLz/AI7RSMifV9ED3VqYjdEZs+ydugXdahBjmfUd86Q05WIgJqe08fiz57tCIADn +u4uNkVWmb5VEk3hdugEerEj88DcfOgB+uUvJoyyu2RWxExK1UdyNX1qGK/LjZTE8HNN jiMYLWG/phb5tk8EzBXHVLovcBXwr5B3zIP2Em3P6WF92nHr3OZQmEcEPFrbl0uacbXJ SBlaV1Fo/ebs9bRomXWL9xyXv/Ua4aOZXc1t5LU7kdpSMMXXBjwRleaqgvkRckYaMNMP Uf4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b="nDg/lMn0"; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r1si3334440oti.200.2020.03.18.03.18.36; Wed, 18 Mar 2020 03:18:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b="nDg/lMn0"; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727564AbgCRKQg (ORCPT + 99 others); Wed, 18 Mar 2020 06:16:36 -0400 Received: from mail26.static.mailgun.info ([104.130.122.26]:23576 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726733AbgCRKQg (ORCPT ); Wed, 18 Mar 2020 06:16:36 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1584526595; h=Message-Id: Date: Subject: Cc: To: From: Sender; bh=O0d05UCJjVD4xSTI3MM3+2mZGIiEeIDQjqFaMpz2WIo=; b=nDg/lMn0WEgRUxzVsBrjpPggx10in86AMaCRP/Mf/C7/3R0aux8Bwigfu5iebVcIVGb35Ye+ x7XFI51KgTdcE7CIEMmkhMq8Ww4BYw/3lksA7qH5IyKxyTJv1w0Nz73XPySnxsX+1zXtyIB2 eKdzZ98gmSKSNaA8OU4qI+3Spw8= X-Mailgun-Sending-Ip: 104.130.122.26 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5e71f4f6.7f82f5770c70-smtp-out-n03; Wed, 18 Mar 2020 10:16:22 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 98B0AC432C2; Wed, 18 Mar 2020 10:16:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from c-gsamin-linux.qualcomm.com (blr-c-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: seevalam) by smtp.codeaurora.org (Postfix) with ESMTPSA id E4E72C433CB; Wed, 18 Mar 2020 10:16:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E4E72C433CB Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=seevalam@codeaurora.org From: Seevalamuthu Mariappan To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Seevalamuthu Mariappan Subject: [PATCH] mac80211: Read rx_stats with perCPU pointers Date: Wed, 18 Mar 2020 15:45:55 +0530 Message-Id: <1584526555-25960-1-git-send-email-seevalam@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Use perCPU pointers to get rx_stats in sta_set_sinfo when RSS is enabled Signed-off-by: Seevalamuthu Mariappan --- net/mac80211/sta_info.c | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index f357156..8989a94 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -2150,19 +2150,41 @@ static int sta_set_rate_info_rx(struct sta_info *sta, struct rate_info *rinfo) return 0; } +static inline u64 sta_get_tidstats_msdu(struct ieee80211_sta_rx_stats *rxstats, + int tid) +{ + unsigned int start; + u64 value; + + do { + start = u64_stats_fetch_begin(&rxstats->syncp); + value = rxstats->msdu[tid]; + } while (u64_stats_fetch_retry(&rxstats->syncp, start)); + + return value; +} + static void sta_set_tidstats(struct sta_info *sta, struct cfg80211_tid_stats *tidstats, int tid) { struct ieee80211_local *local = sta->local; + int cpu; if (!(tidstats->filled & BIT(NL80211_TID_STATS_RX_MSDU))) { - unsigned int start; + if (!ieee80211_hw_check(&local->hw, USES_RSS)) + tidstats->rx_msdu += + sta_get_tidstats_msdu(&sta->rx_stats, tid); - do { - start = u64_stats_fetch_begin(&sta->rx_stats.syncp); - tidstats->rx_msdu = sta->rx_stats.msdu[tid]; - } while (u64_stats_fetch_retry(&sta->rx_stats.syncp, start)); + if (sta->pcpu_rx_stats) { + for_each_possible_cpu(cpu) { + struct ieee80211_sta_rx_stats *cpurxs; + + cpurxs = per_cpu_ptr(sta->pcpu_rx_stats, cpu); + tidstats->rx_msdu += + sta_get_tidstats_msdu(cpurxs, tid); + } + } tidstats->filled |= BIT(NL80211_TID_STATS_RX_MSDU); } @@ -2266,7 +2288,8 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, if (!(sinfo->filled & (BIT_ULL(NL80211_STA_INFO_RX_BYTES64) | BIT_ULL(NL80211_STA_INFO_RX_BYTES)))) { - sinfo->rx_bytes += sta_get_stats_bytes(&sta->rx_stats); + if (!ieee80211_hw_check(&local->hw, USES_RSS)) + sinfo->rx_bytes += sta_get_stats_bytes(&sta->rx_stats); if (sta->pcpu_rx_stats) { for_each_possible_cpu(cpu) { -- 1.9.1