Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f51a5e82 authored by Jason Wang's avatar Jason Wang Committed by David S. Miller
Browse files

tun/macvtap: use consume_skb() instead of kfree_skb() when needed



To be more friendly with drop monitor, we should only call kfree_skb() when
the packets were dropped and use consume_skb() in other cases.

Cc: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-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 6db16718
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -859,7 +859,10 @@ static ssize_t macvtap_do_read(struct macvtap_queue *q,
	}
	if (skb) {
		ret = macvtap_put_user(q, skb, to);
		if (unlikely(ret < 0))
			kfree_skb(skb);
		else
			consume_skb(skb);
	}
	if (!noblock)
		finish_wait(sk_sleep(&q->sk), &wait);
+4 −1
Original line number Diff line number Diff line
@@ -1362,7 +1362,10 @@ static ssize_t tun_do_read(struct tun_struct *tun, struct tun_file *tfile,
		return 0;

	ret = tun_put_user(tun, tfile, skb, to);
	if (unlikely(ret < 0))
		kfree_skb(skb);
	else
		consume_skb(skb);

	return ret;
}