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 HIPPI interface. |
| 7 | * |
| 8 | * Version: @(#)if_hippi.h 1.0.0 05/26/97 |
| 9 | * |
| 10 | * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> |
| 11 | * Donald Becker, <becker@super.org> |
Alan Cox | 113aa83 | 2008-10-13 19:01:08 -0700 | [diff] [blame] | 12 | * Alan Cox, <alan@lxorguk.ukuu.org.uk> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> |
| 14 | * Jes Sorensen, <Jes.Sorensen@cern.ch> |
| 15 | * |
| 16 | * This program is free software; you can redistribute it and/or |
| 17 | * modify it under the terms of the GNU General Public License |
| 18 | * as published by the Free Software Foundation; either version |
| 19 | * 2 of the License, or (at your option) any later version. |
| 20 | */ |
| 21 | |
| 22 | #ifndef _LINUX_IF_HIPPI_H |
| 23 | #define _LINUX_IF_HIPPI_H |
| 24 | |
Jaswinder Singh Rajput | b06e936 | 2009-01-30 21:27:59 +0530 | [diff] [blame] | 25 | #include <linux/types.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <asm/byteorder.h> |
| 27 | |
| 28 | /* |
| 29 | * HIPPI magic constants. |
| 30 | */ |
| 31 | |
| 32 | #define HIPPI_ALEN 6 /* Bytes in one HIPPI hw-addr */ |
| 33 | #define HIPPI_HLEN sizeof(struct hippi_hdr) |
| 34 | #define HIPPI_ZLEN 0 /* Min. bytes in frame without FCS */ |
| 35 | #define HIPPI_DATA_LEN 65280 /* Max. bytes in payload */ |
| 36 | #define HIPPI_FRAME_LEN (HIPPI_DATA_LEN + HIPPI_HLEN) |
| 37 | /* Max. bytes in frame without FCS */ |
| 38 | |
| 39 | /* |
| 40 | * Define LLC and SNAP constants. |
| 41 | */ |
| 42 | #define HIPPI_EXTENDED_SAP 0xAA |
| 43 | #define HIPPI_UI_CMD 0x03 |
| 44 | |
| 45 | |
| 46 | /* |
| 47 | * Do we need to list some sort of ID's here? |
| 48 | */ |
| 49 | |
| 50 | /* |
| 51 | * HIPPI statistics collection data. |
| 52 | */ |
| 53 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 54 | struct hipnet_statistics { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | int rx_packets; /* total packets received */ |
| 56 | int tx_packets; /* total packets transmitted */ |
| 57 | int rx_errors; /* bad packets received */ |
| 58 | int tx_errors; /* packet transmit problems */ |
| 59 | int rx_dropped; /* no space in linux buffers */ |
| 60 | int tx_dropped; /* no space available in linux */ |
| 61 | |
| 62 | /* detailed rx_errors: */ |
| 63 | int rx_length_errors; |
| 64 | int rx_over_errors; /* receiver ring buff overflow */ |
| 65 | int rx_crc_errors; /* recved pkt with crc error */ |
| 66 | int rx_frame_errors; /* recv'd frame alignment error */ |
| 67 | int rx_fifo_errors; /* recv'r fifo overrun */ |
| 68 | int rx_missed_errors; /* receiver missed packet */ |
| 69 | |
| 70 | /* detailed tx_errors */ |
| 71 | int tx_aborted_errors; |
| 72 | int tx_carrier_errors; |
| 73 | int tx_fifo_errors; |
| 74 | int tx_heartbeat_errors; |
| 75 | int tx_window_errors; |
| 76 | }; |
| 77 | |
| 78 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 79 | struct hippi_fp_hdr { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | #if 0 |
| 81 | __u8 ulp; /* must contain 4 */ |
| 82 | #if defined (__BIG_ENDIAN_BITFIELD) |
| 83 | __u8 d1_data_present:1; /* must be 1 */ |
| 84 | __u8 start_d2_burst_boundary:1; /* must be zero */ |
| 85 | __u8 reserved:6; /* must be zero */ |
| 86 | #if 0 |
| 87 | __u16 reserved1:5; |
| 88 | __u16 d1_area_size:8; /* must be 3 */ |
| 89 | __u16 d2_offset:3; /* must be zero */ |
| 90 | #endif |
| 91 | #elif defined(__LITTLE_ENDIAN_BITFIELD) |
| 92 | __u8 reserved:6; /* must be zero */ |
| 93 | __u8 start_d2_burst_boundary:1; /* must be zero */ |
| 94 | __u8 d1_data_present:1; /* must be 1 */ |
| 95 | #if 0 |
| 96 | __u16 d2_offset:3; /* must be zero */ |
| 97 | __u16 d1_area_size:8; /* must be 3 */ |
| 98 | __u16 reserved1:5; /* must be zero */ |
| 99 | #endif |
| 100 | #else |
| 101 | #error "Please fix <asm/byteorder.h>" |
| 102 | #endif |
| 103 | #else |
Alexey Dobriyan | 57bf145 | 2005-08-25 16:06:19 -0700 | [diff] [blame] | 104 | __be32 fixed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | #endif |
Alexey Dobriyan | 57bf145 | 2005-08-25 16:06:19 -0700 | [diff] [blame] | 106 | __be32 d2_size; |
Changli Gao | 09cd2b9 | 2010-08-22 17:25:05 +0000 | [diff] [blame] | 107 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 108 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 109 | struct hippi_le_hdr { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | #if defined (__BIG_ENDIAN_BITFIELD) |
| 111 | __u8 fc:3; |
| 112 | __u8 double_wide:1; |
| 113 | __u8 message_type:4; |
| 114 | #elif defined(__LITTLE_ENDIAN_BITFIELD) |
| 115 | __u8 message_type:4; |
| 116 | __u8 double_wide:1; |
| 117 | __u8 fc:3; |
| 118 | #endif |
| 119 | __u8 dest_switch_addr[3]; |
| 120 | #if defined (__BIG_ENDIAN_BITFIELD) |
| 121 | __u8 dest_addr_type:4, |
| 122 | src_addr_type:4; |
| 123 | #elif defined(__LITTLE_ENDIAN_BITFIELD) |
| 124 | __u8 src_addr_type:4, |
| 125 | dest_addr_type:4; |
| 126 | #endif |
| 127 | __u8 src_switch_addr[3]; |
| 128 | __u16 reserved; |
| 129 | __u8 daddr[HIPPI_ALEN]; |
| 130 | __u16 locally_administered; |
| 131 | __u8 saddr[HIPPI_ALEN]; |
Changli Gao | 09cd2b9 | 2010-08-22 17:25:05 +0000 | [diff] [blame] | 132 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 133 | |
| 134 | #define HIPPI_OUI_LEN 3 |
| 135 | /* |
| 136 | * Looks like the dsap and ssap fields have been swapped by mistake in |
| 137 | * RFC 2067 "IP over HIPPI". |
| 138 | */ |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 139 | struct hippi_snap_hdr { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 140 | __u8 dsap; /* always 0xAA */ |
| 141 | __u8 ssap; /* always 0xAA */ |
| 142 | __u8 ctrl; /* always 0x03 */ |
| 143 | __u8 oui[HIPPI_OUI_LEN]; /* organizational universal id (zero)*/ |
Alexey Dobriyan | 57bf145 | 2005-08-25 16:06:19 -0700 | [diff] [blame] | 144 | __be16 ethertype; /* packet type ID field */ |
Changli Gao | 09cd2b9 | 2010-08-22 17:25:05 +0000 | [diff] [blame] | 145 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 147 | struct hippi_hdr { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 148 | struct hippi_fp_hdr fp; |
| 149 | struct hippi_le_hdr le; |
| 150 | struct hippi_snap_hdr snap; |
Changli Gao | 09cd2b9 | 2010-08-22 17:25:05 +0000 | [diff] [blame] | 151 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 152 | |
| 153 | #endif /* _LINUX_IF_HIPPI_H */ |