if_hippi.h 4.1 KB

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