blob: cefbd2c236bf91decae319bdda66ce49ca338696 [file] [log] [blame]
developere0cba192023-07-28 07:08:38 +08001From 26b093ef1b3bcbd168216ea4d94baedfb1dd5366 Mon Sep 17 00:00:00 2001
developer7be29542023-06-28 17:30:38 +08002From: "sujuan.chen" <sujuan.chen@mediatek.com>
3Date: Tue, 30 May 2023 15:36:33 +0800
developere0cba192023-07-28 07:08:38 +08004Subject: [PATCH 9903/9903] mac80211: mtk: add per-bss flag to support vendors
5 counter
developer7be29542023-06-28 17:30:38 +08006
7Signed-off-by: sujuan.chen <sujuan.chen@mediatek.com>
8---
9 include/uapi/linux/nl80211.h | 1 +
10 net/mac80211/rx.c | 8 ++++++--
11 net/mac80211/tx.c | 13 ++++++++++---
12 3 files changed, 17 insertions(+), 5 deletions(-)
13
14diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
15index 3e348a5..659ae8d 100644
16--- a/include/uapi/linux/nl80211.h
17+++ b/include/uapi/linux/nl80211.h
18@@ -6102,6 +6102,7 @@ enum nl80211_ext_feature_index {
19 NL80211_EXT_FEATURE_BSS_COLOR,
20 NL80211_EXT_FEATURE_FILS_CRYPTO_OFFLOAD,
21 NL80211_EXT_FEATURE_RADAR_BACKGROUND,
22+ NL80211_EXT_FEATURE_STAS_COUNT,
23
24 /* add new features before the definition below */
25 NUM_NL80211_EXT_FEATURES,
26diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
developere0cba192023-07-28 07:08:38 +080027index a9fcc7a..7304dbd 100644
developer7be29542023-06-28 17:30:38 +080028--- a/net/mac80211/rx.c
29+++ b/net/mac80211/rx.c
30@@ -2641,7 +2641,9 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx)
31 skb = rx->skb;
32 xmit_skb = NULL;
33
34- dev_sw_netstats_rx_add(dev, skb->len);
35+ if (!wiphy_ext_feature_isset(sdata->local->hw.wiphy,
36+ NL80211_EXT_FEATURE_STAS_COUNT) || !rx->sta)
37+ dev_sw_netstats_rx_add(dev, skb->len);
38
39 if (rx->sta) {
40 /* The seqno index has the same property as needed
developere0cba192023-07-28 07:08:38 +080041@@ -4545,7 +4547,9 @@ static void ieee80211_rx_8023(struct ieee80211_rx_data *rx,
developer7be29542023-06-28 17:30:38 +080042
43 skb->dev = fast_rx->dev;
44
45- dev_sw_netstats_rx_add(fast_rx->dev, skb->len);
46+ if (!wiphy_ext_feature_isset(sta->local->hw.wiphy,
47+ NL80211_EXT_FEATURE_STAS_COUNT))
48+ dev_sw_netstats_rx_add(fast_rx->dev, skb->len);
49
50 /* The seqno index has the same property as needed
51 * for the rx_msdu field, i.e. it is IEEE80211_NUM_TIDS
52diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
developere0cba192023-07-28 07:08:38 +080053index 50ba10c..e071130 100644
developer7be29542023-06-28 17:30:38 +080054--- a/net/mac80211/tx.c
55+++ b/net/mac80211/tx.c
56@@ -3454,7 +3454,9 @@ ieee80211_xmit_fast_finish(struct ieee80211_sub_if_data *sdata,
57 if (key)
58 info->control.hw_key = &key->conf;
59
60- dev_sw_netstats_tx_add(skb->dev, 1, skb->len);
61+ if (!wiphy_ext_feature_isset(sta->local->hw.wiphy,
62+ NL80211_EXT_FEATURE_STAS_COUNT))
63+ dev_sw_netstats_tx_add(skb->dev, 1, skb->len);
64
65 if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) {
66 tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
67@@ -4219,7 +4221,9 @@ void __ieee80211_subif_start_xmit(struct sk_buff *skb,
68 goto out;
69 }
70
71- dev_sw_netstats_tx_add(dev, 1, skb->len);
72+ if (!wiphy_ext_feature_isset(sdata->local->hw.wiphy,
73+ NL80211_EXT_FEATURE_STAS_COUNT) || !sta)
74+ dev_sw_netstats_tx_add(dev, 1, skb->len);
75
76 ieee80211_xmit(sdata, sta, skb);
77 }
78@@ -4497,7 +4501,10 @@ static void ieee80211_8023_xmit(struct ieee80211_sub_if_data *sdata,
79 info->ack_frame_id = ieee80211_store_ack_skb(local, skb,
80 &info->flags, NULL);
81
82- dev_sw_netstats_tx_add(dev, skbs, len);
83+ if (!wiphy_ext_feature_isset(sta->local->hw.wiphy,
84+ NL80211_EXT_FEATURE_STAS_COUNT))
85+ dev_sw_netstats_tx_add(dev, skbs, len);
86+
87 sta->tx_stats.packets[queue] += skbs;
88 sta->tx_stats.bytes[queue] += len;
89
90--
912.18.0
92