18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
28c2ecf20Sopenharmony_ci/* atmdev.h - ATM device driver declarations and various related items */
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifndef _UAPILINUX_ATMDEV_H
88c2ecf20Sopenharmony_ci#define _UAPILINUX_ATMDEV_H
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <linux/atmapi.h>
128c2ecf20Sopenharmony_ci#include <linux/atm.h>
138c2ecf20Sopenharmony_ci#include <linux/atmioc.h>
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#define ESI_LEN		6
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#define ATM_OC3_PCR	(155520000/270*260/8/53)
198c2ecf20Sopenharmony_ci			/* OC3 link rate:  155520000 bps
208c2ecf20Sopenharmony_ci			   SONET overhead: /270*260 (9 section, 1 path)
218c2ecf20Sopenharmony_ci			   bits per cell:  /8/53
228c2ecf20Sopenharmony_ci			   max cell rate:  353207.547 cells/sec */
238c2ecf20Sopenharmony_ci#define ATM_25_PCR	((25600000/8-8000)/54)
248c2ecf20Sopenharmony_ci			/* 25 Mbps ATM cell rate (59111) */
258c2ecf20Sopenharmony_ci#define ATM_OC12_PCR	(622080000/1080*1040/8/53)
268c2ecf20Sopenharmony_ci			/* OC12 link rate: 622080000 bps
278c2ecf20Sopenharmony_ci			   SONET overhead: /1080*1040
288c2ecf20Sopenharmony_ci			   bits per cell:  /8/53
298c2ecf20Sopenharmony_ci			   max cell rate:  1412830.188 cells/sec */
308c2ecf20Sopenharmony_ci#define ATM_DS3_PCR	(8000*12)
318c2ecf20Sopenharmony_ci			/* DS3: 12 cells in a 125 usec time slot */
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#define __AAL_STAT_ITEMS \
358c2ecf20Sopenharmony_ci    __HANDLE_ITEM(tx);			/* TX okay */ \
368c2ecf20Sopenharmony_ci    __HANDLE_ITEM(tx_err);		/* TX errors */ \
378c2ecf20Sopenharmony_ci    __HANDLE_ITEM(rx);			/* RX okay */ \
388c2ecf20Sopenharmony_ci    __HANDLE_ITEM(rx_err);		/* RX errors */ \
398c2ecf20Sopenharmony_ci    __HANDLE_ITEM(rx_drop);		/* RX out of memory */
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_cistruct atm_aal_stats {
428c2ecf20Sopenharmony_ci#define __HANDLE_ITEM(i) int i
438c2ecf20Sopenharmony_ci	__AAL_STAT_ITEMS
448c2ecf20Sopenharmony_ci#undef __HANDLE_ITEM
458c2ecf20Sopenharmony_ci};
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_cistruct atm_dev_stats {
498c2ecf20Sopenharmony_ci	struct atm_aal_stats aal0;
508c2ecf20Sopenharmony_ci	struct atm_aal_stats aal34;
518c2ecf20Sopenharmony_ci	struct atm_aal_stats aal5;
528c2ecf20Sopenharmony_ci} __ATM_API_ALIGN;
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci#define ATM_GETLINKRATE	_IOW('a',ATMIOC_ITF+1,struct atmif_sioc)
568c2ecf20Sopenharmony_ci					/* get link rate */
578c2ecf20Sopenharmony_ci#define ATM_GETNAMES	_IOW('a',ATMIOC_ITF+3,struct atm_iobuf)
588c2ecf20Sopenharmony_ci					/* get interface names (numbers) */
598c2ecf20Sopenharmony_ci#define ATM_GETTYPE	_IOW('a',ATMIOC_ITF+4,struct atmif_sioc)
608c2ecf20Sopenharmony_ci					/* get interface type name */
618c2ecf20Sopenharmony_ci#define ATM_GETESI	_IOW('a',ATMIOC_ITF+5,struct atmif_sioc)
628c2ecf20Sopenharmony_ci					/* get interface ESI */
638c2ecf20Sopenharmony_ci#define ATM_GETADDR	_IOW('a',ATMIOC_ITF+6,struct atmif_sioc)
648c2ecf20Sopenharmony_ci					/* get itf's local ATM addr. list */
658c2ecf20Sopenharmony_ci#define ATM_RSTADDR	_IOW('a',ATMIOC_ITF+7,struct atmif_sioc)
668c2ecf20Sopenharmony_ci					/* reset itf's ATM address list */
678c2ecf20Sopenharmony_ci#define ATM_ADDADDR	_IOW('a',ATMIOC_ITF+8,struct atmif_sioc)
688c2ecf20Sopenharmony_ci					/* add a local ATM address */
698c2ecf20Sopenharmony_ci#define ATM_DELADDR	_IOW('a',ATMIOC_ITF+9,struct atmif_sioc)
708c2ecf20Sopenharmony_ci					/* remove a local ATM address */
718c2ecf20Sopenharmony_ci#define ATM_GETCIRANGE	_IOW('a',ATMIOC_ITF+10,struct atmif_sioc)
728c2ecf20Sopenharmony_ci					/* get connection identifier range */
738c2ecf20Sopenharmony_ci#define ATM_SETCIRANGE	_IOW('a',ATMIOC_ITF+11,struct atmif_sioc)
748c2ecf20Sopenharmony_ci					/* set connection identifier range */
758c2ecf20Sopenharmony_ci#define ATM_SETESI	_IOW('a',ATMIOC_ITF+12,struct atmif_sioc)
768c2ecf20Sopenharmony_ci					/* set interface ESI */
778c2ecf20Sopenharmony_ci#define ATM_SETESIF	_IOW('a',ATMIOC_ITF+13,struct atmif_sioc)
788c2ecf20Sopenharmony_ci					/* force interface ESI */
798c2ecf20Sopenharmony_ci#define ATM_ADDLECSADDR	_IOW('a', ATMIOC_ITF+14, struct atmif_sioc)
808c2ecf20Sopenharmony_ci					/* register a LECS address */
818c2ecf20Sopenharmony_ci#define ATM_DELLECSADDR	_IOW('a', ATMIOC_ITF+15, struct atmif_sioc)
828c2ecf20Sopenharmony_ci					/* unregister a LECS address */
838c2ecf20Sopenharmony_ci#define ATM_GETLECSADDR	_IOW('a', ATMIOC_ITF+16, struct atmif_sioc)
848c2ecf20Sopenharmony_ci					/* retrieve LECS address(es) */
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci#define ATM_GETSTAT	_IOW('a',ATMIOC_SARCOM+0,struct atmif_sioc)
878c2ecf20Sopenharmony_ci					/* get AAL layer statistics */
888c2ecf20Sopenharmony_ci#define ATM_GETSTATZ	_IOW('a',ATMIOC_SARCOM+1,struct atmif_sioc)
898c2ecf20Sopenharmony_ci					/* get AAL layer statistics and zero */
908c2ecf20Sopenharmony_ci#define ATM_GETLOOP	_IOW('a',ATMIOC_SARCOM+2,struct atmif_sioc)
918c2ecf20Sopenharmony_ci					/* get loopback mode */
928c2ecf20Sopenharmony_ci#define ATM_SETLOOP	_IOW('a',ATMIOC_SARCOM+3,struct atmif_sioc)
938c2ecf20Sopenharmony_ci					/* set loopback mode */
948c2ecf20Sopenharmony_ci#define ATM_QUERYLOOP	_IOW('a',ATMIOC_SARCOM+4,struct atmif_sioc)
958c2ecf20Sopenharmony_ci					/* query supported loopback modes */
968c2ecf20Sopenharmony_ci#define ATM_SETSC	_IOW('a',ATMIOC_SPECIAL+1,int)
978c2ecf20Sopenharmony_ci					/* enable or disable single-copy */
988c2ecf20Sopenharmony_ci#define ATM_SETBACKEND	_IOW('a',ATMIOC_SPECIAL+2,atm_backend_t)
998c2ecf20Sopenharmony_ci					/* set backend handler */
1008c2ecf20Sopenharmony_ci#define ATM_NEWBACKENDIF _IOW('a',ATMIOC_SPECIAL+3,atm_backend_t)
1018c2ecf20Sopenharmony_ci					/* use backend to make new if */
1028c2ecf20Sopenharmony_ci#define ATM_ADDPARTY  	_IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf)
1038c2ecf20Sopenharmony_ci 					/* add party to p2mp call */
1048c2ecf20Sopenharmony_ci#ifdef CONFIG_COMPAT
1058c2ecf20Sopenharmony_ci/* It actually takes struct sockaddr_atmsvc, not struct atm_iobuf */
1068c2ecf20Sopenharmony_ci#define COMPAT_ATM_ADDPARTY  	_IOW('a', ATMIOC_SPECIAL+4,struct compat_atm_iobuf)
1078c2ecf20Sopenharmony_ci#endif
1088c2ecf20Sopenharmony_ci#define ATM_DROPPARTY 	_IOW('a', ATMIOC_SPECIAL+5,int)
1098c2ecf20Sopenharmony_ci					/* drop party from p2mp call */
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci/*
1128c2ecf20Sopenharmony_ci * These are backend handkers that can be set via the ATM_SETBACKEND call
1138c2ecf20Sopenharmony_ci * above.  In the future we may support dynamic loading of these - for now,
1148c2ecf20Sopenharmony_ci * they're just being used to share the ATMIOC_BACKEND ioctls
1158c2ecf20Sopenharmony_ci */
1168c2ecf20Sopenharmony_ci#define ATM_BACKEND_RAW		0
1178c2ecf20Sopenharmony_ci#define ATM_BACKEND_PPP		1	/* PPPoATM - RFC2364 */
1188c2ecf20Sopenharmony_ci#define ATM_BACKEND_BR2684	2	/* Bridged RFC1483/2684 */
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci/* for ATM_GETTYPE */
1218c2ecf20Sopenharmony_ci#define ATM_ITFTYP_LEN	8	/* maximum length of interface type name */
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci/*
1248c2ecf20Sopenharmony_ci * Loopback modes for ATM_{PHY,SAR}_{GET,SET}LOOP
1258c2ecf20Sopenharmony_ci */
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ci/* Point of loopback				CPU-->SAR-->PHY-->line--> ... */
1288c2ecf20Sopenharmony_ci#define __ATM_LM_NONE	0	/* no loop back     ^     ^     ^      ^      */
1298c2ecf20Sopenharmony_ci#define __ATM_LM_AAL	1	/* loop back PDUs --'     |     |      |      */
1308c2ecf20Sopenharmony_ci#define __ATM_LM_ATM	2	/* loop back ATM cells ---'     |      |      */
1318c2ecf20Sopenharmony_ci/* RESERVED		4	loop back on PHY side  ---'		      */
1328c2ecf20Sopenharmony_ci#define __ATM_LM_PHY	8	/* loop back bits (digital) ----'      |      */
1338c2ecf20Sopenharmony_ci#define __ATM_LM_ANALOG 16	/* loop back the analog signal --------'      */
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_ci/* Direction of loopback */
1368c2ecf20Sopenharmony_ci#define __ATM_LM_MKLOC(n)	((n))	    /* Local (i.e. loop TX to RX) */
1378c2ecf20Sopenharmony_ci#define __ATM_LM_MKRMT(n)	((n) << 8)  /* Remote (i.e. loop RX to TX) */
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci#define __ATM_LM_XTLOC(n)	((n) & 0xff)
1408c2ecf20Sopenharmony_ci#define __ATM_LM_XTRMT(n)	(((n) >> 8) & 0xff)
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci#define ATM_LM_NONE	0	/* no loopback */
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci#define ATM_LM_LOC_AAL	__ATM_LM_MKLOC(__ATM_LM_AAL)
1458c2ecf20Sopenharmony_ci#define ATM_LM_LOC_ATM	__ATM_LM_MKLOC(__ATM_LM_ATM)
1468c2ecf20Sopenharmony_ci#define ATM_LM_LOC_PHY	__ATM_LM_MKLOC(__ATM_LM_PHY)
1478c2ecf20Sopenharmony_ci#define ATM_LM_LOC_ANALOG __ATM_LM_MKLOC(__ATM_LM_ANALOG)
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci#define ATM_LM_RMT_AAL	__ATM_LM_MKRMT(__ATM_LM_AAL)
1508c2ecf20Sopenharmony_ci#define ATM_LM_RMT_ATM	__ATM_LM_MKRMT(__ATM_LM_ATM)
1518c2ecf20Sopenharmony_ci#define ATM_LM_RMT_PHY	__ATM_LM_MKRMT(__ATM_LM_PHY)
1528c2ecf20Sopenharmony_ci#define ATM_LM_RMT_ANALOG __ATM_LM_MKRMT(__ATM_LM_ANALOG)
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci/*
1558c2ecf20Sopenharmony_ci * Note: ATM_LM_LOC_* and ATM_LM_RMT_* can be combined, provided that
1568c2ecf20Sopenharmony_ci * __ATM_LM_XTLOC(x) <= __ATM_LM_XTRMT(x)
1578c2ecf20Sopenharmony_ci */
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_cistruct atm_iobuf {
1618c2ecf20Sopenharmony_ci	int length;
1628c2ecf20Sopenharmony_ci	void __user *buffer;
1638c2ecf20Sopenharmony_ci};
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci/* for ATM_GETCIRANGE / ATM_SETCIRANGE */
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_ci#define ATM_CI_MAX      -1              /* use maximum range of VPI/VCI */
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_cistruct atm_cirange {
1708c2ecf20Sopenharmony_ci	signed char	vpi_bits;	/* 1..8, ATM_CI_MAX (-1) for maximum */
1718c2ecf20Sopenharmony_ci	signed char	vci_bits;	/* 1..16, ATM_CI_MAX (-1) for maximum */
1728c2ecf20Sopenharmony_ci};
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_ci/* for ATM_SETSC; actually taken from the ATM_VF number space */
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_ci#define ATM_SC_RX	1024		/* enable RX single-copy */
1778c2ecf20Sopenharmony_ci#define ATM_SC_TX	2048		/* enable TX single-copy */
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_ci#define ATM_BACKLOG_DEFAULT 32 /* if we get more, we're likely to time out
1808c2ecf20Sopenharmony_ci				  anyway */
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ci/* MF: change_qos (Modify) flags */
1838c2ecf20Sopenharmony_ci
1848c2ecf20Sopenharmony_ci#define ATM_MF_IMMED	 1	/* Block until change is effective */
1858c2ecf20Sopenharmony_ci#define ATM_MF_INC_RSV	 2	/* Change reservation on increase */
1868c2ecf20Sopenharmony_ci#define ATM_MF_INC_SHP	 4	/* Change shaping on increase */
1878c2ecf20Sopenharmony_ci#define ATM_MF_DEC_RSV	 8	/* Change reservation on decrease */
1888c2ecf20Sopenharmony_ci#define ATM_MF_DEC_SHP	16	/* Change shaping on decrease */
1898c2ecf20Sopenharmony_ci#define ATM_MF_BWD	32	/* Set the backward direction parameters */
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_ci#define ATM_MF_SET	(ATM_MF_INC_RSV | ATM_MF_INC_SHP | ATM_MF_DEC_RSV | \
1928c2ecf20Sopenharmony_ci			  ATM_MF_DEC_SHP | ATM_MF_BWD)
1938c2ecf20Sopenharmony_ci
1948c2ecf20Sopenharmony_ci/*
1958c2ecf20Sopenharmony_ci * ATM_VS_* are used to express VC state in a human-friendly way.
1968c2ecf20Sopenharmony_ci */
1978c2ecf20Sopenharmony_ci
1988c2ecf20Sopenharmony_ci#define ATM_VS_IDLE	0	/* VC is not used */
1998c2ecf20Sopenharmony_ci#define ATM_VS_CONNECTED 1	/* VC is connected */
2008c2ecf20Sopenharmony_ci#define ATM_VS_CLOSING	2	/* VC is closing */
2018c2ecf20Sopenharmony_ci#define ATM_VS_LISTEN	3	/* VC is listening for incoming setups */
2028c2ecf20Sopenharmony_ci#define ATM_VS_INUSE	4	/* VC is in use (registered with atmsigd) */
2038c2ecf20Sopenharmony_ci#define ATM_VS_BOUND	5	/* VC is bound */
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_ci#define ATM_VS2TXT_MAP \
2068c2ecf20Sopenharmony_ci    "IDLE", "CONNECTED", "CLOSING", "LISTEN", "INUSE", "BOUND"
2078c2ecf20Sopenharmony_ci
2088c2ecf20Sopenharmony_ci#define ATM_VF2TXT_MAP \
2098c2ecf20Sopenharmony_ci    "ADDR",	"READY",	"PARTIAL",	"REGIS", \
2108c2ecf20Sopenharmony_ci    "RELEASED", "HASQOS",	"LISTEN",	"META", \
2118c2ecf20Sopenharmony_ci    "256",	"512",		"1024",		"2048", \
2128c2ecf20Sopenharmony_ci    "SESSION",	"HASSAP",	"BOUND",	"CLOSE"
2138c2ecf20Sopenharmony_ci
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_ci#endif /* _UAPILINUX_ATMDEV_H */
217