162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 262306a36Sopenharmony_ci/* atmdev.h - ATM device driver declarations and various related items */ 362306a36Sopenharmony_ci 462306a36Sopenharmony_ci/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci#ifndef _UAPILINUX_ATMDEV_H 862306a36Sopenharmony_ci#define _UAPILINUX_ATMDEV_H 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#include <linux/atmapi.h> 1262306a36Sopenharmony_ci#include <linux/atm.h> 1362306a36Sopenharmony_ci#include <linux/atmioc.h> 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci#define ESI_LEN 6 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci#define ATM_OC3_PCR (155520000/270*260/8/53) 1962306a36Sopenharmony_ci /* OC3 link rate: 155520000 bps 2062306a36Sopenharmony_ci SONET overhead: /270*260 (9 section, 1 path) 2162306a36Sopenharmony_ci bits per cell: /8/53 2262306a36Sopenharmony_ci max cell rate: 353207.547 cells/sec */ 2362306a36Sopenharmony_ci#define ATM_25_PCR ((25600000/8-8000)/54) 2462306a36Sopenharmony_ci /* 25 Mbps ATM cell rate (59111) */ 2562306a36Sopenharmony_ci#define ATM_OC12_PCR (622080000/1080*1040/8/53) 2662306a36Sopenharmony_ci /* OC12 link rate: 622080000 bps 2762306a36Sopenharmony_ci SONET overhead: /1080*1040 2862306a36Sopenharmony_ci bits per cell: /8/53 2962306a36Sopenharmony_ci max cell rate: 1412830.188 cells/sec */ 3062306a36Sopenharmony_ci#define ATM_DS3_PCR (8000*12) 3162306a36Sopenharmony_ci /* DS3: 12 cells in a 125 usec time slot */ 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci#define __AAL_STAT_ITEMS \ 3562306a36Sopenharmony_ci __HANDLE_ITEM(tx); /* TX okay */ \ 3662306a36Sopenharmony_ci __HANDLE_ITEM(tx_err); /* TX errors */ \ 3762306a36Sopenharmony_ci __HANDLE_ITEM(rx); /* RX okay */ \ 3862306a36Sopenharmony_ci __HANDLE_ITEM(rx_err); /* RX errors */ \ 3962306a36Sopenharmony_ci __HANDLE_ITEM(rx_drop); /* RX out of memory */ 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_cistruct atm_aal_stats { 4262306a36Sopenharmony_ci#define __HANDLE_ITEM(i) int i 4362306a36Sopenharmony_ci __AAL_STAT_ITEMS 4462306a36Sopenharmony_ci#undef __HANDLE_ITEM 4562306a36Sopenharmony_ci}; 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_cistruct atm_dev_stats { 4962306a36Sopenharmony_ci struct atm_aal_stats aal0; 5062306a36Sopenharmony_ci struct atm_aal_stats aal34; 5162306a36Sopenharmony_ci struct atm_aal_stats aal5; 5262306a36Sopenharmony_ci} __ATM_API_ALIGN; 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_ci#define ATM_GETLINKRATE _IOW('a',ATMIOC_ITF+1,struct atmif_sioc) 5662306a36Sopenharmony_ci /* get link rate */ 5762306a36Sopenharmony_ci#define ATM_GETNAMES _IOW('a',ATMIOC_ITF+3,struct atm_iobuf) 5862306a36Sopenharmony_ci /* get interface names (numbers) */ 5962306a36Sopenharmony_ci#define ATM_GETTYPE _IOW('a',ATMIOC_ITF+4,struct atmif_sioc) 6062306a36Sopenharmony_ci /* get interface type name */ 6162306a36Sopenharmony_ci#define ATM_GETESI _IOW('a',ATMIOC_ITF+5,struct atmif_sioc) 6262306a36Sopenharmony_ci /* get interface ESI */ 6362306a36Sopenharmony_ci#define ATM_GETADDR _IOW('a',ATMIOC_ITF+6,struct atmif_sioc) 6462306a36Sopenharmony_ci /* get itf's local ATM addr. list */ 6562306a36Sopenharmony_ci#define ATM_RSTADDR _IOW('a',ATMIOC_ITF+7,struct atmif_sioc) 6662306a36Sopenharmony_ci /* reset itf's ATM address list */ 6762306a36Sopenharmony_ci#define ATM_ADDADDR _IOW('a',ATMIOC_ITF+8,struct atmif_sioc) 6862306a36Sopenharmony_ci /* add a local ATM address */ 6962306a36Sopenharmony_ci#define ATM_DELADDR _IOW('a',ATMIOC_ITF+9,struct atmif_sioc) 7062306a36Sopenharmony_ci /* remove a local ATM address */ 7162306a36Sopenharmony_ci#define ATM_GETCIRANGE _IOW('a',ATMIOC_ITF+10,struct atmif_sioc) 7262306a36Sopenharmony_ci /* get connection identifier range */ 7362306a36Sopenharmony_ci#define ATM_SETCIRANGE _IOW('a',ATMIOC_ITF+11,struct atmif_sioc) 7462306a36Sopenharmony_ci /* set connection identifier range */ 7562306a36Sopenharmony_ci#define ATM_SETESI _IOW('a',ATMIOC_ITF+12,struct atmif_sioc) 7662306a36Sopenharmony_ci /* set interface ESI */ 7762306a36Sopenharmony_ci#define ATM_SETESIF _IOW('a',ATMIOC_ITF+13,struct atmif_sioc) 7862306a36Sopenharmony_ci /* force interface ESI */ 7962306a36Sopenharmony_ci#define ATM_ADDLECSADDR _IOW('a', ATMIOC_ITF+14, struct atmif_sioc) 8062306a36Sopenharmony_ci /* register a LECS address */ 8162306a36Sopenharmony_ci#define ATM_DELLECSADDR _IOW('a', ATMIOC_ITF+15, struct atmif_sioc) 8262306a36Sopenharmony_ci /* unregister a LECS address */ 8362306a36Sopenharmony_ci#define ATM_GETLECSADDR _IOW('a', ATMIOC_ITF+16, struct atmif_sioc) 8462306a36Sopenharmony_ci /* retrieve LECS address(es) */ 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci#define ATM_GETSTAT _IOW('a',ATMIOC_SARCOM+0,struct atmif_sioc) 8762306a36Sopenharmony_ci /* get AAL layer statistics */ 8862306a36Sopenharmony_ci#define ATM_GETSTATZ _IOW('a',ATMIOC_SARCOM+1,struct atmif_sioc) 8962306a36Sopenharmony_ci /* get AAL layer statistics and zero */ 9062306a36Sopenharmony_ci#define ATM_GETLOOP _IOW('a',ATMIOC_SARCOM+2,struct atmif_sioc) 9162306a36Sopenharmony_ci /* get loopback mode */ 9262306a36Sopenharmony_ci#define ATM_SETLOOP _IOW('a',ATMIOC_SARCOM+3,struct atmif_sioc) 9362306a36Sopenharmony_ci /* set loopback mode */ 9462306a36Sopenharmony_ci#define ATM_QUERYLOOP _IOW('a',ATMIOC_SARCOM+4,struct atmif_sioc) 9562306a36Sopenharmony_ci /* query supported loopback modes */ 9662306a36Sopenharmony_ci#define ATM_SETSC _IOW('a',ATMIOC_SPECIAL+1,int) 9762306a36Sopenharmony_ci /* enable or disable single-copy */ 9862306a36Sopenharmony_ci#define ATM_SETBACKEND _IOW('a',ATMIOC_SPECIAL+2,atm_backend_t) 9962306a36Sopenharmony_ci /* set backend handler */ 10062306a36Sopenharmony_ci#define ATM_NEWBACKENDIF _IOW('a',ATMIOC_SPECIAL+3,atm_backend_t) 10162306a36Sopenharmony_ci /* use backend to make new if */ 10262306a36Sopenharmony_ci#define ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf) 10362306a36Sopenharmony_ci /* add party to p2mp call */ 10462306a36Sopenharmony_ci#define ATM_DROPPARTY _IOW('a', ATMIOC_SPECIAL+5,int) 10562306a36Sopenharmony_ci /* drop party from p2mp call */ 10662306a36Sopenharmony_ci 10762306a36Sopenharmony_ci/* 10862306a36Sopenharmony_ci * These are backend handkers that can be set via the ATM_SETBACKEND call 10962306a36Sopenharmony_ci * above. In the future we may support dynamic loading of these - for now, 11062306a36Sopenharmony_ci * they're just being used to share the ATMIOC_BACKEND ioctls 11162306a36Sopenharmony_ci */ 11262306a36Sopenharmony_ci#define ATM_BACKEND_RAW 0 11362306a36Sopenharmony_ci#define ATM_BACKEND_PPP 1 /* PPPoATM - RFC2364 */ 11462306a36Sopenharmony_ci#define ATM_BACKEND_BR2684 2 /* Bridged RFC1483/2684 */ 11562306a36Sopenharmony_ci 11662306a36Sopenharmony_ci/* for ATM_GETTYPE */ 11762306a36Sopenharmony_ci#define ATM_ITFTYP_LEN 8 /* maximum length of interface type name */ 11862306a36Sopenharmony_ci 11962306a36Sopenharmony_ci/* 12062306a36Sopenharmony_ci * Loopback modes for ATM_{PHY,SAR}_{GET,SET}LOOP 12162306a36Sopenharmony_ci */ 12262306a36Sopenharmony_ci 12362306a36Sopenharmony_ci/* Point of loopback CPU-->SAR-->PHY-->line--> ... */ 12462306a36Sopenharmony_ci#define __ATM_LM_NONE 0 /* no loop back ^ ^ ^ ^ */ 12562306a36Sopenharmony_ci#define __ATM_LM_AAL 1 /* loop back PDUs --' | | | */ 12662306a36Sopenharmony_ci#define __ATM_LM_ATM 2 /* loop back ATM cells ---' | | */ 12762306a36Sopenharmony_ci/* RESERVED 4 loop back on PHY side ---' */ 12862306a36Sopenharmony_ci#define __ATM_LM_PHY 8 /* loop back bits (digital) ----' | */ 12962306a36Sopenharmony_ci#define __ATM_LM_ANALOG 16 /* loop back the analog signal --------' */ 13062306a36Sopenharmony_ci 13162306a36Sopenharmony_ci/* Direction of loopback */ 13262306a36Sopenharmony_ci#define __ATM_LM_MKLOC(n) ((n)) /* Local (i.e. loop TX to RX) */ 13362306a36Sopenharmony_ci#define __ATM_LM_MKRMT(n) ((n) << 8) /* Remote (i.e. loop RX to TX) */ 13462306a36Sopenharmony_ci 13562306a36Sopenharmony_ci#define __ATM_LM_XTLOC(n) ((n) & 0xff) 13662306a36Sopenharmony_ci#define __ATM_LM_XTRMT(n) (((n) >> 8) & 0xff) 13762306a36Sopenharmony_ci 13862306a36Sopenharmony_ci#define ATM_LM_NONE 0 /* no loopback */ 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_ci#define ATM_LM_LOC_AAL __ATM_LM_MKLOC(__ATM_LM_AAL) 14162306a36Sopenharmony_ci#define ATM_LM_LOC_ATM __ATM_LM_MKLOC(__ATM_LM_ATM) 14262306a36Sopenharmony_ci#define ATM_LM_LOC_PHY __ATM_LM_MKLOC(__ATM_LM_PHY) 14362306a36Sopenharmony_ci#define ATM_LM_LOC_ANALOG __ATM_LM_MKLOC(__ATM_LM_ANALOG) 14462306a36Sopenharmony_ci 14562306a36Sopenharmony_ci#define ATM_LM_RMT_AAL __ATM_LM_MKRMT(__ATM_LM_AAL) 14662306a36Sopenharmony_ci#define ATM_LM_RMT_ATM __ATM_LM_MKRMT(__ATM_LM_ATM) 14762306a36Sopenharmony_ci#define ATM_LM_RMT_PHY __ATM_LM_MKRMT(__ATM_LM_PHY) 14862306a36Sopenharmony_ci#define ATM_LM_RMT_ANALOG __ATM_LM_MKRMT(__ATM_LM_ANALOG) 14962306a36Sopenharmony_ci 15062306a36Sopenharmony_ci/* 15162306a36Sopenharmony_ci * Note: ATM_LM_LOC_* and ATM_LM_RMT_* can be combined, provided that 15262306a36Sopenharmony_ci * __ATM_LM_XTLOC(x) <= __ATM_LM_XTRMT(x) 15362306a36Sopenharmony_ci */ 15462306a36Sopenharmony_ci 15562306a36Sopenharmony_ci 15662306a36Sopenharmony_cistruct atm_iobuf { 15762306a36Sopenharmony_ci int length; 15862306a36Sopenharmony_ci void __user *buffer; 15962306a36Sopenharmony_ci}; 16062306a36Sopenharmony_ci 16162306a36Sopenharmony_ci/* for ATM_GETCIRANGE / ATM_SETCIRANGE */ 16262306a36Sopenharmony_ci 16362306a36Sopenharmony_ci#define ATM_CI_MAX -1 /* use maximum range of VPI/VCI */ 16462306a36Sopenharmony_ci 16562306a36Sopenharmony_cistruct atm_cirange { 16662306a36Sopenharmony_ci signed char vpi_bits; /* 1..8, ATM_CI_MAX (-1) for maximum */ 16762306a36Sopenharmony_ci signed char vci_bits; /* 1..16, ATM_CI_MAX (-1) for maximum */ 16862306a36Sopenharmony_ci}; 16962306a36Sopenharmony_ci 17062306a36Sopenharmony_ci/* for ATM_SETSC; actually taken from the ATM_VF number space */ 17162306a36Sopenharmony_ci 17262306a36Sopenharmony_ci#define ATM_SC_RX 1024 /* enable RX single-copy */ 17362306a36Sopenharmony_ci#define ATM_SC_TX 2048 /* enable TX single-copy */ 17462306a36Sopenharmony_ci 17562306a36Sopenharmony_ci#define ATM_BACKLOG_DEFAULT 32 /* if we get more, we're likely to time out 17662306a36Sopenharmony_ci anyway */ 17762306a36Sopenharmony_ci 17862306a36Sopenharmony_ci/* MF: change_qos (Modify) flags */ 17962306a36Sopenharmony_ci 18062306a36Sopenharmony_ci#define ATM_MF_IMMED 1 /* Block until change is effective */ 18162306a36Sopenharmony_ci#define ATM_MF_INC_RSV 2 /* Change reservation on increase */ 18262306a36Sopenharmony_ci#define ATM_MF_INC_SHP 4 /* Change shaping on increase */ 18362306a36Sopenharmony_ci#define ATM_MF_DEC_RSV 8 /* Change reservation on decrease */ 18462306a36Sopenharmony_ci#define ATM_MF_DEC_SHP 16 /* Change shaping on decrease */ 18562306a36Sopenharmony_ci#define ATM_MF_BWD 32 /* Set the backward direction parameters */ 18662306a36Sopenharmony_ci 18762306a36Sopenharmony_ci#define ATM_MF_SET (ATM_MF_INC_RSV | ATM_MF_INC_SHP | ATM_MF_DEC_RSV | \ 18862306a36Sopenharmony_ci ATM_MF_DEC_SHP | ATM_MF_BWD) 18962306a36Sopenharmony_ci 19062306a36Sopenharmony_ci/* 19162306a36Sopenharmony_ci * ATM_VS_* are used to express VC state in a human-friendly way. 19262306a36Sopenharmony_ci */ 19362306a36Sopenharmony_ci 19462306a36Sopenharmony_ci#define ATM_VS_IDLE 0 /* VC is not used */ 19562306a36Sopenharmony_ci#define ATM_VS_CONNECTED 1 /* VC is connected */ 19662306a36Sopenharmony_ci#define ATM_VS_CLOSING 2 /* VC is closing */ 19762306a36Sopenharmony_ci#define ATM_VS_LISTEN 3 /* VC is listening for incoming setups */ 19862306a36Sopenharmony_ci#define ATM_VS_INUSE 4 /* VC is in use (registered with atmsigd) */ 19962306a36Sopenharmony_ci#define ATM_VS_BOUND 5 /* VC is bound */ 20062306a36Sopenharmony_ci 20162306a36Sopenharmony_ci#define ATM_VS2TXT_MAP \ 20262306a36Sopenharmony_ci "IDLE", "CONNECTED", "CLOSING", "LISTEN", "INUSE", "BOUND" 20362306a36Sopenharmony_ci 20462306a36Sopenharmony_ci#define ATM_VF2TXT_MAP \ 20562306a36Sopenharmony_ci "ADDR", "READY", "PARTIAL", "REGIS", \ 20662306a36Sopenharmony_ci "RELEASED", "HASQOS", "LISTEN", "META", \ 20762306a36Sopenharmony_ci "256", "512", "1024", "2048", \ 20862306a36Sopenharmony_ci "SESSION", "HASSAP", "BOUND", "CLOSE" 20962306a36Sopenharmony_ci 21062306a36Sopenharmony_ci 21162306a36Sopenharmony_ci 21262306a36Sopenharmony_ci#endif /* _UAPILINUX_ATMDEV_H */ 213