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