⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 atmdev.h

📁 ARM 嵌入式 系统 设计与实例开发 实验教材 二源码
💻 H
📖 第 1 页 / 共 2 页
字号:
enum {	ATM_VF_ADDR,		/* Address is in use. Set by anybody, cleared				   by device driver. */	ATM_VF_READY,		/* VC is ready to transfer data. Set by device				   driver, cleared by anybody. */	ATM_VF_PARTIAL,		/* resources are bound to PVC (partial PVC				   setup), controlled by socket layer */	ATM_VF_REGIS,		/* registered with demon, controlled by SVC				   socket layer */	ATM_VF_BOUND,		/* local SAP is set, controlled by SVC socket				   layer */	ATM_VF_RELEASED,	/* demon has indicated/requested release,				   controlled by SVC socket layer */	ATM_VF_HASQOS,		/* QOS parameters have been set */	ATM_VF_LISTEN,		/* socket is used for listening */	ATM_VF_META,		/* SVC socket isn't used for normal data				   traffic and doesn't depend on signaling				   to be available */	ATM_VF_SESSION,		/* VCC is p2mp session control descriptor */	ATM_VF_HASSAP,		/* SAP has been set */	ATM_VF_CLOSE,		/* asynchronous close - treat like VF_RELEASED*/};#define ATM_VF2VS(flags) \    (test_bit(ATM_VF_READY,&(flags)) ? ATM_VS_CONNECTED : \     test_bit(ATM_VF_RELEASED,&(flags)) ? ATM_VS_CLOSING : \     test_bit(ATM_VF_LISTEN,&(flags)) ? ATM_VS_LISTEN : \     test_bit(ATM_VF_REGIS,&(flags)) ? ATM_VS_INUSE : \     test_bit(ATM_VF_BOUND,&(flags)) ? ATM_VS_BOUND : ATM_VS_IDLE)enum {	ATM_DF_CLOSE,		/* close device when last VCC is closed */};#define ATM_PHY_SIG_LOST    0	/* no carrier/light */#define ATM_PHY_SIG_UNKNOWN 1	/* carrier/light status is unknown */#define ATM_PHY_SIG_FOUND   2	/* carrier/light okay */#define ATM_ATMOPT_CLP	1	/* set CLP bit */typedef struct { unsigned long bits; } atm_vcc_flags_t;struct atm_vcc {	atm_vcc_flags_t flags;		/* VCC flags (ATM_VF_*) */	unsigned char	family;		/* address family; 0 if unused */	short		vpi;		/* VPI and VCI (types must be equal */					/* with sockaddr) */	int 		vci;	unsigned long	aal_options;	/* AAL layer options */	unsigned long	atm_options;	/* ATM layer options */	struct atm_dev	*dev;		/* device back pointer */	struct atm_qos	qos;		/* QOS */	struct atm_sap	sap;		/* SAP */	atomic_t	tx_inuse,rx_inuse; /* buffer space in use */	void (*push)(struct atm_vcc *vcc,struct sk_buff *skb);	void (*pop)(struct atm_vcc *vcc,struct sk_buff *skb); /* optional */	struct sk_buff *(*alloc_tx)(struct atm_vcc *vcc,unsigned int size);					/* TX allocation routine - can be */					/* modified by protocol or by driver.*/					/* NOTE: this interface will change */	int (*push_oam)(struct atm_vcc *vcc,void *cell);	int (*send)(struct atm_vcc *vcc,struct sk_buff *skb);	void		*dev_data;	/* per-device data */	void		*proto_data;	/* per-protocol data */	struct timeval	timestamp;	/* AAL timestamps */	struct sk_buff_head recvq;	/* receive queue */	struct k_atm_aal_stats *stats;	/* pointer to AAL stats group */	wait_queue_head_t sleep;	/* if socket is busy */	struct sock	*sk;		/* socket backpointer */	struct atm_vcc	*prev,*next;	/* SVC part --- may move later ------------------------------------- */	short		itf;		/* interface number */	struct sockaddr_atmsvc local;	struct sockaddr_atmsvc remote;	void (*callback)(struct atm_vcc *vcc);	struct sk_buff_head listenq;	int		backlog_quota;	/* number of connection requests we */					/* can still accept */	int		reply;		/* also used by ATMTCP */	/* Multipoint part ------------------------------------------------- */	struct atm_vcc	*session;	/* session VCC descriptor */	/* Other stuff ----------------------------------------------------- */	void		*user_back;	/* user backlink - not touched by */					/* native ATM stack. Currently used */					/* by CLIP and sch_atm. */};struct atm_dev_addr {	struct sockaddr_atmsvc addr;	/* ATM address */	struct atm_dev_addr *next;	/* next address */};typedef struct { unsigned int bits; } atm_dev_flags_t;struct atm_dev {	const struct atmdev_ops *ops;	/* device operations; NULL if unused */	const struct atmphy_ops *phy;	/* PHY operations, may be undefined */					/* (NULL) */	const char	*type;		/* device type name */	int		number;		/* device index */	struct atm_vcc	*vccs;		/* VCC table (or NULL) */	struct atm_vcc	*last;		/* last VCC (or undefined) */	void		*dev_data;	/* per-device data */	void		*phy_data;	/* private PHY date */	atm_dev_flags_t flags;		/* device flags (ATM_DF_*) */	struct atm_dev_addr *local;	/* local ATM addresses */	unsigned char	esi[ESI_LEN];	/* ESI ("MAC" addr) */	struct atm_cirange ci_range;	/* VPI/VCI range */	struct k_atm_dev_stats stats;	/* statistics */	char		signal;		/* signal status (ATM_PHY_SIG_*) */	int		link_rate;	/* link rate (default: OC3) */#ifdef CONFIG_PROC_FS	struct proc_dir_entry *proc_entry; /* proc entry */	char *proc_name;		/* proc entry name */#endif	struct atm_dev	*prev,*next;	/* linkage */};/* * ioctl, getsockopt, setsockopt, and sg_send are optional and can be set to * NULL. *//* OF: send_Oam Flags */#define ATM_OF_IMMED	1	/* Attempt immediate delivery */#define ATM_OF_INRATE	2	/* Attempt in-rate delivery */struct atmdev_ops { /* only send is required */	void (*dev_close)(struct atm_dev *dev);	int (*open)(struct atm_vcc *vcc,short vpi,int vci);	void (*close)(struct atm_vcc *vcc);	int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void *arg);	int (*getsockopt)(struct atm_vcc *vcc,int level,int optname,	    void *optval,int optlen);	int (*setsockopt)(struct atm_vcc *vcc,int level,int optname,	    void *optval,int optlen);	int (*send)(struct atm_vcc *vcc,struct sk_buff *skb);	int (*sg_send)(struct atm_vcc *vcc,unsigned long start,	    unsigned long size);#if 0 /* keep the current hack for now */	int (*send_iovec)(struct atm_vcc *vcc,struct iovec *iov,int size,	    void (*discard)(struct atm_vcc *vcc,void *user),void *user);#endif	int (*send_oam)(struct atm_vcc *vcc,void *cell,int flags);	void (*phy_put)(struct atm_dev *dev,unsigned char value,	    unsigned long addr);	unsigned char (*phy_get)(struct atm_dev *dev,unsigned long addr);	void (*feedback)(struct atm_vcc *vcc,struct sk_buff *skb,	    unsigned long start,unsigned long dest,int len);	int (*change_qos)(struct atm_vcc *vcc,struct atm_qos *qos,int flags);	void (*free_rx_skb)(struct atm_vcc *vcc, struct sk_buff *skb);		/* @@@ temporary hack */	int (*proc_read)(struct atm_dev *dev,loff_t *pos,char *page);	struct module *owner;};struct atmphy_ops {	int (*start)(struct atm_dev *dev);	int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void *arg);	void (*interrupt)(struct atm_dev *dev);	int (*stop)(struct atm_dev *dev);};struct atm_skb_data {	struct atm_vcc	*vcc;		/* ATM VCC */	int		iovcnt;		/* 0 for "normal" operation */	unsigned long	atm_options;	/* ATM layer options */};#define ATM_SKB(skb) (((struct atm_skb_data *) (skb)->cb))struct atm_dev *atm_dev_register(const char *type,const struct atmdev_ops *ops,    int number,atm_dev_flags_t *flags); /* number == -1: pick first available */struct atm_dev *atm_find_dev(int number);void atm_dev_deregister(struct atm_dev *dev);void shutdown_atm_dev(struct atm_dev *dev);void bind_vcc(struct atm_vcc *vcc,struct atm_dev *dev);/* * This is approximately the algorithm used by alloc_skb. * */static __inline__ int atm_guess_pdu2truesize(int pdu_size){	return ((pdu_size+15) & ~15) + sizeof(struct sk_buff);}static __inline__ void atm_force_charge(struct atm_vcc *vcc,int truesize){	atomic_add(truesize+ATM_PDU_OVHD,&vcc->rx_inuse);}static __inline__ void atm_return(struct atm_vcc *vcc,int truesize){	atomic_sub(truesize+ATM_PDU_OVHD,&vcc->rx_inuse);}static __inline__ int atm_may_send(struct atm_vcc *vcc,unsigned int size){	return size+atomic_read(&vcc->tx_inuse)+ATM_PDU_OVHD < vcc->sk->sndbuf;}int atm_charge(struct atm_vcc *vcc,int truesize);struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size,    int gfp_flags);int atm_find_ci(struct atm_vcc *vcc,short *vpi,int *vci);int atm_pcr_goal(struct atm_trafprm *tp);void atm_async_release_vcc(struct atm_vcc *vcc,int reply);#endif /* __KERNEL__ */#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -