Commit 053c9e18 authored by Wenliang Wang's avatar Wenliang Wang Committed by David S. Miller

virtio_net: fix rx_drops stat for small pkts

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: default avatarWenliang Wang <wangwenliang.1995@bytedance.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e08cdf63
...@@ -733,7 +733,7 @@ static struct sk_buff *receive_small(struct net_device *dev, ...@@ -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", pr_debug("%s: rx error: len %u exceeds max size %d\n",
dev->name, len, GOOD_PACKET_LEN); dev->name, len, GOOD_PACKET_LEN);
dev->stats.rx_length_errors++; dev->stats.rx_length_errors++;
goto err_len; goto err;
} }
if (likely(!vi->xdp_enabled)) { if (likely(!vi->xdp_enabled)) {
...@@ -825,10 +825,8 @@ static struct sk_buff *receive_small(struct net_device *dev, ...@@ -825,10 +825,8 @@ static struct sk_buff *receive_small(struct net_device *dev,
skip_xdp: skip_xdp:
skb = build_skb(buf, buflen); skb = build_skb(buf, buflen);
if (!skb) { if (!skb)
put_page(page);
goto err; goto err;
}
skb_reserve(skb, headroom - delta); skb_reserve(skb, headroom - delta);
skb_put(skb, len); skb_put(skb, len);
if (!xdp_prog) { if (!xdp_prog) {
...@@ -839,13 +837,12 @@ static struct sk_buff *receive_small(struct net_device *dev, ...@@ -839,13 +837,12 @@ static struct sk_buff *receive_small(struct net_device *dev,
if (metasize) if (metasize)
skb_metadata_set(skb, metasize); skb_metadata_set(skb, metasize);
err:
return skb; return skb;
err_xdp: err_xdp:
rcu_read_unlock(); rcu_read_unlock();
stats->xdp_drops++; stats->xdp_drops++;
err_len: err:
stats->drops++; stats->drops++;
put_page(page); put_page(page);
xdp_xmit: xdp_xmit:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment