Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


atmdev.h
001: /* atmdev.h - ATM device driver declarations and various related items */
002:  
003: /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
004:  
005: 
006: #ifndef LINUX_ATMDEV_H
007: #define LINUX_ATMDEV_H
008: 
009: 
010: #include <linux/atmapi.h>
011: #include <linux/atm.h>
012: #include <linux/atmioc.h>
013: 
014: 
015: #define ESI_LEN         6
016: 
017: #define ATM_OC3_PCR     (155520000/270*260/8/53)
018:                         /* OC3 link rate:  155520000 bps
019:                            SONET overhead: /270*260 (9 section, 1 path)
020:                            bits per cell:  /8/53
021:                            max cell rate:  353207.547 cells/sec */
022: #define ATM_25_PCR      ((25600000/8-8000)/54)
023:                         /* 25 Mbps ATM cell rate (59111) */
024: #define ATM_OC12_PCR    (622080000/1080*1040/8/53)
025:                         /* OC12 link rate: 622080000 bps
026:                            SONET overhead: /1080*1040
027:                            bits per cell:  /8/53
028:                            max cell rate:  1412830.188 cells/sec */
029: #define ATM_DS3_PCR     (8000*12)
030:                         /* DS3: 12 cells in a 125 usec time slot */
031: 
032: 
033: #define __AAL_STAT_ITEMS \
034:     __HANDLE_ITEM(tx);                  /* TX okay */ \
035:     __HANDLE_ITEM(tx_err);              /* TX errors */ \
036:     __HANDLE_ITEM(rx);                  /* RX okay */ \
037:     __HANDLE_ITEM(rx_err);              /* RX errors */ \
038:     __HANDLE_ITEM(rx_drop);             /* RX out of memory */
039: 
040: struct atm_aal_stats {
041: #define __HANDLE_ITEM(i) int i
042:         __AAL_STAT_ITEMS
043: #undef __HANDLE_ITEM
044: };
045: 
046: 
047: struct atm_dev_stats {
048:         struct atm_aal_stats aal0;
049:         struct atm_aal_stats aal34;
050:         struct atm_aal_stats aal5;
051: } __ATM_API_ALIGN;
052: 
053: 
054: #define ATM_GETLINKRATE _IOW('a',ATMIOC_ITF+1,struct atmif_sioc)
055:                                         /* get link rate */
056: #define ATM_GETNAMES    _IOW('a',ATMIOC_ITF+3,struct atm_iobuf)
057:                                         /* get interface names (numbers) */
058: #define ATM_GETTYPE     _IOW('a',ATMIOC_ITF+4,struct atmif_sioc)
059:                                         /* get interface type name */
060: #define ATM_GETESI      _IOW('a',ATMIOC_ITF+5,struct atmif_sioc)
061:                                         /* get interface ESI */
062: #define ATM_GETADDR     _IOW('a',ATMIOC_ITF+6,struct atmif_sioc)
063:                                         /* get itf's local ATM addr. list */
064: #define ATM_RSTADDR     _IOW('a',ATMIOC_ITF+7,struct atmif_sioc)
065:                                         /* reset itf's ATM address list */
066: #define ATM_ADDADDR     _IOW('a',ATMIOC_ITF+8,struct atmif_sioc)
067:                                         /* add a local ATM address */
068: #define ATM_DELADDR     _IOW('a',ATMIOC_ITF+9,struct atmif_sioc)
069:                                         /* remove a local ATM address */
070: #define ATM_GETCIRANGE  _IOW('a',ATMIOC_ITF+10,struct atmif_sioc)
071:                                         /* get connection identifier range */
072: #define ATM_SETCIRANGE  _IOW('a',ATMIOC_ITF+11,struct atmif_sioc)
073:                                         /* set connection identifier range */
074: #define ATM_SETESI      _IOW('a',ATMIOC_ITF+12,struct atmif_sioc)
075:                                         /* set interface ESI */
076: #define ATM_SETESIF     _IOW('a',ATMIOC_ITF+13,struct atmif_sioc)
077:                                         /* force interface ESI */
078: #define ATM_ADDLECSADDR _IOW('a', ATMIOC_ITF+14, struct atmif_sioc)
079:                                         /* register a LECS address */
080: #define ATM_DELLECSADDR _IOW('a', ATMIOC_ITF+15, struct atmif_sioc)
081:                                         /* unregister a LECS address */
082: #define ATM_GETLECSADDR _IOW('a', ATMIOC_ITF+16, struct atmif_sioc)
083:                                         /* retrieve LECS address(es) */
084: 
085: #define ATM_GETSTAT     _IOW('a',ATMIOC_SARCOM+0,struct atmif_sioc)
086:                                         /* get AAL layer statistics */
087: #define ATM_GETSTATZ    _IOW('a',ATMIOC_SARCOM+1,struct atmif_sioc)
088:                                         /* get AAL layer statistics and zero */
089: #define ATM_GETLOOP     _IOW('a',ATMIOC_SARCOM+2,struct atmif_sioc)
090:                                         /* get loopback mode */
091: #define ATM_SETLOOP     _IOW('a',ATMIOC_SARCOM+3,struct atmif_sioc)
092:                                         /* set loopback mode */
093: #define ATM_QUERYLOOP   _IOW('a',ATMIOC_SARCOM+4,struct atmif_sioc)
094:                                         /* query supported loopback modes */
095: #define ATM_SETSC       _IOW('a',ATMIOC_SPECIAL+1,int)
096:                                         /* enable or disable single-copy */
097: #define ATM_SETBACKEND  _IOW('a',ATMIOC_SPECIAL+2,atm_backend_t)
098:                                         /* set backend handler */
099: #define ATM_NEWBACKENDIF _IOW('a',ATMIOC_SPECIAL+3,atm_backend_t)
100:                                         /* use backend to make new if */
101: #define ATM_ADDPARTY    _IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf)
102:                                         /* add party to p2mp call */
103: #ifdef CONFIG_COMPAT
104: /* It actually takes struct sockaddr_atmsvc, not struct atm_iobuf */
105: #define COMPAT_ATM_ADDPARTY     _IOW('a', ATMIOC_SPECIAL+4,struct compat_atm_iobuf)
106: #endif
107: #define ATM_DROPPARTY   _IOW('a', ATMIOC_SPECIAL+5,int)
108:                                         /* drop party from p2mp call */
109: 
110: /*
111:  * These are backend handkers that can be set via the ATM_SETBACKEND call
112:  * above.  In the future we may support dynamic loading of these - for now,
113:  * they're just being used to share the ATMIOC_BACKEND ioctls
114:  */
115: #define ATM_BACKEND_RAW         0       
116: #define ATM_BACKEND_PPP         1       /* PPPoATM - RFC2364 */
117: #define ATM_BACKEND_BR2684      2       /* Bridged RFC1483/2684 */
118: 
119: /* for ATM_GETTYPE */
120: #define ATM_ITFTYP_LEN  8       /* maximum length of interface type name */
121: 
122: /*
123:  * Loopback modes for ATM_{PHY,SAR}_{GET,SET}LOOP
124:  */
125: 
126: /* Point of loopback                            CPU-->SAR-->PHY-->line--> ... */
127: #define __ATM_LM_NONE   0       /* no loop back     ^     ^     ^      ^      */
128: #define __ATM_LM_AAL    1       /* loop back PDUs --'     |     |      |      */
129: #define __ATM_LM_ATM    2       /* loop back ATM cells ---'     |      |      */
130: /* RESERVED             4       loop back on PHY side  ---'                   */
131: #define __ATM_LM_PHY    8       /* loop back bits (digital) ----'      |      */
132: #define __ATM_LM_ANALOG 16      /* loop back the analog signal --------'      */
133: 
134: /* Direction of loopback */
135: #define __ATM_LM_MKLOC(n)       ((n))       /* Local (i.e. loop TX to RX) */
136: #define __ATM_LM_MKRMT(n)       ((n) << 8)  /* Remote (i.e. loop RX to TX) */
137: 
138: #define __ATM_LM_XTLOC(n)       ((n) & 0xff)
139: #define __ATM_LM_XTRMT(n)       (((n) >> 8) & 0xff)
140: 
141: #define ATM_LM_NONE     0       /* no loopback */
142: 
143: #define ATM_LM_LOC_AAL  __ATM_LM_MKLOC(__ATM_LM_AAL)
144: #define ATM_LM_LOC_ATM  __ATM_LM_MKLOC(__ATM_LM_ATM)
145: #define ATM_LM_LOC_PHY  __ATM_LM_MKLOC(__ATM_LM_PHY)
146: #define ATM_LM_LOC_ANALOG __ATM_LM_MKLOC(__ATM_LM_ANALOG)
147: 
148: #define ATM_LM_RMT_AAL  __ATM_LM_MKRMT(__ATM_LM_AAL)
149: #define ATM_LM_RMT_ATM  __ATM_LM_MKRMT(__ATM_LM_ATM)
150: #define ATM_LM_RMT_PHY  __ATM_LM_MKRMT(__ATM_LM_PHY)
151: #define ATM_LM_RMT_ANALOG __ATM_LM_MKRMT(__ATM_LM_ANALOG)
152: 
153: /*
154:  * Note: ATM_LM_LOC_* and ATM_LM_RMT_* can be combined, provided that
155:  * __ATM_LM_XTLOC(x) <= __ATM_LM_XTRMT(x)
156:  */
157: 
158: 
159: struct atm_iobuf {
160:         int length;
161:         void *buffer;
162: };
163: 
164: /* for ATM_GETCIRANGE / ATM_SETCIRANGE */
165: 
166: #define ATM_CI_MAX      -1              /* use maximum range of VPI/VCI */
167:  
168: struct atm_cirange {
169:         signed char     vpi_bits;       /* 1..8, ATM_CI_MAX (-1) for maximum */
170:         signed char     vci_bits;       /* 1..16, ATM_CI_MAX (-1) for maximum */
171: };
172: 
173: /* for ATM_SETSC; actually taken from the ATM_VF number space */
174: 
175: #define ATM_SC_RX       1024            /* enable RX single-copy */
176: #define ATM_SC_TX       2048            /* enable TX single-copy */
177: 
178: #define ATM_BACKLOG_DEFAULT 32 /* if we get more, we're likely to time out
179:                                   anyway */
180: 
181: /* MF: change_qos (Modify) flags */
182: 
183: #define ATM_MF_IMMED     1      /* Block until change is effective */
184: #define ATM_MF_INC_RSV   2      /* Change reservation on increase */
185: #define ATM_MF_INC_SHP   4      /* Change shaping on increase */
186: #define ATM_MF_DEC_RSV   8      /* Change reservation on decrease */
187: #define ATM_MF_DEC_SHP  16      /* Change shaping on decrease */
188: #define ATM_MF_BWD      32      /* Set the backward direction parameters */
189: 
190: #define ATM_MF_SET      (ATM_MF_INC_RSV | ATM_MF_INC_SHP | ATM_MF_DEC_RSV | \
191:                           ATM_MF_DEC_SHP | ATM_MF_BWD)
192: 
193: /*
194:  * ATM_VS_* are used to express VC state in a human-friendly way.
195:  */
196: 
197: #define ATM_VS_IDLE     0       /* VC is not used */
198: #define ATM_VS_CONNECTED 1      /* VC is connected */
199: #define ATM_VS_CLOSING  2       /* VC is closing */
200: #define ATM_VS_LISTEN   3       /* VC is listening for incoming setups */
201: #define ATM_VS_INUSE    4       /* VC is in use (registered with atmsigd) */
202: #define ATM_VS_BOUND    5       /* VC is bound */
203: 
204: #define ATM_VS2TXT_MAP \
205:     "IDLE", "CONNECTED", "CLOSING", "LISTEN", "INUSE", "BOUND"
206: 
207: #define ATM_VF2TXT_MAP \
208:     "ADDR",     "READY",        "PARTIAL",      "REGIS", \
209:     "RELEASED", "HASQOS",       "LISTEN",       "META", \
210:     "256",      "512",          "1024",         "2048", \
211:     "SESSION",  "HASSAP",       "BOUND",        "CLOSE"
212: 
213: 
214: 
215: #endif
216: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/