if_hippi.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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@lxorguk.ukuu.org.uk>
  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 <linux/types.h>
  24. #include <asm/byteorder.h>
  25. /*
  26. * HIPPI magic constants.
  27. */
  28. #define HIPPI_ALEN 6 /* Bytes in one HIPPI hw-addr */
  29. #define HIPPI_HLEN sizeof(struct hippi_hdr)
  30. #define HIPPI_ZLEN 0 /* Min. bytes in frame without FCS */
  31. #define HIPPI_DATA_LEN 65280 /* Max. bytes in payload */
  32. #define HIPPI_FRAME_LEN (HIPPI_DATA_LEN + HIPPI_HLEN)
  33. /* Max. bytes in frame without FCS */
  34. /*
  35. * Define LLC and SNAP constants.
  36. */
  37. #define HIPPI_EXTENDED_SAP 0xAA
  38. #define HIPPI_UI_CMD 0x03
  39. /*
  40. * Do we need to list some sort of ID's here?
  41. */
  42. /*
  43. * HIPPI statistics collection data.
  44. */
  45. struct hipnet_statistics {
  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. #if 0
  68. __u8 ulp; /* must contain 4 */
  69. #if defined (__BIG_ENDIAN_BITFIELD)
  70. __u8 d1_data_present:1; /* must be 1 */
  71. __u8 start_d2_burst_boundary:1; /* must be zero */
  72. __u8 reserved:6; /* must be zero */
  73. #if 0
  74. __u16 reserved1:5;
  75. __u16 d1_area_size:8; /* must be 3 */
  76. __u16 d2_offset:3; /* must be zero */
  77. #endif
  78. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  79. __u8 reserved:6; /* must be zero */
  80. __u8 start_d2_burst_boundary:1; /* must be zero */
  81. __u8 d1_data_present:1; /* must be 1 */
  82. #if 0
  83. __u16 d2_offset:3; /* must be zero */
  84. __u16 d1_area_size:8; /* must be 3 */
  85. __u16 reserved1:5; /* must be zero */
  86. #endif
  87. #else
  88. #error "Please fix <asm/byteorder.h>"
  89. #endif
  90. #else
  91. __be32 fixed;
  92. #endif
  93. __be32 d2_size;
  94. } __attribute__((packed));
  95. struct hippi_le_hdr {
  96. #if defined (__BIG_ENDIAN_BITFIELD)
  97. __u8 fc:3;
  98. __u8 double_wide:1;
  99. __u8 message_type:4;
  100. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  101. __u8 message_type:4;
  102. __u8 double_wide:1;
  103. __u8 fc:3;
  104. #endif
  105. __u8 dest_switch_addr[3];
  106. #if defined (__BIG_ENDIAN_BITFIELD)
  107. __u8 dest_addr_type:4,
  108. src_addr_type:4;
  109. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  110. __u8 src_addr_type:4,
  111. dest_addr_type:4;
  112. #endif
  113. __u8 src_switch_addr[3];
  114. __u16 reserved;
  115. __u8 daddr[HIPPI_ALEN];
  116. __u16 locally_administered;
  117. __u8 saddr[HIPPI_ALEN];
  118. } __attribute__((packed));
  119. #define HIPPI_OUI_LEN 3
  120. /*
  121. * Looks like the dsap and ssap fields have been swapped by mistake in
  122. * RFC 2067 "IP over HIPPI".
  123. */
  124. struct hippi_snap_hdr {
  125. __u8 dsap; /* always 0xAA */
  126. __u8 ssap; /* always 0xAA */
  127. __u8 ctrl; /* always 0x03 */
  128. __u8 oui[HIPPI_OUI_LEN]; /* organizational universal id (zero)*/
  129. __be16 ethertype; /* packet type ID field */
  130. } __attribute__((packed));
  131. struct hippi_hdr {
  132. struct hippi_fp_hdr fp;
  133. struct hippi_le_hdr le;
  134. struct hippi_snap_hdr snap;
  135. } __attribute__((packed));
  136. #endif /* _LINUX_IF_HIPPI_H */