From: "Michael S. Tsirkin" <mst@redhat.com>
To: Wenliang Wang <wangwenliang.1995@bytedance.com>
Cc: jasowang@redhat.com, davem@davemloft.net, kuba@kernel.org,
virtualization@lists.linux-foundation.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] virtio_net: fix rx_drops stat for small pkts
Date: Thu, 16 Dec 2021 01:31:03 -0500 [thread overview]
Message-ID: <20211216013056-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20211216031135.3182660-1-wangwenliang.1995@bytedance.com>
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
next prev parent reply other threads:[~2021-12-16 6:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2021-12-16 15:58 ` Jakub Kicinski
2021-12-16 20:51 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211216013056-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=davem@davemloft.net \
--cc=jasowang@redhat.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=wangwenliang.1995@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).