atmdev.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. /* atmdev.h - ATM device driver declarations and various related items */
  2. /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
  3. #ifndef LINUX_ATMDEV_H
  4. #define LINUX_ATMDEV_H
  5. #include <linux/atmapi.h>
  6. #include <linux/atm.h>
  7. #include <linux/atmioc.h>
  8. #define ESI_LEN 6
  9. #define ATM_OC3_PCR (155520000/270*260/8/53)
  10. /* OC3 link rate: 155520000 bps
  11. SONET overhead: /270*260 (9 section, 1 path)
  12. bits per cell: /8/53
  13. max cell rate: 353207.547 cells/sec */
  14. #define ATM_25_PCR ((25600000/8-8000)/54)
  15. /* 25 Mbps ATM cell rate (59111) */
  16. #define ATM_OC12_PCR (622080000/1080*1040/8/53)
  17. /* OC12 link rate: 622080000 bps
  18. SONET overhead: /1080*1040
  19. bits per cell: /8/53
  20. max cell rate: 1412830.188 cells/sec */
  21. #define ATM_DS3_PCR (8000*12)
  22. /* DS3: 12 cells in a 125 usec time slot */
  23. #define __AAL_STAT_ITEMS \
  24. __HANDLE_ITEM(tx); /* TX okay */ \
  25. __HANDLE_ITEM(tx_err); /* TX errors */ \
  26. __HANDLE_ITEM(rx); /* RX okay */ \
  27. __HANDLE_ITEM(rx_err); /* RX errors */ \
  28. __HANDLE_ITEM(rx_drop); /* RX out of memory */
  29. struct atm_aal_stats {
  30. #define __HANDLE_ITEM(i) int i
  31. __AAL_STAT_ITEMS
  32. #undef __HANDLE_ITEM
  33. };
  34. struct atm_dev_stats {
  35. struct atm_aal_stats aal0;
  36. struct atm_aal_stats aal34;
  37. struct atm_aal_stats aal5;
  38. } __ATM_API_ALIGN;
  39. #define ATM_GETLINKRATE _IOW('a',ATMIOC_ITF+1,struct atmif_sioc)
  40. /* get link rate */
  41. #define ATM_GETNAMES _IOW('a',ATMIOC_ITF+3,struct atm_iobuf)
  42. /* get interface names (numbers) */
  43. #define ATM_GETTYPE _IOW('a',ATMIOC_ITF+4,struct atmif_sioc)
  44. /* get interface type name */
  45. #define ATM_GETESI _IOW('a',ATMIOC_ITF+5,struct atmif_sioc)
  46. /* get interface ESI */
  47. #define ATM_GETADDR _IOW('a',ATMIOC_ITF+6,struct atmif_sioc)
  48. /* get itf's local ATM addr. list */
  49. #define ATM_RSTADDR _IOW('a',ATMIOC_ITF+7,struct atmif_sioc)
  50. /* reset itf's ATM address list */
  51. #define ATM_ADDADDR _IOW('a',ATMIOC_ITF+8,struct atmif_sioc)
  52. /* add a local ATM address */
  53. #define ATM_DELADDR _IOW('a',ATMIOC_ITF+9,struct atmif_sioc)
  54. /* remove a local ATM address */
  55. #define ATM_GETCIRANGE _IOW('a',ATMIOC_ITF+10,struct atmif_sioc)
  56. /* get connection identifier range */
  57. #define ATM_SETCIRANGE _IOW('a',ATMIOC_ITF+11,struct atmif_sioc)
  58. /* set connection identifier range */
  59. #define ATM_SETESI _IOW('a',ATMIOC_ITF+12,struct atmif_sioc)
  60. /* set interface ESI */
  61. #define ATM_SETESIF _IOW('a',ATMIOC_ITF+13,struct atmif_sioc)
  62. /* force interface ESI */
  63. #define ATM_ADDLECSADDR _IOW('a', ATMIOC_ITF+14, struct atmif_sioc)
  64. /* register a LECS address */
  65. #define ATM_DELLECSADDR _IOW('a', ATMIOC_ITF+15, struct atmif_sioc)
  66. /* unregister a LECS address */
  67. #define ATM_GETLECSADDR _IOW('a', ATMIOC_ITF+16, struct atmif_sioc)
  68. /* retrieve LECS address(es) */
  69. #define ATM_GETSTAT _IOW('a',ATMIOC_SARCOM+0,struct atmif_sioc)
  70. /* get AAL layer statistics */
  71. #define ATM_GETSTATZ _IOW('a',ATMIOC_SARCOM+1,struct atmif_sioc)
  72. /* get AAL layer statistics and zero */
  73. #define ATM_GETLOOP _IOW('a',ATMIOC_SARCOM+2,struct atmif_sioc)
  74. /* get loopback mode */
  75. #define ATM_SETLOOP _IOW('a',ATMIOC_SARCOM+3,struct atmif_sioc)
  76. /* set loopback mode */
  77. #define ATM_QUERYLOOP _IOW('a',ATMIOC_SARCOM+4,struct atmif_sioc)
  78. /* query supported loopback modes */
  79. #define ATM_SETSC _IOW('a',ATMIOC_SPECIAL+1,int)
  80. /* enable or disable single-copy */
  81. #define ATM_SETBACKEND _IOW('a',ATMIOC_SPECIAL+2,atm_backend_t)
  82. /* set backend handler */
  83. #define ATM_NEWBACKENDIF _IOW('a',ATMIOC_SPECIAL+3,atm_backend_t)
  84. /* use backend to make new if */
  85. #define ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf)
  86. /* add party to p2mp call */
  87. #ifdef CONFIG_COMPAT
  88. /* It actually takes struct sockaddr_atmsvc, not struct atm_iobuf */
  89. #define COMPAT_ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct compat_atm_iobuf)
  90. #endif
  91. #define ATM_DROPPARTY _IOW('a', ATMIOC_SPECIAL+5,int)
  92. /* drop party from p2mp call */
  93. /*
  94. * These are backend handkers that can be set via the ATM_SETBACKEND call
  95. * above. In the future we may support dynamic loading of these - for now,
  96. * they're just being used to share the ATMIOC_BACKEND ioctls
  97. */
  98. #define ATM_BACKEND_RAW 0
  99. #define ATM_BACKEND_PPP 1 /* PPPoATM - RFC2364 */
  100. #define ATM_BACKEND_BR2684 2 /* Bridged RFC1483/2684 */
  101. /* for ATM_GETTYPE */
  102. #define ATM_ITFTYP_LEN 8 /* maximum length of interface type name */
  103. /*
  104. * Loopback modes for ATM_{PHY,SAR}_{GET,SET}LOOP
  105. */
  106. /* Point of loopback CPU-->SAR-->PHY-->line--> ... */
  107. #define __ATM_LM_NONE 0 /* no loop back ^ ^ ^ ^ */
  108. #define __ATM_LM_AAL 1 /* loop back PDUs --' | | | */
  109. #define __ATM_LM_ATM 2 /* loop back ATM cells ---' | | */
  110. /* RESERVED 4 loop back on PHY side ---' */
  111. #define __ATM_LM_PHY 8 /* loop back bits (digital) ----' | */
  112. #define __ATM_LM_ANALOG 16 /* loop back the analog signal --------' */
  113. /* Direction of loopback */
  114. #define __ATM_LM_MKLOC(n) ((n)) /* Local (i.e. loop TX to RX) */
  115. #define __ATM_LM_MKRMT(n) ((n) << 8) /* Remote (i.e. loop RX to TX) */
  116. #define __ATM_LM_XTLOC(n) ((n) & 0xff)
  117. #define __ATM_LM_XTRMT(n) (((n) >> 8) & 0xff)
  118. #define ATM_LM_NONE 0 /* no loopback */
  119. #define ATM_LM_LOC_AAL __ATM_LM_MKLOC(__ATM_LM_AAL)
  120. #define ATM_LM_LOC_ATM __ATM_LM_MKLOC(__ATM_LM_ATM)
  121. #define ATM_LM_LOC_PHY __ATM_LM_MKLOC(__ATM_LM_PHY)
  122. #define ATM_LM_LOC_ANALOG __ATM_LM_MKLOC(__ATM_LM_ANALOG)
  123. #define ATM_LM_RMT_AAL __ATM_LM_MKRMT(__ATM_LM_AAL)
  124. #define ATM_LM_RMT_ATM __ATM_LM_MKRMT(__ATM_LM_ATM)
  125. #define ATM_LM_RMT_PHY __ATM_LM_MKRMT(__ATM_LM_PHY)
  126. #define ATM_LM_RMT_ANALOG __ATM_LM_MKRMT(__ATM_LM_ANALOG)
  127. /*
  128. * Note: ATM_LM_LOC_* and ATM_LM_RMT_* can be combined, provided that
  129. * __ATM_LM_XTLOC(x) <= __ATM_LM_XTRMT(x)
  130. */
  131. struct atm_iobuf {
  132. int length;
  133. void *buffer;
  134. };
  135. /* for ATM_GETCIRANGE / ATM_SETCIRANGE */
  136. #define ATM_CI_MAX -1 /* use maximum range of VPI/VCI */
  137. struct atm_cirange {
  138. signed char vpi_bits; /* 1..8, ATM_CI_MAX (-1) for maximum */
  139. signed char vci_bits; /* 1..16, ATM_CI_MAX (-1) for maximum */
  140. };
  141. /* for ATM_SETSC; actually taken from the ATM_VF number space */
  142. #define ATM_SC_RX 1024 /* enable RX single-copy */
  143. #define ATM_SC_TX 2048 /* enable TX single-copy */
  144. #define ATM_BACKLOG_DEFAULT 32 /* if we get more, we're likely to time out
  145. anyway */
  146. /* MF: change_qos (Modify) flags */
  147. #define ATM_MF_IMMED 1 /* Block until change is effective */
  148. #define ATM_MF_INC_RSV 2 /* Change reservation on increase */
  149. #define ATM_MF_INC_SHP 4 /* Change shaping on increase */
  150. #define ATM_MF_DEC_RSV 8 /* Change reservation on decrease */
  151. #define ATM_MF_DEC_SHP 16 /* Change shaping on decrease */
  152. #define ATM_MF_BWD 32 /* Set the backward direction parameters */
  153. #define ATM_MF_SET (ATM_MF_INC_RSV | ATM_MF_INC_SHP | ATM_MF_DEC_RSV | \
  154. ATM_MF_DEC_SHP | ATM_MF_BWD)
  155. /*
  156. * ATM_VS_* are used to express VC state in a human-friendly way.
  157. */
  158. #define ATM_VS_IDLE 0 /* VC is not used */
  159. #define ATM_VS_CONNECTED 1 /* VC is connected */
  160. #define ATM_VS_CLOSING 2 /* VC is closing */
  161. #define ATM_VS_LISTEN 3 /* VC is listening for incoming setups */
  162. #define ATM_VS_INUSE 4 /* VC is in use (registered with atmsigd) */
  163. #define ATM_VS_BOUND 5 /* VC is bound */
  164. #define ATM_VS2TXT_MAP \
  165. "IDLE", "CONNECTED", "CLOSING", "LISTEN", "INUSE", "BOUND"
  166. #define ATM_VF2TXT_MAP \
  167. "ADDR", "READY", "PARTIAL", "REGIS", \
  168. "RELEASED", "HASQOS", "LISTEN", "META", \
  169. "256", "512", "1024", "2048", \
  170. "SESSION", "HASSAP", "BOUND", "CLOSE"
  171. #endif /* LINUX_ATMDEV_H */