diff mbox series

[net-next,5/9] wireguard: use dev_sw_netstats_rx_add()

Message ID 20220607233614.1133902-6-eric.dumazet@gmail.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next, async
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 1 maintainers not CCed: wireguard@lists.zx2c4.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 16 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Eric Dumazet June 7, 2022, 11:36 p.m. UTC
From: Eric Dumazet <edumazet@google.com>

We have a convenient helper, let's use it.
This will make the following patch easier to review and smaller.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Jason A. Donenfeld <Jason@zx2c4.com>
---
 drivers/net/wireguard/receive.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

Comments

Jason A. Donenfeld June 8, 2022, 7:36 a.m. UTC | #1
Hi Eric,

On Tue, Jun 07, 2022 at 04:36:10PM -0700, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> We have a convenient helper, let's use it.
> This will make the following patch easier to review and smaller.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Jason A. Donenfeld <Jason@zx2c4.com>

The subject line should be:

    wireguard: receive: use dev_sw_netstats_rx_add()

Please don't commit it before changing that. With that addressed,

    Acked-by: Jason A. Donenfeld <Jason@zx2c4.com>

Regards,
Jason

>  drivers/net/wireguard/receive.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/drivers/net/wireguard/receive.c b/drivers/net/wireguard/receive.c
> index 7b8df406c7737398f0270361afcb196af4b6a76e..7135d51d2d872edb66c856379ce2923b214289e9 100644
> --- a/drivers/net/wireguard/receive.c
> +++ b/drivers/net/wireguard/receive.c
> @@ -19,15 +19,8 @@
>  /* Must be called with bh disabled. */
>  static void update_rx_stats(struct wg_peer *peer, size_t len)
>  {
> -	struct pcpu_sw_netstats *tstats =
> -		get_cpu_ptr(peer->device->dev->tstats);
> -
> -	u64_stats_update_begin(&tstats->syncp);
> -	++tstats->rx_packets;
> -	tstats->rx_bytes += len;
> +	dev_sw_netstats_rx_add(peer->device->dev, len);
>  	peer->rx_bytes += len;
> -	u64_stats_update_end(&tstats->syncp);
> -	put_cpu_ptr(tstats);
>  }
>  
>  #define SKB_TYPE_LE32(skb) (((struct message_header *)(skb)->data)->type)
> -- 
> 2.36.1.255.ge46751e96f-goog
>
Eric Dumazet June 8, 2022, 3:41 p.m. UTC | #2
On Wed, Jun 8, 2022 at 12:36 AM Jason A. Donenfeld <Jason@zx2c4.com> wrote:
>
> Hi Eric,
>
> On Tue, Jun 07, 2022 at 04:36:10PM -0700, Eric Dumazet wrote:
> > From: Eric Dumazet <edumazet@google.com>
> >
> > We have a convenient helper, let's use it.
> > This will make the following patch easier to review and smaller.
> >
> > Signed-off-by: Eric Dumazet <edumazet@google.com>
> > Cc: Jason A. Donenfeld <Jason@zx2c4.com>
>
> The subject line should be:
>
>     wireguard: receive: use dev_sw_netstats_rx_add()
>
> Please don't commit it before changing that. With that addressed,
>
>     Acked-by: Jason A. Donenfeld <Jason@zx2c4.com>
>

Got it, thanks.


> Regards,
> Jason
>
> >  drivers/net/wireguard/receive.c | 9 +--------
> >  1 file changed, 1 insertion(+), 8 deletions(-)
> >
> > diff --git a/drivers/net/wireguard/receive.c b/drivers/net/wireguard/receive.c
> > index 7b8df406c7737398f0270361afcb196af4b6a76e..7135d51d2d872edb66c856379ce2923b214289e9 100644
> > --- a/drivers/net/wireguard/receive.c
> > +++ b/drivers/net/wireguard/receive.c
> > @@ -19,15 +19,8 @@
> >  /* Must be called with bh disabled. */
> >  static void update_rx_stats(struct wg_peer *peer, size_t len)
> >  {
> > -     struct pcpu_sw_netstats *tstats =
> > -             get_cpu_ptr(peer->device->dev->tstats);
> > -
> > -     u64_stats_update_begin(&tstats->syncp);
> > -     ++tstats->rx_packets;
> > -     tstats->rx_bytes += len;
> > +     dev_sw_netstats_rx_add(peer->device->dev, len);
> >       peer->rx_bytes += len;
> > -     u64_stats_update_end(&tstats->syncp);
> > -     put_cpu_ptr(tstats);
> >  }
> >
> >  #define SKB_TYPE_LE32(skb) (((struct message_header *)(skb)->data)->type)
> > --
> > 2.36.1.255.ge46751e96f-goog
> >
diff mbox series

Patch

diff --git a/drivers/net/wireguard/receive.c b/drivers/net/wireguard/receive.c
index 7b8df406c7737398f0270361afcb196af4b6a76e..7135d51d2d872edb66c856379ce2923b214289e9 100644
--- a/drivers/net/wireguard/receive.c
+++ b/drivers/net/wireguard/receive.c
@@ -19,15 +19,8 @@ 
 /* Must be called with bh disabled. */
 static void update_rx_stats(struct wg_peer *peer, size_t len)
 {
-	struct pcpu_sw_netstats *tstats =
-		get_cpu_ptr(peer->device->dev->tstats);
-
-	u64_stats_update_begin(&tstats->syncp);
-	++tstats->rx_packets;
-	tstats->rx_bytes += len;
+	dev_sw_netstats_rx_add(peer->device->dev, len);
 	peer->rx_bytes += len;
-	u64_stats_update_end(&tstats->syncp);
-	put_cpu_ptr(tstats);
 }
 
 #define SKB_TYPE_LE32(skb) (((struct message_header *)(skb)->data)->type)