blob: 7690697a2e8426263b3926a2cf72a7b474a35747 [file] [log] [blame]
developer43a264f2024-03-26 14:09:54 +08001From f500b4d7d2eb30f46fe0b75afb7b9bd94f96cf55 Mon Sep 17 00:00:00 2001
developere35b8e42023-10-16 11:04:00 +08002From: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
3Date: Wed, 16 Aug 2023 07:23:34 +0800
developerd243af02023-12-21 14:49:33 +08004Subject: [PATCH 31/37] mtk: mac80211: add per-bss flag to support vendors
developere35b8e42023-10-16 11:04:00 +08005 counter
6
7---
8 include/uapi/linux/nl80211.h | 1 +
9 net/mac80211/rx.c | 8 ++++++--
10 net/mac80211/tx.c | 13 ++++++++++---
11 3 files changed, 17 insertions(+), 5 deletions(-)
12
13diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
14index 6e96ad9..b1555bb 100644
15--- a/include/uapi/linux/nl80211.h
16+++ b/include/uapi/linux/nl80211.h
17@@ -6471,6 +6471,7 @@ enum nl80211_ext_feature_index {
18 NL80211_EXT_FEATURE_PUNCT,
19 NL80211_EXT_FEATURE_SECURE_NAN,
20 NL80211_EXT_FEATURE_AUTH_AND_DEAUTH_RANDOM_TA,
21+ NL80211_EXT_FEATURE_STAS_COUNT,
22
23 /* add new features before the definition below */
24 NUM_NL80211_EXT_FEATURES,
25diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
developer43a264f2024-03-26 14:09:54 +080026index 7a80945..0cf8c59 100644
developere35b8e42023-10-16 11:04:00 +080027--- a/net/mac80211/rx.c
28+++ b/net/mac80211/rx.c
developer43a264f2024-03-26 14:09:54 +080029@@ -2631,7 +2631,9 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx)
developere35b8e42023-10-16 11:04:00 +080030 skb = rx->skb;
31 xmit_skb = NULL;
32
33- dev_sw_netstats_rx_add(dev, 1, skb->len);
34+ if (!wiphy_ext_feature_isset(sdata->local->hw.wiphy,
35+ NL80211_EXT_FEATURE_STAS_COUNT) || !rx->sta)
36+ dev_sw_netstats_rx_add(dev, 1, skb->len);
37
38 if (rx->sta) {
39 /* The seqno index has the same property as needed
40@@ -4762,7 +4764,9 @@ static void ieee80211_rx_8023(struct ieee80211_rx_data *rx,
41
42 skb->dev = fast_rx->dev;
43
44- dev_sw_netstats_rx_add(fast_rx->dev, 1, skb->len);
45+ if (!wiphy_ext_feature_isset(sta->local->hw.wiphy,
46+ NL80211_EXT_FEATURE_STAS_COUNT))
47+ dev_sw_netstats_rx_add(fast_rx->dev, 1, skb->len);
48
49 /* The seqno index has the same property as needed
50 * for the rx_msdu field, i.e. it is IEEE80211_NUM_TIDS
51diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
developer43a264f2024-03-26 14:09:54 +080052index c8fade8..0f6c960 100644
developere35b8e42023-10-16 11:04:00 +080053--- a/net/mac80211/tx.c
54+++ b/net/mac80211/tx.c
developer43a264f2024-03-26 14:09:54 +080055@@ -3541,7 +3541,9 @@ ieee80211_xmit_fast_finish(struct ieee80211_sub_if_data *sdata,
developere35b8e42023-10-16 11:04:00 +080056 if (key)
57 info->control.hw_key = &key->conf;
58
59- dev_sw_netstats_tx_add(skb->dev, 1, skb->len);
60+ if (!wiphy_ext_feature_isset(sta->local->hw.wiphy,
61+ NL80211_EXT_FEATURE_STAS_COUNT))
62+ dev_sw_netstats_tx_add(skb->dev, 1, skb->len);
63
64 if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) {
65 tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
developer43a264f2024-03-26 14:09:54 +080066@@ -4313,7 +4315,9 @@ void __ieee80211_subif_start_xmit(struct sk_buff *skb,
developere35b8e42023-10-16 11:04:00 +080067 goto out;
68 }
69
70- dev_sw_netstats_tx_add(dev, 1, skb->len);
71+ if (!wiphy_ext_feature_isset(sdata->local->hw.wiphy,
72+ NL80211_EXT_FEATURE_STAS_COUNT) || !sta)
73+ dev_sw_netstats_tx_add(dev, 1, skb->len);
74
75 ieee80211_xmit(sdata, sta, skb);
76 }
developer43a264f2024-03-26 14:09:54 +080077@@ -4645,7 +4649,10 @@ static void ieee80211_8023_xmit(struct ieee80211_sub_if_data *sdata,
developere35b8e42023-10-16 11:04:00 +080078 info->ack_frame_id = ieee80211_store_ack_skb(local, skb,
79 &info->flags, NULL);
80
81- dev_sw_netstats_tx_add(dev, skbs, len);
82+ if (!wiphy_ext_feature_isset(sta->local->hw.wiphy,
83+ NL80211_EXT_FEATURE_STAS_COUNT))
84+ dev_sw_netstats_tx_add(dev, skbs, len);
85+
86 sta->deflink.tx_stats.packets[queue] += skbs;
87 sta->deflink.tx_stats.bytes[queue] += len;
88
89--
902.18.0
91