#define TAP_RESERVE HH_DATA_OFF(ETH_HLEN)
 
 /* Get packet from user space buffer */
-static ssize_t tap_get_user(struct tap_queue *q, struct msghdr *m,
+static ssize_t tap_get_user(struct tap_queue *q, void *msg_control,
                            struct iov_iter *from, int noblock)
 {
        int good_linear = SKB_MAX_HEAD(TAP_RESERVE);
        if (unlikely(len < ETH_HLEN))
                goto err;
 
-       if (m && m->msg_control && sock_flag(&q->sk, SOCK_ZEROCOPY)) {
+       if (msg_control && sock_flag(&q->sk, SOCK_ZEROCOPY)) {
                struct iov_iter i;
 
                copylen = vnet_hdr.hdr_len ?
        tap = rcu_dereference(q->tap);
        /* copy skb_ubuf_info for callback when skb has no error */
        if (zerocopy) {
-               skb_shinfo(skb)->destructor_arg = m->msg_control;
+               skb_shinfo(skb)->destructor_arg = msg_control;
                skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY;
                skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG;
-       } else if (m && m->msg_control) {
-               struct ubuf_info *uarg = m->msg_control;
+       } else if (msg_control) {
+               struct ubuf_info *uarg = msg_control;
                uarg->callback(uarg, false);
        }
 
                       size_t total_len)
 {
        struct tap_queue *q = container_of(sock, struct tap_queue, sock);
-       return tap_get_user(q, m, &m->msg_iter, m->msg_flags & MSG_DONTWAIT);
+       struct tun_msg_ctl *ctl = m->msg_control;
+
+       if (ctl && ctl->type != TUN_MSG_UBUF)
+               return -EINVAL;
+
+       return tap_get_user(q, ctl ? ctl->ptr : NULL, &m->msg_iter,
+                           m->msg_flags & MSG_DONTWAIT);
 }
 
 static int tap_recvmsg(struct socket *sock, struct msghdr *m,
 
        int ret;
        struct tun_file *tfile = container_of(sock, struct tun_file, socket);
        struct tun_struct *tun = tun_get(tfile);
+       struct tun_msg_ctl *ctl = m->msg_control;
 
        if (!tun)
                return -EBADFD;
 
-       ret = tun_get_user(tun, tfile, m->msg_control, &m->msg_iter,
+       if (ctl && ctl->type != TUN_MSG_UBUF)
+               return -EINVAL;
+
+       ret = tun_get_user(tun, tfile, ctl ? ctl->ptr : NULL, &m->msg_iter,
                           m->msg_flags & MSG_DONTWAIT,
                           m->msg_flags & MSG_MORE);
        tun_put(tun);
 
                .msg_controllen = 0,
                .msg_flags = MSG_DONTWAIT,
        };
+       struct tun_msg_ctl ctl;
        size_t len, total_len = 0;
        int err;
        struct vhost_net_ubuf_ref *uninitialized_var(ubufs);
                        ubuf->ctx = nvq->ubufs;
                        ubuf->desc = nvq->upend_idx;
                        refcount_set(&ubuf->refcnt, 1);
-                       msg.msg_control = ubuf;
-                       msg.msg_controllen = sizeof(ubuf);
+                       msg.msg_control = &ctl;
+                       ctl.type = TUN_MSG_UBUF;
+                       ctl.ptr = ubuf;
+                       msg.msg_controllen = sizeof(ctl);
                        ubufs = nvq->ubufs;
                        atomic_inc(&ubufs->refcount);
                        nvq->upend_idx = (nvq->upend_idx + 1) % UIO_MAXIOV;
 
 #define __IF_TUN_H
 
 #include <uapi/linux/if_tun.h>
+#include <uapi/linux/virtio_net.h>
 
 #define TUN_XDP_FLAG 0x1UL
 
+#define TUN_MSG_UBUF 1
+#define TUN_MSG_PTR  2
+struct tun_msg_ctl {
+       unsigned short type;
+       unsigned short num;
+       void *ptr;
+};
+
+struct tun_xdp_hdr {
+       int buflen;
+       struct virtio_net_hdr gso;
+};
+
 #if defined(CONFIG_TUN) || defined(CONFIG_TUN_MODULE)
 struct socket *tun_get_socket(struct file *);
 struct ptr_ring *tun_get_tx_ring(struct file *file);