linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] net: mac80211: use core API for updating TX stats
@ 2020-11-12 11:09 Lev Stipakov
  2020-11-12 23:30 ` Jakub Kicinski
  2020-11-13  7:16 ` Heiner Kallweit
  0 siblings, 2 replies; 13+ messages in thread
From: Lev Stipakov @ 2020-11-12 11:09 UTC (permalink / raw)
  To: Johannes Berg, David S. Miller, Jakub Kicinski, linux-wireless,
	netdev, linux-kernel
  Cc: 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().

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)]++;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/3] net: mac80211: use core API for updating TX stats
  2020-11-12 11:09 [PATCH 1/3] net: mac80211: use core API for updating TX stats Lev Stipakov
@ 2020-11-12 23:30 ` Jakub Kicinski
  2020-11-13  7:14   ` Heiner Kallweit
  2020-11-13  7:16 ` Heiner Kallweit
  1 sibling, 1 reply; 13+ messages in thread
From: Jakub Kicinski @ 2020-11-12 23:30 UTC (permalink / raw)
  To: Lev Stipakov
  Cc: Johannes Berg, David S. Miller, linux-wireless, netdev,
	linux-kernel, Lev Stipakov, Heiner Kallweit

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.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/3] net: mac80211: use core API for updating TX stats
  2020-11-12 23:30 ` Jakub Kicinski
@ 2020-11-13  7:14   ` Heiner Kallweit
  0 siblings, 0 replies; 13+ messages in thread
From: Heiner Kallweit @ 2020-11-13  7:14 UTC (permalink / raw)
  To: Jakub Kicinski, Lev Stipakov
  Cc: Johannes Berg, David S. Miller, linux-wireless, netdev,
	linux-kernel, Lev Stipakov

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.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/3] net: mac80211: use core API for updating TX stats
  2020-11-12 11:09 [PATCH 1/3] net: mac80211: use core API for updating TX stats Lev Stipakov
  2020-11-12 23:30 ` Jakub Kicinski
@ 2020-11-13  7:16 ` Heiner Kallweit
  2020-11-13  8:58   ` [PATCH v2 1/3] net: mac80211: use core API for updating TX/RX stats Lev Stipakov
  1 sibling, 1 reply; 13+ messages in thread
From: Heiner Kallweit @ 2020-11-13  7:16 UTC (permalink / raw)
  To: Lev Stipakov, Johannes Berg, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel
  Cc: Lev Stipakov

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)]++;
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 1/3] net: mac80211: use core API for updating TX/RX stats
  2020-11-13  7:16 ` Heiner Kallweit
@ 2020-11-13  8:58   ` Lev Stipakov
  2020-11-13 10:44     ` Heiner Kallweit
  2020-11-13 10:55     ` Johannes Berg
  0 siblings, 2 replies; 13+ messages in thread
From: Lev Stipakov @ 2020-11-13  8:58 UTC (permalink / raw)
  To: Johannes Berg, David S. Miller, Jakub Kicinski, linux-wireless,
	netdev, linux-kernel, linux-kernel, Heiner Kallweit
  Cc: Lev Stipakov

Commits

  d3fd65484c781 ("net: core: add dev_sw_netstats_tx_add")
  451b05f413d3f ("net: netdevice.h: sw_netstats_rx_add helper)

have added API to update net device per-cpu TX/RX stats.

Use core API instead of ieee80211_tx/rx_stats().

Signed-off-by: Lev Stipakov <lev@openvpn.net>
---
 v2: also replace ieee80211_rx_stats() with dev_sw_netstats_rx_add()

 net/mac80211/rx.c | 18 ++++--------------
 net/mac80211/tx.c | 16 +++-------------
 2 files changed, 7 insertions(+), 27 deletions(-)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 09d1c9fb8872..0c1a19a93c79 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -32,16 +32,6 @@
 #include "wme.h"
 #include "rate.h"
 
-static inline void ieee80211_rx_stats(struct net_device *dev, u32 len)
-{
-	struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats);
-
-	u64_stats_update_begin(&tstats->syncp);
-	tstats->rx_packets++;
-	tstats->rx_bytes += len;
-	u64_stats_update_end(&tstats->syncp);
-}
-
 /*
  * monitor mode reception
  *
@@ -842,7 +832,7 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
 
 			if (skb) {
 				skb->dev = sdata->dev;
-				ieee80211_rx_stats(skb->dev, skb->len);
+				dev_sw_netstats_rx_add(skb->dev, skb->len);
 				netif_receive_skb(skb);
 			}
 		}
@@ -2560,7 +2550,7 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx)
 	skb = rx->skb;
 	xmit_skb = NULL;
 
-	ieee80211_rx_stats(dev, skb->len);
+	dev_sw_netstats_rx_add(dev, skb->len);
 
 	if (rx->sta) {
 		/* The seqno index has the same property as needed
@@ -3699,7 +3689,7 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx,
 		}
 
 		prev_dev = sdata->dev;
-		ieee80211_rx_stats(sdata->dev, skb->len);
+		dev_sw_netstats_rx_add(sdata->dev, skb->len);
 	}
 
 	if (prev_dev) {
@@ -4416,7 +4406,7 @@ static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx,
 
 	skb->dev = fast_rx->dev;
 
-	ieee80211_rx_stats(fast_rx->dev, skb->len);
+	dev_sw_netstats_rx_add(fast_rx->dev, skb->len);
 
 	/* The seqno index has the same property as needed
 	 * for the rx_msdu field, i.e. it is IEEE80211_NUM_TIDS
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)]++;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 1/3] net: mac80211: use core API for updating TX/RX stats
  2020-11-13  8:58   ` [PATCH v2 1/3] net: mac80211: use core API for updating TX/RX stats Lev Stipakov
@ 2020-11-13 10:44     ` Heiner Kallweit
  2020-11-13 10:55     ` Johannes Berg
  1 sibling, 0 replies; 13+ messages in thread
From: Heiner Kallweit @ 2020-11-13 10:44 UTC (permalink / raw)
  To: Lev Stipakov, Johannes Berg, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel, linux-kernel
  Cc: Lev Stipakov

Am 13.11.2020 um 09:58 schrieb Lev Stipakov:
> Commits
> 
>   d3fd65484c781 ("net: core: add dev_sw_netstats_tx_add")
>   451b05f413d3f ("net: netdevice.h: sw_netstats_rx_add helper)
> 
> have added API to update net device per-cpu TX/RX stats.
> 
> Use core API instead of ieee80211_tx/rx_stats().
> 
> Signed-off-by: Lev Stipakov <lev@openvpn.net>
> ---
>  v2: also replace ieee80211_rx_stats() with dev_sw_netstats_rx_add()
> 
Reviewed-by: Heiner Kallweit <hkallweit1@gmail.com>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 1/3] net: mac80211: use core API for updating TX/RX stats
  2020-11-13  8:58   ` [PATCH v2 1/3] net: mac80211: use core API for updating TX/RX stats Lev Stipakov
  2020-11-13 10:44     ` Heiner Kallweit
@ 2020-11-13 10:55     ` Johannes Berg
  2020-11-13 12:25       ` Lev Stipakov
  1 sibling, 1 reply; 13+ messages in thread
From: Johannes Berg @ 2020-11-13 10:55 UTC (permalink / raw)
  To: Lev Stipakov, David S. Miller, Jakub Kicinski, linux-wireless,
	netdev, linux-kernel, linux-kernel, Heiner Kallweit
  Cc: Lev Stipakov

On Fri, 2020-11-13 at 10:58 +0200, Lev Stipakov wrote:
> Commits
> 
>   d3fd65484c781 ("net: core: add dev_sw_netstats_tx_add")
>   451b05f413d3f ("net: netdevice.h: sw_netstats_rx_add helper)
> 
> have added API to update net device per-cpu TX/RX stats.
> 
> Use core API instead of ieee80211_tx/rx_stats().
> 

This looks like a 1/3 but I only ever saw this, not the others.

Seems I should take this through my tree, any objections?


johannes


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 1/3] net: mac80211: use core API for updating TX/RX stats
  2020-11-13 10:55     ` Johannes Berg
@ 2020-11-13 12:25       ` Lev Stipakov
  2020-11-13 19:51         ` Jakub Kicinski
  0 siblings, 1 reply; 13+ messages in thread
From: Lev Stipakov @ 2020-11-13 12:25 UTC (permalink / raw)
  To: Johannes Berg
  Cc: David S. Miller, Jakub Kicinski, linux-wireless, netdev,
	linux-kernel, Heiner Kallweit, Lev Stipakov

Hi,

> This looks like a 1/3 but I only ever saw this, not the others.

The rest are similar changes for openvswitch and xfrm subsystems, so
I've sent those to the list of maintainers I got from
scripts/get_maintainer.pl.

-- 
-Lev

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 1/3] net: mac80211: use core API for updating TX/RX stats
  2020-11-13 12:25       ` Lev Stipakov
@ 2020-11-13 19:51         ` Jakub Kicinski
  2020-11-13 19:52           ` Johannes Berg
  2020-11-13 21:25           ` Lev Stipakov
  0 siblings, 2 replies; 13+ messages in thread
From: Jakub Kicinski @ 2020-11-13 19:51 UTC (permalink / raw)
  To: Lev Stipakov, Johannes Berg
  Cc: David S. Miller, linux-wireless, netdev, linux-kernel,
	Heiner Kallweit, Lev Stipakov

On Fri, 13 Nov 2020 14:25:25 +0200 Lev Stipakov wrote:
> > Seems I should take this through my tree, any objections?

Go for it, you may need to pull net-next first but that should happen
soonish anyway, when I get to your pr.

> The rest are similar changes for openvswitch and xfrm subsystems, so
> I've sent those to the list of maintainers I got from
> scripts/get_maintainer.pl.

Lev, please either post the patches separately (non-series) or make
them a proper series which has a cover letter etc. and CC folks on all
the patches.

Since there are no dependencies between the patches here you could have
gone for separate patches here.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 1/3] net: mac80211: use core API for updating TX/RX stats
  2020-11-13 19:51         ` Jakub Kicinski
@ 2020-11-13 19:52           ` Johannes Berg
  2020-11-13 21:25           ` Lev Stipakov
  1 sibling, 0 replies; 13+ messages in thread
From: Johannes Berg @ 2020-11-13 19:52 UTC (permalink / raw)
  To: Jakub Kicinski, Lev Stipakov
  Cc: David S. Miller, linux-wireless, netdev, linux-kernel,
	Heiner Kallweit, Lev Stipakov

On Fri, 2020-11-13 at 11:51 -0800, Jakub Kicinski wrote:
> On Fri, 13 Nov 2020 14:25:25 +0200 Lev Stipakov wrote:
> > > Seems I should take this through my tree, any objections?
> 
> Go for it, you may need to pull net-next first but that should happen
> soonish anyway, when I get to your pr.

Yeah, I'll fast forward once you have pulled that, and generally I don't
apply anything while I have open pull requests (in case I have to
rejigger or whatnot), so all should be well. :)

Thanks!

johannes


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 1/3] net: mac80211: use core API for updating TX/RX stats
  2020-11-13 19:51         ` Jakub Kicinski
  2020-11-13 19:52           ` Johannes Berg
@ 2020-11-13 21:25           ` Lev Stipakov
  2020-11-13 21:31             ` Jakub Kicinski
  1 sibling, 1 reply; 13+ messages in thread
From: Lev Stipakov @ 2020-11-13 21:25 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Johannes Berg, David S. Miller, linux-wireless, netdev,
	linux-kernel, Heiner Kallweit, Lev Stipakov

> Lev, please either post the patches separately (non-series) or make
> them a proper series which has a cover letter etc. and CC folks on all
> the patches.

Understood, thanks.

> Since there are no dependencies between the patches here you could have
> gone for separate patches here.

Shall I re-send those 3 patches separately or can we proceed with those
in the (sub-optimal) form they've been already sent?

-- 
-Lev

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 1/3] net: mac80211: use core API for updating TX/RX stats
  2020-11-13 21:25           ` Lev Stipakov
@ 2020-11-13 21:31             ` Jakub Kicinski
  2020-11-13 21:46               ` [PATCH v3] " Lev Stipakov
  0 siblings, 1 reply; 13+ messages in thread
From: Jakub Kicinski @ 2020-11-13 21:31 UTC (permalink / raw)
  To: Lev Stipakov
  Cc: Johannes Berg, David S. Miller, linux-wireless, netdev,
	linux-kernel, Heiner Kallweit, Lev Stipakov

On Fri, 13 Nov 2020 23:25:31 +0200 Lev Stipakov wrote:
> > Since there are no dependencies between the patches here you could have
> > gone for separate patches here.  
> 
> Shall I re-send those 3 patches separately or can we proceed with those
> in the (sub-optimal) form they've been already sent?

Resend would be great, please keep Heiner's review tags.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v3] net: mac80211: use core API for updating TX/RX stats
  2020-11-13 21:31             ` Jakub Kicinski
@ 2020-11-13 21:46               ` Lev Stipakov
  0 siblings, 0 replies; 13+ messages in thread
From: Lev Stipakov @ 2020-11-13 21:46 UTC (permalink / raw)
  To: Johannes Berg, David S. Miller, Jakub Kicinski, linux-wireless,
	netdev, linux-kernel, Heiner Kallweit
  Cc: Lev Stipakov

Commits

  d3fd65484c781 ("net: core: add dev_sw_netstats_tx_add")
  451b05f413d3f ("net: netdevice.h: sw_netstats_rx_add helper)

have added API to update net device per-cpu TX/RX stats.

Use core API instead of ieee80211_tx/rx_stats().

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Reviewed-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 v3: no code changes, just send separate patch instead of series as
requested
 v2: also replace ieee80211_rx_stats() with dev_sw_netstats_rx_add()

 net/mac80211/rx.c | 18 ++++--------------
 net/mac80211/tx.c | 16 +++-------------
 2 files changed, 7 insertions(+), 27 deletions(-)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 09d1c9fb8872..0c1a19a93c79 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -32,16 +32,6 @@
 #include "wme.h"
 #include "rate.h"
 
-static inline void ieee80211_rx_stats(struct net_device *dev, u32 len)
-{
-	struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats);
-
-	u64_stats_update_begin(&tstats->syncp);
-	tstats->rx_packets++;
-	tstats->rx_bytes += len;
-	u64_stats_update_end(&tstats->syncp);
-}
-
 /*
  * monitor mode reception
  *
@@ -842,7 +832,7 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
 
 			if (skb) {
 				skb->dev = sdata->dev;
-				ieee80211_rx_stats(skb->dev, skb->len);
+				dev_sw_netstats_rx_add(skb->dev, skb->len);
 				netif_receive_skb(skb);
 			}
 		}
@@ -2560,7 +2550,7 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx)
 	skb = rx->skb;
 	xmit_skb = NULL;
 
-	ieee80211_rx_stats(dev, skb->len);
+	dev_sw_netstats_rx_add(dev, skb->len);
 
 	if (rx->sta) {
 		/* The seqno index has the same property as needed
@@ -3699,7 +3689,7 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx,
 		}
 
 		prev_dev = sdata->dev;
-		ieee80211_rx_stats(sdata->dev, skb->len);
+		dev_sw_netstats_rx_add(sdata->dev, skb->len);
 	}
 
 	if (prev_dev) {
@@ -4416,7 +4406,7 @@ static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx,
 
 	skb->dev = fast_rx->dev;
 
-	ieee80211_rx_stats(fast_rx->dev, skb->len);
+	dev_sw_netstats_rx_add(fast_rx->dev, skb->len);
 
 	/* The seqno index has the same property as needed
 	 * for the rx_msdu field, i.e. it is IEEE80211_NUM_TIDS
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)]++;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-11-13 21:47 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-12 11:09 [PATCH 1/3] net: mac80211: use core API for updating TX stats Lev Stipakov
2020-11-12 23:30 ` Jakub Kicinski
2020-11-13  7:14   ` Heiner Kallweit
2020-11-13  7:16 ` Heiner Kallweit
2020-11-13  8:58   ` [PATCH v2 1/3] net: mac80211: use core API for updating TX/RX stats Lev Stipakov
2020-11-13 10:44     ` Heiner Kallweit
2020-11-13 10:55     ` Johannes Berg
2020-11-13 12:25       ` Lev Stipakov
2020-11-13 19:51         ` Jakub Kicinski
2020-11-13 19:52           ` Johannes Berg
2020-11-13 21:25           ` Lev Stipakov
2020-11-13 21:31             ` Jakub Kicinski
2020-11-13 21:46               ` [PATCH v3] " Lev Stipakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).