Re: [RFC v2 1/3] vsockmon: Add tap functions
From: Stefan Hajnoczi <stefanha@redhat.com>
Date: 2016-06-30 10:49:42
Attachments
- signature.asc [application/pgp-signature] 473 bytes
From: Stefan Hajnoczi <stefanha@redhat.com>
Date: 2016-06-30 10:49:42
On Wed, Jun 22, 2016 at 06:11:00PM +0200, ggarcia@abra.uab.cat wrote:
+int __vsock_remove_tap(struct vsock_tap *vt) {This function should be static, it's not used outside this source file.
+static int __vsock_deliver_tap_skb(struct sk_buff *skb,
+ struct net_device *dev)
+{
+ int ret = 0;
+
+ if (skb) {
+ dev_hold(dev);I don't understand the need for this dev_hold()/dev_put(). Can anyone explain why it is necessary?
+ /* Take skb ownership so it is not consumed in dev_queue_xmit. + * dev_queue_xmit will drop a reference so the reference count + * will reset. + */ + skb_get(skb); + skb->dev = dev; + ret = dev_queue_xmit(skb); + if (unlikely(ret > 0)) + ret = net_xmit_errno(ret); + + dev_put(dev); + } + + return ret; +}