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: Jason Wang <jasowang@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
}
if (skb) {
ret = macvtap_put_user(q, skb, to);
- kfree_skb(skb);
+ if (unlikely(ret < 0))
+ kfree_skb(skb);
+ else
+ consume_skb(skb);
}
if (!noblock)
finish_wait(sk_sleep(&q->sk), &wait);
return 0;
ret = tun_put_user(tun, tfile, skb, to);
- kfree_skb(skb);
+ if (unlikely(ret < 0))
+ kfree_skb(skb);
+ else
+ consume_skb(skb);
return ret;
}