if_hippi.h 4.0 KB

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