Blame view
include/linux/if_tun.h
1.55 KB
c942fddf8 treewide: Replace... |
1 |
/* SPDX-License-Identifier: GPL-2.0-or-later */ |
1da177e4c Linux-2.6.12-rc2 |
2 3 4 |
/* * Universal TUN/TAP device driver. * Copyright (C) 1999-2000 Maxim Krasnyansky <max_mk@yahoo.com> |
1da177e4c Linux-2.6.12-rc2 |
5 |
*/ |
1da177e4c Linux-2.6.12-rc2 |
6 7 |
#ifndef __IF_TUN_H #define __IF_TUN_H |
607ca46e9 UAPI: (Scripted) ... |
8 |
#include <uapi/linux/if_tun.h> |
fe8dd45bb tun: switch to ne... |
9 |
#include <uapi/linux/virtio_net.h> |
1da177e4c Linux-2.6.12-rc2 |
10 |
|
fc72d1d54 tuntap: XDP trans... |
11 |
#define TUN_XDP_FLAG 0x1UL |
fe8dd45bb tun: switch to ne... |
12 13 14 15 16 17 18 19 20 21 22 23 |
#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; }; |
05c2828c7 tun: export under... |
24 25 |
#if defined(CONFIG_TUN) || defined(CONFIG_TUN_MODULE) struct socket *tun_get_socket(struct file *); |
5990a3051 tun/tap: use ptr_... |
26 |
struct ptr_ring *tun_get_tx_ring(struct file *file); |
596b5ef45 net-tun: Eliminat... |
27 28 29 30 31 32 33 34 35 36 37 38 |
static inline bool tun_is_xdp_frame(void *ptr) { return (unsigned long)ptr & TUN_XDP_FLAG; } static inline void *tun_xdp_to_ptr(struct xdp_frame *xdp) { return (void *)((unsigned long)xdp | TUN_XDP_FLAG); } static inline struct xdp_frame *tun_ptr_to_xdp(void *ptr) { return (void *)((unsigned long)ptr & ~TUN_XDP_FLAG); } |
3a4030761 vhost_net: examin... |
39 |
void tun_ptr_free(void *ptr); |
05c2828c7 tun: export under... |
40 41 42 43 44 45 46 47 48 |
#else #include <linux/err.h> #include <linux/errno.h> struct file; struct socket; static inline struct socket *tun_get_socket(struct file *f) { return ERR_PTR(-EINVAL); } |
5990a3051 tun/tap: use ptr_... |
49 |
static inline struct ptr_ring *tun_get_tx_ring(struct file *f) |
83339c6b1 tun: export skb_a... |
50 51 52 |
{ return ERR_PTR(-EINVAL); } |
1ffcbc853 tun: convert to u... |
53 |
static inline bool tun_is_xdp_frame(void *ptr) |
fc72d1d54 tuntap: XDP trans... |
54 55 56 |
{ return false; } |
b558b6c24 net-tun: Add type... |
57 |
static inline void *tun_xdp_to_ptr(struct xdp_frame *xdp) |
fc72d1d54 tuntap: XDP trans... |
58 59 60 |
{ return NULL; } |
b558b6c24 net-tun: Add type... |
61 |
static inline struct xdp_frame *tun_ptr_to_xdp(void *ptr) |
fc72d1d54 tuntap: XDP trans... |
62 63 64 |
{ return NULL; } |
3a4030761 vhost_net: examin... |
65 66 67 |
static inline void tun_ptr_free(void *ptr) { } |
05c2828c7 tun: export under... |
68 |
#endif /* CONFIG_TUN */ |
1da177e4c Linux-2.6.12-rc2 |
69 |
#endif /* __IF_TUN_H */ |