netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] virtio_net: fix rx_drops stat for small pkts
@ 2021-12-16  3:11 Wenliang Wang
  2021-12-16  3:23 ` Jason Wang
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Wenliang Wang @ 2021-12-16  3:11 UTC (permalink / raw)
  To: mst, jasowang, davem, kuba
  Cc: virtualization, netdev, linux-kernel, Wenliang Wang

We found the stat of rx drops for small pkts does not increment when
build_skb fail, it's not coherent with other mode's rx drops stat.

Signed-off-by: Wenliang Wang <wangwenliang.1995@bytedance.com>
---
 drivers/net/virtio_net.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 55db6a336f7e..b107835242ad 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -733,7 +733,7 @@ static struct sk_buff *receive_small(struct net_device *dev,
 		pr_debug("%s: rx error: len %u exceeds max size %d\n",
 			 dev->name, len, GOOD_PACKET_LEN);
 		dev->stats.rx_length_errors++;
-		goto err_len;
+		goto err;
 	}
 
 	if (likely(!vi->xdp_enabled)) {
@@ -825,10 +825,8 @@ static struct sk_buff *receive_small(struct net_device *dev,
 
 skip_xdp:
 	skb = build_skb(buf, buflen);
-	if (!skb) {
-		put_page(page);
+	if (!skb)
 		goto err;
-	}
 	skb_reserve(skb, headroom - delta);
 	skb_put(skb, len);
 	if (!xdp_prog) {
@@ -839,13 +837,12 @@ static struct sk_buff *receive_small(struct net_device *dev,
 	if (metasize)
 		skb_metadata_set(skb, metasize);
 
-err:
 	return skb;
 
 err_xdp:
 	rcu_read_unlock();
 	stats->xdp_drops++;
-err_len:
+err:
 	stats->drops++;
 	put_page(page);
 xdp_xmit:
-- 
2.30.2


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

* Re: [PATCH] virtio_net: fix rx_drops stat for small pkts
  2021-12-16  3:11 [PATCH] virtio_net: fix rx_drops stat for small pkts Wenliang Wang
@ 2021-12-16  3:23 ` Jason Wang
  2021-12-16  6:31 ` Michael S. Tsirkin
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jason Wang @ 2021-12-16  3:23 UTC (permalink / raw)
  To: Wenliang Wang
  Cc: mst, davem, Jakub Kicinski, virtualization, netdev, linux-kernel

On Thu, Dec 16, 2021 at 11:12 AM Wenliang Wang
<wangwenliang.1995@bytedance.com> wrote:
>
> We found the stat of rx drops for small pkts does not increment when
> build_skb fail, it's not coherent with other mode's rx drops stat.
>
> Signed-off-by: Wenliang Wang <wangwenliang.1995@bytedance.com>

Acked-by: Jason Wang <jasowang@redhat.com>

> ---
>  drivers/net/virtio_net.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 55db6a336f7e..b107835242ad 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -733,7 +733,7 @@ static struct sk_buff *receive_small(struct net_device *dev,
>                 pr_debug("%s: rx error: len %u exceeds max size %d\n",
>                          dev->name, len, GOOD_PACKET_LEN);
>                 dev->stats.rx_length_errors++;
> -               goto err_len;
> +               goto err;
>         }
>
>         if (likely(!vi->xdp_enabled)) {
> @@ -825,10 +825,8 @@ static struct sk_buff *receive_small(struct net_device *dev,
>
>  skip_xdp:
>         skb = build_skb(buf, buflen);
> -       if (!skb) {
> -               put_page(page);
> +       if (!skb)
>                 goto err;
> -       }
>         skb_reserve(skb, headroom - delta);
>         skb_put(skb, len);
>         if (!xdp_prog) {
> @@ -839,13 +837,12 @@ static struct sk_buff *receive_small(struct net_device *dev,
>         if (metasize)
>                 skb_metadata_set(skb, metasize);
>
> -err:
>         return skb;
>
>  err_xdp:
>         rcu_read_unlock();
>         stats->xdp_drops++;
> -err_len:
> +err:
>         stats->drops++;
>         put_page(page);
>  xdp_xmit:
> --
> 2.30.2
>


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

* Re: [PATCH] virtio_net: fix rx_drops stat for small pkts
  2021-12-16  3:11 [PATCH] virtio_net: fix rx_drops stat for small pkts Wenliang Wang
  2021-12-16  3:23 ` Jason Wang
@ 2021-12-16  6:31 ` Michael S. Tsirkin
  2021-12-16 15:58 ` Jakub Kicinski
  2021-12-16 20:51 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Michael S. Tsirkin @ 2021-12-16  6:31 UTC (permalink / raw)
  To: Wenliang Wang; +Cc: jasowang, davem, kuba, virtualization, netdev, linux-kernel

On Thu, Dec 16, 2021 at 11:11:35AM +0800, Wenliang Wang wrote:
> We found the stat of rx drops for small pkts does not increment when
> build_skb fail, it's not coherent with other mode's rx drops stat.
> 
> Signed-off-by: Wenliang Wang <wangwenliang.1995@bytedance.com>

Acked-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  drivers/net/virtio_net.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 55db6a336f7e..b107835242ad 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -733,7 +733,7 @@ static struct sk_buff *receive_small(struct net_device *dev,
>  		pr_debug("%s: rx error: len %u exceeds max size %d\n",
>  			 dev->name, len, GOOD_PACKET_LEN);
>  		dev->stats.rx_length_errors++;
> -		goto err_len;
> +		goto err;
>  	}
>  
>  	if (likely(!vi->xdp_enabled)) {
> @@ -825,10 +825,8 @@ static struct sk_buff *receive_small(struct net_device *dev,
>  
>  skip_xdp:
>  	skb = build_skb(buf, buflen);
> -	if (!skb) {
> -		put_page(page);
> +	if (!skb)
>  		goto err;
> -	}
>  	skb_reserve(skb, headroom - delta);
>  	skb_put(skb, len);
>  	if (!xdp_prog) {
> @@ -839,13 +837,12 @@ static struct sk_buff *receive_small(struct net_device *dev,
>  	if (metasize)
>  		skb_metadata_set(skb, metasize);
>  
> -err:
>  	return skb;
>  
>  err_xdp:
>  	rcu_read_unlock();
>  	stats->xdp_drops++;
> -err_len:
> +err:
>  	stats->drops++;
>  	put_page(page);
>  xdp_xmit:
> -- 
> 2.30.2


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

* Re: [PATCH] virtio_net: fix rx_drops stat for small pkts
  2021-12-16  3:11 [PATCH] virtio_net: fix rx_drops stat for small pkts Wenliang Wang
  2021-12-16  3:23 ` Jason Wang
  2021-12-16  6:31 ` Michael S. Tsirkin
@ 2021-12-16 15:58 ` Jakub Kicinski
  2021-12-16 20:51 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2021-12-16 15:58 UTC (permalink / raw)
  To: Wenliang Wang; +Cc: mst, jasowang, davem, virtualization, netdev, linux-kernel

On Thu, 16 Dec 2021 11:11:35 +0800 Wenliang Wang wrote:
> We found the stat of rx drops for small pkts does not increment when
> build_skb fail, it's not coherent with other mode's rx drops stat.

Appears to had been applied to net, thanks!

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

* Re: [PATCH] virtio_net: fix rx_drops stat for small pkts
  2021-12-16  3:11 [PATCH] virtio_net: fix rx_drops stat for small pkts Wenliang Wang
                   ` (2 preceding siblings ...)
  2021-12-16 15:58 ` Jakub Kicinski
@ 2021-12-16 20:51 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-12-16 20:51 UTC (permalink / raw)
  To: Wenliang Wang
  Cc: mst, jasowang, davem, kuba, virtualization, netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Thu, 16 Dec 2021 11:11:35 +0800 you wrote:
> We found the stat of rx drops for small pkts does not increment when
> build_skb fail, it's not coherent with other mode's rx drops stat.
> 
> Signed-off-by: Wenliang Wang <wangwenliang.1995@bytedance.com>
> ---
>  drivers/net/virtio_net.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)

Here is the summary with links:
  - virtio_net: fix rx_drops stat for small pkts
    https://git.kernel.org/netdev/net/c/053c9e18c6f9

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2021-12-16 20:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-16  3:11 [PATCH] virtio_net: fix rx_drops stat for small pkts Wenliang Wang
2021-12-16  3:23 ` Jason Wang
2021-12-16  6:31 ` Michael S. Tsirkin
2021-12-16 15:58 ` Jakub Kicinski
2021-12-16 20:51 ` patchwork-bot+netdevbpf

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).