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