1 #ifndef _LINUX_IF_TAP_H_
2 #define _LINUX_IF_TAP_H_
4 #if IS_ENABLED(CONFIG_TAP)
5 struct socket
*tap_get_socket(struct file
*);
6 struct skb_array
*tap_get_skb_array(struct file
*file
);
9 #include <linux/errno.h>
12 static inline struct socket
*tap_get_socket(struct file
*f
)
14 return ERR_PTR(-EINVAL
);
16 static inline struct skb_array
*tap_get_skb_array(struct file
*f
)
18 return ERR_PTR(-EINVAL
);
20 #endif /* CONFIG_TAP */
23 #include <linux/skb_array.h>
25 #define MAX_TAP_QUEUES 256
30 struct net_device
*dev
;
32 /* This array tracks active taps. */
33 struct tap_queue __rcu
*taps
[MAX_TAP_QUEUES
];
34 /* This list tracks all taps (both enabled and disabled) */
35 struct list_head queue_list
;
38 netdev_features_t tap_features
;
41 void (*update_features
)(struct tap_dev
*tap
, netdev_features_t features
);
42 void (*count_tx_dropped
)(struct tap_dev
*tap
);
43 void (*count_rx_dropped
)(struct tap_dev
*tap
);
47 * A tap queue is the central object of tap module, it connects
48 * an open character device to virtual interface. There can be
49 * multiple queues on one interface, which map back to queues
50 * implemented in hardware on the underlying device.
52 * tap_proto is used to allocate queues through the sock allocation
62 struct tap_dev __rcu
*tap
;
67 struct list_head next
;
68 struct skb_array skb_array
;
71 rx_handler_result_t
tap_handle_frame(struct sk_buff
**pskb
);
72 void tap_del_queues(struct tap_dev
*tap
);
73 int tap_get_minor(dev_t major
, struct tap_dev
*tap
);
74 void tap_free_minor(dev_t major
, struct tap_dev
*tap
);
75 int tap_queue_resize(struct tap_dev
*tap
);
76 int tap_create_cdev(struct cdev
*tap_cdev
,
77 dev_t
*tap_major
, const char *device_name
);
78 void tap_destroy_cdev(dev_t major
, struct cdev
*tap_cdev
);
80 #endif /*_LINUX_IF_TAP_H_*/