]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
tun: export skb_array
authorJason Wang <jasowang@redhat.com>
Wed, 17 May 2017 04:14:41 +0000 (12:14 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 18 May 2017 14:07:40 +0000 (10:07 -0400)
This patch exports skb_array through tun_get_skb_array(). Caller can
then manipulate skb array directly.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tun.c
include/linux/if_tun.h

index bbd707b9ef7a6a305804ed0d56c3fc0e1db7d565..3cbfc5c707e3b1e7db78cfb645d161af260615f9 100644 (file)
@@ -2626,6 +2626,19 @@ struct socket *tun_get_socket(struct file *file)
 }
 EXPORT_SYMBOL_GPL(tun_get_socket);
 
+struct skb_array *tun_get_skb_array(struct file *file)
+{
+       struct tun_file *tfile;
+
+       if (file->f_op != &tun_fops)
+               return ERR_PTR(-EINVAL);
+       tfile = file->private_data;
+       if (!tfile)
+               return ERR_PTR(-EBADFD);
+       return &tfile->tx_array;
+}
+EXPORT_SYMBOL_GPL(tun_get_skb_array);
+
 module_init(tun_init);
 module_exit(tun_cleanup);
 MODULE_DESCRIPTION(DRV_DESCRIPTION);
index ed6da2e6df9019d576292e43bd612c898961d9ce..bf9bdf42d5775341388fd9882ad81a6dc4799138 100644 (file)
@@ -19,6 +19,7 @@
 
 #if defined(CONFIG_TUN) || defined(CONFIG_TUN_MODULE)
 struct socket *tun_get_socket(struct file *);
+struct skb_array *tun_get_skb_array(struct file *file);
 #else
 #include <linux/err.h>
 #include <linux/errno.h>
@@ -28,5 +29,9 @@ static inline struct socket *tun_get_socket(struct file *f)
 {
        return ERR_PTR(-EINVAL);
 }
+static inline struct skb_array *tun_get_skb_array(struct file *f)
+{
+       return ERR_PTR(-EINVAL);
+}
 #endif /* CONFIG_TUN */
 #endif /* __IF_TUN_H */