developer | be25f90 | 2023-11-01 08:02:53 +0800 | [diff] [blame] | 1 | From ff7b783e3ecad58a18fba135e56afead7ee05e13 Mon Sep 17 00:00:00 2001 |
| 2 | From: Evelyn Tsai <evelyn.tsai@mediatek.com> |
| 3 | Date: Wed, 1 Nov 2023 07:50:56 +0800 |
| 4 | Subject: [PATCH] mac80211: mtk: add packet count input for |
| 5 | dev_sw_netstat_rx_add |
| 6 | |
| 7 | Signed-off-by: Evelyn Tsai <evelyn.tsai@mediatek.com> |
| 8 | --- |
| 9 | backport-include/linux/netdevice.h | 6 ++++-- |
| 10 | drivers/net/usb/qmi_wwan.c | 2 +- |
| 11 | drivers/net/wireless/quantenna/qtnfmac/pcie/pearl_pcie.c | 2 +- |
| 12 | drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c | 2 +- |
| 13 | net/mac80211/rx.c | 8 ++++---- |
| 14 | 5 files changed, 11 insertions(+), 9 deletions(-) |
| 15 | |
| 16 | diff --git a/backport-include/linux/netdevice.h b/backport-include/linux/netdevice.h |
| 17 | index e177319..87fccdf 100644 |
| 18 | --- a/backport-include/linux/netdevice.h |
| 19 | +++ b/backport-include/linux/netdevice.h |
| 20 | @@ -115,13 +115,15 @@ int netif_rx_any_context(struct sk_buff *skb); |
| 21 | |
| 22 | #if LINUX_VERSION_IS_LESS(5,10,0) |
| 23 | #define dev_sw_netstats_rx_add LINUX_BACKPORT(dev_sw_netstats_rx_add) |
| 24 | -static inline void dev_sw_netstats_rx_add(struct net_device *dev, unsigned int len) |
| 25 | +static inline void dev_sw_netstats_rx_add(struct net_device *dev, |
| 26 | + unsigned int packets, |
| 27 | + unsigned int len) |
| 28 | { |
| 29 | struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats); |
| 30 | |
| 31 | u64_stats_update_begin(&tstats->syncp); |
| 32 | tstats->rx_bytes += len; |
| 33 | - tstats->rx_packets++; |
| 34 | + tstats->rx_packets += packets; |
| 35 | u64_stats_update_end(&tstats->syncp); |
| 36 | } |
| 37 | #endif /* < 5.10 */ |
| 38 | diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c |
| 39 | index df0852f..e754400 100644 |
| 40 | --- a/drivers/net/usb/qmi_wwan.c |
| 41 | +++ b/drivers/net/usb/qmi_wwan.c |
| 42 | @@ -228,7 +228,7 @@ static int qmimux_rx_fixup(struct usbnet *dev, struct sk_buff *skb) |
| 43 | net->stats.rx_errors++; |
| 44 | return 0; |
| 45 | } else { |
| 46 | - dev_sw_netstats_rx_add(net, pkt_len); |
| 47 | + dev_sw_netstats_rx_add(net, 1, pkt_len); |
| 48 | } |
| 49 | |
| 50 | skip: |
| 51 | diff --git a/drivers/net/wireless/quantenna/qtnfmac/pcie/pearl_pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pcie/pearl_pcie.c |
| 52 | index 840728e..b6fe82b 100644 |
| 53 | --- a/drivers/net/wireless/quantenna/qtnfmac/pcie/pearl_pcie.c |
| 54 | +++ b/drivers/net/wireless/quantenna/qtnfmac/pcie/pearl_pcie.c |
| 55 | @@ -756,7 +756,7 @@ static int qtnf_pcie_pearl_rx_poll(struct napi_struct *napi, int budget) |
| 56 | skb_put(skb, psize); |
| 57 | ndev = qtnf_classify_skb(bus, skb); |
| 58 | if (likely(ndev)) { |
| 59 | - dev_sw_netstats_rx_add(ndev, skb->len); |
| 60 | + dev_sw_netstats_rx_add(ndev, 1, skb->len); |
| 61 | skb->protocol = eth_type_trans(skb, ndev); |
| 62 | napi_gro_receive(napi, skb); |
| 63 | } else { |
| 64 | diff --git a/drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c |
| 65 | index 9534e1b..d15cfe0 100644 |
| 66 | --- a/drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c |
| 67 | +++ b/drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c |
| 68 | @@ -662,7 +662,7 @@ static int qtnf_topaz_rx_poll(struct napi_struct *napi, int budget) |
| 69 | skb_put(skb, psize); |
| 70 | ndev = qtnf_classify_skb(bus, skb); |
| 71 | if (likely(ndev)) { |
| 72 | - dev_sw_netstats_rx_add(ndev, skb->len); |
| 73 | + dev_sw_netstats_rx_add(ndev, 1, skb->len); |
| 74 | skb->protocol = eth_type_trans(skb, ndev); |
| 75 | netif_receive_skb(skb); |
| 76 | } else { |
| 77 | diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c |
| 78 | index 7304dbd..86d541b 100644 |
| 79 | --- a/net/mac80211/rx.c |
| 80 | +++ b/net/mac80211/rx.c |
| 81 | @@ -856,7 +856,7 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb, |
| 82 | |
| 83 | if (skb) { |
| 84 | skb->dev = sdata->dev; |
| 85 | - dev_sw_netstats_rx_add(skb->dev, skb->len); |
| 86 | + dev_sw_netstats_rx_add(skb->dev, 1, skb->len); |
| 87 | netif_receive_skb(skb); |
| 88 | } |
| 89 | } |
| 90 | @@ -2643,7 +2643,7 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx) |
| 91 | |
| 92 | if (!wiphy_ext_feature_isset(sdata->local->hw.wiphy, |
| 93 | NL80211_EXT_FEATURE_STAS_COUNT) || !rx->sta) |
| 94 | - dev_sw_netstats_rx_add(dev, skb->len); |
| 95 | + dev_sw_netstats_rx_add(dev, 1, skb->len); |
| 96 | |
| 97 | if (rx->sta) { |
| 98 | /* The seqno index has the same property as needed |
| 99 | @@ -3917,7 +3917,7 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx, |
| 100 | } |
| 101 | |
| 102 | prev_dev = sdata->dev; |
| 103 | - dev_sw_netstats_rx_add(sdata->dev, skb->len); |
| 104 | + dev_sw_netstats_rx_add(sdata->dev, 1, skb->len); |
| 105 | } |
| 106 | |
| 107 | if (prev_dev) { |
| 108 | @@ -4549,7 +4549,7 @@ static void ieee80211_rx_8023(struct ieee80211_rx_data *rx, |
| 109 | |
| 110 | if (!wiphy_ext_feature_isset(sta->local->hw.wiphy, |
| 111 | NL80211_EXT_FEATURE_STAS_COUNT)) |
| 112 | - dev_sw_netstats_rx_add(fast_rx->dev, skb->len); |
| 113 | + dev_sw_netstats_rx_add(fast_rx->dev, 1, skb->len); |
| 114 | |
| 115 | /* The seqno index has the same property as needed |
| 116 | * for the rx_msdu field, i.e. it is IEEE80211_NUM_TIDS |
| 117 | -- |
| 118 | 2.18.0 |
| 119 | |