~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/if_tap.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef _LINUX_IF_TAP_H_
  3 #define _LINUX_IF_TAP_H_
  4 
  5 #include <net/sock.h>
  6 #include <linux/skb_array.h>
  7 
  8 struct file;
  9 struct socket;
 10 
 11 #if IS_ENABLED(CONFIG_TAP)
 12 struct socket *tap_get_socket(struct file *);
 13 struct ptr_ring *tap_get_ptr_ring(struct file *file);
 14 #else
 15 #include <linux/err.h>
 16 #include <linux/errno.h>
 17 static inline struct socket *tap_get_socket(struct file *f)
 18 {
 19         return ERR_PTR(-EINVAL);
 20 }
 21 static inline struct ptr_ring *tap_get_ptr_ring(struct file *f)
 22 {
 23         return ERR_PTR(-EINVAL);
 24 }
 25 #endif /* CONFIG_TAP */
 26 
 27 /*
 28  * Maximum times a tap device can be opened. This can be used to
 29  * configure the number of receive queue, e.g. for multiqueue virtio.
 30  */
 31 #define MAX_TAP_QUEUES 256
 32 
 33 struct tap_queue;
 34 
 35 struct tap_dev {
 36         struct net_device       *dev;
 37         u16                     flags;
 38         /* This array tracks active taps. */
 39         struct tap_queue    __rcu *taps[MAX_TAP_QUEUES];
 40         /* This list tracks all taps (both enabled and disabled) */
 41         struct list_head        queue_list;
 42         int                     numvtaps;
 43         int                     numqueues;
 44         netdev_features_t       tap_features;
 45         int                     minor;
 46 
 47         void (*update_features)(struct tap_dev *tap, netdev_features_t features);
 48         void (*count_tx_dropped)(struct tap_dev *tap);
 49         void (*count_rx_dropped)(struct tap_dev *tap);
 50 };
 51 
 52 /*
 53  * A tap queue is the central object of tap module, it connects
 54  * an open character device to virtual interface. There can be
 55  * multiple queues on one interface, which map back to queues
 56  * implemented in hardware on the underlying device.
 57  *
 58  * tap_proto is used to allocate queues through the sock allocation
 59  * mechanism.
 60  *
 61  */
 62 
 63 struct tap_queue {
 64         struct sock sk;
 65         struct socket sock;
 66         int vnet_hdr_sz;
 67         struct tap_dev __rcu *tap;
 68         struct file *file;
 69         unsigned int flags;
 70         u16 queue_index;
 71         bool enabled;
 72         struct list_head next;
 73         struct ptr_ring ring;
 74 };
 75 
 76 rx_handler_result_t tap_handle_frame(struct sk_buff **pskb);
 77 void tap_del_queues(struct tap_dev *tap);
 78 int tap_get_minor(dev_t major, struct tap_dev *tap);
 79 void tap_free_minor(dev_t major, struct tap_dev *tap);
 80 int tap_queue_resize(struct tap_dev *tap);
 81 int tap_create_cdev(struct cdev *tap_cdev, dev_t *tap_major,
 82                     const char *device_name, struct module *module);
 83 void tap_destroy_cdev(dev_t major, struct cdev *tap_cdev);
 84 
 85 #endif /*_LINUX_IF_TAP_H_*/
 86 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php