if_tr.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 Token-Ring IEEE 802.5 interface.
  7. *
  8. * Version: @(#)if_tr.h 0.0 07/11/94
  9. *
  10. * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  11. * Donald Becker, <becker@super.org>
  12. * Peter De Schrijver, <stud11@cc4.kuleuven.ac.be>
  13. *
  14. * This program is free software; you can redistribute it and/or
  15. * modify it under the terms of the GNU General Public License
  16. * as published by the Free Software Foundation; either version
  17. * 2 of the License, or (at your option) any later version.
  18. */
  19. #ifndef _LINUX_IF_TR_H
  20. #define _LINUX_IF_TR_H
  21. /* IEEE 802.5 Token-Ring magic constants. The frame sizes omit the preamble
  22. and FCS/CRC (frame check sequence). */
  23. #define TR_ALEN 6 /* Octets in one token-ring addr */
  24. #define TR_HLEN (sizeof(struct trh_hdr)+sizeof(struct trllc))
  25. #define AC 0x10
  26. #define LLC_FRAME 0x40
  27. /* LLC and SNAP constants */
  28. #define EXTENDED_SAP 0xAA
  29. #define UI_CMD 0x03
  30. /* This is an Token-Ring frame header. */
  31. struct trh_hdr {
  32. __u8 ac; /* access control field */
  33. __u8 fc; /* frame control field */
  34. __u8 daddr[TR_ALEN]; /* destination address */
  35. __u8 saddr[TR_ALEN]; /* source address */
  36. __u16 rcf; /* route control field */
  37. __u16 rseg[8]; /* routing registers */
  38. };
  39. #ifdef __KERNEL__
  40. #include <linux/skbuff.h>
  41. static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb)
  42. {
  43. return (struct trh_hdr *)skb->mac.raw;
  44. }
  45. #endif
  46. /* This is an Token-Ring LLC structure */
  47. struct trllc {
  48. __u8 dsap; /* destination SAP */
  49. __u8 ssap; /* source SAP */
  50. __u8 llc; /* LLC control field */
  51. __u8 protid[3]; /* protocol id */
  52. __u16 ethertype; /* ether type field */
  53. };
  54. /* Token-Ring statistics collection data. */
  55. struct tr_statistics {
  56. unsigned long rx_packets; /* total packets received */
  57. unsigned long tx_packets; /* total packets transmitted */
  58. unsigned long rx_bytes; /* total bytes received */
  59. unsigned long tx_bytes; /* total bytes transmitted */
  60. unsigned long rx_errors; /* bad packets received */
  61. unsigned long tx_errors; /* packet transmit problems */
  62. unsigned long rx_dropped; /* no space in linux buffers */
  63. unsigned long tx_dropped; /* no space available in linux */
  64. unsigned long multicast; /* multicast packets received */
  65. unsigned long transmit_collision;
  66. /* detailed Token-Ring errors. See IBM Token-Ring Network
  67. Architecture for more info */
  68. unsigned long line_errors;
  69. unsigned long internal_errors;
  70. unsigned long burst_errors;
  71. unsigned long A_C_errors;
  72. unsigned long abort_delimiters;
  73. unsigned long lost_frames;
  74. unsigned long recv_congest_count;
  75. unsigned long frame_copied_errors;
  76. unsigned long frequency_errors;
  77. unsigned long token_errors;
  78. unsigned long dummy1;
  79. };
  80. /* source routing stuff */
  81. #define TR_RII 0x80
  82. #define TR_RCF_DIR_BIT 0x80
  83. #define TR_RCF_LEN_MASK 0x1f00
  84. #define TR_RCF_BROADCAST 0x8000 /* all-routes broadcast */
  85. #define TR_RCF_LIMITED_BROADCAST 0xC000 /* single-route broadcast */
  86. #define TR_RCF_FRAME2K 0x20
  87. #define TR_RCF_BROADCAST_MASK 0xC000
  88. #define TR_MAXRIFLEN 18
  89. #endif /* _LINUX_IF_TR_H */