Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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> |
Jon Mason | 82d1542 | 2005-05-23 12:53:14 -0700 | [diff] [blame] | 12 | * Peter De Schrijver, <stud11@cc4.kuleuven.ac.be> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Tom Rini | 03722adc | 2005-06-13 13:57:10 -0700 | [diff] [blame] | 22 | #include <asm/byteorder.h> /* For __be16 */ |
| 23 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | /* IEEE 802.5 Token-Ring magic constants. The frame sizes omit the preamble |
| 25 | and FCS/CRC (frame check sequence). */ |
Jon Mason | 82d1542 | 2005-05-23 12:53:14 -0700 | [diff] [blame] | 26 | #define TR_ALEN 6 /* Octets in one token-ring addr */ |
| 27 | #define TR_HLEN (sizeof(struct trh_hdr)+sizeof(struct trllc)) |
| 28 | #define AC 0x10 |
| 29 | #define LLC_FRAME 0x40 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | |
| 31 | /* LLC and SNAP constants */ |
Jon Mason | 82d1542 | 2005-05-23 12:53:14 -0700 | [diff] [blame] | 32 | #define EXTENDED_SAP 0xAA |
| 33 | #define UI_CMD 0x03 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
| 35 | /* This is an Token-Ring frame header. */ |
| 36 | struct trh_hdr { |
| 37 | __u8 ac; /* access control field */ |
| 38 | __u8 fc; /* frame control field */ |
| 39 | __u8 daddr[TR_ALEN]; /* destination address */ |
| 40 | __u8 saddr[TR_ALEN]; /* source address */ |
Alexey Dobriyan | c6b3365 | 2005-05-26 12:59:05 -0700 | [diff] [blame] | 41 | __be16 rcf; /* route control field */ |
| 42 | __be16 rseg[8]; /* routing registers */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | }; |
| 44 | |
| 45 | #ifdef __KERNEL__ |
Arnaldo Carvalho de Melo | 2038073 | 2005-08-16 02:18:02 -0300 | [diff] [blame] | 46 | #include <linux/config.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | #include <linux/skbuff.h> |
| 48 | |
| 49 | static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb) |
| 50 | { |
| 51 | return (struct trh_hdr *)skb->mac.raw; |
| 52 | } |
Arnaldo Carvalho de Melo | 2038073 | 2005-08-16 02:18:02 -0300 | [diff] [blame] | 53 | #ifdef CONFIG_SYSCTL |
| 54 | extern struct ctl_table tr_table[]; |
| 55 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | #endif |
| 57 | |
| 58 | /* This is an Token-Ring LLC structure */ |
| 59 | struct trllc { |
| 60 | __u8 dsap; /* destination SAP */ |
| 61 | __u8 ssap; /* source SAP */ |
| 62 | __u8 llc; /* LLC control field */ |
| 63 | __u8 protid[3]; /* protocol id */ |
Alexey Dobriyan | c6b3365 | 2005-05-26 12:59:05 -0700 | [diff] [blame] | 64 | __be16 ethertype; /* ether type field */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | }; |
| 66 | |
| 67 | /* Token-Ring statistics collection data. */ |
| 68 | struct tr_statistics { |
| 69 | unsigned long rx_packets; /* total packets received */ |
| 70 | unsigned long tx_packets; /* total packets transmitted */ |
| 71 | unsigned long rx_bytes; /* total bytes received */ |
| 72 | unsigned long tx_bytes; /* total bytes transmitted */ |
| 73 | unsigned long rx_errors; /* bad packets received */ |
| 74 | unsigned long tx_errors; /* packet transmit problems */ |
| 75 | unsigned long rx_dropped; /* no space in linux buffers */ |
| 76 | unsigned long tx_dropped; /* no space available in linux */ |
| 77 | unsigned long multicast; /* multicast packets received */ |
| 78 | unsigned long transmit_collision; |
| 79 | |
| 80 | /* detailed Token-Ring errors. See IBM Token-Ring Network |
| 81 | Architecture for more info */ |
| 82 | |
| 83 | unsigned long line_errors; |
| 84 | unsigned long internal_errors; |
| 85 | unsigned long burst_errors; |
| 86 | unsigned long A_C_errors; |
| 87 | unsigned long abort_delimiters; |
| 88 | unsigned long lost_frames; |
| 89 | unsigned long recv_congest_count; |
| 90 | unsigned long frame_copied_errors; |
| 91 | unsigned long frequency_errors; |
| 92 | unsigned long token_errors; |
| 93 | unsigned long dummy1; |
| 94 | }; |
| 95 | |
| 96 | /* source routing stuff */ |
Jon Mason | 82d1542 | 2005-05-23 12:53:14 -0700 | [diff] [blame] | 97 | #define TR_RII 0x80 |
| 98 | #define TR_RCF_DIR_BIT 0x80 |
| 99 | #define TR_RCF_LEN_MASK 0x1f00 |
| 100 | #define TR_RCF_BROADCAST 0x8000 /* all-routes broadcast */ |
| 101 | #define TR_RCF_LIMITED_BROADCAST 0xC000 /* single-route broadcast */ |
| 102 | #define TR_RCF_FRAME2K 0x20 |
| 103 | #define TR_RCF_BROADCAST_MASK 0xC000 |
| 104 | #define TR_MAXRIFLEN 18 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | |
| 106 | #endif /* _LINUX_IF_TR_H */ |