1 it has been suggested that atm_vcc has redundant members with
4 this patch removes family, tx_inuse, rx_inuse, and recvq from
5 atm_vcc in favor of sk->family, sk->wmem_alloc, sk->rmem_alloc,
6 and sk->receive_queue (respectively). listenq and backlog_quota
7 should be removed as well but i need to think about them for a
8 bit. also, atm_dev now uses the list manipulation routines (converting
9 the vccs lists is a bit more involved since some the atm drivers know
13 Index: linux/include/linux/atmdev.h
14 ===================================================================
15 RCS file: /home/chas/CVSROOT/linux/include/linux/atmdev.h,v
16 retrieving revision 1.2
17 diff -u -r1.2 atmdev.h
18 --- linux/include/linux/atmdev.h 20 Feb 2003 20:17:59 -0000 1.2
19 +++ linux/include/linux/atmdev.h 5 Mar 2003 00:05:46 -0000
23 unsigned long flags; /* VCC flags (ATM_VF_*) */
24 - unsigned char family; /* address family; 0 if unused */
25 short vpi; /* VPI and VCI (types must be equal */
29 struct atm_dev *dev; /* device back pointer */
30 struct atm_qos qos; /* QOS */
31 struct atm_sap sap; /* SAP */
32 - atomic_t tx_inuse,rx_inuse; /* buffer space in use */
33 void (*push)(struct atm_vcc *vcc,struct sk_buff *skb);
34 void (*pop)(struct atm_vcc *vcc,struct sk_buff *skb); /* optional */
35 struct sk_buff *(*alloc_tx)(struct atm_vcc *vcc,unsigned int size);
37 int (*send)(struct atm_vcc *vcc,struct sk_buff *skb);
38 void *dev_data; /* per-device data */
39 void *proto_data; /* per-protocol data */
40 - struct sk_buff_head recvq; /* receive queue */
41 struct k_atm_aal_stats *stats; /* pointer to AAL stats group */
42 wait_queue_head_t sleep; /* if socket is busy */
43 struct sock *sk; /* socket backpointer */
45 struct proc_dir_entry *proc_entry; /* proc entry */
46 char *proc_name; /* proc entry name */
48 - struct atm_dev *prev,*next; /* linkage */
49 + struct list_head dev_list; /* linkage */
55 static __inline__ void atm_force_charge(struct atm_vcc *vcc,int truesize)
57 - atomic_add(truesize+ATM_PDU_OVHD,&vcc->rx_inuse);
58 + atomic_add(truesize+ATM_PDU_OVHD,&vcc->sk->rmem_alloc);
62 static __inline__ void atm_return(struct atm_vcc *vcc,int truesize)
64 - atomic_sub(truesize+ATM_PDU_OVHD,&vcc->rx_inuse);
65 + atomic_sub(truesize+ATM_PDU_OVHD,&vcc->sk->rmem_alloc);
69 static __inline__ int atm_may_send(struct atm_vcc *vcc,unsigned int size)
71 - return size+atomic_read(&vcc->tx_inuse)+ATM_PDU_OVHD < vcc->sk->sndbuf;
72 + return size+atomic_read(&vcc->sk->wmem_alloc)+ATM_PDU_OVHD < vcc->sk->sndbuf;
76 Index: linux/net/atm/atm_misc.c
77 ===================================================================
78 RCS file: /home/chas/CVSROOT/linux/net/atm/atm_misc.c,v
79 retrieving revision 1.1.1.1
80 diff -u -r1.1.1.1 atm_misc.c
81 --- linux/net/atm/atm_misc.c 20 Feb 2003 13:46:30 -0000 1.1.1.1
82 +++ linux/net/atm/atm_misc.c 4 Mar 2003 23:29:50 -0000
84 int atm_charge(struct atm_vcc *vcc,int truesize)
86 atm_force_charge(vcc,truesize);
87 - if (atomic_read(&vcc->rx_inuse) <= vcc->sk->rcvbuf) return 1;
88 + if (atomic_read(&vcc->sk->rmem_alloc) <= vcc->sk->rcvbuf) return 1;
89 atm_return(vcc,truesize);
90 atomic_inc(&vcc->stats->rx_drop);
93 int guess = atm_guess_pdu2truesize(pdu_size);
95 atm_force_charge(vcc,guess);
96 - if (atomic_read(&vcc->rx_inuse) <= vcc->sk->rcvbuf) {
97 + if (atomic_read(&vcc->sk->rmem_alloc) <= vcc->sk->rcvbuf) {
98 struct sk_buff *skb = alloc_skb(pdu_size,gfp_flags);
101 - atomic_add(skb->truesize-guess,&vcc->rx_inuse);
102 + atomic_add(skb->truesize-guess,&vcc->sk->rmem_alloc);
106 Index: linux/net/atm/clip.c
107 ===================================================================
108 RCS file: /home/chas/CVSROOT/linux/net/atm/clip.c,v
109 retrieving revision 1.3
111 --- linux/net/atm/clip.c 4 Mar 2003 20:48:04 -0000 1.3
112 +++ linux/net/atm/clip.c 4 Mar 2003 23:45:45 -0000
116 atm_force_charge(atmarpd,skb->truesize);
117 - skb_queue_tail(&atmarpd->recvq,skb);
118 + skb_queue_tail(&atmarpd->sk->receive_queue,skb);
119 wake_up(&atmarpd->sleep);
123 memcpy(here,llc_oui,sizeof(llc_oui));
124 ((u16 *) here)[3] = skb->protocol;
126 - atomic_add(skb->truesize,&vcc->tx_inuse);
127 + atomic_add(skb->truesize,&vcc->sk->wmem_alloc);
128 ATM_SKB(skb)->iovcnt = 0;
129 ATM_SKB(skb)->atm_options = vcc->atm_options;
130 entry->vccs->last_use = jiffies;
132 vcc->push = clip_push;
134 skb_queue_head_init(©);
135 - skb_migrate(&vcc->recvq,©);
136 + skb_migrate(&vcc->sk->receive_queue,©);
137 /* re-process everything received between connection setup and MKIP */
138 while ((skb = skb_dequeue(©)))
140 @@ -691,10 +691,10 @@
142 unregister_inetaddr_notifier(&clip_inet_notifier);
143 unregister_netdevice_notifier(&clip_dev_notifier);
144 - if (skb_peek(&vcc->recvq))
145 + if (skb_peek(&vcc->sk->receive_queue))
146 printk(KERN_ERR "atmarpd_close: closing with requests "
148 - skb_queue_purge(&vcc->recvq);
149 + skb_queue_purge(&vcc->sk->receive_queue);
151 module_put(THIS_MODULE);
153 Index: linux/net/atm/common.c
154 ===================================================================
155 RCS file: /home/chas/CVSROOT/linux/net/atm/common.c,v
156 retrieving revision 1.6
157 diff -u -r1.6 common.c
158 --- linux/net/atm/common.c 3 Mar 2003 22:23:13 -0000 1.6
159 +++ linux/net/atm/common.c 5 Mar 2003 00:15:53 -0000
164 - if (atomic_read(&vcc->tx_inuse) && !atm_may_send(vcc,size)) {
165 - DPRINTK("Sorry: tx_inuse = %d, size = %d, sndbuf = %d\n",
166 - atomic_read(&vcc->tx_inuse),size,vcc->sk->sndbuf);
167 + if (atomic_read(&vcc->sk->wmem_alloc) && !atm_may_send(vcc,size)) {
168 + DPRINTK("Sorry: wmem_alloc = %d, size = %d, sndbuf = %d\n",
169 + atomic_read(&vcc->sk->wmem_alloc),size,vcc->sk->sndbuf);
172 while (!(skb = alloc_skb(size,GFP_KERNEL))) schedule();
173 - DPRINTK("AlTx %d += %d\n",atomic_read(&vcc->tx_inuse),skb->truesize);
174 - atomic_add(skb->truesize+ATM_PDU_OVHD,&vcc->tx_inuse);
175 + DPRINTK("AlTx %d += %d\n",atomic_read(&vcc->sk->wmem_alloc),skb->truesize);
176 + atomic_add(skb->truesize+ATM_PDU_OVHD,&vcc->sk->wmem_alloc);
180 @@ -114,21 +114,19 @@
182 memset(&vcc->flags,0,sizeof(vcc->flags));
184 - vcc->family = sock->ops->family;
185 vcc->alloc_tx = alloc_tx;
186 vcc->callback = NULL;
187 memset(&vcc->local,0,sizeof(struct sockaddr_atmsvc));
188 memset(&vcc->remote,0,sizeof(struct sockaddr_atmsvc));
189 vcc->qos.txtp.max_sdu = 1 << 16; /* for meta VCs */
190 - atomic_set(&vcc->tx_inuse,0);
191 - atomic_set(&vcc->rx_inuse,0);
192 + atomic_set(&vcc->sk->wmem_alloc,0);
193 + atomic_set(&vcc->sk->rmem_alloc,0);
196 vcc->push_oam = NULL;
197 vcc->vpi = vcc->vci = 0; /* no VCI/VPI yet */
198 vcc->atm_options = vcc->aal_options = 0;
199 init_waitqueue_head(&vcc->sleep);
200 - skb_queue_head_init(&vcc->recvq);
201 skb_queue_head_init(&vcc->listenq);
202 sk->sleep = &vcc->sleep;
206 if (vcc->dev->ops->close) vcc->dev->ops->close(vcc);
207 if (vcc->push) vcc->push(vcc,NULL); /* atmarpd has no push */
208 - while ((skb = skb_dequeue(&vcc->recvq))) {
209 + while ((skb = skb_dequeue(&vcc->sk->receive_queue))) {
210 atm_return(vcc,skb->truesize);
211 if (vcc->dev->ops->free_rx_skb)
212 vcc->dev->ops->free_rx_skb(vcc,skb);
213 @@ -153,10 +151,10 @@
216 fops_put (vcc->dev->ops);
217 - if (atomic_read(&vcc->rx_inuse))
218 + if (atomic_read(&vcc->sk->rmem_alloc))
219 printk(KERN_WARNING "atm_release_vcc: strange ... "
220 - "rx_inuse == %d after closing\n",
221 - atomic_read(&vcc->rx_inuse));
222 + "rmem_alloc == %d after closing\n",
223 + atomic_read(&vcc->sk->rmem_alloc));
227 @@ -311,11 +309,15 @@
228 if (error) return error;
231 - struct atm_dev *dev;
232 + struct atm_dev *dev = NULL;
233 + struct list_head *p;
236 - for (dev = atm_devs; dev; dev = dev->next)
237 + list_for_each(p, &atm_devs) {
238 + dev = list_entry(p, struct atm_dev, dev_list);
239 if (!atm_do_connect_dev(vcc,dev,vpi,vci)) break;
243 if (!dev) return -ENODEV;
246 add_wait_queue(&vcc->sleep,&wait);
247 set_current_state(TASK_INTERRUPTIBLE);
248 error = 1; /* <= 0 is error */
249 - while (!(skb = skb_dequeue(&vcc->recvq))) {
250 + while (!(skb = skb_dequeue(&vcc->sk->receive_queue))) {
251 if (test_bit(ATM_VF_RELEASED,&vcc->flags) ||
252 test_bit(ATM_VF_CLOSE,&vcc->flags)) {
255 if (vcc->dev->ops->feedback)
256 vcc->dev->ops->feedback(vcc,skb,(unsigned long) skb->data,
257 (unsigned long) buff,eff_len);
258 - DPRINTK("RcvM %d -= %d\n",atomic_read(&vcc->rx_inuse),skb->truesize);
259 + DPRINTK("RcvM %d -= %d\n",atomic_read(&vcc->sk->rmem_alloc),skb->truesize);
260 atm_return(vcc,skb->truesize);
261 if (ATM_SKB(skb)->iovcnt) { /* @@@ hack */
262 /* iovcnt set, use scatter-gather for receive */
263 @@ -494,14 +496,14 @@
265 poll_wait(file,&vcc->sleep,wait);
267 - if (skb_peek(&vcc->recvq) || skb_peek(&vcc->listenq))
268 + if (skb_peek(&vcc->sk->receive_queue) || skb_peek(&vcc->listenq))
269 mask |= POLLIN | POLLRDNORM;
270 if (test_bit(ATM_VF_RELEASED,&vcc->flags) ||
271 test_bit(ATM_VF_CLOSE,&vcc->flags))
273 if (sock->state != SS_CONNECTING) {
274 if (vcc->qos.txtp.traffic_class != ATM_NONE &&
275 - vcc->qos.txtp.max_sdu+atomic_read(&vcc->tx_inuse)+
276 + vcc->qos.txtp.max_sdu+atomic_read(&vcc->sk->wmem_alloc)+
277 ATM_PDU_OVHD <= vcc->sk->sndbuf)
278 mask |= POLLOUT | POLLWRNORM;
281 int atm_ioctl(struct socket *sock,unsigned int cmd,unsigned long arg)
284 + struct list_head *p;
286 int *tmp_buf, *tmp_p;
291 ret_val = put_user(vcc->sk->sndbuf-
292 - atomic_read(&vcc->tx_inuse)-ATM_PDU_OVHD,
293 + atomic_read(&vcc->sk->wmem_alloc)-ATM_PDU_OVHD,
294 (int *) arg) ? -EFAULT : 0;
301 - skb = skb_peek(&vcc->recvq);
302 + skb = skb_peek(&vcc->sk->receive_queue);
303 ret_val = put_user(skb ? skb->len : 0,(int *) arg)
310 - for (dev = atm_devs; dev; dev = dev->next)
311 + list_for_each(p, &atm_devs)
319 - for (dev = atm_devs; dev; dev = dev->next)
320 + list_for_each(p, &atm_devs) {
321 + dev = list_entry(p, struct atm_dev, dev_list);
322 *tmp_p++ = dev->number;
324 ret_val = ((copy_to_user(buf, tmp_buf, size)) ||
325 put_user(size, &((struct atm_iobuf *) arg)->length)
328 if (!error) error = adjust_tp(&qos->rxtp,qos->aal);
329 if (error) return error;
330 if (!vcc->dev->ops->change_qos) return -EOPNOTSUPP;
331 - if (vcc->family == AF_ATMPVC)
332 + if (vcc->sk->family == AF_ATMPVC)
333 return vcc->dev->ops->change_qos(vcc,qos,ATM_MF_SET);
334 return svc_change_qos(vcc,qos);
336 Index: linux/net/atm/lec.c
337 ===================================================================
338 RCS file: /home/chas/CVSROOT/linux/net/atm/lec.c,v
339 retrieving revision 1.14
341 --- linux/net/atm/lec.c 4 Mar 2003 20:48:28 -0000 1.14
342 +++ linux/net/atm/lec.c 4 Mar 2003 23:42:21 -0000
345 priv = (struct lec_priv *)dev->priv;
346 atm_force_charge(priv->lecd, skb2->truesize);
347 - skb_queue_tail(&priv->lecd->recvq, skb2);
348 + skb_queue_tail(&priv->lecd->sk->receive_queue, skb2);
349 wake_up(&priv->lecd->sleep);
353 lec_send(struct atm_vcc *vcc, struct sk_buff *skb, struct lec_priv *priv)
355 if (atm_may_send(vcc, skb->len)) {
356 - atomic_add(skb->truesize, &vcc->tx_inuse);
357 + atomic_add(skb->truesize, &vcc->sk->wmem_alloc);
358 ATM_SKB(skb)->vcc = vcc;
359 ATM_SKB(skb)->iovcnt = 0;
360 ATM_SKB(skb)->atm_options = vcc->atm_options;
363 char *tmp; /* FIXME */
365 - atomic_sub(skb->truesize+ATM_PDU_OVHD, &vcc->tx_inuse);
366 + atomic_sub(skb->truesize+ATM_PDU_OVHD, &vcc->sk->wmem_alloc);
367 mesg = (struct atmlec_msg *)skb->data;
369 tmp += sizeof(struct atmlec_msg);
371 skb2->len = sizeof(struct atmlec_msg);
372 memcpy(skb2->data, mesg, sizeof(struct atmlec_msg));
373 atm_force_charge(priv->lecd, skb2->truesize);
374 - skb_queue_tail(&priv->lecd->recvq, skb2);
375 + skb_queue_tail(&priv->lecd->sk->receive_queue, skb2);
376 wake_up(&priv->lecd->sleep);
378 if (f != NULL) br_fdb_put_hook(f);
379 @@ -534,10 +534,10 @@
380 netif_stop_queue(dev);
381 lec_arp_destroy(priv);
383 - if (skb_peek(&vcc->recvq))
384 + if (skb_peek(&vcc->sk->receive_queue))
385 printk("%s lec_atm_close: closing with messages pending\n",
387 - while ((skb = skb_dequeue(&vcc->recvq))) {
388 + while ((skb = skb_dequeue(&vcc->sk->receive_queue))) {
389 atm_return(vcc, skb->truesize);
392 @@ -595,13 +595,13 @@
393 memcpy(&mesg->content.normal.atm_addr, atm_addr, ATM_ESA_LEN);
395 atm_force_charge(priv->lecd, skb->truesize);
396 - skb_queue_tail(&priv->lecd->recvq, skb);
397 + skb_queue_tail(&priv->lecd->sk->receive_queue, skb);
398 wake_up(&priv->lecd->sleep);
401 DPRINTK("lec: about to send %d bytes of data\n", data->len);
402 atm_force_charge(priv->lecd, data->truesize);
403 - skb_queue_tail(&priv->lecd->recvq, data);
404 + skb_queue_tail(&priv->lecd->sk->receive_queue, data);
405 wake_up(&priv->lecd->sleep);
409 #endif /* DUMP_PACKETS > 0 */
410 if (memcmp(skb->data, lec_ctrl_magic, 4) ==0) { /* Control frame, to daemon*/
411 DPRINTK("%s: To daemon\n",dev->name);
412 - skb_queue_tail(&vcc->recvq, skb);
413 + skb_queue_tail(&vcc->sk->receive_queue, skb);
414 wake_up(&vcc->sleep);
415 } else { /* Data frame, queue to protocol handlers */
417 Index: linux/net/atm/mpc.c
418 ===================================================================
419 RCS file: /home/chas/CVSROOT/linux/net/atm/mpc.c,v
420 retrieving revision 1.4
422 --- linux/net/atm/mpc.c 3 Mar 2003 22:23:13 -0000 1.4
423 +++ linux/net/atm/mpc.c 4 Mar 2003 23:42:27 -0000
425 memcpy(skb->data, &llc_snap_mpoa_data, sizeof(struct llc_snap_hdr));
428 - atomic_add(skb->truesize, &entry->shortcut->tx_inuse);
429 + atomic_add(skb->truesize, &entry->shortcut->sk->wmem_alloc);
430 ATM_SKB(skb)->iovcnt = 0; /* just to be safe ... */
431 ATM_SKB(skb)->atm_options = entry->shortcut->atm_options;
432 entry->shortcut->send(entry->shortcut, skb);
435 if (memcmp(skb->data, &llc_snap_mpoa_ctrl, sizeof(struct llc_snap_hdr)) == 0) {
436 dprintk("mpoa: (%s) mpc_push: control packet arrived\n", dev->name);
437 - skb_queue_tail(&vcc->recvq, skb); /* Pass control packets to daemon */
438 + skb_queue_tail(&vcc->sk->receive_queue, skb); /* Pass control packets to daemon */
439 wake_up(&vcc->sleep);
443 mpc->in_ops->destroy_cache(mpc);
444 mpc->eg_ops->destroy_cache(mpc);
446 - while ( (skb = skb_dequeue(&vcc->recvq)) ){
447 + while ( (skb = skb_dequeue(&vcc->sk->receive_queue)) ){
448 atm_return(vcc, skb->truesize);
453 struct mpoa_client *mpc = find_mpc_by_vcc(vcc);
454 struct k_message *mesg = (struct k_message*)skb->data;
455 - atomic_sub(skb->truesize+ATM_PDU_OVHD, &vcc->tx_inuse);
456 + atomic_sub(skb->truesize+ATM_PDU_OVHD, &vcc->sk->wmem_alloc);
459 printk("mpoa: msg_from_mpoad: no mpc found\n");
461 skb_put(skb, sizeof(struct k_message));
462 memcpy(skb->data, mesg, sizeof(struct k_message));
463 atm_force_charge(mpc->mpoad_vcc, skb->truesize);
464 - skb_queue_tail(&mpc->mpoad_vcc->recvq, skb);
465 + skb_queue_tail(&mpc->mpoad_vcc->sk->receive_queue, skb);
466 wake_up(&mpc->mpoad_vcc->sleep);
469 @@ -1214,7 +1214,7 @@
470 purge_msg->content.eg_info = entry->ctrl_info;
472 atm_force_charge(vcc, skb->truesize);
473 - skb_queue_tail(&vcc->recvq, skb);
474 + skb_queue_tail(&vcc->sk->receive_queue, skb);
475 wake_up(&vcc->sleep);
476 dprintk("mpoa: purge_egress_shortcut: exiting:\n");
478 Index: linux/net/atm/proc.c
479 ===================================================================
480 RCS file: /home/chas/CVSROOT/linux/net/atm/proc.c,v
481 retrieving revision 1.3
483 --- linux/net/atm/proc.c 3 Mar 2003 22:23:13 -0000 1.3
484 +++ linux/net/atm/proc.c 5 Mar 2003 00:19:32 -0000
489 - svc = !clip_vcc || clip_vcc->vcc->family == AF_ATMSVC;
490 + svc = !clip_vcc || clip_vcc->vcc->sk->family == AF_ATMSVC;
491 off = sprintf(buf,"%-6s%-4s%-4s%5ld ",dev->name,svc ? "SVC" : "PVC",
492 !clip_vcc || clip_vcc->encap ? "LLC" : "NULL",
493 (jiffies-(clip_vcc ? clip_vcc->last_use : entry->neigh->used))/
495 if (!vcc->dev) here += sprintf(here,"Unassigned ");
496 else here += sprintf(here,"%3d %3d %5d ",vcc->dev->number,vcc->vpi,
498 - switch (vcc->family) {
499 + switch (vcc->sk->family) {
501 here += sprintf(here,"PVC");
503 @@ -217,12 +217,12 @@
504 here += sprintf(here,"SVC");
507 - here += sprintf(here,"%3d",vcc->family);
508 + here += sprintf(here,"%3d",vcc->sk->family);
510 here += sprintf(here," %04lx %5d %7d/%7d %7d/%7d\n",vcc->flags,
512 - atomic_read(&vcc->tx_inuse),vcc->sk->sndbuf,
513 - atomic_read(&vcc->rx_inuse),vcc->sk->rcvbuf);
514 + atomic_read(&vcc->sk->wmem_alloc),vcc->sk->sndbuf,
515 + atomic_read(&vcc->sk->rmem_alloc),vcc->sk->rcvbuf);
520 static int atm_devices_info(loff_t pos,char *buf)
523 + struct list_head *p;
527 @@ -309,10 +310,14 @@
528 "AAL(TX,err,RX,err,drop) ...\n");
531 - for (dev = atm_devs; dev && left; dev = dev->next) left--;
532 - if (!dev) return 0;
534 - return strlen(buf);
535 + list_for_each(p, &atm_devs) {
536 + dev = list_entry(p, struct atm_dev, dev_list);
539 + return strlen(buf);
547 static int atm_pvc_info(loff_t pos,char *buf)
550 + struct list_head *p;
554 @@ -331,13 +337,15 @@
558 - for (dev = atm_devs; dev; dev = dev->next)
559 + list_for_each(p, &atm_devs) {
560 + dev = list_entry(p, struct atm_dev, dev_list);
561 for (vcc = dev->vccs; vcc; vcc = vcc->next)
562 - if (vcc->family == PF_ATMPVC &&
563 + if (vcc->sk->family == PF_ATMPVC &&
564 vcc->dev && !left--) {
573 static int atm_vc_info(loff_t pos,char *buf)
576 + struct list_head *p;
580 @@ -353,12 +362,14 @@
581 "Address"," Itf VPI VCI Fam Flags Reply Send buffer"
584 - for (dev = atm_devs; dev; dev = dev->next)
585 + list_for_each(p, &atm_devs) {
586 + dev = list_entry(p, struct atm_dev, dev_list);
587 for (vcc = dev->vccs; vcc; vcc = vcc->next)
593 for (vcc = nodev_vccs; vcc; vcc = vcc->next)
596 @@ -372,20 +383,23 @@
597 static int atm_svc_info(loff_t pos,char *buf)
600 + struct list_head *p;
605 return sprintf(buf,"Itf VPI VCI State Remote\n");
607 - for (dev = atm_devs; dev; dev = dev->next)
608 + list_for_each(p, &atm_devs) {
609 + dev = list_entry(p, struct atm_dev, dev_list);
610 for (vcc = dev->vccs; vcc; vcc = vcc->next)
611 - if (vcc->family == PF_ATMSVC && !left--) {
612 + if (vcc->sk->family == PF_ATMSVC && !left--) {
617 for (vcc = nodev_vccs; vcc; vcc = vcc->next)
618 - if (vcc->family == PF_ATMSVC && !left--) {
619 + if (vcc->sk->family == PF_ATMSVC && !left--) {
623 Index: linux/net/atm/raw.c
624 ===================================================================
625 RCS file: /home/chas/CVSROOT/linux/net/atm/raw.c,v
626 retrieving revision 1.1.1.1
627 diff -u -r1.1.1.1 raw.c
628 --- linux/net/atm/raw.c 20 Feb 2003 13:46:30 -0000 1.1.1.1
629 +++ linux/net/atm/raw.c 4 Mar 2003 23:42:30 -0000
631 void atm_push_raw(struct atm_vcc *vcc,struct sk_buff *skb)
634 - skb_queue_tail(&vcc->recvq,skb);
635 + skb_queue_tail(&vcc->sk->receive_queue,skb);
636 wake_up(&vcc->sleep);
641 static void atm_pop_raw(struct atm_vcc *vcc,struct sk_buff *skb)
643 - DPRINTK("APopR (%d) %d -= %d\n",vcc->vci,vcc->tx_inuse,skb->truesize);
644 - atomic_sub(skb->truesize+ATM_PDU_OVHD,&vcc->tx_inuse);
645 + DPRINTK("APopR (%d) %d -= %d\n",vcc->vci,vcc->sk->wmem_alloc,skb->truesize);
646 + atomic_sub(skb->truesize+ATM_PDU_OVHD,&vcc->sk->wmem_alloc);
647 dev_kfree_skb_any(skb);
648 wake_up(&vcc->sleep);
650 Index: linux/net/atm/resources.c
651 ===================================================================
652 RCS file: /home/chas/CVSROOT/linux/net/atm/resources.c,v
653 retrieving revision 1.2
654 diff -u -r1.2 resources.c
655 --- linux/net/atm/resources.c 25 Feb 2003 20:03:53 -0000 1.2
656 +++ linux/net/atm/resources.c 5 Mar 2003 00:10:01 -0000
661 -struct atm_dev *atm_devs = NULL;
662 -static struct atm_dev *last_dev = NULL;
663 +LIST_HEAD(atm_devs);
664 struct atm_vcc *nodev_vccs = NULL;
665 extern struct semaphore atm_dev_sem;
669 dev->signal = ATM_PHY_SIG_UNKNOWN;
670 dev->link_rate = ATM_OC3_PCR;
673 - dev->prev = last_dev;
676 - last_dev->next = dev;
680 + list_add_tail(&dev->dev_list, &atm_devs);
685 /* Caller must hold atm_dev_sem. */
686 static void __free_atm_dev(struct atm_dev *dev)
689 - dev->prev->next = dev->next;
691 - atm_devs = dev->next;
693 - dev->next->prev = dev->prev;
695 - last_dev = dev->prev;
696 + list_del(&dev->dev_list);
701 struct atm_dev *atm_find_dev(int number)
704 + struct list_head *p;
706 - for (dev = atm_devs; dev; dev = dev->next)
707 + list_for_each(p, &atm_devs) {
708 + dev = list_entry(p, struct atm_dev, dev_list);
709 if (dev->ops && dev->number == number)
715 Index: linux/net/atm/resources.h
716 ===================================================================
717 RCS file: /home/chas/CVSROOT/linux/net/atm/resources.h,v
718 retrieving revision 1.1.1.1
719 diff -u -r1.1.1.1 resources.h
720 --- linux/net/atm/resources.h 20 Feb 2003 13:46:30 -0000 1.1.1.1
721 +++ linux/net/atm/resources.h 5 Mar 2003 00:11:51 -0000
723 #include <linux/atmdev.h>
726 -extern struct atm_dev *atm_devs;
727 +extern struct list_head atm_devs;
728 extern struct atm_vcc *nodev_vccs; /* VCCs not linked to any device */
731 Index: linux/net/atm/signaling.c
732 ===================================================================
733 RCS file: /home/chas/CVSROOT/linux/net/atm/signaling.c,v
734 retrieving revision 1.2
735 diff -u -r1.2 signaling.c
736 --- linux/net/atm/signaling.c 25 Feb 2003 20:03:53 -0000 1.2
737 +++ linux/net/atm/signaling.c 5 Mar 2003 00:21:45 -0000
741 atm_force_charge(sigd,skb->truesize);
742 - skb_queue_tail(&sigd->recvq,skb);
743 + skb_queue_tail(&sigd->sk->receive_queue,skb);
744 wake_up(&sigd->sleep);
748 struct atm_vcc *session_vcc;
750 msg = (struct atmsvc_msg *) skb->data;
751 - atomic_sub(skb->truesize+ATM_PDU_OVHD,&vcc->tx_inuse);
752 + atomic_sub(skb->truesize+ATM_PDU_OVHD,&vcc->sk->wmem_alloc);
753 DPRINTK("sigd_send %d (0x%lx)\n",(int) msg->type,
754 (unsigned long) msg->vcc);
755 vcc = *(struct atm_vcc **) &msg->vcc;
757 static void purge_vccs(struct atm_vcc *vcc)
760 - if (vcc->family == PF_ATMSVC &&
761 + if (vcc->sk->family == PF_ATMSVC &&
762 !test_bit(ATM_VF_META,&vcc->flags)) {
763 set_bit(ATM_VF_RELEASED,&vcc->flags);
764 vcc->reply = -EUNATCH;
765 @@ -212,16 +212,20 @@
766 static void sigd_close(struct atm_vcc *vcc)
769 + struct list_head *p;
771 DPRINTK("sigd_close\n");
773 - if (skb_peek(&vcc->recvq))
774 + if (skb_peek(&vcc->sk->receive_queue))
775 printk(KERN_ERR "sigd_close: closing with requests pending\n");
776 - skb_queue_purge(&vcc->recvq);
777 + skb_queue_purge(&vcc->sk->receive_queue);
778 purge_vccs(nodev_vccs);
781 - for (dev = atm_devs; dev; dev = dev->next) purge_vccs(dev->vccs);
782 + list_for_each(p, &atm_devs) {
783 + dev = list_entry(p, struct atm_dev, dev_list);
784 + purge_vccs(dev->vccs);
789 --- linux-2.4.20/drivers/atm/idt77252.c.orig Fri Dec 21 18:41:53 2001
790 +++ linux-2.4.20/drivers/atm/idt77252.c Wed Mar 5 20:27:00 2003
792 struct atm_vcc *vcc = vc->tx_vcc;
794 vc->estimator->cells += (skb->len + 47) / 48;
795 - if (atomic_read(&vcc->tx_inuse) > (vcc->sk->sndbuf >> 1)) {
796 + if (atomic_read(&vcc->sk->wmem_alloc) > (vcc->sk->sndbuf >> 1)) {
797 u32 cps = vc->estimator->maxcps;
799 vc->estimator->cps = cps;
800 @@ -2025,7 +2025,7 @@
801 atomic_inc(&vcc->stats->tx_err);
804 - atomic_add(skb->truesize + ATM_PDU_OVHD, &vcc->tx_inuse);
805 + atomic_add(skb->truesize + ATM_PDU_OVHD, &vcc->sk->wmem_alloc);
806 ATM_SKB(skb)->iovcnt = 0;
808 memcpy(skb_put(skb, 52), cell, 52);
809 --- linux-2.4.20/net/atm/br2684.c.orig Wed Mar 5 22:11:10 2003
810 +++ linux-2.4.20/net/atm/br2684.c Wed Mar 5 22:42:20 2003
815 - atomic_add(skb->truesize, &atmvcc->tx_inuse);
816 + atomic_add(skb->truesize, &atmvcc->sk->wmem_alloc);
817 ATM_SKB(skb)->iovcnt = 0;
818 ATM_SKB(skb)->atm_options = atmvcc->atm_options;
819 brdev->stats.tx_packets++;
822 atmvcc->push = br2684_push;
823 skb_queue_head_init(©);
824 - skb_migrate(&atmvcc->recvq, ©);
825 + skb_migrate(&atmvcc->sk->receive_queue, ©);
826 while ((skb = skb_dequeue(©))) {
827 BRPRIV(skb->dev)->stats.rx_bytes -= skb->len;
828 BRPRIV(skb->dev)->stats.rx_packets--;
829 --- linux-2.4.20/net/atm/pppoatm.c~ Sat Aug 3 02:39:46 2002
830 +++ linux-2.4.20/net/atm/pppoatm.c Wed Mar 5 22:43:51 2003
835 - atomic_add(skb->truesize, &ATM_SKB(skb)->vcc->tx_inuse);
836 + atomic_add(skb->truesize, &ATM_SKB(skb)->vcc->sk->wmem_alloc);
837 ATM_SKB(skb)->iovcnt = 0;
838 ATM_SKB(skb)->atm_options = ATM_SKB(skb)->vcc->atm_options;
839 DPRINTK("(unit %d): atm_skb(%p)->vcc(%p)->dev(%p)\n",
840 --- linux-2.4.20/net/sched/sch_atm.c.orig Fri Dec 21 18:42:06 2001
841 +++ linux-2.4.20/net/sched/sch_atm.c Thu Mar 6 22:55:53 2003
843 ATM_SKB(skb)->vcc = flow->vcc;
844 memcpy(skb_push(skb,flow->hdr_len),flow->hdr,
846 - atomic_add(skb->truesize,&flow->vcc->tx_inuse);
847 + atomic_add(skb->truesize,&flow->vcc->sk->wmem_alloc);
848 ATM_SKB(skb)->iovcnt = 0;
849 /* atm.atm_options are already set by atm_tc_enqueue */
850 (void) flow->vcc->send(flow->vcc,skb);
852 To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
853 the body of a message to majordomo@vger.kernel.org
854 More majordomo info at http://vger.kernel.org/majordomo-info.html
855 Please read the FAQ at http://www.tux.org/lkml/