Linux-2.6.12-rc2
[safe/jmp/linux-2.6] / include / linux / if_tr.h
1 /*
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 Token-Ring IEEE 802.5 interface.
7  *
8  * Version:     @(#)if_tr.h     0.0     07/11/94
9  *
10  * Author:      Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
11  *              Donald Becker, <becker@super.org>
12  *    Peter De Schrijver, <stud11@cc4.kuleuven.ac.be>
13  *
14  *              This program is free software; you can redistribute it and/or
15  *              modify it under the terms of the GNU General Public License
16  *              as published by the Free Software Foundation; either version
17  *              2 of the License, or (at your option) any later version.
18  */
19 #ifndef _LINUX_IF_TR_H
20 #define _LINUX_IF_TR_H
21
22
23 /* IEEE 802.5 Token-Ring magic constants.  The frame sizes omit the preamble
24    and FCS/CRC (frame check sequence). */
25 #define TR_ALEN 6               /* Octets in one ethernet addr   */
26 #define TR_HLEN   (sizeof(struct trh_hdr)+sizeof(struct trllc))
27 #define AC                      0x10
28 #define LLC_FRAME 0x40
29 #if 0
30 #define ETH_HLEN        14              /* Total octets in header.       */
31 #define ETH_ZLEN        60              /* Min. octets in frame sans FCS */
32 #define ETH_DATA_LEN    1500            /* Max. octets in payload        */
33 #define ETH_FRAME_LEN   1514            /* Max. octets in frame sans FCS */
34 #endif
35
36
37 /* LLC and SNAP constants */
38 #define EXTENDED_SAP 0xAA
39 #define UI_CMD       0x03
40
41 /* This is an Token-Ring frame header. */
42 struct trh_hdr {
43         __u8  ac;                       /* access control field */
44         __u8  fc;                       /* frame control field */
45         __u8  daddr[TR_ALEN];           /* destination address */
46         __u8  saddr[TR_ALEN];           /* source address */
47         __u16 rcf;                      /* route control field */
48         __u16 rseg[8];                  /* routing registers */
49 };
50
51 #ifdef __KERNEL__
52 #include <linux/skbuff.h>
53
54 static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb)
55 {
56         return (struct trh_hdr *)skb->mac.raw;
57 }
58 #endif
59
60 /* This is an Token-Ring LLC structure */
61 struct trllc {
62         __u8  dsap;                     /* destination SAP */
63         __u8  ssap;                     /* source SAP */
64         __u8  llc;                      /* LLC control field */
65         __u8  protid[3];                /* protocol id */
66         __u16 ethertype;                /* ether type field */
67 };
68
69 /* Token-Ring statistics collection data. */
70 struct tr_statistics {
71         unsigned long rx_packets;       /* total packets received       */
72         unsigned long tx_packets;       /* total packets transmitted    */
73         unsigned long rx_bytes;         /* total bytes received         */
74         unsigned long tx_bytes;         /* total bytes transmitted      */
75         unsigned long rx_errors;        /* bad packets received         */
76         unsigned long tx_errors;        /* packet transmit problems     */
77         unsigned long rx_dropped;       /* no space in linux buffers    */
78         unsigned long tx_dropped;       /* no space available in linux  */
79         unsigned long multicast;        /* multicast packets received   */
80         unsigned long transmit_collision;
81
82         /* detailed Token-Ring errors. See IBM Token-Ring Network
83            Architecture for more info */
84
85         unsigned long line_errors;
86         unsigned long internal_errors;
87         unsigned long burst_errors;
88         unsigned long A_C_errors;
89         unsigned long abort_delimiters;
90         unsigned long lost_frames;
91         unsigned long recv_congest_count;
92         unsigned long frame_copied_errors;
93         unsigned long frequency_errors;
94         unsigned long token_errors;
95         unsigned long dummy1;
96 };
97
98 /* source routing stuff */
99
100 #define TR_RII 0x80
101 #define TR_RCF_DIR_BIT 0x80
102 #define TR_RCF_LEN_MASK 0x1f00
103 #define TR_RCF_BROADCAST 0x8000         /* all-routes broadcast */
104 #define TR_RCF_LIMITED_BROADCAST 0xC000 /* single-route broadcast */
105 #define TR_RCF_FRAME2K 0x20
106 #define TR_RCF_BROADCAST_MASK 0xC000
107 #define TR_MAXRIFLEN 18
108
109 #endif  /* _LINUX_IF_TR_H */