treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / arch / um / drivers / vector_user.h
blob91f35b266abac69f5b319f4e71294b9a20f3dff3
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Copyright (C) 2002 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
4 */
6 #ifndef __UM_VECTOR_USER_H
7 #define __UM_VECTOR_USER_H
9 #define MAXVARGS 20
11 #define TOKEN_IFNAME "ifname"
13 #define TRANS_RAW "raw"
14 #define TRANS_RAW_LEN strlen(TRANS_RAW)
16 #define TRANS_TAP "tap"
17 #define TRANS_TAP_LEN strlen(TRANS_TAP)
19 #define TRANS_GRE "gre"
20 #define TRANS_GRE_LEN strlen(TRANS_RAW)
22 #define TRANS_L2TPV3 "l2tpv3"
23 #define TRANS_L2TPV3_LEN strlen(TRANS_L2TPV3)
25 #define TRANS_HYBRID "hybrid"
26 #define TRANS_HYBRID_LEN strlen(TRANS_HYBRID)
28 #define TRANS_BESS "bess"
29 #define TRANS_BESS_LEN strlen(TRANS_BESS)
31 #define DEFAULT_BPF_LEN 6
33 #ifndef IPPROTO_GRE
34 #define IPPROTO_GRE 0x2F
35 #endif
37 #define GRE_MODE_CHECKSUM cpu_to_be16(8 << 12) /* checksum */
38 #define GRE_MODE_RESERVED cpu_to_be16(4 << 12) /* unused */
39 #define GRE_MODE_KEY cpu_to_be16(2 << 12) /* KEY present */
40 #define GRE_MODE_SEQUENCE cpu_to_be16(1 << 12) /* sequence */
42 #define GRE_IRB cpu_to_be16(0x6558)
44 #define L2TPV3_DATA_PACKET 0x30000
46 /* IANA-assigned IP protocol ID for L2TPv3 */
48 #ifndef IPPROTO_L2TP
49 #define IPPROTO_L2TP 0x73
50 #endif
52 struct arglist {
53 int numargs;
54 char *tokens[MAXVARGS];
55 char *values[MAXVARGS];
58 /* Separating read and write FDs allows us to have different
59 * rx and tx method. Example - read tap via raw socket using
60 * recvmmsg, write using legacy tap write calls
63 struct vector_fds {
64 int rx_fd;
65 int tx_fd;
66 void *remote_addr;
67 int remote_addr_size;
70 #define VECTOR_READ 1
71 #define VECTOR_WRITE (1 < 1)
72 #define VECTOR_HEADERS (1 < 2)
74 extern struct arglist *uml_parse_vector_ifspec(char *arg);
76 extern struct vector_fds *uml_vector_user_open(
77 int unit,
78 struct arglist *parsed
81 extern char *uml_vector_fetch_arg(
82 struct arglist *ifspec,
83 char *token
86 extern int uml_vector_recvmsg(int fd, void *hdr, int flags);
87 extern int uml_vector_sendmsg(int fd, void *hdr, int flags);
88 extern int uml_vector_writev(int fd, void *hdr, int iovcount);
89 extern int uml_vector_sendmmsg(
90 int fd, void *msgvec,
91 unsigned int vlen,
92 unsigned int flags
94 extern int uml_vector_recvmmsg(
95 int fd,
96 void *msgvec,
97 unsigned int vlen,
98 unsigned int flags
100 extern void *uml_vector_default_bpf(void *mac);
101 extern void *uml_vector_user_bpf(char *filename);
102 extern int uml_vector_attach_bpf(int fd, void *bpf);
103 extern int uml_vector_detach_bpf(int fd, void *bpf);
104 extern bool uml_raw_enable_qdisc_bypass(int fd);
105 extern bool uml_raw_enable_vnet_headers(int fd);
106 extern bool uml_tap_enable_vnet_headers(int fd);
109 #endif