Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1612662

[PATCH V2 net-next 3/7] tun: export skb_array

From Jason Wang <jasowang@redhat.com>
Newsgroups linux.kernel
Subject [PATCH V2 net-next 3/7] tun: export skb_array
Date 2017-03-30 09:30 +0200
Message-ID <tqCGS-2MS-31@gated-at.bofh.it> (permalink)
References <tqCGR-2MS-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 drivers/net/tun.c      | 13 +++++++++++++
 include/linux/if_tun.h |  5 +++++
 2 files changed, 18 insertions(+)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index c418f0a..70dd9ec 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -2613,6 +2613,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);
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index ed6da2e..bf9bdf4 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -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 */
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V2 net-next 0/7] vhost-net rx batching Jason Wang <jasowang@redhat.com> - 2017-03-30 09:30 +0200
  [PATCH V2 net-next 6/7] tap: support receiving skb from msg_control Jason Wang <jasowang@redhat.com> - 2017-03-30 09:30 +0200
    Re: [PATCH V2 net-next 6/7] tap: support receiving skb from  msg_control "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-30 17:10 +0200
      Re: [PATCH V2 net-next 6/7] tap: support receiving skb from  msg_control Jason Wang <jasowang@redhat.com> - 2017-03-31 06:10 +0200
  [PATCH V2 net-next 1/7] ptr_ring: introduce batch dequeuing Jason Wang <jasowang@redhat.com> - 2017-03-30 09:30 +0200
    Re: [PATCH V2 net-next 1/7] ptr_ring: introduce batch dequeuing "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-30 16:00 +0200
      Re: [PATCH V2 net-next 1/7] ptr_ring: introduce batch dequeuing Jason Wang <jasowang@redhat.com> - 2017-03-31 06:00 +0200
        Re: [PATCH V2 net-next 1/7] ptr_ring: introduce batch dequeuing "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-31 16:40 +0200
          Re: [PATCH V2 net-next 1/7] ptr_ring: introduce batch dequeuing Jason Wang <jasowang@redhat.com> - 2017-04-01 07:20 +0200
  [PATCH V2 net-next 4/7] tap: export skb_array Jason Wang <jasowang@redhat.com> - 2017-03-30 09:30 +0200
  [PATCH V2 net-next 3/7] tun: export skb_array Jason Wang <jasowang@redhat.com> - 2017-03-30 09:30 +0200
  [PATCH V2 net-next 2/7] skb_array: introduce batch dequeuing Jason Wang <jasowang@redhat.com> - 2017-03-30 09:30 +0200
  [PATCH V2 net-next 7/7] vhost_net: try batch dequing from skb array Jason Wang <jasowang@redhat.com> - 2017-03-30 09:30 +0200
    Re: [PATCH V2 net-next 7/7] vhost_net: try batch dequing from skb  array "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-30 16:30 +0200
      Re: [PATCH V2 net-next 7/7] vhost_net: try batch dequing from skb  array Jason Wang <jasowang@redhat.com> - 2017-03-31 06:10 +0200
        Re: [PATCH V2 net-next 7/7] vhost_net: try batch dequing from skb  array Jason Wang <jasowang@redhat.com> - 2017-03-31 08:50 +0200

csiph-web