Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
0002 /*
0003  * INET     An implementation of the TCP/IP protocol suite for the LINUX
0004  *      operating system.  INET is implemented using the  BSD Socket
0005  *      interface as the means of communication with the user level.
0006  *
0007  *      Global definitions for the HIPPI interface.
0008  *
0009  * Version: @(#)if_hippi.h  1.0.0   05/26/97
0010  *
0011  * Author:  Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
0012  *      Donald Becker, <becker@super.org>
0013  *      Alan Cox, <alan@lxorguk.ukuu.org.uk>
0014  *      Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk>
0015  *      Jes Sorensen, <Jes.Sorensen@cern.ch>
0016  *
0017  *      This program is free software; you can redistribute it and/or
0018  *      modify it under the terms of the GNU General Public License
0019  *      as published by the Free Software Foundation; either version
0020  *      2 of the License, or (at your option) any later version.
0021  */
0022  
0023 #ifndef _LINUX_IF_HIPPI_H
0024 #define _LINUX_IF_HIPPI_H
0025 
0026 #include <linux/types.h>
0027 #include <asm/byteorder.h>
0028 
0029 /*
0030  *  HIPPI magic constants.
0031  */
0032 
0033 #define HIPPI_ALEN  6       /* Bytes in one HIPPI hw-addr      */
0034 #define HIPPI_HLEN  sizeof(struct hippi_hdr)
0035 #define HIPPI_ZLEN  0       /* Min. bytes in frame without FCS */
0036 #define HIPPI_DATA_LEN  65280       /* Max. bytes in payload       */
0037 #define HIPPI_FRAME_LEN (HIPPI_DATA_LEN + HIPPI_HLEN)
0038                     /* Max. bytes in frame without FCS */
0039 
0040 /*
0041  * Define LLC and SNAP constants.
0042  */
0043 #define HIPPI_EXTENDED_SAP  0xAA
0044 #define HIPPI_UI_CMD        0x03
0045 
0046 
0047 /*
0048  *  Do we need to list some sort of ID's here?
0049  */
0050 
0051 /*
0052  *  HIPPI statistics collection data. 
0053  */
0054  
0055 struct hipnet_statistics {
0056     int rx_packets;     /* total packets received   */
0057     int tx_packets;     /* total packets transmitted    */
0058     int rx_errors;      /* bad packets received     */
0059     int tx_errors;      /* packet transmit problems */
0060     int rx_dropped;     /* no space in linux buffers    */
0061     int tx_dropped;     /* no space available in linux  */
0062 
0063     /* detailed rx_errors: */
0064     int rx_length_errors;
0065     int rx_over_errors;     /* receiver ring buff overflow  */
0066     int rx_crc_errors;      /* recved pkt with crc error    */
0067     int rx_frame_errors;    /* recv'd frame alignment error */
0068     int rx_fifo_errors;     /* recv'r fifo overrun      */
0069     int rx_missed_errors;   /* receiver missed packet   */
0070 
0071     /* detailed tx_errors */
0072     int tx_aborted_errors;
0073     int tx_carrier_errors;
0074     int tx_fifo_errors;
0075     int tx_heartbeat_errors;
0076     int tx_window_errors;
0077 };
0078 
0079 
0080 struct hippi_fp_hdr {
0081 #if 0
0082     __u8        ulp;                /* must contain 4 */
0083 #if defined (__BIG_ENDIAN_BITFIELD)
0084     __u8        d1_data_present:1;      /* must be 1 */
0085     __u8        start_d2_burst_boundary:1;  /* must be zero */
0086     __u8        reserved:6;         /* must be zero */
0087 #if 0
0088     __u16       reserved1:5;
0089     __u16       d1_area_size:8;         /* must be 3 */
0090     __u16       d2_offset:3;            /* must be zero */
0091 #endif
0092 #elif defined(__LITTLE_ENDIAN_BITFIELD)
0093     __u8        reserved:6;         /* must be zero */
0094     __u8        start_d2_burst_boundary:1;  /* must be zero */
0095     __u8        d1_data_present:1;      /* must be 1 */
0096 #if 0
0097     __u16       d2_offset:3;            /* must be zero */
0098     __u16       d1_area_size:8;         /* must be 3 */
0099     __u16       reserved1:5;            /* must be zero */
0100 #endif
0101 #else
0102 #error  "Please fix <asm/byteorder.h>"
0103 #endif
0104 #else
0105     __be32      fixed;
0106 #endif
0107     __be32      d2_size;
0108 } __attribute__((packed));
0109 
0110 struct hippi_le_hdr {
0111 #if defined (__BIG_ENDIAN_BITFIELD)
0112     __u8        fc:3;
0113     __u8        double_wide:1;
0114     __u8        message_type:4;
0115 #elif defined(__LITTLE_ENDIAN_BITFIELD)
0116     __u8        message_type:4;
0117     __u8        double_wide:1;
0118     __u8        fc:3;
0119 #endif
0120     __u8        dest_switch_addr[3];
0121 #if defined (__BIG_ENDIAN_BITFIELD)
0122     __u8        dest_addr_type:4,
0123             src_addr_type:4;
0124 #elif defined(__LITTLE_ENDIAN_BITFIELD)
0125     __u8        src_addr_type:4,
0126             dest_addr_type:4;
0127 #endif
0128     __u8        src_switch_addr[3];
0129     __u16       reserved;
0130     __u8        daddr[HIPPI_ALEN];
0131     __u16       locally_administered;
0132     __u8        saddr[HIPPI_ALEN];
0133 } __attribute__((packed));
0134 
0135 #define HIPPI_OUI_LEN   3
0136 /*
0137  * Looks like the dsap and ssap fields have been swapped by mistake in
0138  * RFC 2067 "IP over HIPPI".
0139  */
0140 struct hippi_snap_hdr {
0141     __u8    dsap;           /* always 0xAA */
0142     __u8    ssap;           /* always 0xAA */
0143     __u8    ctrl;           /* always 0x03 */
0144     __u8    oui[HIPPI_OUI_LEN]; /* organizational universal id (zero)*/
0145     __be16  ethertype;      /* packet type ID field */
0146 } __attribute__((packed));
0147 
0148 struct hippi_hdr {
0149     struct hippi_fp_hdr fp;
0150     struct hippi_le_hdr le;
0151     struct hippi_snap_hdr   snap;
0152 } __attribute__((packed));
0153 
0154 #endif  /* _LINUX_IF_HIPPI_H */