atmdev.h 7.5 KB

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