Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 /* atmdev.h - ATM device driver declarations and various related items */
0003  
0004 /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
0005  
0006 
0007 #ifndef _UAPILINUX_ATMDEV_H
0008 #define _UAPILINUX_ATMDEV_H
0009 
0010 
0011 #include <linux/atmapi.h>
0012 #include <linux/atm.h>
0013 #include <linux/atmioc.h>
0014 
0015 
0016 #define ESI_LEN     6
0017 
0018 #define ATM_OC3_PCR (155520000/270*260/8/53)
0019             /* OC3 link rate:  155520000 bps
0020                SONET overhead: /270*260 (9 section, 1 path)
0021                bits per cell:  /8/53
0022                max cell rate:  353207.547 cells/sec */
0023 #define ATM_25_PCR  ((25600000/8-8000)/54)
0024             /* 25 Mbps ATM cell rate (59111) */
0025 #define ATM_OC12_PCR    (622080000/1080*1040/8/53)
0026             /* OC12 link rate: 622080000 bps
0027                SONET overhead: /1080*1040
0028                bits per cell:  /8/53
0029                max cell rate:  1412830.188 cells/sec */
0030 #define ATM_DS3_PCR (8000*12)
0031             /* DS3: 12 cells in a 125 usec time slot */
0032 
0033 
0034 #define __AAL_STAT_ITEMS \
0035     __HANDLE_ITEM(tx);          /* TX okay */ \
0036     __HANDLE_ITEM(tx_err);      /* TX errors */ \
0037     __HANDLE_ITEM(rx);          /* RX okay */ \
0038     __HANDLE_ITEM(rx_err);      /* RX errors */ \
0039     __HANDLE_ITEM(rx_drop);     /* RX out of memory */
0040 
0041 struct atm_aal_stats {
0042 #define __HANDLE_ITEM(i) int i
0043     __AAL_STAT_ITEMS
0044 #undef __HANDLE_ITEM
0045 };
0046 
0047 
0048 struct atm_dev_stats {
0049     struct atm_aal_stats aal0;
0050     struct atm_aal_stats aal34;
0051     struct atm_aal_stats aal5;
0052 } __ATM_API_ALIGN;
0053 
0054 
0055 #define ATM_GETLINKRATE _IOW('a',ATMIOC_ITF+1,struct atmif_sioc)
0056                     /* get link rate */
0057 #define ATM_GETNAMES    _IOW('a',ATMIOC_ITF+3,struct atm_iobuf)
0058                     /* get interface names (numbers) */
0059 #define ATM_GETTYPE _IOW('a',ATMIOC_ITF+4,struct atmif_sioc)
0060                     /* get interface type name */
0061 #define ATM_GETESI  _IOW('a',ATMIOC_ITF+5,struct atmif_sioc)
0062                     /* get interface ESI */
0063 #define ATM_GETADDR _IOW('a',ATMIOC_ITF+6,struct atmif_sioc)
0064                     /* get itf's local ATM addr. list */
0065 #define ATM_RSTADDR _IOW('a',ATMIOC_ITF+7,struct atmif_sioc)
0066                     /* reset itf's ATM address list */
0067 #define ATM_ADDADDR _IOW('a',ATMIOC_ITF+8,struct atmif_sioc)
0068                     /* add a local ATM address */
0069 #define ATM_DELADDR _IOW('a',ATMIOC_ITF+9,struct atmif_sioc)
0070                     /* remove a local ATM address */
0071 #define ATM_GETCIRANGE  _IOW('a',ATMIOC_ITF+10,struct atmif_sioc)
0072                     /* get connection identifier range */
0073 #define ATM_SETCIRANGE  _IOW('a',ATMIOC_ITF+11,struct atmif_sioc)
0074                     /* set connection identifier range */
0075 #define ATM_SETESI  _IOW('a',ATMIOC_ITF+12,struct atmif_sioc)
0076                     /* set interface ESI */
0077 #define ATM_SETESIF _IOW('a',ATMIOC_ITF+13,struct atmif_sioc)
0078                     /* force interface ESI */
0079 #define ATM_ADDLECSADDR _IOW('a', ATMIOC_ITF+14, struct atmif_sioc)
0080                     /* register a LECS address */
0081 #define ATM_DELLECSADDR _IOW('a', ATMIOC_ITF+15, struct atmif_sioc)
0082                     /* unregister a LECS address */
0083 #define ATM_GETLECSADDR _IOW('a', ATMIOC_ITF+16, struct atmif_sioc)
0084                     /* retrieve LECS address(es) */
0085 
0086 #define ATM_GETSTAT _IOW('a',ATMIOC_SARCOM+0,struct atmif_sioc)
0087                     /* get AAL layer statistics */
0088 #define ATM_GETSTATZ    _IOW('a',ATMIOC_SARCOM+1,struct atmif_sioc)
0089                     /* get AAL layer statistics and zero */
0090 #define ATM_GETLOOP _IOW('a',ATMIOC_SARCOM+2,struct atmif_sioc)
0091                     /* get loopback mode */
0092 #define ATM_SETLOOP _IOW('a',ATMIOC_SARCOM+3,struct atmif_sioc)
0093                     /* set loopback mode */
0094 #define ATM_QUERYLOOP   _IOW('a',ATMIOC_SARCOM+4,struct atmif_sioc)
0095                     /* query supported loopback modes */
0096 #define ATM_SETSC   _IOW('a',ATMIOC_SPECIAL+1,int)
0097                     /* enable or disable single-copy */
0098 #define ATM_SETBACKEND  _IOW('a',ATMIOC_SPECIAL+2,atm_backend_t)
0099                     /* set backend handler */
0100 #define ATM_NEWBACKENDIF _IOW('a',ATMIOC_SPECIAL+3,atm_backend_t)
0101                     /* use backend to make new if */
0102 #define ATM_ADDPARTY    _IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf)
0103                     /* add party to p2mp call */
0104 #ifdef CONFIG_COMPAT
0105 /* It actually takes struct sockaddr_atmsvc, not struct atm_iobuf */
0106 #define COMPAT_ATM_ADDPARTY     _IOW('a', ATMIOC_SPECIAL+4,struct compat_atm_iobuf)
0107 #endif
0108 #define ATM_DROPPARTY   _IOW('a', ATMIOC_SPECIAL+5,int)
0109                     /* drop party from p2mp call */
0110 
0111 /*
0112  * These are backend handkers that can be set via the ATM_SETBACKEND call
0113  * above.  In the future we may support dynamic loading of these - for now,
0114  * they're just being used to share the ATMIOC_BACKEND ioctls
0115  */
0116 #define ATM_BACKEND_RAW     0   
0117 #define ATM_BACKEND_PPP     1   /* PPPoATM - RFC2364 */
0118 #define ATM_BACKEND_BR2684  2   /* Bridged RFC1483/2684 */
0119 
0120 /* for ATM_GETTYPE */
0121 #define ATM_ITFTYP_LEN  8   /* maximum length of interface type name */
0122 
0123 /*
0124  * Loopback modes for ATM_{PHY,SAR}_{GET,SET}LOOP
0125  */
0126 
0127 /* Point of loopback                CPU-->SAR-->PHY-->line--> ... */
0128 #define __ATM_LM_NONE   0   /* no loop back     ^     ^     ^      ^      */
0129 #define __ATM_LM_AAL    1   /* loop back PDUs --'     |     |      |      */
0130 #define __ATM_LM_ATM    2   /* loop back ATM cells ---'     |      |      */
0131 /* RESERVED     4   loop back on PHY side  ---'           */
0132 #define __ATM_LM_PHY    8   /* loop back bits (digital) ----'      |      */
0133 #define __ATM_LM_ANALOG 16  /* loop back the analog signal --------'      */
0134 
0135 /* Direction of loopback */
0136 #define __ATM_LM_MKLOC(n)   ((n))       /* Local (i.e. loop TX to RX) */
0137 #define __ATM_LM_MKRMT(n)   ((n) << 8)  /* Remote (i.e. loop RX to TX) */
0138 
0139 #define __ATM_LM_XTLOC(n)   ((n) & 0xff)
0140 #define __ATM_LM_XTRMT(n)   (((n) >> 8) & 0xff)
0141 
0142 #define ATM_LM_NONE 0   /* no loopback */
0143 
0144 #define ATM_LM_LOC_AAL  __ATM_LM_MKLOC(__ATM_LM_AAL)
0145 #define ATM_LM_LOC_ATM  __ATM_LM_MKLOC(__ATM_LM_ATM)
0146 #define ATM_LM_LOC_PHY  __ATM_LM_MKLOC(__ATM_LM_PHY)
0147 #define ATM_LM_LOC_ANALOG __ATM_LM_MKLOC(__ATM_LM_ANALOG)
0148 
0149 #define ATM_LM_RMT_AAL  __ATM_LM_MKRMT(__ATM_LM_AAL)
0150 #define ATM_LM_RMT_ATM  __ATM_LM_MKRMT(__ATM_LM_ATM)
0151 #define ATM_LM_RMT_PHY  __ATM_LM_MKRMT(__ATM_LM_PHY)
0152 #define ATM_LM_RMT_ANALOG __ATM_LM_MKRMT(__ATM_LM_ANALOG)
0153 
0154 /*
0155  * Note: ATM_LM_LOC_* and ATM_LM_RMT_* can be combined, provided that
0156  * __ATM_LM_XTLOC(x) <= __ATM_LM_XTRMT(x)
0157  */
0158 
0159 
0160 struct atm_iobuf {
0161     int length;
0162     void __user *buffer;
0163 };
0164 
0165 /* for ATM_GETCIRANGE / ATM_SETCIRANGE */
0166 
0167 #define ATM_CI_MAX      -1              /* use maximum range of VPI/VCI */
0168  
0169 struct atm_cirange {
0170     signed char vpi_bits;   /* 1..8, ATM_CI_MAX (-1) for maximum */
0171     signed char vci_bits;   /* 1..16, ATM_CI_MAX (-1) for maximum */
0172 };
0173 
0174 /* for ATM_SETSC; actually taken from the ATM_VF number space */
0175 
0176 #define ATM_SC_RX   1024        /* enable RX single-copy */
0177 #define ATM_SC_TX   2048        /* enable TX single-copy */
0178 
0179 #define ATM_BACKLOG_DEFAULT 32 /* if we get more, we're likely to time out
0180                   anyway */
0181 
0182 /* MF: change_qos (Modify) flags */
0183 
0184 #define ATM_MF_IMMED     1  /* Block until change is effective */
0185 #define ATM_MF_INC_RSV   2  /* Change reservation on increase */
0186 #define ATM_MF_INC_SHP   4  /* Change shaping on increase */
0187 #define ATM_MF_DEC_RSV   8  /* Change reservation on decrease */
0188 #define ATM_MF_DEC_SHP  16  /* Change shaping on decrease */
0189 #define ATM_MF_BWD  32  /* Set the backward direction parameters */
0190 
0191 #define ATM_MF_SET  (ATM_MF_INC_RSV | ATM_MF_INC_SHP | ATM_MF_DEC_RSV | \
0192               ATM_MF_DEC_SHP | ATM_MF_BWD)
0193 
0194 /*
0195  * ATM_VS_* are used to express VC state in a human-friendly way.
0196  */
0197 
0198 #define ATM_VS_IDLE 0   /* VC is not used */
0199 #define ATM_VS_CONNECTED 1  /* VC is connected */
0200 #define ATM_VS_CLOSING  2   /* VC is closing */
0201 #define ATM_VS_LISTEN   3   /* VC is listening for incoming setups */
0202 #define ATM_VS_INUSE    4   /* VC is in use (registered with atmsigd) */
0203 #define ATM_VS_BOUND    5   /* VC is bound */
0204 
0205 #define ATM_VS2TXT_MAP \
0206     "IDLE", "CONNECTED", "CLOSING", "LISTEN", "INUSE", "BOUND"
0207 
0208 #define ATM_VF2TXT_MAP \
0209     "ADDR", "READY",    "PARTIAL",  "REGIS", \
0210     "RELEASED", "HASQOS",   "LISTEN",   "META", \
0211     "256",  "512",      "1024",     "2048", \
0212     "SESSION",  "HASSAP",   "BOUND",    "CLOSE"
0213 
0214 
0215 
0216 #endif /* _UAPILINUX_ATMDEV_H */