| 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> |
|---|
| 12 | * Alan Cox, <alan@redhat.com> |
|---|
| 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 | |
|---|
| 25 | #include <endian.h> |
|---|
| 26 | #include <byteswap.h> |
|---|
| 27 | #include <asm/types.h> |
|---|
| 28 | |
|---|
| 29 | /* |
|---|
| 30 | * HIPPI magic constants. |
|---|
| 31 | */ |
|---|
| 32 | |
|---|
| 33 | #define HIPPI_ALEN 6 /* Bytes in one HIPPI hw-addr */ |
|---|
| 34 | #define HIPPI_HLEN sizeof(struct hippi_hdr) |
|---|
| 35 | #define HIPPI_ZLEN 0 /* Min. bytes in frame without FCS */ |
|---|
| 36 | #define HIPPI_DATA_LEN 65280 /* Max. bytes in payload */ |
|---|
| 37 | #define HIPPI_FRAME_LEN (HIPPI_DATA_LEN + HIPPI_HLEN) |
|---|
| 38 | /* Max. bytes in frame without FCS */ |
|---|
| 39 | |
|---|
| 40 | /* |
|---|
| 41 | * Define LLC and SNAP constants. |
|---|
| 42 | */ |
|---|
| 43 | #define HIPPI_EXTENDED_SAP 0xAA |
|---|
| 44 | #define HIPPI_UI_CMD 0x03 |
|---|
| 45 | |
|---|
| 46 | |
|---|
| 47 | /* |
|---|
| 48 | * Do we need to list some sort of ID's here? |
|---|
| 49 | */ |
|---|
| 50 | |
|---|
| 51 | /* |
|---|
| 52 | * HIPPI statistics collection data. |
|---|
| 53 | */ |
|---|
| 54 | |
|---|
| 55 | struct hipnet_statistics |
|---|
| 56 | { |
|---|
| 57 | int rx_packets; /* total packets received */ |
|---|
| 58 | int tx_packets; /* total packets transmitted */ |
|---|
| 59 | int rx_errors; /* bad packets received */ |
|---|
| 60 | int tx_errors; /* packet transmit problems */ |
|---|
| 61 | int rx_dropped; /* no space in linux buffers */ |
|---|
| 62 | int tx_dropped; /* no space available in linux */ |
|---|
| 63 | |
|---|
| 64 | /* detailed rx_errors: */ |
|---|
| 65 | int rx_length_errors; |
|---|
| 66 | int rx_over_errors; /* receiver ring buff overflow */ |
|---|
| 67 | int rx_crc_errors; /* recved pkt with crc error */ |
|---|
| 68 | int rx_frame_errors; /* recv'd frame alignment error */ |
|---|
| 69 | int rx_fifo_errors; /* recv'r fifo overrun */ |
|---|
| 70 | int rx_missed_errors; /* receiver missed packet */ |
|---|
| 71 | |
|---|
| 72 | /* detailed tx_errors */ |
|---|
| 73 | int tx_aborted_errors; |
|---|
| 74 | int tx_carrier_errors; |
|---|
| 75 | int tx_fifo_errors; |
|---|
| 76 | int tx_heartbeat_errors; |
|---|
| 77 | int tx_window_errors; |
|---|
| 78 | }; |
|---|
| 79 | |
|---|
| 80 | |
|---|
| 81 | struct hippi_fp_hdr |
|---|
| 82 | { |
|---|
| 83 | #if 0 |
|---|
| 84 | __u8 ulp; /* must contain 4 */ |
|---|
| 85 | #if defined (__BIG_ENDIAN) |
|---|
| 86 | __u8 d1_data_present:1; /* must be 1 */ |
|---|
| 87 | __u8 start_d2_burst_boundary:1; /* must be zero */ |
|---|
| 88 | __u8 reserved:6; /* must be zero */ |
|---|
| 89 | #if 0 |
|---|
| 90 | __u16 reserved1:5; |
|---|
| 91 | __u16 d1_area_size:8; /* must be 3 */ |
|---|
| 92 | __u16 d2_offset:3; /* must be zero */ |
|---|
| 93 | #endif |
|---|
| 94 | #elif defined(__LITTLE_ENDIAN) |
|---|
| 95 | __u8 reserved:6; /* must be zero */ |
|---|
| 96 | __u8 start_d2_burst_boundary:1; /* must be zero */ |
|---|
| 97 | __u8 d1_data_present:1; /* must be 1 */ |
|---|
| 98 | #if 0 |
|---|
| 99 | __u16 d2_offset:3; /* must be zero */ |
|---|
| 100 | __u16 d1_area_size:8; /* must be 3 */ |
|---|
| 101 | __u16 reserved1:5; /* must be zero */ |
|---|
| 102 | #endif |
|---|
| 103 | #else |
|---|
| 104 | #error "Endian problem - this didn't happen" |
|---|
| 105 | #endif |
|---|
| 106 | #else |
|---|
| 107 | __u32 fixed; |
|---|
| 108 | #endif |
|---|
| 109 | __u32 d2_size; |
|---|
| 110 | } __attribute__ ((packed)); |
|---|
| 111 | |
|---|
| 112 | struct hippi_le_hdr |
|---|
| 113 | { |
|---|
| 114 | #if defined (__BIG_ENDIAN) |
|---|
| 115 | __u8 fc:3; |
|---|
| 116 | __u8 double_wide:1; |
|---|
| 117 | __u8 message_type:4; |
|---|
| 118 | #elif defined(__LITTLE_ENDIAN) |
|---|
| 119 | __u8 message_type:4; |
|---|
| 120 | __u8 double_wide:1; |
|---|
| 121 | __u8 fc:3; |
|---|
| 122 | #endif |
|---|
| 123 | __u8 dest_switch_addr[3]; |
|---|
| 124 | #if defined (__BIG_ENDIAN) |
|---|
| 125 | __u8 dest_addr_type:4, |
|---|
| 126 | src_addr_type:4; |
|---|
| 127 | #elif defined(__LITTLE_ENDIAN) |
|---|
| 128 | __u8 src_addr_type:4, |
|---|
| 129 | dest_addr_type:4; |
|---|
| 130 | #endif |
|---|
| 131 | __u8 src_switch_addr[3]; |
|---|
| 132 | __u16 reserved; |
|---|
| 133 | __u8 daddr[HIPPI_ALEN]; |
|---|
| 134 | __u16 locally_administered; |
|---|
| 135 | __u8 saddr[HIPPI_ALEN]; |
|---|
| 136 | } __attribute__ ((packed)); |
|---|
| 137 | |
|---|
| 138 | #define HIPPI_OUI_LEN 3 |
|---|
| 139 | /* |
|---|
| 140 | * Looks like the dsap and ssap fields have been swapped by mistake in |
|---|
| 141 | * RFC 2067 "IP over HIPPI". |
|---|
| 142 | */ |
|---|
| 143 | struct hippi_snap_hdr |
|---|
| 144 | { |
|---|
| 145 | __u8 dsap; /* always 0xAA */ |
|---|
| 146 | __u8 ssap; /* always 0xAA */ |
|---|
| 147 | __u8 ctrl; /* always 0x03 */ |
|---|
| 148 | __u8 oui[HIPPI_OUI_LEN]; /* organizational universal id (zero)*/ |
|---|
| 149 | __u16 ethertype; /* packet type ID field */ |
|---|
| 150 | } __attribute__ ((packed)); |
|---|
| 151 | |
|---|
| 152 | struct hippi_hdr |
|---|
| 153 | { |
|---|
| 154 | struct hippi_fp_hdr fp; |
|---|
| 155 | struct hippi_le_hdr le; |
|---|
| 156 | struct hippi_snap_hdr snap; |
|---|
| 157 | } __attribute__ ((packed)); |
|---|
| 158 | |
|---|
| 159 | #endif /* _LINUX_IF_HIPPI_H */ |
|---|