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