E_FLUSH Like WRITE_SYNC but with preceding cache flush. * WRITE_FUA Like WRITE_SYNC but data is guaranteed to be on * non-volatile media on completion. * WRITE_FLUSH_FUA Combination of WRITE_FLUSH and FUA. The IO is preceded * by a cache flush and data is guaranteed to be on * non-volatile media on completion. * */ #define RW_MASK REQ_WRITE #define RWA_MASK REQ_RAHEAD #define READ 0 #define WRITE RW_MASK #define READA RWA_MASK #define READ_SYNC (READ | REQ_SYNC | REQ_UNPLUG) #define READ_META (READ | REQ_META) #define WRITE_SYNC_PLUG (WRITE | REQ_SYNC | REQ_NOIDLE) #define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG) #define WRITE_ODIRECT_PLUG (WRITE | REQ_SYNC) #define WRITE_META (WRITE | REQ_META) #define WRITE_FLUSH (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \ REQ_FLUSH) #define WRITE_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \ REQ_FUA) #define WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \ REQ_FLUSH | REQ_FUA) #define SEL_IN 1 #define SEL_OUT 2 #define SEL_EX 4 /* public flags for file_system_type */ #define FS_REQUIRES_DEV 1 #define FS_BINARY_MOUNTDATA 2 #define FS_HAS_SUBTYPE 4 #define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */ #define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() * during rename() internally. */ /* * These are the fs-independent mount-flags: up to 32 flags are supported */ #define MS_RDONLY 1 /* Mount read-only */ #define MS_NOSUID 2 /* Ignore suid and sgid bits */ #define MS_NODEV 4 /* Disallow access to device special files */ #define MS_NOEXEC 8 /* Disallow program execution */ #define MS_SYNCHRONOUS 16 /* Writes are synced at once */ #define MS_REMOUNT 32 /* Alter flags of a mounted FS */ #define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ #define MS_DIRSYNC 128 /* Directory modifications are synchronous */ #define MS_NOATIME 1024 /* Do not update access times. */ #define MS_NODIRATIME 2048 /* Do not update directory access times */ #define MS_BIND 4096 #define MS_MOVE 8192 #define MS_REC 16384 #define MS_VERBOSE 32768 /* War is peace. Verbosity is silence. MS_VERBOSE is deprecated. */ #define MS_SILENT 32768 #define MS_POSIXACL (1<<16) /* VFS does not apply the umask */ #define MS_UNBINDABLE (1<<17) /* change to unbindable */ #define MS_PRIVATE (1<<18) /* change to private */ #define MS_SLAVE (1<<19) /* change to slave */ #define MS_SHARED (1<<20) /* change to shared */ #define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */ #define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ #define MS_I_VERSION (1<<23) /* Update inode I_version field */ #define MS_STRICTATIME (1<<24) /* Always perform atime updates */ #define MS_BORN (1<<29) #define MS_ACTIVE (1<<30) #define MS_NOUSER (1<<31) /* * Superblock flags that can be altered by MS_REMOUNT */ #define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION) /* * Old magic mount flag and mask */ #define MS_MGC_VAL 0xC0ED0000 #define MS_MGC_MSK 0xffff0000 /* Inode flags - they have nothing to superblock flags now */ #define S_SYNC 1 /* Writes are synced at once */ #define S_NOATIME 2 /* Do not update access times */ #define S_APPEND 4 /* Append-only file */ #define S_IMMUTABLE 8 /* Immutable file */ #define S_DEAD 16 /* removed, but still open directory */ #define S_NOQUOTA 32 /* Inode is not counted to quota */ #define S_DIRSYNC 64 /* Directory modifications are synchronous */ #define S_NOCMTIME 128 /* Do not update file c/mtime */ #define S_SWAPFILE 256 /* Do not truncate: swapon got its bmaps */ #define S_PRIVATE 512 /* Inode is fs-internal */ #define S_IMA 1024 /* Inode has an associated IMA struct */ /* * Note that nosuid etc flags are inode-specific: setting some file-system * flags just means all the inodes inherit those flags by default. It might be * possible to override it selectively if you really wanted to with some * ioctl() that is not currently implemented. * * Exception: MS_RDONLY is always applied to the entire file system. * * Unfortunately, it is possible to change a filesystems flags with it mounted * with files in use. This means that all of the inodes will not have their * i_flags updated. Hence, i_flags no longer inherit the superblock mount * flags, so these have to be checked separately. -- rmk@arm.uk.linux.org */ #define __IS_FLG(inode,flg) ((inode)->i_sb->s_flags & (flg)) #define IS_RDONLY(inode) ((inode)->i_sb->s_flags & MS_RDONLY) #define IS_SYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS) || \ ((inode)->i_flags & S_SYNC)) #define IS_DIRSYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS|MS_DIRSYNC) || \ ((inode)->i_flags & (S_SYNC|S_DIRSYNC))) #define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK) #define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME) #define IS_I_VERSION(inode) __IS_FLG(inode, MS_I_VERSION) #define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA) #define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) #define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE) #define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL) #define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD) #define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME) #define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE) #define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE) #define IS_IMA(inode) ((inode)->i_flags & S_IMA) /* the read-only stuff doesn't really belong here, but any other place is probably as bad and I don't want to create yet another include file. */ #define BLKROSET _IO(0x12,93) /* set device read-only (0 = read-write) */ #define BLKROGET _IO(0x12,94) /* get read-only status (0 = read_write) */ #define BLKRRPART _IO(0x12,95) /* re-read partition table */ #define BLKGETSIZE _IO(0x12,96) /* return device size /512 (long *arg) */ #define BLKFLSBUF _IO(0x12,97) /* flush buffer cache */ #define BLKRASET _IO(0x12,98) /* set read ahead for block device */ #define BLKRAGET _IO(0x12,99) /* get current read ahead setting */ #define BLKFRASET _IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ #define BLKFRAGET _IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ #define BLKSECTSET _IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ #define BLKSECTGET _IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ #define BLKSSZGET _IO(0x12,104)/* get block device sector size */ #if 0 #define BLKPG _IO(0x12,105)/* See blkpg.h */ /* Some people are morons. Do not use sizeof! */ #define BLKELVGET _IOR(0x12,106,size_t)/* elevator get */ #define BLKELVSET _IOW(0x12,107,size_t)/* elevator set */ /* This was here just to show that the number is taken - probably all these _IO(0x12,*) ioctls should be moved to blkpg.h. */ #endif /* A jump here: 108-111 have been used for various private purposes. */ #define BLKBSZGET _IOR(0x12,112,size_t) #define BLKBSZSET _IOW(0x12,113,size_t) #define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size in bytes (u64 *arg) */ #define BLKTRACESETUP _IOWR(0x12,115,struct blk_user_trace_setup) #define BLKTRACESTART _IO(0x12,116) #deÜ Ü Üfine BLKTRACESTOP _IO(0x12,117) #define BLKTRACETEARDOWN _IO(0x12,118) #define BLKDISCARD _IO(0x12,119) #define BLKIOMIN _IO(0x12,120) #define BLKIOOPT _IO(0x12,121) #define BLKALIGNOFF _IO(0x12,122) #define BLKPBSZGET _IO(0x12,123) #define BLKDISCARDZEROES _IO(0x12,124) #define BLKSECDISCARD _IO(0x12,125) #define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ #define FIBMAP _IO(0x00,1) /* bmap access */ #define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */ #define FIFREEZE _IOWR('X', 119, int) /* Freeze */ #define FITHAW _IOWR('X', 120, int) /* Thaw */ #define FITRIM _IOWR('X', 121, struct fstrim_range) /* Trim */ #define FS_IOC_GETFLAGS _IOR('f', 1, long) #define FS_IOC_SETFLAGS _IOW('f', 2, long) #define FS_IOC_GETVERSION _IOR('v', 1, long) #define FS_IOC_SETVERSION _IOW('v', 2, long) #define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap) #define FS_IOC32_GETFLAGS _IOR('f', 1, int) #define FS_IOC32_SETFLAGS _IOW('f', 2, int) #define FS_IOC32_GETVERSION _IOR('v', 1, int) #define FS_IOC32_SETVERSION _IOW('v', 2, int) /* * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS) */ #define FS_SECRM_FL 0x00000001 /* Secure deletion */ #define FS_UNRM_FL 0x00000002 /* Undelete */ #define FS_COMPR_FL 0x00000004 /* Compress file */ #define FS_SYNC_FL 0x00000008 /* Synchronous updates */ #define FS_IMMUTABLE_FL 0x00000010 /* Immutable file */ #define FS_APPEND_FL 0x00000020 /* writes to file may only append */ #define FS_NODUMP_FL 0x00000040 /* do not dump file */ #define FS_NOATIME_FL 0x00000080 /* do not update atime */ /* Reserved for compression usage... */ #define FS_DIRTY_FL 0x00000100 #define FS_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */ #define FS_NOCOMP_FL 0x00000400 /* Don't compress */ #define FS_ECOMPR_FL 0x00000800 /* Compression error */ /* End compression flags --- maybe not all used */ #define FS_BTREE_FL 0x00001000 /* btree format dir */ #define FS_INDEX_FL 0x00001000 /* hash-indexed directory */ #define FS_IMAGIC_FL 0x00002000 /* AFS directory */ #define FS_JOURNAL_DATA_FL 0x00004000 /* Reserved for ext3 */ #define FS_NOTAIL_FL 0x00008000 /* file tail should not be merged */ #define FS_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */ #define FS_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ #define FS_EXTENT_FL 0x00080000 /* Extents */ #define FS_DIRECTIO_FL 0x00100000 /* Use direct i/o */ #define FS_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ #define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ #define FS_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */ #define SYNC_FILE_RANGE_WAIT_BEFORE 1 #define SYNC_FILE_RANGE_WRITE 2 #define SYNC_FILE_RANGE_WAIT_AFTER 4 #endif /* _LINUX_FS_H */ /* atm_tcp.h - Driver-specific declarations of the ATMTCP driver (for use by driver-specific utilities) */ /* Written 1997-2000 by Werner Almesberger, EPFL LRC/ICA */ #ifndef LINUX_ATM_TCP_H #define LINUX_ATM_TCP_H #include #include #include #include /* * All values in struct atmtcp_hdr are in network byte order */ struct atmtcp_hdr { __u16 vpi; __u16 vci; __u32 length; /* ... of data part */ }; /* * All values in struct atmtcp_command are in host byte order */ #define ATMTCP_HDR_MAGIC (~0) /* this length indicates a command */ #define ATMTCP_CTRL_OPEN 1 /* request/reply */ #define ATMTCP_CTRL_CLOSE 2 /* request/reply */ struct atmtcp_control { struct atmtcp_hdr hdr; /* must be first */ int type; /* message type; both directions */ atm_kptr_t vcc; /* both directions */ struct sockaddr_atmpvc addr; /* suggested value from kernel */ struct atm_qos qos; /* both directions */ int result; /* to kernel only */ } __ATM_API_ALIGN; /* * Field usage: * Messge type dir. hdr.v?i type addr qos vcc result * ----------- ---- ------- ---- ---- --- --- ------ * OPEN K->D Y Y Y Y Y 0 * OPEN D->K - Y Y Y Y Y * CLOSE K->D - - Y - Y 0 * CLOSE D->K - - - - Y Y */ #define SIOCSIFATMTCP _IO('a',ATMIOC_ITF) /* set ATMTCP mode */ #define ATMTCP_CREATE _IO('a',ATMIOC_ITF+14) /* create persistent ATMTCP interface */ #define ATMTCP_REMOVE _IO('a',ATMIOC_ITF+15) /* destroy persistent ATMTCP interface */ #endif #ifndef _LINUX_LP_H #define _LINUX_LP_H /* * usr/include/linux/lp.h c.1991-1992 James Wiegand * many modifications copyright (C) 1992 Michael K. Johnson * Interrupt support added 1993 Nigel Gamble * Removed 8255 status defines from inside __KERNEL__ Marcelo Tosatti */ /* * Per POSIX guidelines, this module reserves the LP and lp prefixes * These are the lp_table[minor].flags flags... */ #define LP_EXIST 0x0001 #define LP_SELEC 0x0002 #define LP_BUSY 0x0004 #define LP_BUSY_BIT_POS 2 #define LP_OFFL 0x0008 #define LP_NOPA 0x0010 #define LP_ERR 0x0020 #define LP_ABORT 0x0040 #define LP_CAREFUL 0x0080 /* obsoleted -arca */ #define LP_ABORTOPEN 0x0100 #define LP_TRUST_IRQ_ 0x0200 /* obsolete */ #define LP_NO_REVERSE 0x0400 /* No reverse mode available. */ #define LP_DATA_AVAIL 0x0800 /* Data is available. */ /* * bit defines for 8255 status port * base + 1 * accessed with LP_S(minor), which gets the byte... */ #define LP_PBUSY 0x80 /* inverted input, active high */ #define LP_PACK 0x40 /* unchanged input, active low */ #define LP_POUTPA 0x20 /* unchanged input, active high */ #define LP_PSELECD 0x10 /* unchanged input, active high */ #define LP_PERRORP 0x08 /* unchanged input, active low */ /* timeout for each character. This is relative to bus cycles -- it * is the count in a busy loop. THIS IS THE VALUE TO CHANGE if you * have extremely slow printing, or if the machine seems to slow down * a lot when you print. If you have slow printing, increase this * number and recompile, and if your system gets bogged down, decrease * this number. This can be changed with the tunelp(8) command as well. */ #define LP_INIT_CHAR 1000 /* The parallel port specs apparently say that there needs to be * a .5usec wait before and after the strobe. */ #define LP_INIT_WAIT 1 /* This is the amount of time that the driver waits for the printer to * catch up when the printer's buffer appears to be filled. If you * want to tune this and have a fast printer (i.e. HPIIIP), decrease * this number, and if you have a slow printer, increase this number. * This is in hundredths of a second, the default 2 being .05 second. * Or use the tunelp(8) command, which is especially nice if you want * change back and forth between character and graphics printing, which * are wildly different... */ #define LP_INIT_TIME 2 /* IOCTL numbers */ #define LPCHAR 0x0601 /* corresponds to LP_INIT_CHAR */ #define LPTIME 0x0602 /* corresponds to LP_INIT_TIME */ #define LPABORT 0x0604 /* call with TRUE arg to abort on error, FALSE to retry. Default is retry. */ #define LPSETIRQ 0x0605 /* call with new IRQ number, or 0 for polling (no IRQ) */ #define LPGETIRQ 0x0606 /* get the current IRQ number */ #define LPWAIT 0x0608 /* corresponds to LP_INIT_WAIT */ /* NOTE: LPCAREFUL is obsoleted and it' s always the default right now -arca */ #define LPCAREFUL 0x0609 /* call with TRUE arg to require out-of-paper, off- line, and error indicators good on all writes, FALSE to ignore them. Default is ignore. */ #define LPABORTOPEN 0x060a /* call with TRUE arg to abort open() on error, FALSE to ignore error. Default is ignore. */ #define LPGETSTATUS 0x060b /* return LP_S(minor) */ #define LPRESET 0x060c /* reset printer */ #ifdef LP_STATS #define LPGETSTATS 0x060d /* get statistics (struct lp_stats) */ #endif #define LPGETFLAGS 0x060e /* get status flags */ #define LPSETTIMEOUT 0x060f /* set parport timeout */ /* timeout for printk'ing a timeout, in jiffies (100ths of a second). This is also used for re-checking error conditions if LP_ABORT is not set. This is the default behavior. */ #define LP_TIMEOUT_INTERRUPT (60 * HZ) #define LP_TIMEOUT_POLLED (10 * HZ) #endif /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Definitions for the UDP protocol. * * Version: @(#)udp.h 1.0.2 04/28/93 * * Author: Fred N. van Kempen, * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_UDP_H #define _LINUX_UDP_H #include struct udphdr { __be16 source; __be16 dest; __be16 len; __sum16 check; }; /* UDP socket options */ #define UDP_CORK 1 /* Never send partially complete segments */ #define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */ /* UDP encapsulation types */ #define UDP_ENCAP_ESPINUDP_NON_IKE 1 /* draft-ietf-ipsec-nat-t-ike-00/01 */ #define UDP_ENCAP_ESPINUDP 2 /* draft-ietf-ipsec-udp-encaps-06 */ #define UDP_ENCAP_L2TPINUDP 3 /* rfc2661 */ #endif /* _LINUX_UDP_H */ #ifndef _LINUX_VIRTIO_NET_H #define _LINUX_VIRTIO_NET_H /* This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. */ #include #include #include #include /* The feature bitmap for virtio net */ #define VIRTIO_NET_F_CSUM 0 /* Host handles pkts w/ partial csum */ #define VIRTIO_NET_F_GUEST_CSUM 1 /* Guest handles pkts w/ partial csum */ #define VIRTIO_NET_F_MAC 5 /* Host has given MAC address. */ #define VIRTIO_NET_F_GSO 6 /* Host handles pkts w/ any GSO type */ #define VIRTIO_NET_F_GUEST_TSO4 7 /* Guest can handle TSOv4 in. */ #define VIRTIO_NET_F_GUEST_TSO6 8 /* Guest can handle TSOv6 in. */ #define VIRTIO_NET_F_GUEST_ECN 9 /* Guest can handle TSO[6] w/ ECN in. */ #define VIRTIO_NET_F_GUEST_UFO 10 /* Guest can handle UFO in. */ #define VIRTIO_NET_F_HOST_TSO4 11 /* Host can handle TSOv4 in. */ #define VIRTIO_NET_F_HOST_TSO6 12 /* Host can handle TSOv6 in. */ #define VIRTIO_NET_F_HOST_ECN 13 /* Host can handle TSO[6] w/ ECN in. */ #define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */ #define VIRTIO_NET_F_MRG_RXBUF 15 /* Host can merge receive buffers. */ #define VIRTIO_NET_F_STATUS 16 /* virtio_net_config.status available */ #define VIRTIO_NET_F_CTRL_VQ 17 /* Control channel available */ #define VIRTIO_NET_F_CTRL_RX 18 /* Control channel RX mode support */ #define VIRTIO_NET_F_CTRL_VLAN 19 /* Control channel VLAN filtering */ #define VIRTIO_NET_F_CTRL_RX_EXTRA 20 /* Extra RX mode control support */ #define VIRTIO_NET_S_LINK_UP 1 /* Link is up */ struct virtio_net_config { /* The config defining mac address (if VIRTIO_NET_F_MAC) */ __u8 mac[6]; /* See VIRTIO_NET_F_STATUS and VIRTIO_NET_S_* above */ __u16 status; } __attribute__((packed)); /* This is the first element of the scatter-gather list. If you don't * specify GSO or CSUM features, you can simply ignore the header. */ struct virtio_net_hdr { #define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 // Use csum_start, csum_offset __u8 flags; #define VIRTIO_NET_HDR_GSO_NONE 0 // Not a GSO frame #define VIRTIO_NET_HDR_GSO_TCPV4 1 // GSO frame, IPv4 TCP (TSO) #define VIRTIO_NET_HDR_GSO_UDP 3 // GSO frame, IPv4 UDP (UFO) #define VIRTIO_NET_HDR_GSO_TCPV6 4 // GSO frame, IPv6 TCP #define VIRTIO_NET_HDR_GSO_ECN 0x80 // TCP has ECN set __u8 gso_type; __u16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */ __u16 gso_size; /* Bytes to append to hdr_len per frame */ __u16 csum_start; /* Position to start checksumming from */ __u16 csum_offset; /* Offset after that to place checksum */ }; /* This is the version of the header to use when the MRG_RXBUF * feature has been negotiated. */ struct virtio_net_hdr_mrg_rxbuf { struct virtio_net_hdr hdr; __u16 num_buffers; /* Number of merged rx buffers */ }; /* * Control virtqueue data structures * * The control virtqueue expects a header in the first sg entry * and an ack/status response in the last entry. Data for the * command goes in between. */ struct virtio_net_ctrl_hdr { __u8 class; __u8 cmd; } __attribute__((packed)); typedef __u8 virtio_net_ctrl_ack; #define VIRTIO_NET_OK 0 #define VIRTIO_NET_ERR 1 /* * Control the RX mode, ie. promisucous, allmulti, etc... * All commands require an "out" sg entry containing a 1 byte * state value, zero = disable, non-zero = enable. Commands * 0 and 1 are supported with the VIRTIO_NET_F_CTRL_RX feature. * Commands 2-5 are added with VIRTIO_NET_F_CTRL_RX_EXTRA. */ #define VIRTIO_NET_CTRL_RX 0 #define VIRTIO_NET_CTRL_RX_PROMISC 0 #define VIRTIO_NET_CTRL_RX_ALLMULTI 1 #define VIRTIO_NET_CTRL_RX_ALLUNI 2 #define VIRTIO_NET_CTRL_RX_NOMULTI 3 #define VIRTIO_NET_CTRL_RX_NOUNI 4 #define VIRTIO_NET_CTRL_RX_NOBCAST 5 /* * Control the MAC filter table. * * The MAC filter table is managed by the hypervisor, the guest should * assume the size is infinite. Filtering should be considered * non-perfect, ie. based on hypervisor resources, the guest may * received packets from sources not specified in the filter list. * * In addition to the class/cmd header, the TABLE_SET command requires * two out scatterlists. Each contains a 4 byte count of entries followed * by a concatenated byte stream of the ETH_ALEN MAC addresses. The * first sg list contains unicast addresses, the second is for multicast. * This functionality is present if the VIRTIO_NET_F_CTRL_RX feature * is available. */ struct virtio_net_ctrl_mac { __u32 entries; __u8 macs[][ETH_ALEN]; } __attribute__((packed)); #define VIRTIO_NET_CTRL_MAC 1 #define VIRTIO_NET_CTRL_MAC_TABLE_SET 0 /* * Control VLAN filtering * * The VLAN filter table is controlled via a simple ADD/DEL interface. * VLAN IDs not added may be filterd by the hypervisor. Del is the * opposite of add. Both commands expect an out entry containing a 2 * byte VLAN ID. VLAN filterting is available with the * VIRTIO_NET_F_CTRL_VLAN feature bit. */ #define VIRTIO_NET_CTRL_VLAN 2 #define VIRTIO_NET_CTRL_VLAN_ADD 0 #define VIRTIO_NET_CTRL_VLAN_DEL 1 #endif /* _LINUX_VIRTIO_NET_H */ /* * linux/can.h * * Definitions for CAN network layer (socket addr / CAN frame / CAN filter) * * Authors: Oliver Hartkopp * Urs Thuermann * Copyright (c) 2002-2007 Volkswagen Group Electronic Research * All rights reserved. * * Send feedback to * */ #ifndef CAN_H #define CAN_H #include #include /* controller area network (CAN) kernel definitions */ /* special address description flags for the CAN_ID */ #define CAN_EFF_FLAG 0x80000000U /* EFF/SFF is set in the MSB */ #define CAN_RTR_FLAG 0x40000000U /* remote transmission request */ #define CAN_ERR_FLAG 0x20000000U /* error frame */ /* valid bits in CAN ID for frame formats */ #define CAN_SFF_MASK 0x000007FFU /* standard frame format (SFF) */ #define CAN_EFF_MASK 0x1FFFFFFFU /* extended frame format (EFF) */ #define CAN_ERR_MASK 0x1FFFFFFFU /* omit EFF, RTR, ERR flags */ /* * Controller Area Network Identifier structure * * bit 0-28 : CAN identifier (11/29 bit) * bit 29 : error frame flag (0 = data frame, 1 = error frame) * bit 30 : remote transmission request flag (1 = rtr frame) * bit 31 : frame format flag (0 = standard 11 bit, 1 = extended 29 bit) */ typedef __u32 canid_t; /* * Controller Area Network Error Frame Mask structure * * bit 0-28 : error class mask (see include/linux/can/error.h) * bit 29-31 : set to zero */ typedef __u32 can_err_mask_t; /** * struct can_frame - basic CAN frame structure * @can_id: the CAN ID of the frame and CAN_*_FLAG flags, see above. * @can_dlc: the data length field of the CAN frame * @data: the CAN frame payload. */ struct can_frame { canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */ __u8 can_dlc; /* data length code: 0 .. 8 */ __u8 data[8] __attribute__((aligned(8))); }; /* particular protocols of the protocol family PF_CAN */ #define CAN_RAW 1 /* RAW sockets */ #define CAN_BCM 2 /* Broadcast Manager */ #define CAN_TP16 3 /* VAG Transport Protocol v1.6 */ #define CAN_TP20 4 /* VAG Transport Protocol v2.0 */ #define CAN_MCNET 5 /* Bosch MCNet */ #define CAN_ISOTP 6 /* ISO 15765-2 Transport Protocol */ #define CAN_NPROTO 7 #define SOL_CAN_BASE 100 /** * struct sockaddr_can - the sockaddr structure for CAN sockets * @can_family: address family number AF_CAN. * @can_ifindex: CAN network interface index. * @can_addr: protocol specific address information */ struct sockaddr_can { sa_family_t can_family; int can_ifindex; union { /* transport protocol class address information (e.g. ISOTP) */ struct { canid_t rx_id, tx_id; } tp; /* reserved for future CAN protocols address information */ } can_addr; }; /** * struct can_filter - CAN ID based filter in can_register(). * @can_id: relevant bits of CAN ID which are not masked out. * @can_mask: CAN mask (see description) * * Description: * A filter matches, when * * & mask == can_id & mask * * The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can * filter for error frames (CAN_ERR_FLAG bit set in mask). */ struct can_filter { canid_t can_id; canid_t can_mask; }; #define CAN_INV_FILTER 0x20000000U /* to be set in can_filter.can_id */ #endif /* CAN_H */ #ifndef _LINUX_SEM_H #define _LINUX_SEM_H #include /* semop flags */ #define SEM_UNDO 0x1000 /* undo the operation on exit */ /* semctl Command Definitions. */ #define GETPID 11 /* get sempid */ #define GETVAL 12 /* get semval */ #define GETALL 13 /* get all semval's */ #define GETNCNT 14 /* get semncnt */ #define GETZCNT 15 /* get semzcnt */ #define SETVAL 16 /* set semval */ #define SETALL 17 /* set all semval's */ /* ipcs ctl cmds */ #define SEM_STAT 18 #define SEM_INFO 19 /* Obsolete, used only for backwards compatibility and libc5 compiles */ struct semid_ds { struct ipc_perm sem_perm; /* permissions .. see ipc.h */ __kernel_time_t sem_otime; /* last semop time */ __kernel_time_t sem_ctime; /* last change time */ struct sem *sem_base; /* ptr to first semaphore in array */ struct sem_queue *sem_pending; /* pending operations to be processed */ struct sem_queue **sem_pending_last; /* last pending operation */ struct sem_undo *undo; /* undo requests on this array */ unsigned short sem_nsems; /* no. of semaphores in array */ }; /* Include the definition of semid64_ds */ #include /* semop system calls takes an array of these. */ struct sembuf { unsigned short sem_num; /* semaphore index in array */ short sem_op; /* semaphore operation */ short sem_flg; /* operation flags */ }; /* arg for semctl system calls. */ union semun { int val; /* value for SETVAL */ struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */ unsigned short *array; /* array for GETALL & SETALL */ struct seminfo *__buf; /* buffer for IPC_INFO */ void *__pad; }; struct seminfo { int semmap; int semmni; int semmns; int semmnu; int semmsl; int semopm; int semume; int semusz; int semvmx; int semaem; }; #define SEMMNI 128 /* <= IPCMNI max # of semaphore identifiers */ #define SEMMSL 250 /* <= 8 000 max num of semaphores per id */ #define SEMMNS (SEMMNI*SEMMSL) /* <= INT_MAX max # of semaphores in system */ #define SEMOPM 32 /* <= 1 000 max num of ops per semop call */ #define SEMVMX 32767 /* <= 32767 semaphore maximum value */ #define SEMAEM SEMVMX /* adjust on exit max value */ /* unused */ #define SEMUME SEMOPM /* max num of undo entries per process */ #define SEMMNU SEMMNS /* num of undo structures system wide */ #define SEMMAP SEMMNS /* # of entries in semaphore map */ #define SEMUSZ 20 /* sizeof struct sem_undo */ #endif /* _LINUX_SEM_H */ #ifndef __LINUX_PKT_SCHED_H #define __LINUX_PKT_SCHED_H #include /* Logical priority bands not depending on specific packet scheduler. Every scheduler will map them to real traffic classes, if it has no more precise mechanism to classify packets. These numbers have no special meaning, though their coincidence with obsolete IPv6 values is not occasional :-). New IPv6 drafts preferred full anarchy inspired by diffserv group. Note: TC_PRIO_BESTEFFORT does not mean that it is the most unhappy class, actually, as rule it will be handled with more care than filler or even bulk. */ #define TC_PRIO_BESTEFFORT 0 #define TC_PRIO_FILLER 1 #define TC_PRIO_BULK 2 #define TC_PRIO_INTERACTIVE_BULK 4 #define TC_PRIO_INTERACTIVE 6 #define TC_PRIO_CONTROL 7 #define TC_PRIO_MAX 15 /* Generic queue statistics, available for all the elements. Particular schedulers may have also their private records. */ struct tc_stats { __u64 bytes; /* NUmber of enqueues bytes */ __u32 packets; /* Number of enqueued packets */ __u32 drops; /* Packets dropped because of lack of resources */ __u32 overlimits; /* Number of throttle events when this * flow goes out of allocated bandwidth */ __u32 bps; /* Current flow byte rate */ __u32 pps; /* Current flow packet rate */ __u32 qlen; __u32 backlog; }; struct tc_estimator { signed char interval; unsigned char ewma_log; }; /* "Handles" --------- All the traffic control objects have 32bit identifiers, or "handles". They can be considered as opaque numbers from user API viewpoint, but actually they always consist of two fields: major and minor numbers, which are interpreted by kernel specially, that may be used by applications, though not recommended. F.e. qdisc handles always have minor number equal to zero, classes (or flows) have major equal to parent qdisc major, and minor uniquely identifying class inside qdisc. Macros to manipulate handles: */ #define TC_H_MAJ_MASK (0xFFFF0000U) #define TC_H_MIN_MASK (0x0000FFFFU) #define TC_H_MAJ(h) ((h)&TC_H_MAJ_MASK) #define TC_H_MIN(h) ((h)&TC_H_MIN_MASK) #define TC_H_MAKE(maj,min) (((maj)&TC_H_MAJ_MASK)|((min)&TC_H_MIN_MASK)) #define TC_H_UNSPEC (0U) #define TC_H_ROOT (0xFFFFFFFFU) #define TC_H_INGRESS (0xFFFFFFF1U) struct tc_ratespec { unsigned char cell_log; unsigned char __reserved; unsigned short overhead; short cell_align; unsigned short mpu; __u32 rate; }; #define TC_RTAB_SIZE 1024 struct tc_sizespec { unsigned char cell_log; unsigned char size_log; short cell_align; int overhead; unsigned int linklayer; unsigned int mpu; unsigned int mtu; unsigned int tsize; }; enum { TCA_STAB_UNSPEC, TCA_STAB_BASE, TCA_STAB_DATA, __TCA_STAB_MAX }; #define TCA_STAB_MAX (__TCA_STAB_MAX - 1) /* FIFO section */ struct tc_fifo_qopt { __u32 limit; /* Queue length: bytes for bfifo, packets for pfifo */ }; /* PRIO section */ #define TCQ_PRIO_BANDS 16 #define TCQ_MIN_PRIO_BANDS 2 struct tc_prio_qopt { int bands; /* Number of bands */ __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */ }; /* MULTIQ section */ struct tc_multiq_qopt { __u16 bands; /* Number of bands */ __u16 max_bands; /* Maximum number of queues */ }; /* TBF section */ struct tc_tbf_qopt { struct tc_ratespec rate; struct tc_ratespec peakrate; __u32 limit; __u32 buffer; __u32 mtu; }; enum { TCA_TBF_UNSPEC, TCA_TBF_PARMS, TCA_TBF_RTAB, TCA_TBF_PTAB, __TCA_TBF_MAX, }; #define TCA_TBF_MAX (__TCA_TBF_MAX - 1) /* TEQL section */ /* TEQL does not require any parameters */ /* SFQ section */ struct tc_sfq_qopt { unsigned quantum; /* Bytes per round allocated to flow */ int perturb_period; /* Period of hash perturbation */ __u32 limit; /* Maximal packets in queue */ unsigned divisor; /* Hash divisor */ unsigned flows; /* Maximal number of flows */ }; struct tc_sfq_xstats { __s32 allot; }; /* * NOTE: limit, divisor and flows are hardwired to code at the moment. * * limit=flows=128, divisor=1024; * * The only reason for this is efficiency, it is possible * to change these parameters in compile time. */ /* RED section */ enum { TCA_RED_UNSPEC, TCA_RED_PARMS, TCA_RED_STAB, __TCA_RED_MAX, }; #define TCA_RED_MAX (__TCA_RED_MAX - 1) struct tc_red_qopt { __u32 limit; /* HARD maximal queue length (bytes) */ __u32 qth_min; /* Min average length threshold (bytes) */ __u32 qth_max; /* Max average length threshold (bytes) */ unsigned char Wlog; /* log(W) */ unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ unsigned char Scell_log; /* cell size for idle damping */ unsigned char flags; #define TC_RED_ECN 1 #define TC_RED_HARDDROP 2 }; struct tc_red_xstats { __u32 early; /* Early drops */ __u32 pdrop; /* Drops due to queue limits */ __u32 other; /* Drops due to drop() calls */ __u32 marked; /* Marked packets */ }; /* GRED section */ #define MAX_DPs 16 enum { TCA_GRED_UNSPEC, TCA_GRED_PARMS, TCA_GRED_STAB, TCA_GRED_DPS, __TCA_GRED_MAX, }; #define TCA_GRED_MAX (__TCA_GRED_MAX - 1) struct tc_gred_qopt { __u32 limit; /* HARD maximal queue length (bytes) */ __u32 qth_min; /* Min average length threshold (bytes) */ __u32 qth_max; /* Max average length threshold (bytes) */ __u32 DP; /* upto 2^32 DPs */ __u32 backlog; __u32 qave; __u32 forced; __u32 early; __u32 other; __u32 pdrop; __u8 Wlog; /* log(W) */ __u8 Plog; /* log(P_max/(qth_max-qth_min)) */ __u8 Scell_log; /* cell size for idle damping */ __u8 prio; /* prio of this VQ */ __u32 packets; __u32 bytesin; }; /* gred setup */ struct tc_gred_sopt { __u32 DPs; __u32 def_DP; __u8 grio; __u8 flags; __u16 pad1; }; /* HTB section */ #define TC_HTB_NUMPRIO 8 #define TC_HTB_MAXDEPTH 8 #define TC_HTB_PROTOVER 3 /* the same as HTB and TC's major */ struct tc_htb_opt { struct tc_ratespec rate; struct tc_ratespec ceil; __u32 buffer; __u32 cbuffer; __u32 quantum; __u32 level; /* out only */ __u32 prio; }; struct tc_htb_glob { __u32 version; /* to match HTB/TC */ __u32 rate2quantum; /* bps->quantum divisor */ __u32 defcls; /* default class number */ __u32 debug; /* debug flags */ /* stats */ __u32 direct_pkts; /* count of non shapped packets */ }; enum { TCA_HTB_UNSPEC, TCA_HTB_PARMS, TCA_HTB_INIT, TCA_HTB_CTAB, TCA_HTB_RTAB, __TCA_HTB_MAX, }; #define TCA_HTB_MAX (__TCA_HTB_MAX - 1) struct tc_htb_xstats { __u32 lends; __u32 borrows; __u32 giants; /* too big packets (rate will not be accurate) */ __u32 tokens; __u32 ctokens; }; /* HFSC section */ struct tc_hfsc_qopt { __u16 defcls; /* default class */ }; struct tc_service_curve { __u32 m1; /* slope of the first segment in bps */ __u32 d; /* x-projection of the first segment in us */ __u32 m2; /* slope of the second segment in bps */ }; struct tc_hfsc_stats { __u64 work; /* total work done */ __u64 rtwork; /* work done by real-time criteria */ __u32 period; /* current period */ __u32 level; /* class level in hierarchy */ }; enum { TCA_HFSC_UNSPEC, TCA_HFSC_RSC, TCA_HFSC_FSC, TCA_HFSC_USC, __TCA_HFSC_MAX, }; #define TCA_HFSC_MAX (__TCA_HFSC_MAX - 1) /* CBQ section */ #define TC_CBQ_MAXPRIO 8 #define TC_CBQ_MAXLEVEL 8 #define TC_CBQ_DEF_EWMA 5 struct tc_cbq_lssopt { unsigned char change; unsigned char flags; #define TCF_CBQ_LSS_BOUNDED 1 #define TCF_CBQ_LSS_ISOLATED 2 unsigned char ewma_log; unsigned char level; #define TCF_CBQ_LSS_FLAGS 1 #define TCF_CBQ_LSS_EWMA 2 #define TCF_CBQ_LSS_MAXIDLE 4 #define TCF_CBQ_LSS_MINIDLE 8 #define TCF_CBQ_LSS_OFFTIME 0x10 #define TCF_CBQ_LSS_AVPKT 0x20 __u32 maxidle; __u32 minidle; __u32 offtime; __u32 avpkt; }; struct tc_cbq_wrropt { unsigned char flags; unsigned char priority; unsigned char cpriority; unsigned char __reserved; __u32 allot; __u32 weight; }; struct tc_cbq_ovl { unsigned char strategy; #define TC_CBQ_OVL_CLASSIC 0 #define TC_CBQ_OVL_DELAY 1 #define TC_CBQ_OVL_LOWPRIO 2 #define TC_CBQ_OVL_DROP 3 #define TC_CBQ_OVL_RCLASSIC 4 unsigned char priority2; __u16 pad; __u32 penalty; }; struct tc_cbq_police { unsigned char police; unsigned char __res1; unsigned short __res2; }; struct tc_cbq_fopt { __u32 split; __u32 defmap; __u32 defchange; }; struct tc_cbq_xstats { __u32 borrows; __u32 overactions; __s32 avgidle; __s32 undertime; }; enum { TCA_CBQ_UNSPEC, TCA_CBQ_LSSOPT, TCA_CBQ_WRROPT, TCA_CBQ_FOPT, TCA_CBQ_OVL_STRATEGY, TCA_CBQ_RATE, TCA_CBQ_RTAB, TCA_CBQ_POLICE, __TCA_CBQ_MAX, }; #define TCA_CBQ_MAX (__TCA_CBQ_MAX - 1) /* dsmark section */ enum { TCA_DSMARK_UNSPEC, TCA_DSMARK_INDICES, TCA_DSMARK_DEFAULT_INDEX, TCA_DSMARK_SET_TC_INDEX, TCA_DSMARK_MASK, TCA_DSMARK_VALUE, __TCA_DSMARK_MAX, }; #define TCA_DSMARK_MAX (__TCA_DSMARK_MAX - 1) /* ATM section */ enum { TCA_ATM_UNSPEC, TCA_ATM_FD, /* file/socket descriptor */ TCA_ATM_PTR, /* pointer to descriptor - later */ TCA_ATM_HDR, /* LL header */ TCA_ATM_EXCESS, /* excess traffic class (0 for CLP) */ TCA_ATM_ADDR, /* PVC address (for output only) */ TCA_ATM_STATE, /* VC state (ATM_VS_*; for output only) */ __TCA_ATM_MAX, }; #define TCA_ATM_MAX (__TCA_ATM_MAX - 1) /* Network emulator */ enum { TCA_NETEM_UNSPEC, TCA_NETEM_CORR, TCA_NETEM_DELAY_DIST, TCA_NETEM_REORDER, TCA_NETEM_CORRUPT, __TCA_NETEM_MAX, }; #define TCA_NETEM_MAX (__TCA_NETEM_MAX - 1) struct tc_netem_qopt { __u32 latency; /* added delay (us) */ __u32 limit; /* fifo limit (packets) */ __u32 loss; /* random packet loss (0=none ~0=100%) */ __u32 gap; /* re-ordering gap (0 for none) */ __u32 duplicate; /* random packet dup (0=none ~0=100%) */ __u32 jitter; /* random jitter in latency (us) */ }; struct tc_netem_corr { __u32 delay_corr; /* delay correlation */ __u32 loss_corr; /* packet loss correlation */ __u32 dup_corr; /* duplicate correlation */ }; struct tc_netem_reorder { __u32 probability; __u32 correlation; }; struct tc_netem_corrupt { __u32 probability; __u32 correlation; }; #define NETEM_DIST_SCALE 8192 /* DRR */ enum { TCA_DRR_UNSPEC, TCA_DRR_QUANTUM, __TCA_DRR_MAX }; #define TCA_DRR_MAX (__TCA_DRR_MAX - 1) struct tc_drr_stats { __u32 deficit; }; #endif #ifndef BLKTRACE_H #define BLKTRACE_H #include /* * Trace categories */ enum blktrace_cat { BLK_TC_READ = 1 << 0, /* reads */ BLK_TC_WRITE = 1 << 1, /* writes */ BLK_TC_BARRIER = 1 << 2, /* barrier */ BLK_TC_SYNC = 1 << 3, /* sync IO */ BLK_TC_SYNCIO = BLK_TC_SYNC, BLK_TC_QUEUE = 1 << 4, /* queueing/merging */ BLK_TC_REQUEUE = 1 << 5, /* requeueing */ BLK_TC_ISSUE = 1 << 6, /* issue */ BLK_TC_COMPLETE = 1 << 7, /* completions */ BLK_TC_FS = 1 << 8, /* fs requests */ BLK_TC_PC = 1 << 9, /* pc requests */ BLK_TC_NOTIFY = 1 << 10, /* special message */ BLK_TC_AHEAD = 1 << 11, /* readahead */ BLK_TC_META = 1 << 12, /* metadata */ BLK_TC_DISCARD = 1 << 13, /* discard requests */ BLK_TC_DRV_DATA = 1 << 14, /* binary per-driver data */ BLK_TC_END = 1 << 15, /* only 16-bits, reminder */ }; #define BLK_TC_SHIFT (16) #define BLK_TC_ACT(act) ((act) << BLK_TC_SHIFT) /* * Basic trace actions */ enum blktrace_act { __BLK_TA_QUEUE = 1, /* queued */ __BLK_TA_BACKMERGE, /* back merged to existing rq */ __BLK_TA_FRONTMERGE, /* front merge to existing rq */ __BLK_TA_GETRQ, /* allocated new request */ __BLK_TA_SLEEPRQ, /* sleeping on rq allocation */ __BLK_TA_REQUEUE, /* request requeued */ __BLK_TA_ISSUE, /* sent to driver */ __BLK_TA_COMPLETE, /* completed by driver */ __BLK_TA_PLUG, /* queue was plugged */ __BLK_TA_UNPLUG_IO, /* queue was unplugged by io */ __BLK_TA_UNPLUG_TIMER, /* queue was unplugged by timer */ __BLK_TA_INSERT, /* insert request */ __BLK_TA_SPLIT, /* bio was split */ __BLK_TA_BOUNCE, /* bio was bounced */ __BLK_TA_REMAP, /* bio was remapped */ __BLK_TA_ABORT, /* request aborted */ __BLK_TA_DRV_DATA, /* driver-specific binary data */ }; /* * Notify events. */ enum blktrace_notify { __BLK_TN_PROCESS = 0, /* establish pid/name mapping */ __BLK_TN_TIMESTAMP, /* include system clock */ __BLK_TN_MESSAGE, /* Character string message */ }; /* * Trace actions in full. Additionally, read or write is masked */ #define BLK_TA_QUEUE (__BLK_TA_QUEUE | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_BACKMERGE (__BLK_TA_BACKMERGE | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_FRONTMERGE (__BLK_TA_FRONTMERGE | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_GETRQ (__BLK_TA_GETRQ | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_SLEEPRQ (__BLK_TA_SLEEPRQ | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_REQUEUE (__BLK_TA_REQUEUE | BLK_TC_ACT(BLK_TC_REQUEUE)) #define BLK_TA_ISSUE (__BLK_TA_ISSUE | BLK_TC_ACT(BLK_TC_ISSUE)) #define BLK_TA_COMPLETE (__BLK_TA_COMPLETE| BLK_TC_ACT(BLK_TC_COMPLETE)) #define BLK_TA_PLUG (__BLK_TA_PLUG | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_UNPLUG_IO (__BLK_TA_UNPLUG_IO | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_UNPLUG_TIMER (__BLK_TA_UNPLUG_TIMER | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_INSERT (__BLK_TA_INSERT | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_SPLIT (__BLK_TA_SPLIT) #define BLK_TA_BOUNCE (__BLK_TA_BOUNCE) #define BLK_TA_REMAP (__BLK_TA_REMAP | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_ABORT (__BLK_TA_ABORT | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_DRV_DATA (__BLK_TA_DRV_DATA | BLK_TC_ACT(BLK_TC_DRV_DATA)) #define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY)) #define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY)) #define BLK_TN_MESSAGE (__BLK_TN_MESSAGE | BLK_TC_ACT(BLK_TC_NOTIFY)) #define BLK_IO_TRACE_MAGIC 0x65617400 #define BLK_IO_TRACE_VERSION 0x07 /* * The trace itself */ struct blk_io_trace { __u32 magic; /* MAGIC << 8 | version */ __u32 sequence; /* event number */ __u64 time; /* in microseconds */ __u64 sector; /* disk offset */ __u32 bytes; /* transfer length */ __u32 action; /* what happened */ __u32 pid; /* who did it */ __u32 device; /* device number */ __u32 cpu; /* on what cpu did it happen */ __u16 error; /* completion error */ __u16 pdu_len; /* length of data after this trace */ }; /* * The remap event */ struct blk_io_trace_remap { __be32 device_from; __be32 device_to; __be64 sector_from; }; enum { Blktrace_setup = 1, Blktrace_running, Blktrace_stopped, }; #define BLKTRACE_BDEV_SIZE 32 /* * User setup structure passed with BLKTRACESTART */ struct blk_user_trace_setup { char name[BLKTRACE_BDEV_SIZE]; /* output */ __u16 act_mask; /* input */ __u32 buf_size; /* input */ __u32 buf_nr; /* input */ __u64 start_lba; __u64 end_lba; __u32 pid; }; #endif t, .ñ* ..u, g_printer.hv, gadgetfs.hw,cdc.hx, ..install.cmdy,.installz,ch11.h{,audio.h|,tmc.h},ch9.h~,Hmidi.h/* * g_printer.h -- Header file for USB Printer gadget driver * * Copyright (C) 2007 Craig W. Nadler * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __LINUX_USB_G_PRINTER_H #define __LINUX_USB_G_PRINTER_H #define PRINTER_NOT_ERROR 0x08 #define PRINTER_SELECTED 0x10 #define PRINTER_PAPER_EMPTY 0x20 /* The 'g' code is also used by gadgetfs ioctl requests. * Don't add any colliding codes to either driver, and keep * them in unique ranges (size 0x20 for now). */ #define GADGET_GET_PRINTER_STATUS _IOR('g', 0x21, unsigned char) #define GADGET_SET_PRINTER_STATUS _IOWR('g', 0x22, unsigned char) #endif /* __LINUX_USB_G_PRINTER_H */ /* * Filesystem based user-mode API to USB Gadget controller hardware * * Other than ep0 operations, most things are done by read() and write() * on endpoint files found in one directory. They are configured by * writing descriptors, and then may be used for normal stream style * i/o requests. When ep0 is configured, the device can enumerate; * when it's closed, the device disconnects from usb. Operations on * ep0 require ioctl() operations. * * Configuration and device descriptors get written to /dev/gadget/$CHIP, * which may then be used to read usb_gadgetfs_event structs. The driver * may activate endpoints as it handles SET_CONFIGURATION setup events, * or earlier; writing endpoint descriptors to /dev/gadget/$ENDPOINT * then performing data transfers by reading or writing. */ #ifndef __LINUX_USB_GADGETFS_H #define __LINUX_USB_GADGETFS_H #include #include #include /* * Events are delivered on the ep0 file descriptor, when the user mode driver * reads from this file descriptor after writing the descriptors. Don't * stop polling this descriptor. */ enum usb_gadgetfs_event_type { GADGETFS_NOP = 0, GADGETFS_CONNECT, GADGETFS_DISCONNECT, GADGETFS_SETUP, GADGETFS_SUSPEND, /* and likely more ! */ }; /* NOTE: this structure must stay the same size and layout on * both 32-bit and 64-bit kernels. */ struct usb_gadgetfs_event { union { /* NOP, DISCONNECT, SUSPEND: nothing * ... some hardware can't report disconnection */ /* CONNECT: just the speed */ enum usb_device_speed speed; /* SETUP: packet; DATA phase i/o precedes next event *(setup.bmRequestType & USB_DIR_IN) flags direction * ... includes SET_CONFIGURATION, SET_INTERFACE */ struct usb_ctrlrequest setup; } u; enum usb_gadgetfs_event_type type; }; /* The 'g' code is also used by printer gadget ioctl requests. * Don't add any colliding codes to either driver, and keep * them in unique ranges (size 0x20 for now). */ /* endpoint ioctls */ /* IN transfers may be reported to the gadget driver as complete * when the fifo is loaded, before the host reads the data; * OUT transfers may be reported to the host's "client" driver as * complete when they're sitting in the FIFO unread. * THIS returns how many bytes are "unclaimed" in the endpoint fifo * (needed for precise fault handling, when the hardware allows it) */ #define GADGETFS_FIFO_STATUS _IO('g', 1) /* discards any unclaimed data in the fifo. */ #define GADGETFS_FIFO_FLUSH _IO('g', 2) /* resets endpoint halt+toggle; used to implement set_interface. * some hardware (like pxa2xx) can't support this. */ #define GADGETFS_CLEAR_HALT _IO('g', 3) #endif /* __LINUX_USB_GADGETFS_H */ /* * USB Communications Device Class (CDC) definitions * * CDC says how to talk to lots of different types of network adapters, * notably ethernet adapters and various modems. It's used mostly with * firmware based USB peripherals. */ #ifndef __LINUX_USB_CDC_H #define __LINUX_USB_CDC_H #include #define USB_CDC_SUBCLASS_ACM 0x02 #define USB_CDC_SUBCLASS_ETHERNET 0x06 #define USB_CDC_SUBCLASS_WHCM 0x08 #define USB_CDC_SUBCLASS_DMM 0x09 #define USB_CDC_SUBCLASS_MDLM 0x0a #define USB_CDC_SUBCLASS_OBEX 0x0b #define USB_CDC_SUBCLASS_EEM 0x0c #define USB_CDC_SUBCLASS_NCM 0x0d #define USB_CDC_PROTO_NONE 0 #define USB_CDC_ACM_PROTO_AT_V25TER 1 #define USB_CDC_ACM_PROTO_AT_PCCA101 2 #define USB_CDC_ACM_PROTO_AT_PCCA101_WAKE 3 #define USB_CDC_ACM_PROTO_AT_GSM 4 #define USB_CDC_ACM_PROTO_AT_3G 5 #define USB_CDC_ACM_PROTO_AT_CDMA 6 #define USB_CDC_ACM_PROTO_VENDOR 0xff #define USB_CDC_PROTO_EEM 7 #define USB_CDC_NCM_PROTO_NTB 1 /*-------------------------------------------------------------------------*/ /* * Class-Specific descriptors ... there are a couple dozen of them */ #define USB_CDC_HEADER_TYPE 0x00 /* header_desc */ #define USB_CDC_CALL_MANAGEMENT_TYPE 0x01 /* call_mgmt_descriptor */ #define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */ #define USB_CDC_UNION_TYPE 0x06 /* union_desc */ #define USB_CDC_COUNTRY_TYPE 0x07 #define USB_CDC_NETWORK_TERMINAL_TYPE 0x0a /* network_terminal_desc */ #define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */ #define USB_CDC_WHCM_TYPE 0x11 #define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */ #define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */ #define USB_CDC_DMM_TYPE 0x14 #define USB_CDC_OBEX_TYPE 0x15 #define USB_CDC_NCM_TYPE 0x1a /* "Header Functional Descriptor" from CDC spec 5.2.3.1 */ struct usb_cdc_header_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __le16 bcdCDC; } __attribute__ ((packed)); /* "Call Management Descriptor" from CDC spec 5.2.3.2 */ struct usb_cdc_call_mgmt_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bmCapabilities; #define USB_CDC_CALL_MGMT_CAP_CALL_MGMT 0x01 #define USB_CDC_CALL_MGMT_CAP_DATA_INTF 0x02 __u8 bDataInterface; } __attribute__ ((packed)); /* "Abstract Control Management Descriptor" from CDC spec 5.2.3.3 */ struct usb_cdc_acm_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bmCapabilities; } __attribute__ ((packed)); /* capabilities from 5.2.3.3 */ #define USB_CDC_COMM_FEATURE 0x01 #define USB_CDC_CAP_LINE 0x02 #define USB_CDC_CAP_BRK 0x04 #define USB_CDC_CAP_NOTIFY 0x08 /* "Union Functional Descriptor" from CDC spec 5.2.3.8 */ struct usb_cdc_union_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bMasterInterface0; __u8 bSlaveInterface0; /* ... and there could be other slave interfaces */ } __attribute__ ((packed)); /* "Country Selection Functional Descriptor" from CDC spec 5.2.3.9 */ struct usb_cdc_country_functional_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 iCountryCodeRelDate; __le16 wCountyCode0; /* ... and there can be a lot of country codes */ } __attribute__ ((packed)); /* "Network Channel Terminal Functional Descriptor" from CDC spec 5.2.3.11 */ struct usb_cdc_network_terminal_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bEntityId; __u8 iName; __u8 bChannelIndex; __u8 bPhysicalInterface; } __attribute__ ((packed)); /* "Ethernet Networking Functional Descriptor" from CDC spec 5.2.3.16 */ struct usb_cdc_ether_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 iMACAddress; __le32 bmEthernetStatistics; __le16 wMaxSegmentSize; __le16 wNumberMCFilters; __u8 bNumberPowerFilters; } __attribute__ ((packed)); /* "Telephone Control Model Functional Descriptor" from CDC WMC spec 6.3..3 */ struct usb_cdc_dmm_desc { __u8 bFunctionLength; __u8 bDescriptorType; __u8 bDescriptorSubtype; __u16 bcdVersion; __le16 wMaxCommand; } __attribute__ ((packed)); /* "MDLM Functional Descriptor" from CDC WMC spec 6.7.2.3 */ struct usb_cdc_mdlm_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __le16 bcdVersion; __u8 bGUID[16]; } __attribute__ ((packed)); /* "MDLM Detail Functional Descriptor" from CDC WMC spec 6.7.2.4 */ struct usb_cdc_mdlm_detail_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; /* type is associated with mdlm_desc.bGUID */ __u8 bGuidDescriptorType; __u8 bDetailData[0]; } __attribute__ ((packed)); /* "OBEX Control Model Functional Descriptor" */ struct usb_cdc_obex_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __le16 bcdVersion; } __attribute__ ((packed)); /* "NCM Control Model Functional Descriptor" */ struct usb_cdc_ncm_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __le16 bcdNcmVersion; __u8 bmNetworkCapabilities; } __attribute__ ((packed)); /*-------------------------------------------------------------------------*/ /* * Class-Specific Control Requests (6.2) * * section 3.6.2.1 table 4 has the ACM profile, for modems. * section 3.8.2 table 10 has the ethernet profile. * * Microsoft's RNDIS stack for Ethernet is a vendor-specific CDC ACM variant, * heavily dependent on the encapsulated (proprietary) command mechanism. */ #define USB_CDC_SEND_ENCAPSULATED_COMMAND 0x00 #define USB_CDC_GET_ENCAPSULATED_RESPONSE 0x01 #define USB_CDC_REQ_SET_LINE_CODING 0x20 #define USB_CDC_REQ_GET_LINE_CODING 0x21 #define USB_CDC_REQ_SET_CONTROL_LINE_STATE 0x22 #define USB_CDC_REQ_SEND_BREAK 0x23 #define USB_CDC_SET_ETHERNET_MULTICAST_FILTERS 0x40 #define USB_CDC_SET_ETHERNET_PM_PATTERN_FILTER 0x41 #define USB_CDC_GET_ETHERNET_PM_PATTERN_FILTER 0x42 #define USB_CDC_SET_ETHERNET_PACKET_FILTER 0x43 #define USB_CDC_GET_ETHERNET_STATISTIC 0x44 #define USB_CDC_GET_NTB_PARAMETERS 0x80 #define USB_CDC_GET_NET_ADDRESS 0x81 #define USB_CDC_SET_NET_ADDRESS 0x82 #define USB_CDC_GET_NTB_FORMAT 0x83 #define USB_CDC_SET_NTB_FORMAT 0x84 #define USB_CDC_GET_NTB_INPUT_SIZE 0x85 #define USB_CDC_SET_NTB_INPUT_SIZE 0x86 #define USB_CDC_GET_MAX_DATAGRAM_SIZE 0x87 #define USB_CDC_SET_MAX_DATAGRAM_SIZE 0x88 #define USB_CDC_GET_CRC_MODE 0x89 #define USB_CDC_SET_CRC_MODE 0x8a /* Line Coding Structure from CDC spec 6.2.13 */ struct usb_cdc_line_coding { __le32 dwDTERate; __u8 bCharFormat; #define USB_CDC_1_STOP_BITS 0 #define USB_CDC_1_5_STOP_BITS 1 #define USB_CDC_2_STOP_BITS 2 __u8 bParityType; #define USB_CDC_NO_PARITY 0 #define USB_CDC_ODD_PARITY 1 #define USB_CDC_EVEN_PARITY 2 #define USB_CDC_MARK_PARITY 3 #define USB_CDC_SPACE_PARITY 4 __u8 bDataBits; } __attribute__ ((packed)); /* table 62; bits in multicast filter */ #define USB_CDC_PACKET_TYPE_PROMISCUOUS (1 << 0) #define USB_CDC_PACKET_TYPE_ALL_MULTICAST (1 << 1) /* no filter */ #define USB_CDC_PACKET_TYPE_DIRECTED (1 << 2) #define USB_CDC_PACKET_TYPE_BROADCAST (1 << 3) #define USB_CDC_PACKET_TYPE_MULTICAST (1 << 4) /* filtered */ /*-------------------------------------------------------------------------*/ /* * Class-Specific Notifications (6.3) sent by interrupt transfers * * section 3.8.2 table 11 of the CDC spec lists Ethernet notifications * section 3.6.2.1 table 5 specifies ACM notifications, accepted by RNDIS * RNDIS also defines its own bit-incompatible notifications */ #define USB_CDC_NOTIFY_NETWORK_CONNECTION 0x00 #define USB_CDC_NOTIFY_RESPONSE_AVAILABLE 0x01 #define USB_CDC_NOTIFY_SERIAL_STATE 0x20 #define USB_CDC_NOTIFY_SPEED_CHANGE 0x2a struct usb_cdc_notification { __u8 bmRequestType; __u8 bNotificationType; __le16 wValue; __le16 wIndex; __le16 wLength; } __attribute__ ((packed)); /*-------------------------------------------------------------------------*/ /* * Class Specific structures and constants * * CDC NCM NTB parameters structure, CDC NCM subclass 6.2.1 * */ struct usb_cdc_ncm_ntb_parameters { __le16 wLength; __le16 bmNtbFormatsSupported; __le32 dwNtbInMaxSize; __le16 wNdpInDivisor; __le16 wNdpInPayloadRemainder; __le16 wNdpInAlignment; __le16 wPadding1; __le32 dwNtbOutMaxSize; __le16 wNdpOutDivisor; __le16 wNdpOutPayloadRemainder; __le16 wNdpOutAlignment; __le16 wPadding2; } __attribute__ ((packed)); /* * CDC NCM transfer headers, CDC NCM subclass 3.2 */ #define USB_CDC_NCM_NTH16_SIGN 0x484D434E /* NCMH */ #define USB_CDC_NCM_NTH32_SIGN 0x686D636E /* ncmh */ struct usb_cdc_ncm_nth16 { __le32 dwSignature; __le16 wHeaderLength; __le16 wSequence; __le16 wBlockLength; __le16 wFpIndex; } __attribute__ ((packed)); struct usb_cdc_ncm_nth32 { __le32 dwSignature; __le16 wHeaderLength; __le16 wSequence; __le32 dwBlockLength; __le32 dwFpIndex; } __attribute__ ((packed)); /* * CDC NCM datagram pointers, CDC NCM subclass 3.3 */ #define USB_CDC_NCM_NDP16_CRC_SIGN 0x314D434E /* NCM1 */ #define USB_CDC_NCM_NDP16_NOCRC_SIGN 0x304D434E /* NCM0 */ #define USB_CDC_NCM_NDP32_CRC_SIGN 0x316D636E /* ncm1 */ #define USB_CDC_NCM_NDP32_NOCRC_SIGN 0x306D636E /* ncm0 */ /* 16-bit NCM Datagram Pointer Entry */ struct usb_cdc_ncm_dpe16 { __le16 wDatagramIndex; __le16 wDatagramLength; } __attribute__((__packed__)); /* 16-bit NCM Datagram Pointer Table */ struct usb_cdc_ncm_ndp16 { __le32 dwSignature; __le16 wLength; __le16 wNextFpIndex; struct usb_cdc_ncm_dpe16 dpe16[0]; } __attribute__ ((packed)); /* 32-bit NCM Datagram Pointer Entry */ struct usb_cdc_ncm_dpe32 { __le32 dwDatagramIndex; __le32 dwDatagramLength; } __attribute__((__packed__)); /* 32-bit NCM Datagram Pointer Table */ struct usb_cdc_ncm_ndp32 { __le32 dwSignature; __le16 wLength; __le16 wReserved6; __le32 dwNextNdpIndex; __le32 dwReserved12; struct usb_cdc_ncm_dpe32 dpe32[0]; } __attribute__ ((packed)); /* CDC NCM subclass 3.2.1 and 3.2.2 */ #define USB_CDC_NCM_NDP16_INDEX_MIN 0x000C #define USB_CDC_NCM_NDP32_INDEX_MIN 0x0010 /* CDC NCM subclass 3.3.3 Datagram Formatting */ #define USB_CDC_NCM_DATAGRAM_FORMAT_CRC 0x30 #define USB_CDC_NCM_DATAGRAM_FORMAT_NOCRC 0X31 /* CDC NCM subclass 4.2 NCM Communications Interface Protocol Code */ #def