diff mbox series

[1/3] net: mac80211: use core API for updating TX stats

Message ID 20201112110953.34055-1-lev@openvpn.net (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [1/3] net: mac80211: use core API for updating TX stats | expand

Checks

Context Check Description
netdev/cover_letter warning Series does not have a cover letter
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/source_inline success Was 1 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch warning WARNING: From:/Signed-off-by: email address mismatch: 'From: Lev Stipakov <lstipakov@gmail.com>' != 'Signed-off-by: Lev Stipakov <lev@openvpn.net>'
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Lev Stipakov Nov. 12, 2020, 11:09 a.m. UTC
Commit d3fd65484c781 ("net: core: add dev_sw_netstats_tx_add")
has added function "dev_sw_netstats_tx_add()" to update
net device per-cpu TX stats.

Use this function instead of ieee80211_tx_stats().

Signed-off-by: Lev Stipakov <lev@openvpn.net>
---
 net/mac80211/tx.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

Comments

Jakub Kicinski Nov. 12, 2020, 11:30 p.m. UTC | #1
On Thu, 12 Nov 2020 13:09:53 +0200 Lev Stipakov wrote:
> Commit d3fd65484c781 ("net: core: add dev_sw_netstats_tx_add")
> has added function "dev_sw_netstats_tx_add()" to update
> net device per-cpu TX stats.
> 
> Use this function instead of ieee80211_tx_stats().
> 
> Signed-off-by: Lev Stipakov <lev@openvpn.net>

Heiner is actively working on this.

Heiner, would you mind looking at these three patches? If you have
these changes queued in your tree I'm happy to wait for them.
Heiner Kallweit Nov. 13, 2020, 7:14 a.m. UTC | #2
Am 13.11.2020 um 00:30 schrieb Jakub Kicinski:
> On Thu, 12 Nov 2020 13:09:53 +0200 Lev Stipakov wrote:
>> Commit d3fd65484c781 ("net: core: add dev_sw_netstats_tx_add")
>> has added function "dev_sw_netstats_tx_add()" to update
>> net device per-cpu TX stats.
>>
>> Use this function instead of ieee80211_tx_stats().
>>
>> Signed-off-by: Lev Stipakov <lev@openvpn.net>
> 
> Heiner is actively working on this.
> 
> Heiner, would you mind looking at these three patches? If you have
> these changes queued in your tree I'm happy to wait for them.
> 
This series is a good follow-up to what I did already.
I'll have a look at it.
Heiner Kallweit Nov. 13, 2020, 7:16 a.m. UTC | #3
Am 12.11.2020 um 12:09 schrieb Lev Stipakov:
> Commit d3fd65484c781 ("net: core: add dev_sw_netstats_tx_add")
> has added function "dev_sw_netstats_tx_add()" to update
> net device per-cpu TX stats.
> 
> Use this function instead of ieee80211_tx_stats().
> 
I think you can do the same with ieee80211_rx_stats().

> Signed-off-by: Lev Stipakov <lev@openvpn.net>
> ---
>  net/mac80211/tx.c | 16 +++-------------
>  1 file changed, 3 insertions(+), 13 deletions(-)
> 
> diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
> index 5f05f4651dd7..7807f8178527 100644
> --- a/net/mac80211/tx.c
> +++ b/net/mac80211/tx.c
> @@ -38,16 +38,6 @@
>  
>  /* misc utils */
>  
> -static inline void ieee80211_tx_stats(struct net_device *dev, u32 len)
> -{
> -	struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats);
> -
> -	u64_stats_update_begin(&tstats->syncp);
> -	tstats->tx_packets++;
> -	tstats->tx_bytes += len;
> -	u64_stats_update_end(&tstats->syncp);
> -}
> -
>  static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
>  				 struct sk_buff *skb, int group_addr,
>  				 int next_frag_len)
> @@ -3403,7 +3393,7 @@ static void ieee80211_xmit_fast_finish(struct ieee80211_sub_if_data *sdata,
>  	if (key)
>  		info->control.hw_key = &key->conf;
>  
> -	ieee80211_tx_stats(skb->dev, skb->len);
> +	dev_sw_netstats_tx_add(skb->dev, 1, skb->len);
>  
>  	if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) {
>  		tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
> @@ -4021,7 +4011,7 @@ void __ieee80211_subif_start_xmit(struct sk_buff *skb,
>  			goto out;
>  		}
>  
> -		ieee80211_tx_stats(dev, skb->len);
> +		dev_sw_netstats_tx_add(dev, 1, skb->len);
>  
>  		ieee80211_xmit(sdata, sta, skb);
>  	}
> @@ -4248,7 +4238,7 @@ static void ieee80211_8023_xmit(struct ieee80211_sub_if_data *sdata,
>  
>  	info->hw_queue = sdata->vif.hw_queue[skb_get_queue_mapping(skb)];
>  
> -	ieee80211_tx_stats(dev, skb->len);
> +	dev_sw_netstats_tx_add(dev, 1, skb->len);
>  
>  	sta->tx_stats.bytes[skb_get_queue_mapping(skb)] += skb->len;
>  	sta->tx_stats.packets[skb_get_queue_mapping(skb)]++;
>
diff mbox series

Patch

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 5f05f4651dd7..7807f8178527 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -38,16 +38,6 @@ 
 
 /* misc utils */
 
-static inline void ieee80211_tx_stats(struct net_device *dev, u32 len)
-{
-	struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats);
-
-	u64_stats_update_begin(&tstats->syncp);
-	tstats->tx_packets++;
-	tstats->tx_bytes += len;
-	u64_stats_update_end(&tstats->syncp);
-}
-
 static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
 				 struct sk_buff *skb, int group_addr,
 				 int next_frag_len)
@@ -3403,7 +3393,7 @@  static void ieee80211_xmit_fast_finish(struct ieee80211_sub_if_data *sdata,
 	if (key)
 		info->control.hw_key = &key->conf;
 
-	ieee80211_tx_stats(skb->dev, skb->len);
+	dev_sw_netstats_tx_add(skb->dev, 1, skb->len);
 
 	if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) {
 		tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
@@ -4021,7 +4011,7 @@  void __ieee80211_subif_start_xmit(struct sk_buff *skb,
 			goto out;
 		}
 
-		ieee80211_tx_stats(dev, skb->len);
+		dev_sw_netstats_tx_add(dev, 1, skb->len);
 
 		ieee80211_xmit(sdata, sta, skb);
 	}
@@ -4248,7 +4238,7 @@  static void ieee80211_8023_xmit(struct ieee80211_sub_if_data *sdata,
 
 	info->hw_queue = sdata->vif.hw_queue[skb_get_queue_mapping(skb)];
 
-	ieee80211_tx_stats(dev, skb->len);
+	dev_sw_netstats_tx_add(dev, 1, skb->len);
 
 	sta->tx_stats.bytes[skb_get_queue_mapping(skb)] += skb->len;
 	sta->tx_stats.packets[skb_get_queue_mapping(skb)]++;