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