Blame view
include/linux/atmdev.h
9.93 KB
b24413180 License cleanup: ... |
1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
1da177e4c Linux-2.6.12-rc2 |
2 |
/* atmdev.h - ATM device driver declarations and various related items */ |
1da177e4c Linux-2.6.12-rc2 |
3 4 |
#ifndef LINUX_ATMDEV_H #define LINUX_ATMDEV_H |
1da177e4c Linux-2.6.12-rc2 |
5 6 7 |
#include <linux/wait.h> /* wait_queue_head_t */ #include <linux/time.h> /* struct timeval */ #include <linux/net.h> |
187f1882b BUG: headers with... |
8 |
#include <linux/bug.h> |
1da177e4c Linux-2.6.12-rc2 |
9 10 11 |
#include <linux/skbuff.h> /* struct sk_buff */ #include <linux/uio.h> #include <net/sock.h> |
60063497a atomic: use <linu... |
12 |
#include <linux/atomic.h> |
458bc30ce net, atm: convert... |
13 |
#include <linux/refcount.h> |
607ca46e9 UAPI: (Scripted) ... |
14 |
#include <uapi/linux/atmdev.h> |
1da177e4c Linux-2.6.12-rc2 |
15 16 17 18 19 20 |
#ifdef CONFIG_PROC_FS #include <linux/proc_fs.h> extern struct proc_dir_entry *atm_proc_root; #endif |
8865c418c atm: 32-bit ioctl... |
21 22 23 24 25 26 27 |
#ifdef CONFIG_COMPAT #include <linux/compat.h> struct compat_atm_iobuf { int length; compat_uptr_t buffer; }; #endif |
1da177e4c Linux-2.6.12-rc2 |
28 29 30 31 32 33 34 35 36 37 38 39 40 |
struct k_atm_aal_stats { #define __HANDLE_ITEM(i) atomic_t i __AAL_STAT_ITEMS #undef __HANDLE_ITEM }; struct k_atm_dev_stats { struct k_atm_aal_stats aal0; struct k_atm_aal_stats aal34; struct k_atm_aal_stats aal5; }; |
313162d0b device.h: audit a... |
41 |
struct device; |
1da177e4c Linux-2.6.12-rc2 |
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
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*/ ATM_VF_WAITING, /* waiting for reply from sigd */ ATM_VF_IS_CLIP, /* in use by CLIP protocol */ }; #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 { |
64bf69ddf [ATM]: deregistra... |
78 |
ATM_DF_REMOVED, /* device was removed from atm_devs list */ |
1da177e4c Linux-2.6.12-rc2 |
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
}; #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 */ struct atm_vcc { /* struct sock has to be the first member of atm_vcc */ struct sock sk; unsigned long flags; /* VCC flags (ATM_VF_*) */ 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 */ |
c971f08cb atm: add release_... |
100 |
void (*release_cb)(struct atm_vcc *vcc); /* release_sock callback */ |
1da177e4c Linux-2.6.12-rc2 |
101 102 103 104 105 106 107 |
void (*push)(struct atm_vcc *vcc,struct sk_buff *skb); void (*pop)(struct atm_vcc *vcc,struct sk_buff *skb); /* optional */ 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 k_atm_aal_stats *stats; /* pointer to AAL stats group */ |
ec809bd81 atm: add owner of... |
108 |
struct module *owner; /* owner of ->push function */ |
1da177e4c Linux-2.6.12-rc2 |
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
/* SVC part --- may move later ------------------------------------- */ short itf; /* interface number */ struct sockaddr_atmsvc local; struct sockaddr_atmsvc remote; /* 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. */ }; static inline struct atm_vcc *atm_sk(struct sock *sk) { return (struct atm_vcc *)sk; } static inline struct atm_vcc *ATM_SD(struct socket *sock) { return atm_sk(sock->sk); } static inline struct sock *sk_atm(struct atm_vcc *vcc) { return (struct sock *)vcc; } struct atm_dev_addr { struct sockaddr_atmsvc addr; /* ATM address */ struct list_head entry; /* next address */ }; |
0f21ba7cc [ATM]: add suppor... |
140 |
enum atm_addr_type_t { ATM_ADDR_LOCAL, ATM_ADDR_LECS }; |
1da177e4c Linux-2.6.12-rc2 |
141 142 143 144 145 146 147 148 149 150 |
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 */ void *dev_data; /* per-device data */ void *phy_data; /* private PHY date */ unsigned long flags; /* device flags (ATM_DF_*) */ struct list_head local; /* local ATM addresses */ |
0f21ba7cc [ATM]: add suppor... |
151 |
struct list_head lecs; /* LECS ATM addresses learned via ILMI */ |
1da177e4c Linux-2.6.12-rc2 |
152 153 154 155 156 |
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) */ |
458bc30ce net, atm: convert... |
157 |
refcount_t refcnt; /* reference count */ |
1da177e4c Linux-2.6.12-rc2 |
158 159 160 161 162 |
spinlock_t lock; /* protect internal members */ #ifdef CONFIG_PROC_FS struct proc_dir_entry *proc_entry; /* proc entry */ char *proc_name; /* proc entry name */ #endif |
ef39592f7 [ATM]: Convert st... |
163 |
struct device class_dev; /* sysfs device */ |
1da177e4c Linux-2.6.12-rc2 |
164 165 166 167 168 169 170 171 |
struct list_head dev_list; /* linkage */ }; /* OF: send_Oam Flags */ #define ATM_OF_IMMED 1 /* Attempt immediate delivery */ #define ATM_OF_INRATE 2 /* Attempt in-rate delivery */ |
1da177e4c Linux-2.6.12-rc2 |
172 173 174 175 176 |
struct atmdev_ops { /* only send is required */ void (*dev_close)(struct atm_dev *dev); int (*open)(struct atm_vcc *vcc); void (*close)(struct atm_vcc *vcc); int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void __user *arg); |
8865c418c atm: 32-bit ioctl... |
177 178 179 180 |
#ifdef CONFIG_COMPAT int (*compat_ioctl)(struct atm_dev *dev,unsigned int cmd, void __user *arg); #endif |
1da177e4c Linux-2.6.12-rc2 |
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
int (*send)(struct atm_vcc *vcc,struct sk_buff *skb); 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); int (*change_qos)(struct atm_vcc *vcc,struct atm_qos *qos,int flags); 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 __user *arg); void (*interrupt)(struct atm_dev *dev); int (*stop)(struct atm_dev *dev); }; struct atm_skb_data { struct atm_vcc *vcc; /* ATM VCC */ unsigned long atm_options; /* ATM layer options */ |
9bbe60a67 atm: Preserve val... |
201 |
unsigned int acct_truesize; /* truesize accounted to vcc */ |
1da177e4c Linux-2.6.12-rc2 |
202 203 204 205 206 207 208 209 |
}; #define VCC_HTABLE_SIZE 32 extern struct hlist_head vcc_hash[VCC_HTABLE_SIZE]; extern rwlock_t vcc_sklist_lock; #define ATM_SKB(skb) (((struct atm_skb_data *) (skb)->cb)) |
d9ca676bc atm: correct sysf... |
210 211 212 213 |
struct atm_dev *atm_dev_register(const char *type, struct device *parent, const struct atmdev_ops *ops, int number, /* -1 == pick first available */ unsigned long *flags); |
1da177e4c Linux-2.6.12-rc2 |
214 215 |
struct atm_dev *atm_dev_lookup(int number); void atm_dev_deregister(struct atm_dev *dev); |
7313bb8f3 atm: propagate si... |
216 217 218 219 220 221 222 |
/* atm_dev_signal_change * * Propagate lower layer signal change in atm_dev->signal to netdevice. * The event will be sent via a notifier call chain. */ void atm_dev_signal_change(struct atm_dev *dev, char signal); |
1da177e4c Linux-2.6.12-rc2 |
223 |
void vcc_insert_socket(struct sock *sk); |
c031235b3 atm/solos-pci: Do... |
224 |
void atm_dev_release_vccs(struct atm_dev *dev); |
1da177e4c Linux-2.6.12-rc2 |
225 |
|
9bbe60a67 atm: Preserve val... |
226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
static inline void atm_account_tx(struct atm_vcc *vcc, struct sk_buff *skb) { /* * Because ATM skbs may not belong to a sock (and we don't * necessarily want to), skb->truesize may be adjusted, * escaping the hack in pskb_expand_head() which avoids * doing so for some cases. So stash the value of truesize * at the time we accounted it, and atm_pop_raw() can use * that value later, in case it changes. */ refcount_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc); ATM_SKB(skb)->acct_truesize = skb->truesize; ATM_SKB(skb)->atm_options = vcc->atm_options; } |
1da177e4c Linux-2.6.12-rc2 |
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
static inline void atm_force_charge(struct atm_vcc *vcc,int truesize) { atomic_add(truesize, &sk_atm(vcc)->sk_rmem_alloc); } static inline void atm_return(struct atm_vcc *vcc,int truesize) { atomic_sub(truesize, &sk_atm(vcc)->sk_rmem_alloc); } static inline int atm_may_send(struct atm_vcc *vcc,unsigned int size) { |
14afee4b6 net: convert sock... |
255 |
return (size + refcount_read(&sk_atm(vcc)->sk_wmem_alloc)) < |
1da177e4c Linux-2.6.12-rc2 |
256 257 258 259 260 261 |
sk_atm(vcc)->sk_sndbuf; } static inline void atm_dev_hold(struct atm_dev *dev) { |
458bc30ce net, atm: convert... |
262 |
refcount_inc(&dev->refcnt); |
1da177e4c Linux-2.6.12-rc2 |
263 264 265 266 267 |
} static inline void atm_dev_put(struct atm_dev *dev) { |
458bc30ce net, atm: convert... |
268 |
if (refcount_dec_and_test(&dev->refcnt)) { |
64bf69ddf [ATM]: deregistra... |
269 270 271 |
BUG_ON(!test_bit(ATM_DF_REMOVED, &dev->flags)); if (dev->ops->dev_close) dev->ops->dev_close(dev); |
ef39592f7 [ATM]: Convert st... |
272 |
put_device(&dev->class_dev); |
64bf69ddf [ATM]: deregistra... |
273 |
} |
1da177e4c Linux-2.6.12-rc2 |
274 275 276 277 278 |
} int atm_charge(struct atm_vcc *vcc,int truesize); struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size, |
dd0fc66fb [PATCH] gfp flags... |
279 |
gfp_t gfp_flags); |
c219750b2 [ATM]: atm_pcr_go... |
280 |
int atm_pcr_goal(const struct atm_trafprm *tp); |
1da177e4c Linux-2.6.12-rc2 |
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
void vcc_release_async(struct atm_vcc *vcc, int reply); struct atm_ioctl { struct module *owner; /* A module reference is kept if appropriate over this call. * Return -ENOIOCTLCMD if you don't handle it. */ int (*ioctl)(struct socket *, unsigned int cmd, unsigned long arg); struct list_head list; }; /** * register_atm_ioctl - register handler for ioctl operations * * Special (non-device) handlers of ioctl's should * register here. If you're a normal device, you should * set .ioctl in your atmdev_ops instead. */ void register_atm_ioctl(struct atm_ioctl *); /** * deregister_atm_ioctl - remove the ioctl handler */ void deregister_atm_ioctl(struct atm_ioctl *); |
7313bb8f3 atm: propagate si... |
305 306 307 308 309 310 311 312 |
/* register_atmdevice_notifier - register atm_dev notify events * * Clients like br2684 will register notify events * Currently we notify of signal found/lost */ int register_atmdevice_notifier(struct notifier_block *nb); void unregister_atmdevice_notifier(struct notifier_block *nb); |
1da177e4c Linux-2.6.12-rc2 |
313 |
#endif |