xref: /linux/include/uapi/linux/if_arcnet.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2607ca46eSDavid Howells /*
3607ca46eSDavid Howells  * INET         An implementation of the TCP/IP protocol suite for the LINUX
4607ca46eSDavid Howells  *              operating system.  INET is implemented using the  BSD Socket
5607ca46eSDavid Howells  *              interface as the means of communication with the user level.
6607ca46eSDavid Howells  *
7607ca46eSDavid Howells  *              Global definitions for the ARCnet interface.
8607ca46eSDavid Howells  *
9607ca46eSDavid Howells  * Authors:     David Woodhouse and Avery Pennarun
10607ca46eSDavid Howells  *
11607ca46eSDavid Howells  *              This program is free software; you can redistribute it and/or
12607ca46eSDavid Howells  *              modify it under the terms of the GNU General Public License
13607ca46eSDavid Howells  *              as published by the Free Software Foundation; either version
14607ca46eSDavid Howells  *              2 of the License, or (at your option) any later version.
15607ca46eSDavid Howells  */
16607ca46eSDavid Howells 
17607ca46eSDavid Howells #ifndef _LINUX_IF_ARCNET_H
18607ca46eSDavid Howells #define _LINUX_IF_ARCNET_H
19607ca46eSDavid Howells 
20607ca46eSDavid Howells #include <linux/types.h>
21607ca46eSDavid Howells #include <linux/if_ether.h>
22607ca46eSDavid Howells 
23607ca46eSDavid Howells /*
24607ca46eSDavid Howells  *    These are the defined ARCnet Protocol ID's.
25607ca46eSDavid Howells  */
26607ca46eSDavid Howells 
27607ca46eSDavid Howells /* CAP mode */
28607ca46eSDavid Howells /* No macro but uses 1-8 */
29607ca46eSDavid Howells 
30607ca46eSDavid Howells /* RFC1201 Protocol ID's */
31607ca46eSDavid Howells #define ARC_P_IP		212	/* 0xD4 */
32607ca46eSDavid Howells #define ARC_P_IPV6		196	/* 0xC4: RFC2497 */
33607ca46eSDavid Howells #define ARC_P_ARP		213	/* 0xD5 */
34607ca46eSDavid Howells #define ARC_P_RARP		214	/* 0xD6 */
35607ca46eSDavid Howells #define ARC_P_IPX		250	/* 0xFA */
36607ca46eSDavid Howells #define ARC_P_NOVELL_EC		236	/* 0xEC */
37607ca46eSDavid Howells 
38607ca46eSDavid Howells /* Old RFC1051 Protocol ID's */
39607ca46eSDavid Howells #define ARC_P_IP_RFC1051	240	/* 0xF0 */
40607ca46eSDavid Howells #define ARC_P_ARP_RFC1051	241	/* 0xF1 */
41607ca46eSDavid Howells 
42607ca46eSDavid Howells /* MS LanMan/WfWg "NDIS" encapsulation */
43607ca46eSDavid Howells #define ARC_P_ETHER		232	/* 0xE8 */
44607ca46eSDavid Howells 
45607ca46eSDavid Howells /* Unsupported/indirectly supported protocols */
46607ca46eSDavid Howells #define ARC_P_DATAPOINT_BOOT	0	/* very old Datapoint equipment */
47607ca46eSDavid Howells #define ARC_P_DATAPOINT_MOUNT	1
48607ca46eSDavid Howells #define ARC_P_POWERLAN_BEACON	8	/* Probably ATA-Netbios related */
49607ca46eSDavid Howells #define ARC_P_POWERLAN_BEACON2	243	/* 0xF3 */
50607ca46eSDavid Howells #define ARC_P_LANSOFT		251	/* 0xFB - what is this? */
51607ca46eSDavid Howells #define ARC_P_ATALK		0xDD
52607ca46eSDavid Howells 
53607ca46eSDavid Howells /* Hardware address length */
54607ca46eSDavid Howells #define ARCNET_ALEN	1
55607ca46eSDavid Howells 
56607ca46eSDavid Howells /*
57607ca46eSDavid Howells  * The RFC1201-specific components of an arcnet packet header.
58607ca46eSDavid Howells  */
59607ca46eSDavid Howells struct arc_rfc1201 {
60607ca46eSDavid Howells 	__u8  proto;		/* protocol ID field - varies		*/
61607ca46eSDavid Howells 	__u8  split_flag;	/* for use with split packets		*/
62607ca46eSDavid Howells 	__be16   sequence;	/* sequence number			*/
63*94dfc73eSGustavo A. R. Silva 	__u8  payload[];	/* space remaining in packet (504 bytes)*/
64607ca46eSDavid Howells };
65607ca46eSDavid Howells #define RFC1201_HDR_SIZE 4
66607ca46eSDavid Howells 
67607ca46eSDavid Howells /*
68607ca46eSDavid Howells  * The RFC1051-specific components.
69607ca46eSDavid Howells  */
70607ca46eSDavid Howells struct arc_rfc1051 {
71607ca46eSDavid Howells 	__u8 proto;		/* ARC_P_RFC1051_ARP/RFC1051_IP	*/
72*94dfc73eSGustavo A. R. Silva 	__u8 payload[];	/* 507 bytes			*/
73607ca46eSDavid Howells };
74607ca46eSDavid Howells #define RFC1051_HDR_SIZE 1
75607ca46eSDavid Howells 
76607ca46eSDavid Howells /*
77607ca46eSDavid Howells  * The ethernet-encap-specific components.  We have a real ethernet header
78607ca46eSDavid Howells  * and some data.
79607ca46eSDavid Howells  */
80607ca46eSDavid Howells struct arc_eth_encap {
81607ca46eSDavid Howells 	__u8 proto;		/* Always ARC_P_ETHER			*/
82607ca46eSDavid Howells 	struct ethhdr eth;	/* standard ethernet header (yuck!)	*/
83*94dfc73eSGustavo A. R. Silva 	__u8 payload[];	/* 493 bytes				*/
84607ca46eSDavid Howells };
85607ca46eSDavid Howells #define ETH_ENCAP_HDR_SIZE 14
86607ca46eSDavid Howells 
87607ca46eSDavid Howells struct arc_cap {
88607ca46eSDavid Howells 	__u8 proto;
8937587fadSJoe Perches 	__u8 cookie[sizeof(int)];
9037587fadSJoe Perches 				/* Actually NOT sent over the network */
91607ca46eSDavid Howells 	union {
92607ca46eSDavid Howells 		__u8 ack;
93607ca46eSDavid Howells 		__u8 raw[0];	/* 507 bytes */
94607ca46eSDavid Howells 	} mes;
95607ca46eSDavid Howells };
96607ca46eSDavid Howells 
97607ca46eSDavid Howells /*
98607ca46eSDavid Howells  * The data needed by the actual arcnet hardware.
99607ca46eSDavid Howells  *
100607ca46eSDavid Howells  * Now, in the real arcnet hardware, the third and fourth bytes are the
101607ca46eSDavid Howells  * 'offset' specification instead of the length, and the soft data is at
102607ca46eSDavid Howells  * the _end_ of the 512-byte buffer.  We hide this complexity inside the
103607ca46eSDavid Howells  * driver.
104607ca46eSDavid Howells  */
105607ca46eSDavid Howells struct arc_hardware {
10637587fadSJoe Perches 	__u8 source;		/* source ARCnet - filled in automagically */
10737587fadSJoe Perches 	__u8 dest;		/* destination ARCnet - 0 for broadcast    */
10837587fadSJoe Perches 	__u8 offset[2];		/* offset bytes (some weird semantics)     */
109607ca46eSDavid Howells };
110607ca46eSDavid Howells #define ARC_HDR_SIZE 4
111607ca46eSDavid Howells 
112607ca46eSDavid Howells /*
113607ca46eSDavid Howells  * This is an ARCnet frame header, as seen by the kernel (and userspace,
114607ca46eSDavid Howells  * when you do a raw packet capture).
115607ca46eSDavid Howells  */
116607ca46eSDavid Howells struct archdr {
117607ca46eSDavid Howells 	/* hardware requirements */
118607ca46eSDavid Howells 	struct arc_hardware hard;
119607ca46eSDavid Howells 
120607ca46eSDavid Howells 	/* arcnet encapsulation-specific bits */
121607ca46eSDavid Howells 	union {
122607ca46eSDavid Howells 		struct arc_rfc1201   rfc1201;
123607ca46eSDavid Howells 		struct arc_rfc1051   rfc1051;
124607ca46eSDavid Howells 		struct arc_eth_encap eth_encap;
125607ca46eSDavid Howells 		struct arc_cap       cap;
126607ca46eSDavid Howells 		__u8 raw[0];	/* 508 bytes				*/
127607ca46eSDavid Howells 	} soft;
128607ca46eSDavid Howells };
129607ca46eSDavid Howells 
130607ca46eSDavid Howells #endif				/* _LINUX_IF_ARCNET_H */
131