From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Wenliang Wang <wangwenliang.1995@bytedance.com>,
Jason Wang <jasowang@redhat.com>,
"Michael S . Tsirkin" <mst@redhat.com>,
"David S . Miller" <davem@davemloft.net>,
Sasha Levin <sashal@kernel.org>,
kuba@kernel.org, virtualization@lists.linux-foundation.org,
netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 5.15 22/29] virtio_net: fix rx_drops stat for small pkts
Date: Mon, 20 Dec 2021 20:57:43 -0500 [thread overview]
Message-ID: <20211221015751.116328-22-sashal@kernel.org> (raw)
In-Reply-To: <20211221015751.116328-1-sashal@kernel.org>
From: Wenliang Wang <wangwenliang.1995@bytedance.com>
[ Upstream commit 053c9e18c6f9cf82242ef35ac21cae1842725714 ]
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>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
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 4ad25a8b0870c..1231b48f7183e 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -730,7 +730,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;
}
rcu_read_lock();
xdp_prog = rcu_dereference(rq->xdp_prog);
@@ -815,10 +815,8 @@ static struct sk_buff *receive_small(struct net_device *dev,
rcu_read_unlock();
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) {
@@ -829,13 +827,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.34.1
next prev parent reply other threads:[~2021-12-21 1:59 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20211221015751.116328-1-sashal@kernel.org>
2021-12-21 1:57 ` [PATCH AUTOSEL 5.15 04/29] mac80211: fix TCP performance on mesh interface Sasha Levin
2021-12-21 1:57 ` [PATCH AUTOSEL 5.15 05/29] mac80211: set up the fwd_skb->dev for mesh forwarding Sasha Levin
2021-12-21 1:57 ` [PATCH AUTOSEL 5.15 06/29] mac80211: fix a memory leak where sta_info is not freed Sasha Levin
2021-12-21 1:57 ` [PATCH AUTOSEL 5.15 07/29] nl80211: reset regdom when reloading regdb Sasha Levin
2021-12-25 18:23 ` Sedat Dilek
2021-12-21 1:57 ` [PATCH AUTOSEL 5.15 08/29] iwlwifi: fix LED dependencies Sasha Levin
2021-12-21 1:57 ` [PATCH AUTOSEL 5.15 09/29] phonet: refcount leak in pep_sock_accep Sasha Levin
2021-12-21 1:57 ` [PATCH AUTOSEL 5.15 10/29] net: usb: qmi_wwan: add Telit 0x1070 composition Sasha Levin
2021-12-21 1:57 ` [PATCH AUTOSEL 5.15 12/29] net: bcmgenet: Fix NULL vs IS_ERR() checking Sasha Levin
2021-12-21 1:57 ` [PATCH AUTOSEL 5.15 13/29] net: ethernet: ti: add missing of_node_put before return Sasha Levin
2021-12-21 1:57 ` [PATCH AUTOSEL 5.15 15/29] mac80211: Fix the size used for building probe request Sasha Levin
2021-12-21 1:57 ` [PATCH AUTOSEL 5.15 16/29] mac80211: update channel context before station state Sasha Levin
2021-12-21 1:57 ` [PATCH AUTOSEL 5.15 17/29] mac80211: do drv_reconfig_complete() before restarting all Sasha Levin
2021-12-21 1:57 ` [PATCH AUTOSEL 5.15 21/29] net: usb: lan78xx: add Allied Telesis AT29M2-AF Sasha Levin
2021-12-21 1:57 ` Sasha Levin [this message]
2021-12-21 1:57 ` [PATCH AUTOSEL 5.15 23/29] bpf: Make 32->64 bounds propagation slightly more robust Sasha Levin
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=20211221015751.116328-22-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=davem@davemloft.net \
--cc=jasowang@redhat.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=stable@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).