blob: cfb642f8e7bd3b0eb0446fce2d5898eeb04bec4d [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Global definitions for the ARCnet interface.
7 *
8 * Authors: David Woodhouse and Avery Pennarun
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
15
16#ifndef _LINUX_IF_ARCNET_H
17#define _LINUX_IF_ARCNET_H
18
Arnd Bergmann9adfbfb2009-02-26 00:51:40 +010019#include <linux/types.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070020#include <linux/if_ether.h>
21
Linus Torvalds1da177e2005-04-16 15:20:36 -070022/*
23 * These are the defined ARCnet Protocol ID's.
24 */
25
26/* CAP mode */
27/* No macro but uses 1-8 */
28
29/* RFC1201 Protocol ID's */
30#define ARC_P_IP 212 /* 0xD4 */
31#define ARC_P_IPV6 196 /* 0xC4: RFC2497 */
32#define ARC_P_ARP 213 /* 0xD5 */
33#define ARC_P_RARP 214 /* 0xD6 */
34#define ARC_P_IPX 250 /* 0xFA */
35#define ARC_P_NOVELL_EC 236 /* 0xEC */
36
37/* Old RFC1051 Protocol ID's */
38#define ARC_P_IP_RFC1051 240 /* 0xF0 */
39#define ARC_P_ARP_RFC1051 241 /* 0xF1 */
40
41/* MS LanMan/WfWg "NDIS" encapsulation */
42#define ARC_P_ETHER 232 /* 0xE8 */
43
44/* Unsupported/indirectly supported protocols */
45#define ARC_P_DATAPOINT_BOOT 0 /* very old Datapoint equipment */
46#define ARC_P_DATAPOINT_MOUNT 1
47#define ARC_P_POWERLAN_BEACON 8 /* Probably ATA-Netbios related */
48#define ARC_P_POWERLAN_BEACON2 243 /* 0xF3 */
49#define ARC_P_LANSOFT 251 /* 0xFB - what is this? */
50#define ARC_P_ATALK 0xDD
51
52/* Hardware address length */
53#define ARCNET_ALEN 1
54
55/*
56 * The RFC1201-specific components of an arcnet packet header.
57 */
Eric Dumazetd94d9fe2009-11-04 09:50:58 -080058struct arc_rfc1201 {
Joe Perches37587fa2015-07-30 13:22:43 -070059 __u8 proto; /* protocol ID field - varies */
60 __u8 split_flag; /* for use with split packets */
61 __be16 sequence; /* sequence number */
62 __u8 payload[0]; /* space remaining in packet (504 bytes)*/
Linus Torvalds1da177e2005-04-16 15:20:36 -070063};
64#define RFC1201_HDR_SIZE 4
65
Linus Torvalds1da177e2005-04-16 15:20:36 -070066/*
67 * The RFC1051-specific components.
68 */
Eric Dumazetd94d9fe2009-11-04 09:50:58 -080069struct arc_rfc1051 {
Joe Perches37587fa2015-07-30 13:22:43 -070070 __u8 proto; /* ARC_P_RFC1051_ARP/RFC1051_IP */
71 __u8 payload[0]; /* 507 bytes */
Linus Torvalds1da177e2005-04-16 15:20:36 -070072};
73#define RFC1051_HDR_SIZE 1
74
Linus Torvalds1da177e2005-04-16 15:20:36 -070075/*
76 * The ethernet-encap-specific components. We have a real ethernet header
77 * and some data.
78 */
Eric Dumazetd94d9fe2009-11-04 09:50:58 -080079struct arc_eth_encap {
Joe Perches37587fa2015-07-30 13:22:43 -070080 __u8 proto; /* Always ARC_P_ETHER */
81 struct ethhdr eth; /* standard ethernet header (yuck!) */
82 __u8 payload[0]; /* 493 bytes */
Linus Torvalds1da177e2005-04-16 15:20:36 -070083};
84#define ETH_ENCAP_HDR_SIZE 14
85
Eric Dumazetd94d9fe2009-11-04 09:50:58 -080086struct arc_cap {
Arnd Bergmann9adfbfb2009-02-26 00:51:40 +010087 __u8 proto;
Joe Perches37587fa2015-07-30 13:22:43 -070088 __u8 cookie[sizeof(int)];
89 /* Actually NOT sent over the network */
Linus Torvalds1da177e2005-04-16 15:20:36 -070090 union {
Arnd Bergmann9adfbfb2009-02-26 00:51:40 +010091 __u8 ack;
Joe Perches37587fa2015-07-30 13:22:43 -070092 __u8 raw[0]; /* 507 bytes */
Linus Torvalds1da177e2005-04-16 15:20:36 -070093 } mes;
94};
95
96/*
97 * The data needed by the actual arcnet hardware.
98 *
99 * Now, in the real arcnet hardware, the third and fourth bytes are the
100 * 'offset' specification instead of the length, and the soft data is at
101 * the _end_ of the 512-byte buffer. We hide this complexity inside the
102 * driver.
103 */
Eric Dumazetd94d9fe2009-11-04 09:50:58 -0800104struct arc_hardware {
Joe Perches37587fa2015-07-30 13:22:43 -0700105 __u8 source; /* source ARCnet - filled in automagically */
106 __u8 dest; /* destination ARCnet - 0 for broadcast */
107 __u8 offset[2]; /* offset bytes (some weird semantics) */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108};
109#define ARC_HDR_SIZE 4
110
111/*
112 * This is an ARCnet frame header, as seen by the kernel (and userspace,
113 * when you do a raw packet capture).
114 */
Eric Dumazetd94d9fe2009-11-04 09:50:58 -0800115struct archdr {
Joe Perches37587fa2015-07-30 13:22:43 -0700116 /* hardware requirements */
117 struct arc_hardware hard;
118
119 /* arcnet encapsulation-specific bits */
120 union {
121 struct arc_rfc1201 rfc1201;
122 struct arc_rfc1051 rfc1051;
123 struct arc_eth_encap eth_encap;
124 struct arc_cap cap;
125 __u8 raw[0]; /* 508 bytes */
126 } soft;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127};
128
129#endif /* _LINUX_IF_ARCNET_H */