1*6f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2607ca46eSDavid Howells /* atmdev.h - ATM device driver declarations and various related items */ 3607ca46eSDavid Howells 4607ca46eSDavid Howells /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ 5607ca46eSDavid Howells 6607ca46eSDavid Howells 7607ca46eSDavid Howells #ifndef _UAPILINUX_ATMDEV_H 8607ca46eSDavid Howells #define _UAPILINUX_ATMDEV_H 9607ca46eSDavid Howells 10607ca46eSDavid Howells 11607ca46eSDavid Howells #include <linux/atmapi.h> 12607ca46eSDavid Howells #include <linux/atm.h> 13607ca46eSDavid Howells #include <linux/atmioc.h> 14607ca46eSDavid Howells 15607ca46eSDavid Howells 16607ca46eSDavid Howells #define ESI_LEN 6 17607ca46eSDavid Howells 18607ca46eSDavid Howells #define ATM_OC3_PCR (155520000/270*260/8/53) 19607ca46eSDavid Howells /* OC3 link rate: 155520000 bps 20607ca46eSDavid Howells SONET overhead: /270*260 (9 section, 1 path) 21607ca46eSDavid Howells bits per cell: /8/53 22607ca46eSDavid Howells max cell rate: 353207.547 cells/sec */ 23607ca46eSDavid Howells #define ATM_25_PCR ((25600000/8-8000)/54) 24607ca46eSDavid Howells /* 25 Mbps ATM cell rate (59111) */ 25607ca46eSDavid Howells #define ATM_OC12_PCR (622080000/1080*1040/8/53) 26607ca46eSDavid Howells /* OC12 link rate: 622080000 bps 27607ca46eSDavid Howells SONET overhead: /1080*1040 28607ca46eSDavid Howells bits per cell: /8/53 29607ca46eSDavid Howells max cell rate: 1412830.188 cells/sec */ 30607ca46eSDavid Howells #define ATM_DS3_PCR (8000*12) 31607ca46eSDavid Howells /* DS3: 12 cells in a 125 usec time slot */ 32607ca46eSDavid Howells 33607ca46eSDavid Howells 34607ca46eSDavid Howells #define __AAL_STAT_ITEMS \ 35607ca46eSDavid Howells __HANDLE_ITEM(tx); /* TX okay */ \ 36607ca46eSDavid Howells __HANDLE_ITEM(tx_err); /* TX errors */ \ 37607ca46eSDavid Howells __HANDLE_ITEM(rx); /* RX okay */ \ 38607ca46eSDavid Howells __HANDLE_ITEM(rx_err); /* RX errors */ \ 39607ca46eSDavid Howells __HANDLE_ITEM(rx_drop); /* RX out of memory */ 40607ca46eSDavid Howells 41607ca46eSDavid Howells struct atm_aal_stats { 42607ca46eSDavid Howells #define __HANDLE_ITEM(i) int i 43607ca46eSDavid Howells __AAL_STAT_ITEMS 44607ca46eSDavid Howells #undef __HANDLE_ITEM 45607ca46eSDavid Howells }; 46607ca46eSDavid Howells 47607ca46eSDavid Howells 48607ca46eSDavid Howells struct atm_dev_stats { 49607ca46eSDavid Howells struct atm_aal_stats aal0; 50607ca46eSDavid Howells struct atm_aal_stats aal34; 51607ca46eSDavid Howells struct atm_aal_stats aal5; 52607ca46eSDavid Howells } __ATM_API_ALIGN; 53607ca46eSDavid Howells 54607ca46eSDavid Howells 55607ca46eSDavid Howells #define ATM_GETLINKRATE _IOW('a',ATMIOC_ITF+1,struct atmif_sioc) 56607ca46eSDavid Howells /* get link rate */ 57607ca46eSDavid Howells #define ATM_GETNAMES _IOW('a',ATMIOC_ITF+3,struct atm_iobuf) 58607ca46eSDavid Howells /* get interface names (numbers) */ 59607ca46eSDavid Howells #define ATM_GETTYPE _IOW('a',ATMIOC_ITF+4,struct atmif_sioc) 60607ca46eSDavid Howells /* get interface type name */ 61607ca46eSDavid Howells #define ATM_GETESI _IOW('a',ATMIOC_ITF+5,struct atmif_sioc) 62607ca46eSDavid Howells /* get interface ESI */ 63607ca46eSDavid Howells #define ATM_GETADDR _IOW('a',ATMIOC_ITF+6,struct atmif_sioc) 64607ca46eSDavid Howells /* get itf's local ATM addr. list */ 65607ca46eSDavid Howells #define ATM_RSTADDR _IOW('a',ATMIOC_ITF+7,struct atmif_sioc) 66607ca46eSDavid Howells /* reset itf's ATM address list */ 67607ca46eSDavid Howells #define ATM_ADDADDR _IOW('a',ATMIOC_ITF+8,struct atmif_sioc) 68607ca46eSDavid Howells /* add a local ATM address */ 69607ca46eSDavid Howells #define ATM_DELADDR _IOW('a',ATMIOC_ITF+9,struct atmif_sioc) 70607ca46eSDavid Howells /* remove a local ATM address */ 71607ca46eSDavid Howells #define ATM_GETCIRANGE _IOW('a',ATMIOC_ITF+10,struct atmif_sioc) 72607ca46eSDavid Howells /* get connection identifier range */ 73607ca46eSDavid Howells #define ATM_SETCIRANGE _IOW('a',ATMIOC_ITF+11,struct atmif_sioc) 74607ca46eSDavid Howells /* set connection identifier range */ 75607ca46eSDavid Howells #define ATM_SETESI _IOW('a',ATMIOC_ITF+12,struct atmif_sioc) 76607ca46eSDavid Howells /* set interface ESI */ 77607ca46eSDavid Howells #define ATM_SETESIF _IOW('a',ATMIOC_ITF+13,struct atmif_sioc) 78607ca46eSDavid Howells /* force interface ESI */ 79607ca46eSDavid Howells #define ATM_ADDLECSADDR _IOW('a', ATMIOC_ITF+14, struct atmif_sioc) 80607ca46eSDavid Howells /* register a LECS address */ 81607ca46eSDavid Howells #define ATM_DELLECSADDR _IOW('a', ATMIOC_ITF+15, struct atmif_sioc) 82607ca46eSDavid Howells /* unregister a LECS address */ 83607ca46eSDavid Howells #define ATM_GETLECSADDR _IOW('a', ATMIOC_ITF+16, struct atmif_sioc) 84607ca46eSDavid Howells /* retrieve LECS address(es) */ 85607ca46eSDavid Howells 86607ca46eSDavid Howells #define ATM_GETSTAT _IOW('a',ATMIOC_SARCOM+0,struct atmif_sioc) 87607ca46eSDavid Howells /* get AAL layer statistics */ 88607ca46eSDavid Howells #define ATM_GETSTATZ _IOW('a',ATMIOC_SARCOM+1,struct atmif_sioc) 89607ca46eSDavid Howells /* get AAL layer statistics and zero */ 90607ca46eSDavid Howells #define ATM_GETLOOP _IOW('a',ATMIOC_SARCOM+2,struct atmif_sioc) 91607ca46eSDavid Howells /* get loopback mode */ 92607ca46eSDavid Howells #define ATM_SETLOOP _IOW('a',ATMIOC_SARCOM+3,struct atmif_sioc) 93607ca46eSDavid Howells /* set loopback mode */ 94607ca46eSDavid Howells #define ATM_QUERYLOOP _IOW('a',ATMIOC_SARCOM+4,struct atmif_sioc) 95607ca46eSDavid Howells /* query supported loopback modes */ 96607ca46eSDavid Howells #define ATM_SETSC _IOW('a',ATMIOC_SPECIAL+1,int) 97607ca46eSDavid Howells /* enable or disable single-copy */ 98607ca46eSDavid Howells #define ATM_SETBACKEND _IOW('a',ATMIOC_SPECIAL+2,atm_backend_t) 99607ca46eSDavid Howells /* set backend handler */ 100607ca46eSDavid Howells #define ATM_NEWBACKENDIF _IOW('a',ATMIOC_SPECIAL+3,atm_backend_t) 101607ca46eSDavid Howells /* use backend to make new if */ 102607ca46eSDavid Howells #define ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf) 103607ca46eSDavid Howells /* add party to p2mp call */ 104607ca46eSDavid Howells #define ATM_DROPPARTY _IOW('a', ATMIOC_SPECIAL+5,int) 105607ca46eSDavid Howells /* drop party from p2mp call */ 106607ca46eSDavid Howells 107607ca46eSDavid Howells /* 108607ca46eSDavid Howells * These are backend handkers that can be set via the ATM_SETBACKEND call 109607ca46eSDavid Howells * above. In the future we may support dynamic loading of these - for now, 110607ca46eSDavid Howells * they're just being used to share the ATMIOC_BACKEND ioctls 111607ca46eSDavid Howells */ 112607ca46eSDavid Howells #define ATM_BACKEND_RAW 0 113607ca46eSDavid Howells #define ATM_BACKEND_PPP 1 /* PPPoATM - RFC2364 */ 114607ca46eSDavid Howells #define ATM_BACKEND_BR2684 2 /* Bridged RFC1483/2684 */ 115607ca46eSDavid Howells 116607ca46eSDavid Howells /* for ATM_GETTYPE */ 117607ca46eSDavid Howells #define ATM_ITFTYP_LEN 8 /* maximum length of interface type name */ 118607ca46eSDavid Howells 119607ca46eSDavid Howells /* 120607ca46eSDavid Howells * Loopback modes for ATM_{PHY,SAR}_{GET,SET}LOOP 121607ca46eSDavid Howells */ 122607ca46eSDavid Howells 123607ca46eSDavid Howells /* Point of loopback CPU-->SAR-->PHY-->line--> ... */ 124607ca46eSDavid Howells #define __ATM_LM_NONE 0 /* no loop back ^ ^ ^ ^ */ 125607ca46eSDavid Howells #define __ATM_LM_AAL 1 /* loop back PDUs --' | | | */ 126607ca46eSDavid Howells #define __ATM_LM_ATM 2 /* loop back ATM cells ---' | | */ 127607ca46eSDavid Howells /* RESERVED 4 loop back on PHY side ---' */ 128607ca46eSDavid Howells #define __ATM_LM_PHY 8 /* loop back bits (digital) ----' | */ 129607ca46eSDavid Howells #define __ATM_LM_ANALOG 16 /* loop back the analog signal --------' */ 130607ca46eSDavid Howells 131607ca46eSDavid Howells /* Direction of loopback */ 132607ca46eSDavid Howells #define __ATM_LM_MKLOC(n) ((n)) /* Local (i.e. loop TX to RX) */ 133607ca46eSDavid Howells #define __ATM_LM_MKRMT(n) ((n) << 8) /* Remote (i.e. loop RX to TX) */ 134607ca46eSDavid Howells 135607ca46eSDavid Howells #define __ATM_LM_XTLOC(n) ((n) & 0xff) 136607ca46eSDavid Howells #define __ATM_LM_XTRMT(n) (((n) >> 8) & 0xff) 137607ca46eSDavid Howells 138607ca46eSDavid Howells #define ATM_LM_NONE 0 /* no loopback */ 139607ca46eSDavid Howells 140607ca46eSDavid Howells #define ATM_LM_LOC_AAL __ATM_LM_MKLOC(__ATM_LM_AAL) 141607ca46eSDavid Howells #define ATM_LM_LOC_ATM __ATM_LM_MKLOC(__ATM_LM_ATM) 142607ca46eSDavid Howells #define ATM_LM_LOC_PHY __ATM_LM_MKLOC(__ATM_LM_PHY) 143607ca46eSDavid Howells #define ATM_LM_LOC_ANALOG __ATM_LM_MKLOC(__ATM_LM_ANALOG) 144607ca46eSDavid Howells 145607ca46eSDavid Howells #define ATM_LM_RMT_AAL __ATM_LM_MKRMT(__ATM_LM_AAL) 146607ca46eSDavid Howells #define ATM_LM_RMT_ATM __ATM_LM_MKRMT(__ATM_LM_ATM) 147607ca46eSDavid Howells #define ATM_LM_RMT_PHY __ATM_LM_MKRMT(__ATM_LM_PHY) 148607ca46eSDavid Howells #define ATM_LM_RMT_ANALOG __ATM_LM_MKRMT(__ATM_LM_ANALOG) 149607ca46eSDavid Howells 150607ca46eSDavid Howells /* 151607ca46eSDavid Howells * Note: ATM_LM_LOC_* and ATM_LM_RMT_* can be combined, provided that 152607ca46eSDavid Howells * __ATM_LM_XTLOC(x) <= __ATM_LM_XTRMT(x) 153607ca46eSDavid Howells */ 154607ca46eSDavid Howells 155607ca46eSDavid Howells 156607ca46eSDavid Howells struct atm_iobuf { 157607ca46eSDavid Howells int length; 158607ca46eSDavid Howells void __user *buffer; 159607ca46eSDavid Howells }; 160607ca46eSDavid Howells 161607ca46eSDavid Howells /* for ATM_GETCIRANGE / ATM_SETCIRANGE */ 162607ca46eSDavid Howells 163607ca46eSDavid Howells #define ATM_CI_MAX -1 /* use maximum range of VPI/VCI */ 164607ca46eSDavid Howells 165607ca46eSDavid Howells struct atm_cirange { 166607ca46eSDavid Howells signed char vpi_bits; /* 1..8, ATM_CI_MAX (-1) for maximum */ 167607ca46eSDavid Howells signed char vci_bits; /* 1..16, ATM_CI_MAX (-1) for maximum */ 168607ca46eSDavid Howells }; 169607ca46eSDavid Howells 170607ca46eSDavid Howells /* for ATM_SETSC; actually taken from the ATM_VF number space */ 171607ca46eSDavid Howells 172607ca46eSDavid Howells #define ATM_SC_RX 1024 /* enable RX single-copy */ 173607ca46eSDavid Howells #define ATM_SC_TX 2048 /* enable TX single-copy */ 174607ca46eSDavid Howells 175607ca46eSDavid Howells #define ATM_BACKLOG_DEFAULT 32 /* if we get more, we're likely to time out 176607ca46eSDavid Howells anyway */ 177607ca46eSDavid Howells 178607ca46eSDavid Howells /* MF: change_qos (Modify) flags */ 179607ca46eSDavid Howells 180607ca46eSDavid Howells #define ATM_MF_IMMED 1 /* Block until change is effective */ 181607ca46eSDavid Howells #define ATM_MF_INC_RSV 2 /* Change reservation on increase */ 182607ca46eSDavid Howells #define ATM_MF_INC_SHP 4 /* Change shaping on increase */ 183607ca46eSDavid Howells #define ATM_MF_DEC_RSV 8 /* Change reservation on decrease */ 184607ca46eSDavid Howells #define ATM_MF_DEC_SHP 16 /* Change shaping on decrease */ 185607ca46eSDavid Howells #define ATM_MF_BWD 32 /* Set the backward direction parameters */ 186607ca46eSDavid Howells 187607ca46eSDavid Howells #define ATM_MF_SET (ATM_MF_INC_RSV | ATM_MF_INC_SHP | ATM_MF_DEC_RSV | \ 188607ca46eSDavid Howells ATM_MF_DEC_SHP | ATM_MF_BWD) 189607ca46eSDavid Howells 190607ca46eSDavid Howells /* 191607ca46eSDavid Howells * ATM_VS_* are used to express VC state in a human-friendly way. 192607ca46eSDavid Howells */ 193607ca46eSDavid Howells 194607ca46eSDavid Howells #define ATM_VS_IDLE 0 /* VC is not used */ 195607ca46eSDavid Howells #define ATM_VS_CONNECTED 1 /* VC is connected */ 196607ca46eSDavid Howells #define ATM_VS_CLOSING 2 /* VC is closing */ 197607ca46eSDavid Howells #define ATM_VS_LISTEN 3 /* VC is listening for incoming setups */ 198607ca46eSDavid Howells #define ATM_VS_INUSE 4 /* VC is in use (registered with atmsigd) */ 199607ca46eSDavid Howells #define ATM_VS_BOUND 5 /* VC is bound */ 200607ca46eSDavid Howells 201607ca46eSDavid Howells #define ATM_VS2TXT_MAP \ 202607ca46eSDavid Howells "IDLE", "CONNECTED", "CLOSING", "LISTEN", "INUSE", "BOUND" 203607ca46eSDavid Howells 204607ca46eSDavid Howells #define ATM_VF2TXT_MAP \ 205607ca46eSDavid Howells "ADDR", "READY", "PARTIAL", "REGIS", \ 206607ca46eSDavid Howells "RELEASED", "HASQOS", "LISTEN", "META", \ 207607ca46eSDavid Howells "256", "512", "1024", "2048", \ 208607ca46eSDavid Howells "SESSION", "HASSAP", "BOUND", "CLOSE" 209607ca46eSDavid Howells 210607ca46eSDavid Howells 211607ca46eSDavid Howells 212607ca46eSDavid Howells #endif /* _UAPILINUX_ATMDEV_H */ 213