1607ca46eSDavid Howells /* 2607ca46eSDavid Howells * INET An implementation of the TCP/IP protocol suite for the LINUX 3607ca46eSDavid Howells * operating system. INET is implemented using the BSD Socket 4607ca46eSDavid Howells * interface as the means of communication with the user level. 5607ca46eSDavid Howells * 6607ca46eSDavid Howells * Global definitions for the HIPPI interface. 7607ca46eSDavid Howells * 8607ca46eSDavid Howells * Version: @(#)if_hippi.h 1.0.0 05/26/97 9607ca46eSDavid Howells * 10607ca46eSDavid Howells * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> 11607ca46eSDavid Howells * Donald Becker, <becker@super.org> 12607ca46eSDavid Howells * Alan Cox, <alan@lxorguk.ukuu.org.uk> 13607ca46eSDavid Howells * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> 14607ca46eSDavid Howells * Jes Sorensen, <Jes.Sorensen@cern.ch> 15607ca46eSDavid Howells * 16607ca46eSDavid Howells * This program is free software; you can redistribute it and/or 17607ca46eSDavid Howells * modify it under the terms of the GNU General Public License 18607ca46eSDavid Howells * as published by the Free Software Foundation; either version 19607ca46eSDavid Howells * 2 of the License, or (at your option) any later version. 20607ca46eSDavid Howells */ 21607ca46eSDavid Howells 22607ca46eSDavid Howells #ifndef _LINUX_IF_HIPPI_H 23607ca46eSDavid Howells #define _LINUX_IF_HIPPI_H 24607ca46eSDavid Howells 25607ca46eSDavid Howells #include <linux/types.h> 26607ca46eSDavid Howells #include <asm/byteorder.h> 27607ca46eSDavid Howells 28607ca46eSDavid Howells /* 29607ca46eSDavid Howells * HIPPI magic constants. 30607ca46eSDavid Howells */ 31607ca46eSDavid Howells 32607ca46eSDavid Howells #define HIPPI_ALEN 6 /* Bytes in one HIPPI hw-addr */ 33607ca46eSDavid Howells #define HIPPI_HLEN sizeof(struct hippi_hdr) 34607ca46eSDavid Howells #define HIPPI_ZLEN 0 /* Min. bytes in frame without FCS */ 35607ca46eSDavid Howells #define HIPPI_DATA_LEN 65280 /* Max. bytes in payload */ 36607ca46eSDavid Howells #define HIPPI_FRAME_LEN (HIPPI_DATA_LEN + HIPPI_HLEN) 37607ca46eSDavid Howells /* Max. bytes in frame without FCS */ 38607ca46eSDavid Howells 39607ca46eSDavid Howells /* 40607ca46eSDavid Howells * Define LLC and SNAP constants. 41607ca46eSDavid Howells */ 42607ca46eSDavid Howells #define HIPPI_EXTENDED_SAP 0xAA 43607ca46eSDavid Howells #define HIPPI_UI_CMD 0x03 44607ca46eSDavid Howells 45607ca46eSDavid Howells 46607ca46eSDavid Howells /* 47607ca46eSDavid Howells * Do we need to list some sort of ID's here? 48607ca46eSDavid Howells */ 49607ca46eSDavid Howells 50607ca46eSDavid Howells /* 51607ca46eSDavid Howells * HIPPI statistics collection data. 52607ca46eSDavid Howells */ 53607ca46eSDavid Howells 54607ca46eSDavid Howells struct hipnet_statistics { 55607ca46eSDavid Howells int rx_packets; /* total packets received */ 56607ca46eSDavid Howells int tx_packets; /* total packets transmitted */ 57607ca46eSDavid Howells int rx_errors; /* bad packets received */ 58607ca46eSDavid Howells int tx_errors; /* packet transmit problems */ 59607ca46eSDavid Howells int rx_dropped; /* no space in linux buffers */ 60607ca46eSDavid Howells int tx_dropped; /* no space available in linux */ 61607ca46eSDavid Howells 62607ca46eSDavid Howells /* detailed rx_errors: */ 63607ca46eSDavid Howells int rx_length_errors; 64607ca46eSDavid Howells int rx_over_errors; /* receiver ring buff overflow */ 65607ca46eSDavid Howells int rx_crc_errors; /* recved pkt with crc error */ 66607ca46eSDavid Howells int rx_frame_errors; /* recv'd frame alignment error */ 67607ca46eSDavid Howells int rx_fifo_errors; /* recv'r fifo overrun */ 68607ca46eSDavid Howells int rx_missed_errors; /* receiver missed packet */ 69607ca46eSDavid Howells 70607ca46eSDavid Howells /* detailed tx_errors */ 71607ca46eSDavid Howells int tx_aborted_errors; 72607ca46eSDavid Howells int tx_carrier_errors; 73607ca46eSDavid Howells int tx_fifo_errors; 74607ca46eSDavid Howells int tx_heartbeat_errors; 75607ca46eSDavid Howells int tx_window_errors; 76607ca46eSDavid Howells }; 77607ca46eSDavid Howells 78607ca46eSDavid Howells 79607ca46eSDavid Howells struct hippi_fp_hdr { 80607ca46eSDavid Howells #if 0 81607ca46eSDavid Howells __u8 ulp; /* must contain 4 */ 82607ca46eSDavid Howells #if defined (__BIG_ENDIAN_BITFIELD) 83607ca46eSDavid Howells __u8 d1_data_present:1; /* must be 1 */ 84607ca46eSDavid Howells __u8 start_d2_burst_boundary:1; /* must be zero */ 85607ca46eSDavid Howells __u8 reserved:6; /* must be zero */ 86607ca46eSDavid Howells #if 0 87607ca46eSDavid Howells __u16 reserved1:5; 88607ca46eSDavid Howells __u16 d1_area_size:8; /* must be 3 */ 89607ca46eSDavid Howells __u16 d2_offset:3; /* must be zero */ 90607ca46eSDavid Howells #endif 91607ca46eSDavid Howells #elif defined(__LITTLE_ENDIAN_BITFIELD) 92607ca46eSDavid Howells __u8 reserved:6; /* must be zero */ 93607ca46eSDavid Howells __u8 start_d2_burst_boundary:1; /* must be zero */ 94607ca46eSDavid Howells __u8 d1_data_present:1; /* must be 1 */ 95607ca46eSDavid Howells #if 0 96607ca46eSDavid Howells __u16 d2_offset:3; /* must be zero */ 97607ca46eSDavid Howells __u16 d1_area_size:8; /* must be 3 */ 98607ca46eSDavid Howells __u16 reserved1:5; /* must be zero */ 99607ca46eSDavid Howells #endif 100607ca46eSDavid Howells #else 101607ca46eSDavid Howells #error "Please fix <asm/byteorder.h>" 102607ca46eSDavid Howells #endif 103607ca46eSDavid Howells #else 104607ca46eSDavid Howells __be32 fixed; 105607ca46eSDavid Howells #endif 106607ca46eSDavid Howells __be32 d2_size; 107607ca46eSDavid Howells } __attribute__((packed)); 108607ca46eSDavid Howells 109607ca46eSDavid Howells struct hippi_le_hdr { 110607ca46eSDavid Howells #if defined (__BIG_ENDIAN_BITFIELD) 111607ca46eSDavid Howells __u8 fc:3; 112607ca46eSDavid Howells __u8 double_wide:1; 113607ca46eSDavid Howells __u8 message_type:4; 114607ca46eSDavid Howells #elif defined(__LITTLE_ENDIAN_BITFIELD) 115607ca46eSDavid Howells __u8 message_type:4; 116607ca46eSDavid Howells __u8 double_wide:1; 117607ca46eSDavid Howells __u8 fc:3; 118607ca46eSDavid Howells #endif 119607ca46eSDavid Howells __u8 dest_switch_addr[3]; 120607ca46eSDavid Howells #if defined (__BIG_ENDIAN_BITFIELD) 121607ca46eSDavid Howells __u8 dest_addr_type:4, 122607ca46eSDavid Howells src_addr_type:4; 123607ca46eSDavid Howells #elif defined(__LITTLE_ENDIAN_BITFIELD) 124607ca46eSDavid Howells __u8 src_addr_type:4, 125607ca46eSDavid Howells dest_addr_type:4; 126607ca46eSDavid Howells #endif 127607ca46eSDavid Howells __u8 src_switch_addr[3]; 128607ca46eSDavid Howells __u16 reserved; 129607ca46eSDavid Howells __u8 daddr[HIPPI_ALEN]; 130607ca46eSDavid Howells __u16 locally_administered; 131607ca46eSDavid Howells __u8 saddr[HIPPI_ALEN]; 132607ca46eSDavid Howells } __attribute__((packed)); 133607ca46eSDavid Howells 134607ca46eSDavid Howells #define HIPPI_OUI_LEN 3 135607ca46eSDavid Howells /* 136607ca46eSDavid Howells * Looks like the dsap and ssap fields have been swapped by mistake in 137607ca46eSDavid Howells * RFC 2067 "IP over HIPPI". 138607ca46eSDavid Howells */ 139607ca46eSDavid Howells struct hippi_snap_hdr { 140607ca46eSDavid Howells __u8 dsap; /* always 0xAA */ 141607ca46eSDavid Howells __u8 ssap; /* always 0xAA */ 142607ca46eSDavid Howells __u8 ctrl; /* always 0x03 */ 143607ca46eSDavid Howells __u8 oui[HIPPI_OUI_LEN]; /* organizational universal id (zero)*/ 144607ca46eSDavid Howells __be16 ethertype; /* packet type ID field */ 145607ca46eSDavid Howells } __attribute__((packed)); 146607ca46eSDavid Howells 147607ca46eSDavid Howells struct hippi_hdr { 148607ca46eSDavid Howells struct hippi_fp_hdr fp; 149607ca46eSDavid Howells struct hippi_le_hdr le; 150607ca46eSDavid Howells struct hippi_snap_hdr snap; 151607ca46eSDavid Howells } __attribute__((packed)); 152607ca46eSDavid Howells 153607ca46eSDavid Howells #endif /* _LINUX_IF_HIPPI_H */ 154